1GCC(1) GNU GCC(1)
2
3
4
6 gcc - GNU project C and C++ compiler
7
9 gcc [-c|-S|-E] [-std=standard]
10 [-g] [-pg] [-Olevel]
11 [-Wwarn...] [-Wpedantic]
12 [-Idir...] [-Ldir...]
13 [-Dmacro[=defn]...] [-Umacro]
14 [-foption...] [-mmachine-option...]
15 [-o outfile] [@file] infile...
16
17 Only the most useful options are listed here; see below for the
18 remainder. g++ accepts mostly the same options as gcc.
19
21 When you invoke GCC, it normally does preprocessing, compilation,
22 assembly and linking. The "overall options" allow you to stop this
23 process at an intermediate stage. For example, the -c option says not
24 to run the linker. Then the output consists of object files output by
25 the assembler.
26
27 Other options are passed on to one or more stages of processing. Some
28 options control the preprocessor and others the compiler itself. Yet
29 other options control the assembler and linker; most of these are not
30 documented here, since you rarely need to use any of them.
31
32 Most of the command-line options that you can use with GCC are useful
33 for C programs; when an option is only useful with another language
34 (usually C++), the explanation says so explicitly. If the description
35 for a particular option does not mention a source language, you can use
36 that option with all supported languages.
37
38 The usual way to run GCC is to run the executable called gcc, or
39 machine-gcc when cross-compiling, or machine-gcc-version to run a
40 specific version of GCC. When you compile C++ programs, you should
41 invoke GCC as g++ instead.
42
43 The gcc program accepts options and file names as operands. Many
44 options have multi-letter names; therefore multiple single-letter
45 options may not be grouped: -dv is very different from -d -v.
46
47 You can mix options and other arguments. For the most part, the order
48 you use doesn't matter. Order does matter when you use several options
49 of the same kind; for example, if you specify -L more than once, the
50 directories are searched in the order specified. Also, the placement
51 of the -l option is significant.
52
53 Many options have long names starting with -f or with -W---for example,
54 -fmove-loop-invariants, -Wformat and so on. Most of these have both
55 positive and negative forms; the negative form of -ffoo is -fno-foo.
56 This manual documents only one of these two forms, whichever one is not
57 the default.
58
59 Some options take one or more arguments typically separated either by a
60 space or by the equals sign (=) from the option name. Unless
61 documented otherwise, an argument can be either numeric or a string.
62 Numeric arguments must typically be small unsigned decimal or
63 hexadecimal integers. Hexadecimal arguments must begin with the 0x
64 prefix. Arguments to options that specify a size threshold of some
65 sort may be arbitrarily large decimal or hexadecimal integers followed
66 by a byte size suffix designating a multiple of bytes such as "kB" and
67 "KiB" for kilobyte and kibibyte, respectively, "MB" and "MiB" for
68 megabyte and mebibyte, "GB" and "GiB" for gigabyte and gigibyte, and so
69 on. Such arguments are designated by byte-size in the following text.
70 Refer to the NIST, IEC, and other relevant national and international
71 standards for the full listing and explanation of the binary and
72 decimal byte size prefixes.
73
75 Option Summary
76 Here is a summary of all the options, grouped by type. Explanations
77 are in the following sections.
78
79 Overall Options
80 -c -S -E -o file -dumpbase dumpbase -dumpbase-ext auxdropsuf
81 -dumpdir dumppfx -x language -v -### --help[=class[,...]]
82 --target-help --version -pass-exit-codes -pipe -specs=file
83 -wrapper @file -ffile-prefix-map=old=new -fplugin=file
84 -fplugin-arg-name=arg -fdump-ada-spec[-slim]
85 -fada-spec-parent=unit -fdump-go-spec=file
86
87 C Language Options
88 -ansi -std=standard -aux-info filename
89 -fallow-parameterless-variadic-functions -fno-asm -fno-builtin
90 -fno-builtin-function -fcond-mismatch -ffreestanding -fgimple
91 -fgnu-tm -fgnu89-inline -fhosted -flax-vector-conversions
92 -fms-extensions -foffload=arg -foffload-options=arg -fopenacc
93 -fopenacc-dim=geom -fopenmp -fopenmp-simd
94 -fpermitted-flt-eval-methods=standard -fplan9-extensions
95 -fsigned-bitfields -funsigned-bitfields -fsigned-char
96 -funsigned-char -fsso-struct=endianness
97
98 C++ Language Options
99 -fabi-version=n -fno-access-control -faligned-new=n
100 -fargs-in-order=n -fchar8_t -fcheck-new -fconstexpr-depth=n
101 -fconstexpr-cache-depth=n -fconstexpr-loop-limit=n
102 -fconstexpr-ops-limit=n -fno-elide-constructors
103 -fno-enforce-eh-specs -fno-gnu-keywords -fno-implicit-templates
104 -fno-implicit-inline-templates -fno-implement-inlines
105 -fmodule-header[=kind] -fmodule-only -fmodules-ts
106 -fmodule-implicit-inline -fno-module-lazy
107 -fmodule-mapper=specification -fmodule-version-ignore
108 -fms-extensions -fnew-inheriting-ctors -fnew-ttp-matching
109 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names
110 -fno-optional-diags -fpermissive -fno-pretty-templates -fno-rtti
111 -fsized-deallocation -ftemplate-backtrace-limit=n
112 -ftemplate-depth=n -fno-threadsafe-statics -fuse-cxa-atexit
113 -fno-weak -nostdinc++ -fvisibility-inlines-hidden
114 -fvisibility-ms-compat -fext-numeric-literals
115 -flang-info-include-translate[=header]
116 -flang-info-include-translate-not -flang-info-module-cmi[=module]
117 -stdlib=libstdc++,libc++ -Wabi-tag -Wcatch-value -Wcatch-value=n
118 -Wno-class-conversion -Wclass-memaccess -Wcomma-subscript
119 -Wconditionally-supported -Wno-conversion-null
120 -Wctad-maybe-unsupported -Wctor-dtor-privacy
121 -Wno-delete-incomplete -Wdelete-non-virtual-dtor
122 -Wno-deprecated-array-compare -Wdeprecated-copy
123 -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion
124 -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-exceptions
125 -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor
126 -Wno-init-list-lifetime -Winvalid-imported-macros
127 -Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-new-delete
128 -Wmismatched-tags -Wmultiple-inheritance -Wnamespaces -Wnarrowing
129 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor -Wpessimizing-move
130 -Wno-placement-new -Wplacement-new=n -Wrange-loop-construct
131 -Wredundant-move -Wredundant-tags -Wreorder -Wregister
132 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates
133 -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual
134 -Wno-pmf-conversions -Wsign-promo -Wsized-deallocation
135 -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override
136 -Wno-terminate -Wuseless-cast -Wno-vexing-parse
137 -Wvirtual-inheritance -Wno-virtual-move-assign -Wvolatile
138 -Wzero-as-null-pointer-constant
139
140 Objective-C and Objective-C++ Language Options
141 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
142 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
143 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
144 -fobjc-std=objc1 -fno-local-ivars
145 -fivar-visibility=[public|protected|private|package]
146 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
147 -Wno-property-assign-default -Wno-protocol -Wobjc-root-class
148 -Wselector -Wstrict-selector-match -Wundeclared-selector
149
150 Diagnostic Message Formatting Options
151 -fmessage-length=n -fdiagnostics-plain-output
152 -fdiagnostics-show-location=[once|every-line]
153 -fdiagnostics-color=[auto|never|always]
154 -fdiagnostics-urls=[auto|never|always]
155 -fdiagnostics-format=[text|json] -fno-diagnostics-show-option
156 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
157 -fno-diagnostics-show-line-numbers -fno-diagnostics-show-cwe
158 -fdiagnostics-minimum-margin-width=width
159 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
160 -fdiagnostics-show-template-tree -fno-elide-type
161 -fdiagnostics-path-format=[none|separate-events|inline-events]
162 -fdiagnostics-show-path-depths -fno-show-column
163 -fdiagnostics-column-unit=[display|byte]
164 -fdiagnostics-column-origin=origin
165 -fdiagnostics-escape-format=[unicode|bytes]
166
167 Warning Options
168 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
169 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
170 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
171 -Walloca -Walloca-larger-than=byte-size
172 -Wno-aggressive-loop-optimizations -Warith-conversion
173 -Warray-bounds -Warray-bounds=n -Warray-compare -Wno-attributes
174 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
175 -Wbidi-chars=[none|unpaired|any|ucn] -Wbool-compare
176 -Wbool-operation -Wno-builtin-declaration-mismatch
177 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
178 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
179 -Wc++17-compat -Wc++20-compat -Wno-c++11-extensions
180 -Wno-c++14-extensions -Wno-c++17-extensions -Wno-c++20-extensions
181 -Wno-c++23-extensions -Wcast-align -Wcast-align=strict
182 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
183 -Wcomment -Wconversion -Wno-coverage-mismatch -Wno-cpp
184 -Wdangling-else -Wdangling-pointer -Wdangling-pointer=n
185 -Wdate-time -Wno-deprecated -Wno-deprecated-declarations
186 -Wno-designated-init -Wdisabled-optimization
187 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers
188 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-branches
189 -Wduplicated-cond -Wempty-body -Wno-endif-labels -Wenum-compare
190 -Wenum-conversion -Werror -Werror=* -Wexpansion-to-defined
191 -Wfatal-errors -Wfloat-conversion -Wfloat-equal -Wformat
192 -Wformat=2 -Wno-format-contains-nul -Wno-format-extra-args
193 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
194 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
195 -Wframe-address -Wframe-larger-than=byte-size
196 -Wno-free-nonheap-object -Wno-if-not-aligned
197 -Wno-ignored-attributes -Wignored-qualifiers
198 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
199 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
200 -Wno-implicit-int -Winfinite-recursion -Winit-self -Winline
201 -Wno-int-conversion -Wint-in-bool-context -Wno-int-to-pointer-cast
202 -Wno-invalid-memory-model -Winvalid-pch -Wjump-misses-init
203 -Wlarger-than=byte-size -Wlogical-not-parentheses -Wlogical-op
204 -Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
205 -Wmemset-elt-size -Wmemset-transposed-args
206 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
207 -Wmissing-field-initializers -Wmissing-format-attribute
208 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
209 -Wno-multichar -Wmultistatement-macros -Wnonnull
210 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
211 -Wnull-dereference -Wno-odr -Wopenacc-parallelism -Wopenmp-simd
212 -Wno-overflow -Woverlength-strings
213 -Wno-override-init-side-effects -Wpacked
214 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
215 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
216 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
217 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
218 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
219 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
220 -Wshadow=compatible-local -Wno-shadow-ivar
221 -Wno-shift-count-negative -Wno-shift-count-overflow
222 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
223 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
224 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
225 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
226 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
227 -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread
228 -Wno-stringop-truncation
229 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
230 -Wno-switch-bool -Wswitch-default -Wswitch-enum
231 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
232 -Wsystem-headers -Wtautological-compare -Wtrampolines
233 -Wtrigraphs -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef
234 -Wuninitialized -Wunknown-pragmas -Wunsuffixed-float-constants
235 -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable
236 -Wunused-const-variable -Wunused-const-variable=n
237 -Wunused-function -Wunused-label -Wunused-local-typedefs
238 -Wunused-macros -Wunused-parameter -Wno-unused-result
239 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
240 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
241 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
242 -Wzero-length-bounds
243
244 Static Analyzer Options
245 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
246 -fno-analyzer-feasibility -fanalyzer-fine-grained
247 -fno-analyzer-state-merge -fno-analyzer-state-purge
248 -fanalyzer-transitivity -fanalyzer-verbose-edges
249 -fanalyzer-verbose-state-changes -fanalyzer-verbosity=level
250 -fdump-analyzer -fdump-analyzer-callgraph
251 -fdump-analyzer-exploded-graph -fdump-analyzer-exploded-nodes
252 -fdump-analyzer-exploded-nodes-2 -fdump-analyzer-exploded-nodes-3
253 -fdump-analyzer-exploded-paths -fdump-analyzer-feasibility
254 -fdump-analyzer-json -fdump-analyzer-state-purge
255 -fdump-analyzer-stderr -fdump-analyzer-supergraph
256 -fdump-analyzer-untracked -Wno-analyzer-double-fclose
257 -Wno-analyzer-double-free
258 -Wno-analyzer-exposure-through-output-file -Wno-analyzer-file-leak
259 -Wno-analyzer-free-of-non-heap -Wno-analyzer-malloc-leak
260 -Wno-analyzer-mismatching-deallocation -Wno-analyzer-null-argument
261 -Wno-analyzer-null-dereference -Wno-analyzer-possible-null-argument
262 -Wno-analyzer-possible-null-dereference
263 -Wno-analyzer-shift-count-negative
264 -Wno-analyzer-shift-count-overflow
265 -Wno-analyzer-stale-setjmp-buffer
266 -Wno-analyzer-tainted-allocation-size
267 -Wno-analyzer-tainted-array-index -Wno-analyzer-tainted-divisor
268 -Wno-analyzer-tainted-offset -Wno-analyzer-tainted-size
269 -Wanalyzer-too-complex
270 -Wno-analyzer-unsafe-call-within-signal-handler
271 -Wno-analyzer-use-after-free
272 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
273 -Wno-analyzer-use-of-uninitialized-value
274 -Wno-analyzer-write-to-const -Wno-analyzer-write-to-string-literal
275
276 C and Objective-C-only Warning Options
277 -Wbad-function-cast -Wmissing-declarations
278 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
279 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
280 -Wtraditional -Wtraditional-conversion
281 -Wdeclaration-after-statement -Wpointer-sign
282
283 Debugging Options
284 -g -glevel -gdwarf -gdwarf-version -gbtf -gctf -gctflevel -ggdb
285 -grecord-gcc-switches -gno-record-gcc-switches -gstabs -gstabs+
286 -gstrict-dwarf -gno-strict-dwarf -gas-loc-support
287 -gno-as-loc-support -gas-locview-support -gno-as-locview-support
288 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64
289 -gstatement-frontiers -gno-statement-frontiers
290 -gvariable-location-views -gno-variable-location-views
291 -ginternal-reset-location-views -gno-internal-reset-location-views
292 -ginline-points -gno-inline-points -gvms -gxcoff -gxcoff+
293 -gz[=type] -gsplit-dwarf -gdescribe-dies -gno-describe-dies
294 -fdebug-prefix-map=old=new -fdebug-types-section
295 -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
296 -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-
297 list] -fno-eliminate-unused-debug-symbols
298 -femit-class-debug-always -fno-merge-debug-strings
299 -fno-dwarf2-cfi-asm -fvar-tracking -fvar-tracking-assignments
300
301 Optimization Options
302 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
303 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
304 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
305 -fallow-store-data-races -fassociative-math -fauto-profile
306 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
307 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
308 -fcompare-elim -fcprop-registers -fcrossjumping
309 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
310 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
311 -fdelete-null-pointer-checks -fdevirtualize
312 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
313 -fearly-inlining -fipa-sra -fexpensive-optimizations
314 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
315 -fexcess-precision=style -ffinite-loops -fforward-propagate
316 -ffp-contract=style -ffunction-sections -fgcse
317 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
318 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
319 -findirect-inlining -finline-functions
320 -finline-functions-called-once -finline-limit=n
321 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
322 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
323 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
324 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
325 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
326 -fno-ira-share-save-slots -fno-ira-share-spill-slots
327 -fisolate-erroneous-paths-dereference
328 -fisolate-erroneous-paths-attribute -fivopts
329 -fkeep-inline-functions -fkeep-static-functions
330 -fkeep-static-consts -flimit-function-alignment
331 -flive-range-shrinkage -floop-block -floop-interchange
332 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
333 -floop-parallelize-all -flra-remat -flto -flto-compression-level
334 -flto-partition=alg -fmerge-all-constants -fmerge-constants
335 -fmodulo-sched -fmodulo-sched-allow-regmoves
336 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg
337 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse
338 -fno-guess-branch-probability -fno-inline -fno-math-errno
339 -fno-peephole -fno-peephole2 -fno-printf-return-value
340 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
341 -fno-toplevel-reorder -fno-trapping-math
342 -fno-zero-initialized-in-bss -fomit-frame-pointer
343 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
344 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
345 -fprofile-use -fprofile-use=path -fprofile-partial-training
346 -fprofile-values -fprofile-reorder-functions -freciprocal-math
347 -free -frename-registers -freorder-blocks
348 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
349 -freorder-functions -frerun-cse-after-loop
350 -freschedule-modulo-scheduled-loops -frounding-math
351 -fsave-optimization-record -fsched2-use-superblocks
352 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
353 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
354 -fsched-group-heuristic -fsched-critical-path-heuristic
355 -fsched-spec-insn-heuristic -fsched-rank-heuristic
356 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
357 -fschedule-fusion -fschedule-insns -fschedule-insns2
358 -fsection-anchors -fselective-scheduling -fselective-scheduling2
359 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
360 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
361 -fsignaling-nans -fsingle-precision-constant
362 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
363 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
364 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
365 -fipa-strict-aliasing -fthread-jumps -ftracer -ftree-bit-ccp
366 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-coalesce-vars
367 -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse
368 -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert
369 -ftree-loop-im -ftree-phiprop -ftree-loop-distribution
370 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
371 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
372 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
373 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
374 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
375 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init
376 -funconstrained-commons -funit-at-a-time -funroll-all-loops
377 -funroll-loops -funsafe-math-optimizations -funswitch-loops
378 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model
379 -fvpt -fweb -fwhole-program -fwpa -fuse-linker-plugin
380 -fzero-call-used-regs --param name=value -O -O0 -O1 -O2 -O3
381 -Os -Ofast -Og -Oz
382
383 Program Instrumentation Options
384 -p -pg -fprofile-arcs --coverage -ftest-coverage
385 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
386 -fprofile-generate=path -fprofile-info-section
387 -fprofile-info-section=name -fprofile-note=path
388 -fprofile-prefix-path=path -fprofile-update=method
389 -fprofile-filter-files=regex -fprofile-exclude-files=regex
390 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
391 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
392 -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
393 -fsanitize-undefined-trap-on-error -fbounds-check
394 -fcf-protection=[full|branch|return|none|check] -fharden-compares
395 -fharden-conditional-branches -fstack-protector
396 -fstack-protector-all -fstack-protector-strong
397 -fstack-protector-explicit -fstack-check
398 -fstack-limit-register=reg -fstack-limit-symbol=sym
399 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
400 -fvtv-counts -fvtv-debug -finstrument-functions
401 -finstrument-functions-exclude-function-list=sym,sym,...
402 -finstrument-functions-exclude-file-list=file,file,...
403 -fprofile-prefix-map=old=new
404
405 Preprocessor Options
406 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
407 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
408 -fdollars-in-identifiers -fexec-charset=charset
409 -fextended-identifiers -finput-charset=charset
410 -flarge-source-files -fmacro-prefix-map=old=new
411 -fmax-include-depth=depth -fno-canonical-system-headers -fpch-deps
412 -fpch-preprocess -fpreprocessed -ftabstop=width
413 -ftrack-macro-expansion -fwide-exec-charset=charset
414 -fworking-directory -H -imacros file -include file -M -MD -MF
415 -MG -MM -MMD -MP -MQ -MT -Mno-modules -no-integrated-cpp -P
416 -pthread -remap -traditional -traditional-cpp -trigraphs -Umacro
417 -undef -Wp,option -Xpreprocessor option
418
419 Assembler Options
420 -Wa,option -Xassembler option
421
422 Linker Options
423 object-file-name -fuse-ld=linker -llibrary -nostartfiles
424 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
425 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
426 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
427 -static-libubsan -shared -shared-libgcc -symbolic -T script
428 -Wl,option -Xlinker option -u symbol -z keyword
429
430 Directory Options
431 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
432 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
433 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
434 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
435 --sysroot=dir
436
437 Code Generation Options
438 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
439 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
440 -fasynchronous-unwind-tables -fno-gnu-unique
441 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
442 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
443 -fno-bit-tests -frecord-gcc-switches -freg-struct-return
444 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
445 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
446 -ftrampolines -ftrapv -fwrapv
447 -fvisibility=[default|internal|hidden|protected]
448 -fstrict-volatile-bitfields -fsync-libcalls
449
450 Developer Options
451 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
452 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
453 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
454 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
455 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
456 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
457 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
458 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
459 -fdump-lang-switch -fdump-lang-switch-options
460 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
461 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
462 -fdump-tree-switch -fdump-tree-switch-options
463 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
464 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
465 list -fira-verbose=n -flto-report -flto-report-wpa
466 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
467 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
468 -fprofile-report -frandom-seed=string -fsched-verbose=n
469 -fsel-sched-verbose -fsel-sched-dump-cfg
470 -fsel-sched-pipelining-verbose -fstats -fstack-usage
471 -ftime-report -ftime-report-details
472 -fvar-tracking-assignments-toggle -gtoggle
473 -print-file-name=library -print-libgcc-file-name
474 -print-multi-directory -print-multi-lib -print-multi-os-directory
475 -print-prog-name=program -print-search-dirs -Q -print-sysroot
476 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
477 -save-temps=obj -time[=file]
478
479 Machine-Dependent Options
480 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
481 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
482 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
483 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
484 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
485 -mlow-precision-recip-sqrt -mlow-precision-sqrt
486 -mlow-precision-div -mpc-relative-literal-loads
487 -msign-return-address=scope -mbranch-protection=none|standard|pac-
488 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
489 -mtune=name -moverride=string -mverbose-cost-dump
490 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
491 -mstack-protector-guard-offset=offset -mtrack-speculation
492 -moutline-atomics
493
494 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
495 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
496 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
497 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
498 -mvect-double -max-vect-align=num -msplit-vecmove-early
499 -m1reg-reg
500
501 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
502
503 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
504 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
505 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
506 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
507 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
508 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
509 -marclinux_prof -mlong-calls -mmedium-calls -msdata
510 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
511 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
512 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
513 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
514 -mlra -mlra-priority-none -mlra-priority-compact
515 -mlra-priority-noncompact -mmillicode -mmixed-code -mq-class
516 -mRcq -mRcw -msize-level=level -mtune=cpu -mmultcost=num
517 -mcode-density-frame -munalign-prob-threshold=probability
518 -mmpy-option=multo -mdiv-rem -mcode-density -mll64 -mfpu=fpu
519 -mrf16 -mbranch-index
520
521 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
522 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
523 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
524 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
525 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
526 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
527 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
528 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
529 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
530 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
531 -mtpcs-leaf-frame -mcaller-super-interworking
532 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
533 -mword-relocations -mfix-cortex-m3-ldrd
534 -mfix-cortex-a57-aes-1742098 -mfix-cortex-a72-aes-1655431
535 -munaligned-access -mneon-for-64bits -mslow-flash-data
536 -masm-syntax-unified -mrestrict-it -mverbose-cost-dump -mpure-code
537 -mcmse -mfix-cmse-cve-2021-35465 -mstack-protector-guard=guard
538 -mstack-protector-guard-offset=offset -mfdpic
539
540 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
541 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
542 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
543 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
544 -mfract-convert-truncate -mshort-calls -nodevicelib
545 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
546
547 Blackfin Options -mcpu=cpu[-sirevision] -msim
548 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
549 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
550 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
551 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
552 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
553 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
554 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
555
556 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
557 -msdata=sdata-type
558
559 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
560 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects
561 -mstack-align -mdata-align -mconst-align -m32-bit -m16-bit
562 -m8-bit -mno-prologue-epilogue -melf -maout -sim -sim2
563 -mmul-bug-workaround -mno-mul-bug-workaround
564
565 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
566 -mdata-model=model
567
568 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
569 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
570 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
571 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
572 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
573 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
574 -msched-prolog -msim
575
576 Darwin Options -all_load -allowable_client -arch
577 -arch_errors_fatal -arch_only -bind_at_load -bundle
578 -bundle_loader -client_name -compatibility_version
579 -current_version -dead_strip -dependency-file -dylib_file
580 -dylinker_install_name -dynamic -dynamiclib
581 -exported_symbols_list -filelist -flat_namespace
582 -force_cpusubtype_ALL -force_flat_namespace
583 -headerpad_max_install_names -iframework -image_base -init
584 -install_name -keep_private_externs -multi_module
585 -multiply_defined -multiply_defined_unused -noall_load
586 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
587 -noprebind -noseglinkedit -pagezero_size -prebind
588 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
589 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
590 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
591 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
592 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
593 -single_module -static -sub_library -sub_umbrella
594 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
595 -weak_reference_mismatches -whatsloaded -F -gused -gfull
596 -mmacosx-version-min=version -mkernel -mone-byte-bool
597
598 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
599 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
600 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
601 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
602 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
603 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
604
605 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
606 -mframe-limit=bytes -mxbpf -mco-re -mno-co-re -mjmpext -mjmp32
607 -malu32 -mcpu=version
608
609 FR30 Options -msmall-model -mno-lsim
610
611 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
612
613 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
614 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
615 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
616 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
617 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
618 -mno-pack -mno-eflags -mcond-move -mno-cond-move
619 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
620 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
621 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
622 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
623
624 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
625 -tno-android-cc -tno-android-ld
626
627 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
628 -malign-300
629
630 HPPA Options -march=architecture-type -mcaller-copies
631 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
632 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
633 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
634 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
635 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
636 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
637 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
638 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
639 -static -threads
640
641 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
642 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
643 -mconstant-gp -mauto-pic -mfused-madd
644 -minline-float-divide-min-latency
645 -minline-float-divide-max-throughput -mno-inline-float-divide
646 -minline-int-divide-min-latency -minline-int-divide-max-throughput
647 -mno-inline-int-divide -minline-sqrt-min-latency
648 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
649 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
650 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
651 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
652 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
653 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
654 -msched-prefer-non-control-spec-insns
655 -msched-stop-bits-after-every-cycle
656 -msched-count-spec-in-critical-path
657 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
658 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
659 insns
660
661 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
662 -mmultiply-enabled -msign-extend-enabled -muser-enabled
663
664 LoongArch Options -march=cpu-type -mtune=cpu-type -mabi=base-abi-
665 type -mfpu=fpu-type -msoft-float -msingle-float -mdouble-float
666 -mbranch-cost=n -mcheck-zero-division -mno-check-zero-division
667 -mcond-move-int -mno-cond-move-int -mcond-move-float
668 -mno-cond-move-float -memcpy -mno-memcpy -mstrict-align
669 -mno-strict-align -mmax-inline-memcpy-size=n -mcmodel=code-model
670
671 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
672 -mno-align-loops -missue-rate=number -mbranch-cost=number
673 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
674 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
675
676 M32C Options -mcpu=cpu -msim -memregs=number
677
678 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
679 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
680 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
681 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
682 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
683 -malign-int -mstrict-align -msep-data -mno-sep-data
684 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
685 -mxgot -mno-xgot -mlong-jump-table-offsets
686
687 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
688 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
689 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
690 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
691 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
692 -mstack-increment
693
694 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
695 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
696 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
697 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
698 -msimnovec -mtf -mtiny=n
699
700 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
701 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
702 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
703 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
704 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
705 -mpic-data-is-text-relative
706
707 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
708 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
709 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
710 -mno-mips16 -mflip-mips16 -minterlink-compressed
711 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
712 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
713 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
714 -mhard-float -msoft-float -mno-float -msingle-float
715 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
716 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
717 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
718 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
719 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
720 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
721 type -msmartmips -mno-smartmips -mpaired-single
722 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
723 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
724 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
725 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
726 -mno-embedded-data -muninit-const-in-rodata
727 -mno-uninit-const-in-rodata -mcode-readable=setting
728 -msplit-addresses -mno-split-addresses -mexplicit-relocs
729 -mno-explicit-relocs -mcheck-zero-division
730 -mno-check-zero-division -mdivide-traps -mdivide-breaks
731 -mload-store-pairs -mno-load-store-pairs -munaligned-access
732 -mno-unaligned-access -mmemcpy -mno-memcpy -mlong-calls
733 -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd -mfused-madd
734 -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k -mfix-r4000
735 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 -mfix-r5900
736 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000
737 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130
738 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 -mflush-func=func
739 -mno-flush-func -mbranch-cost=num -mbranch-likely
740 -mno-branch-likely -mcompact-branches=policy -mfp-exceptions
741 -mno-fp-exceptions -mvr4130-align -mno-vr4130-align -msynci
742 -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4
743 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address
744 -mframe-header-opt -mno-frame-header-opt
745
746 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
747 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
748 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
749 -mbase-addresses -mno-base-addresses -msingle-exit
750 -mno-single-exit
751
752 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
753 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
754 -mrelax -mliw -msetlb
755
756 Moxie Options -meb -mel -mmul.x -mno-crt0
757
758 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
759 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
760 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
761 -mmax-inline-shift=
762
763 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
764 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
765 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
766 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
767 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
768
769 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
770 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
771 -mbypass-cache -mno-cache-volatile -mcache-volatile
772 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
773 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
774 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
775 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
776 -mno-cdx
777
778 Nvidia PTX Options -m64 -mmainkernel -moptimize
779
780 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
781 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
782 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
783 -mcmodel=code-model
784
785 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
786 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
787 -mdec-asm -mgnu-asm -mlra
788
789 picoChip Options -mae=ae_type -mvliw-lookahead=N
790 -msymbol-as-address -mno-inefficient-warnings
791
792 PowerPC Options See RS/6000 and PowerPC Options.
793
794 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
795
796 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
797 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -misa-spec=ISA-
798 spec-string -march=ISA-string -mtune=processor-string
799 -mpreferred-stack-boundary=num -msmall-data-limit=N-bytes
800 -msave-restore -mno-save-restore -mshorten-memrefs
801 -mno-shorten-memrefs -mstrict-align -mno-strict-align
802 -mcmodel=medlow -mcmodel=medany -mexplicit-relocs
803 -mno-explicit-relocs -mrelax -mno-relax -mriscv-attribute
804 -mmo-riscv-attribute -malign-data=type -mbig-endian
805 -mlittle-endian -mstack-protector-guard=guard
806 -mstack-protector-guard-reg=reg
807 -mstack-protector-guard-offset=offset
808
809 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
810 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
811 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
812
813 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
814 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
815 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
816 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
817 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
818 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
819 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
820 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
821 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
822 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
823 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
824 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
825 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
826 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
827 -msingle-pic-base -mprioritize-restricted-insns=priority
828 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
829 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
830 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
831 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
832 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
833 -mlongcall -mno-longcall -mpltseq -mno-pltseq
834 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
835 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
836 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
837 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
838 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
839 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
840 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
841 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
842 -mno-pointers-to-nested-functions -msave-toc-indirect
843 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
844 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
845 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
846 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
847 -mfloat128 -mno-float128 -mfloat128-hardware
848 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
849 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
850 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
851 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
852 -mprivileged -mno-privileged
853
854 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
855 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
856 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
857 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
858 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
859 -msave-acc-in-interrupts
860
861 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
862 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
863 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
864 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
865 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
866 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
867 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
868 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
869 -mhotpatch=halfwords,halfwords
870
871 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
872 -mscore7 -mscore7d
873
874 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
875 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
876 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
877 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
878 -mnomacsave -mieee -mno-ieee -mbitops -misize
879 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
880 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
881 -mfixed-range=register-range -maccumulate-outgoing-args
882 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
883 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
884 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
885 -mpretend-cmove -mtas
886
887 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
888 -mno-impure-text -pthreads
889
890 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
891 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
892 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
893 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
894 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
895 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
896 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
897 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
898 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
899 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
900 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
901
902 System V Options -Qy -Qn -YP,paths -Ym,dir
903
904 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
905 -mlittle-endian -mcmodel=code-model
906
907 TILEPro Options -mcpu=cpu -m32
908
909 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
910 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
911 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
912 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
913 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
914 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
915
916 VAX Options -mg -mgnu -munix -mlra
917
918 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
919 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
920 -muser-mode
921
922 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
923 -mpointer-size=size
924
925 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
926 -Xbind-now
927
928 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
929 list -mdump-tune-features -mno-default -mfpmath=unit
930 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
931 -mhard-float -msoft-float -mno-wide-multiply -mrtd
932 -malign-double -mpreferred-stack-boundary=num
933 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
934 -mcrc32 -mmwait -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
935 -mprefer-vector-width=opt -mmove-max=bits -mstore-max=bits -mmmx
936 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx
937 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl
938 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
939 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd
940 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves
941 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4
942 -mxop -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm
943 -mhle -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
944 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
945 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
946 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
947 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
948 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
949 -mamx-bf16 -muintr -mhreset -mavxvnni -mavx512fp16 -mcldemote
950 -mms-bitfields -mno-align-stringops -minline-all-stringops
951 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
952 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
953 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
954 -m96bit-long-double -mlong-double-64 -mlong-double-80
955 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
956 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
957 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
958 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
959 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
960 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
961 -minstrument-return=type -mfentry-name=name -mfentry-section=name
962 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
963 -malign-data=type -mstack-protector-guard=guard
964 -mstack-protector-guard-reg=reg
965 -mstack-protector-guard-offset=offset
966 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
967 -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
968 -mindirect-branch=choice -mfunction-return=choice
969 -mindirect-branch-register -mharden-sls=choice
970 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
971
972 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
973 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
974 -fno-set-stack-executable
975
976 Xstormy16 Options -msim
977
978 Xtensa Options -mconst16 -mno-const16 -mfused-madd
979 -mno-fused-madd -mforce-no-pic -mserialize-volatile
980 -mno-serialize-volatile -mtext-section-literals
981 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
982 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
983 -mabi=abi-type
984
985 zSeries Options See S/390 and zSeries Options.
986
987 Options Controlling the Kind of Output
988 Compilation can involve up to four stages: preprocessing, compilation
989 proper, assembly and linking, always in that order. GCC is capable of
990 preprocessing and compiling several files either into several assembler
991 input files, or into one assembler input file; then each assembler
992 input file produces an object file, and linking combines all the object
993 files (those newly compiled, and those specified as input) into an
994 executable file.
995
996 For any given input file, the file name suffix determines what kind of
997 compilation is done:
998
999 file.c
1000 C source code that must be preprocessed.
1001
1002 file.i
1003 C source code that should not be preprocessed.
1004
1005 file.ii
1006 C++ source code that should not be preprocessed.
1007
1008 file.m
1009 Objective-C source code. Note that you must link with the libobjc
1010 library to make an Objective-C program work.
1011
1012 file.mi
1013 Objective-C source code that should not be preprocessed.
1014
1015 file.mm
1016 file.M
1017 Objective-C++ source code. Note that you must link with the
1018 libobjc library to make an Objective-C++ program work. Note that
1019 .M refers to a literal capital M.
1020
1021 file.mii
1022 Objective-C++ source code that should not be preprocessed.
1023
1024 file.h
1025 C, C++, Objective-C or Objective-C++ header file to be turned into
1026 a precompiled header (default), or C, C++ header file to be turned
1027 into an Ada spec (via the -fdump-ada-spec switch).
1028
1029 file.cc
1030 file.cp
1031 file.cxx
1032 file.cpp
1033 file.CPP
1034 file.c++
1035 file.C
1036 C++ source code that must be preprocessed. Note that in .cxx, the
1037 last two letters must both be literally x. Likewise, .C refers to
1038 a literal capital C.
1039
1040 file.mm
1041 file.M
1042 Objective-C++ source code that must be preprocessed.
1043
1044 file.mii
1045 Objective-C++ source code that should not be preprocessed.
1046
1047 file.hh
1048 file.H
1049 file.hp
1050 file.hxx
1051 file.hpp
1052 file.HPP
1053 file.h++
1054 file.tcc
1055 C++ header file to be turned into a precompiled header or Ada spec.
1056
1057 file.f
1058 file.for
1059 file.ftn
1060 Fixed form Fortran source code that should not be preprocessed.
1061
1062 file.F
1063 file.FOR
1064 file.fpp
1065 file.FPP
1066 file.FTN
1067 Fixed form Fortran source code that must be preprocessed (with the
1068 traditional preprocessor).
1069
1070 file.f90
1071 file.f95
1072 file.f03
1073 file.f08
1074 Free form Fortran source code that should not be preprocessed.
1075
1076 file.F90
1077 file.F95
1078 file.F03
1079 file.F08
1080 Free form Fortran source code that must be preprocessed (with the
1081 traditional preprocessor).
1082
1083 file.go
1084 Go source code.
1085
1086 file.d
1087 D source code.
1088
1089 file.di
1090 D interface file.
1091
1092 file.dd
1093 D documentation code (Ddoc).
1094
1095 file.ads
1096 Ada source code file that contains a library unit declaration (a
1097 declaration of a package, subprogram, or generic, or a generic
1098 instantiation), or a library unit renaming declaration (a package,
1099 generic, or subprogram renaming declaration). Such files are also
1100 called specs.
1101
1102 file.adb
1103 Ada source code file containing a library unit body (a subprogram
1104 or package body). Such files are also called bodies.
1105
1106 file.s
1107 Assembler code.
1108
1109 file.S
1110 file.sx
1111 Assembler code that must be preprocessed.
1112
1113 other
1114 An object file to be fed straight into linking. Any file name with
1115 no recognized suffix is treated this way.
1116
1117 You can specify the input language explicitly with the -x option:
1118
1119 -x language
1120 Specify explicitly the language for the following input files
1121 (rather than letting the compiler choose a default based on the
1122 file name suffix). This option applies to all following input
1123 files until the next -x option. Possible values for language are:
1124
1125 c c-header cpp-output
1126 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1127 objective-c objective-c-header objective-c-cpp-output
1128 objective-c++ objective-c++-header objective-c++-cpp-output
1129 assembler assembler-with-cpp
1130 ada
1131 d
1132 f77 f77-cpp-input f95 f95-cpp-input
1133 go
1134
1135 -x none
1136 Turn off any specification of a language, so that subsequent files
1137 are handled according to their file name suffixes (as they are if
1138 -x has not been used at all).
1139
1140 If you only want some of the stages of compilation, you can use -x (or
1141 filename suffixes) to tell gcc where to start, and one of the options
1142 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1143 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1144
1145 -c Compile or assemble the source files, but do not link. The linking
1146 stage simply is not done. The ultimate output is in the form of an
1147 object file for each source file.
1148
1149 By default, the object file name for a source file is made by
1150 replacing the suffix .c, .i, .s, etc., with .o.
1151
1152 Unrecognized input files, not requiring compilation or assembly,
1153 are ignored.
1154
1155 -S Stop after the stage of compilation proper; do not assemble. The
1156 output is in the form of an assembler code file for each non-
1157 assembler input file specified.
1158
1159 By default, the assembler file name for a source file is made by
1160 replacing the suffix .c, .i, etc., with .s.
1161
1162 Input files that don't require compilation are ignored.
1163
1164 -E Stop after the preprocessing stage; do not run the compiler proper.
1165 The output is in the form of preprocessed source code, which is
1166 sent to the standard output.
1167
1168 Input files that don't require preprocessing are ignored.
1169
1170 -o file
1171 Place the primary output in file file. This applies to whatever
1172 sort of output is being produced, whether it be an executable file,
1173 an object file, an assembler file or preprocessed C code.
1174
1175 If -o is not specified, the default is to put an executable file in
1176 a.out, the object file for source.suffix in source.o, its assembler
1177 file in source.s, a precompiled header file in source.suffix.gch,
1178 and all preprocessed C source on standard output.
1179
1180 Though -o names only the primary output, it also affects the naming
1181 of auxiliary and dump outputs. See the examples below. Unless
1182 overridden, both auxiliary outputs and dump outputs are placed in
1183 the same directory as the primary output. In auxiliary outputs,
1184 the suffix of the input file is replaced with that of the auxiliary
1185 output file type; in dump outputs, the suffix of the dump file is
1186 appended to the input file suffix. In compilation commands, the
1187 base name of both auxiliary and dump outputs is that of the primary
1188 output; in compile and link commands, the primary output name,
1189 minus the executable suffix, is combined with the input file name.
1190 If both share the same base name, disregarding the suffix, the
1191 result of the combination is that base name, otherwise, they are
1192 concatenated, separated by a dash.
1193
1194 gcc -c foo.c ...
1195
1196 will use foo.o as the primary output, and place aux outputs and
1197 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1198 dump file foo.c.???r.final for -fdump-rtl-final.
1199
1200 If a non-linker output file is explicitly specified, aux and dump
1201 files by default take the same base name:
1202
1203 gcc -c foo.c -o dir/foobar.o ...
1204
1205 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1206
1207 A linker output will instead prefix aux and dump outputs:
1208
1209 gcc foo.c bar.c -o dir/foobar ...
1210
1211 will generally name aux outputs dir/foobar-foo.* and
1212 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1213 dir/foobar-bar.c.*.
1214
1215 The one exception to the above is when the executable shares the
1216 base name with the single input:
1217
1218 gcc foo.c -o dir/foo ...
1219
1220 in which case aux outputs are named dir/foo.* and dump outputs
1221 named dir/foo.c.*.
1222
1223 The location and the names of auxiliary and dump outputs can be
1224 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1225 -save-temps=cwd, and -save-temps=obj.
1226
1227 -dumpbase dumpbase
1228 This option sets the base name for auxiliary and dump output files.
1229 It does not affect the name of the primary output file.
1230 Intermediate outputs, when preserved, are not regarded as primary
1231 outputs, but as auxiliary outputs:
1232
1233 gcc -save-temps -S foo.c
1234
1235 saves the (no longer) temporary preprocessed file in foo.i, and
1236 then compiles to the (implied) output file foo.s, whereas:
1237
1238 gcc -save-temps -dumpbase save-foo -c foo.c
1239
1240 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1241 intermediate, thus auxiliary output), and then assembles to the
1242 (implied) output file foo.o.
1243
1244 Absent this option, dump and aux files take their names from the
1245 input file, or from the (non-linker) output file, if one is
1246 explicitly specified: dump output files (e.g. those requested by
1247 -fdump-* options) with the input name suffix, and aux output files
1248 (those requested by other non-dump options, e.g. "-save-temps",
1249 "-gsplit-dwarf", "-fcallgraph-info") without it.
1250
1251 Similar suffix differentiation of dump and aux outputs can be
1252 attained for explicitly-given -dumpbase basename.suf by also
1253 specifying -dumpbase-ext .suf.
1254
1255 If dumpbase is explicitly specified with any directory component,
1256 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1257 ignored, and instead of appending to it, dumpbase fully overrides
1258 it:
1259
1260 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1261 -dumpdir pfx- -save-temps=cwd ...
1262
1263 creates auxiliary and dump outputs named alt/foo.*, disregarding
1264 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1265 -dumpdir.
1266
1267 When -dumpbase is specified in a command that compiles multiple
1268 inputs, or that compiles and then links, it may be combined with
1269 dumppfx, as specified under -dumpdir. Then, each input file is
1270 compiled using the combined dumppfx, and default values for
1271 dumpbase and auxdropsuf are computed for each input file:
1272
1273 gcc foo.c bar.c -c -dumpbase main ...
1274
1275 creates foo.o and bar.o as primary outputs, and avoids overwriting
1276 the auxiliary and dump outputs by using the dumpbase as a prefix,
1277 creating auxiliary and dump outputs named main-foo.* and
1278 main-bar.*.
1279
1280 An empty string specified as dumpbase avoids the influence of the
1281 output basename in the naming of auxiliary and dump outputs during
1282 compilation, computing default values :
1283
1284 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1285
1286 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1287 how their basenames are taken from the input name, but the
1288 directory still defaults to that of the output.
1289
1290 The empty-string dumpbase does not prevent the use of the output
1291 basename for outputs during linking:
1292
1293 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1294
1295 The compilation of the source files will name auxiliary outputs
1296 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1297 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1298 as the prefix for dumps and auxiliary files.
1299
1300 -dumpbase-ext auxdropsuf
1301 When forming the name of an auxiliary (but not a dump) output file,
1302 drop trailing auxdropsuf from dumpbase before appending any
1303 suffixes. If not specified, this option defaults to the suffix of
1304 a default dumpbase, i.e., the suffix of the input file when
1305 -dumpbase is not present in the command line, or dumpbase is
1306 combined with dumppfx.
1307
1308 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1309
1310 creates dir/foo.o as the main output, and generates auxiliary
1311 outputs in dir/x-foo.*, taking the location of the primary output,
1312 and dropping the .c suffix from the dumpbase. Dump outputs retain
1313 the suffix: dir/x-foo.c.*.
1314
1315 This option is disregarded if it does not match the suffix of a
1316 specified dumpbase, except as an alternative to the executable
1317 suffix when appending the linker output base name to dumppfx, as
1318 specified below:
1319
1320 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1321
1322 creates main.out as the primary output, and avoids overwriting the
1323 auxiliary and dump outputs by using the executable name minus
1324 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1325 and main-bar.* and dump outputs named main-foo.c.* and
1326 main-bar.c.*.
1327
1328 -dumpdir dumppfx
1329 When forming the name of an auxiliary or dump output file, use
1330 dumppfx as a prefix:
1331
1332 gcc -dumpdir pfx- -c foo.c ...
1333
1334 creates foo.o as the primary output, and auxiliary outputs named
1335 pfx-foo.*, combining the given dumppfx with the default dumpbase
1336 derived from the default primary output, derived in turn from the
1337 input name. Dump outputs also take the input name suffix:
1338 pfx-foo.c.*.
1339
1340 If dumppfx is to be used as a directory name, it must end with a
1341 directory separator:
1342
1343 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1344
1345 creates obj/bar.o as the primary output, and auxiliary outputs
1346 named dir/bar.*, combining the given dumppfx with the default
1347 dumpbase derived from the primary output name. Dump outputs also
1348 take the input name suffix: dir/bar.c.*.
1349
1350 It defaults to the location of the output file, unless the output
1351 file is a special file like "/dev/null". Options -save-temps=cwd
1352 and -save-temps=obj override this default, just like an explicit
1353 -dumpdir option. In case multiple such options are given, the last
1354 one prevails:
1355
1356 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1357
1358 outputs foo.o, with auxiliary outputs named foo.* because
1359 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1360 option. It does not matter that =obj is the default for
1361 -save-temps, nor that the output directory is implicitly the
1362 current directory. Dump outputs are named foo.c.*.
1363
1364 When compiling from multiple input files, if -dumpbase is
1365 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1366 appended to (or override, if containing any directory components)
1367 an explicit or defaulted dumppfx, so that each of the multiple
1368 compilations gets differently-named aux and dump outputs.
1369
1370 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1371
1372 outputs auxiliary dumps to dir/pfx-main-foo.* and
1373 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1374 retain the input file suffix: dir/pfx-main-foo.c.* and
1375 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1376 compilation:
1377
1378 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1379
1380 that, applying -dumpbase to a single source, does not compute and
1381 append a separate dumpbase per input file. Its auxiliary and dump
1382 outputs go in dir/pfx-main.*.
1383
1384 When compiling and then linking from multiple input files, a
1385 defaulted or explicitly specified dumppfx also undergoes the
1386 dumpbase- transformation above (e.g. the compilation of foo.c and
1387 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1388 are given, the linker output base name, minus auxdropsuf, if
1389 specified, or the executable suffix otherwise, plus a dash is
1390 appended to the default dumppfx instead. Note, however, that
1391 unlike earlier cases of linking:
1392
1393 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1394
1395 does not append the output name main to dumppfx, because -dumpdir
1396 is explicitly specified. The goal is that the explicitly-specified
1397 dumppfx may contain the specified output name as part of the
1398 prefix, if desired; only an explicitly-specified -dumpbase would be
1399 combined with it, in order to avoid simply discarding a meaningful
1400 option.
1401
1402 When compiling and then linking from a single input file, the
1403 linker output base name will only be appended to the default
1404 dumppfx as above if it does not share the base name with the single
1405 input file name. This has been covered in single-input linking
1406 cases above, but not with an explicit -dumpdir that inhibits the
1407 combination, even if overridden by -save-temps=*:
1408
1409 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1410
1411 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1412 current working directory as ultimately requested by
1413 -save-temps=cwd.
1414
1415 Summing it all up for an intuitive though slightly imprecise data
1416 flow: the primary output name is broken into a directory part and a
1417 basename part; dumppfx is set to the former, unless overridden by
1418 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1419 unless overriden by -dumpbase. If there are multiple inputs or
1420 linking, this dumpbase may be combined with dumppfx and taken from
1421 each input file. Auxiliary output names for each input are formed
1422 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1423 output suffix; dump output names are only different in that the
1424 suffix from dumpbase is retained.
1425
1426 When it comes to auxiliary and dump outputs created during LTO
1427 recompilation, a combination of dumppfx and dumpbase, as given or
1428 as derived from the linker output name but not from inputs, even in
1429 cases in which this combination would not otherwise be used as
1430 such, is passed down with a trailing period replacing the compiler-
1431 added dash, if any, as a -dumpdir option to lto-wrapper; being
1432 involved in linking, this program does not normally get any
1433 -dumpbase and -dumpbase-ext, and it ignores them.
1434
1435 When running sub-compilers, lto-wrapper appends LTO stage names to
1436 the received dumppfx, ensures it contains a directory component so
1437 that it overrides any -dumpdir, and passes that as -dumpbase to
1438 sub-compilers.
1439
1440 -v Print (on standard error output) the commands executed to run the
1441 stages of compilation. Also print the version number of the
1442 compiler driver program and of the preprocessor and the compiler
1443 proper.
1444
1445 -###
1446 Like -v except the commands are not executed and arguments are
1447 quoted unless they contain only alphanumeric characters or "./-_".
1448 This is useful for shell scripts to capture the driver-generated
1449 command lines.
1450
1451 --help
1452 Print (on the standard output) a description of the command-line
1453 options understood by gcc. If the -v option is also specified then
1454 --help is also passed on to the various processes invoked by gcc,
1455 so that they can display the command-line options they accept. If
1456 the -Wextra option has also been specified (prior to the --help
1457 option), then command-line options that have no documentation
1458 associated with them are also displayed.
1459
1460 --target-help
1461 Print (on the standard output) a description of target-specific
1462 command-line options for each tool. For some targets extra target-
1463 specific information may also be printed.
1464
1465 --help={class|[^]qualifier}[,...]
1466 Print (on the standard output) a description of the command-line
1467 options understood by the compiler that fit into all specified
1468 classes and qualifiers. These are the supported classes:
1469
1470 optimizers
1471 Display all of the optimization options supported by the
1472 compiler.
1473
1474 warnings
1475 Display all of the options controlling warning messages
1476 produced by the compiler.
1477
1478 target
1479 Display target-specific options. Unlike the --target-help
1480 option however, target-specific options of the linker and
1481 assembler are not displayed. This is because those tools do
1482 not currently support the extended --help= syntax.
1483
1484 params
1485 Display the values recognized by the --param option.
1486
1487 language
1488 Display the options supported for language, where language is
1489 the name of one of the languages supported in this version of
1490 GCC. If an option is supported by all languages, one needs to
1491 select common class.
1492
1493 common
1494 Display the options that are common to all languages.
1495
1496 These are the supported qualifiers:
1497
1498 undocumented
1499 Display only those options that are undocumented.
1500
1501 joined
1502 Display options taking an argument that appears after an equal
1503 sign in the same continuous piece of text, such as:
1504 --help=target.
1505
1506 separate
1507 Display options taking an argument that appears as a separate
1508 word following the original option, such as: -o output-file.
1509
1510 Thus for example to display all the undocumented target-specific
1511 switches supported by the compiler, use:
1512
1513 --help=target,undocumented
1514
1515 The sense of a qualifier can be inverted by prefixing it with the ^
1516 character, so for example to display all binary warning options
1517 (i.e., ones that are either on or off and that do not take an
1518 argument) that have a description, use:
1519
1520 --help=warnings,^joined,^undocumented
1521
1522 The argument to --help= should not consist solely of inverted
1523 qualifiers.
1524
1525 Combining several classes is possible, although this usually
1526 restricts the output so much that there is nothing to display. One
1527 case where it does work, however, is when one of the classes is
1528 target. For example, to display all the target-specific
1529 optimization options, use:
1530
1531 --help=target,optimizers
1532
1533 The --help= option can be repeated on the command line. Each
1534 successive use displays its requested class of options, skipping
1535 those that have already been displayed. If --help is also
1536 specified anywhere on the command line then this takes precedence
1537 over any --help= option.
1538
1539 If the -Q option appears on the command line before the --help=
1540 option, then the descriptive text displayed by --help= is changed.
1541 Instead of describing the displayed options, an indication is given
1542 as to whether the option is enabled, disabled or set to a specific
1543 value (assuming that the compiler knows this at the point where the
1544 --help= option is used).
1545
1546 Here is a truncated example from the ARM port of gcc:
1547
1548 % gcc -Q -mabi=2 --help=target -c
1549 The following options are target specific:
1550 -mabi= 2
1551 -mabort-on-noreturn [disabled]
1552 -mapcs [disabled]
1553
1554 The output is sensitive to the effects of previous command-line
1555 options, so for example it is possible to find out which
1556 optimizations are enabled at -O2 by using:
1557
1558 -Q -O2 --help=optimizers
1559
1560 Alternatively you can discover which binary optimizations are
1561 enabled by -O3 by using:
1562
1563 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1564 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1565 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1566
1567 --version
1568 Display the version number and copyrights of the invoked GCC.
1569
1570 -pass-exit-codes
1571 Normally the gcc program exits with the code of 1 if any phase of
1572 the compiler returns a non-success return code. If you specify
1573 -pass-exit-codes, the gcc program instead returns with the
1574 numerically highest error produced by any phase returning an error
1575 indication. The C, C++, and Fortran front ends return 4 if an
1576 internal compiler error is encountered.
1577
1578 -pipe
1579 Use pipes rather than temporary files for communication between the
1580 various stages of compilation. This fails to work on some systems
1581 where the assembler is unable to read from a pipe; but the GNU
1582 assembler has no trouble.
1583
1584 -specs=file
1585 Process file after the compiler reads in the standard specs file,
1586 in order to override the defaults which the gcc driver program uses
1587 when determining what switches to pass to cc1, cc1plus, as, ld,
1588 etc. More than one -specs=file can be specified on the command
1589 line, and they are processed in order, from left to right.
1590
1591 -wrapper
1592 Invoke all subcommands under a wrapper program. The name of the
1593 wrapper program and its parameters are passed as a comma separated
1594 list.
1595
1596 gcc -c t.c -wrapper gdb,--args
1597
1598 This invokes all subprograms of gcc under gdb --args, thus the
1599 invocation of cc1 is gdb --args cc1 ....
1600
1601 -ffile-prefix-map=old=new
1602 When compiling files residing in directory old, record any
1603 references to them in the result of the compilation as if the files
1604 resided in directory new instead. Specifying this option is
1605 equivalent to specifying all the individual -f*-prefix-map options.
1606 This can be used to make reproducible builds that are location
1607 independent. See also -fmacro-prefix-map, -fdebug-prefix-map and
1608 -fprofile-prefix-map.
1609
1610 -fplugin=name.so
1611 Load the plugin code in file name.so, assumed to be a shared object
1612 to be dlopen'd by the compiler. The base name of the shared object
1613 file is used to identify the plugin for the purposes of argument
1614 parsing (See -fplugin-arg-name-key=value below). Each plugin
1615 should define the callback functions specified in the Plugins API.
1616
1617 -fplugin-arg-name-key=value
1618 Define an argument called key with a value of value for the plugin
1619 called name.
1620
1621 -fdump-ada-spec[-slim]
1622 For C and C++ source and include files, generate corresponding Ada
1623 specs.
1624
1625 -fada-spec-parent=unit
1626 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1627 specs as child units of parent unit.
1628
1629 -fdump-go-spec=file
1630 For input files in any language, generate corresponding Go
1631 declarations in file. This generates Go "const", "type", "var",
1632 and "func" declarations which may be a useful way to start writing
1633 a Go interface to code written in some other language.
1634
1635 @file
1636 Read command-line options from file. The options read are inserted
1637 in place of the original @file option. If file does not exist, or
1638 cannot be read, then the option will be treated literally, and not
1639 removed.
1640
1641 Options in file are separated by whitespace. A whitespace
1642 character may be included in an option by surrounding the entire
1643 option in either single or double quotes. Any character (including
1644 a backslash) may be included by prefixing the character to be
1645 included with a backslash. The file may itself contain additional
1646 @file options; any such options will be processed recursively.
1647
1648 Compiling C++ Programs
1649 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1650 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1651 (for shared template code) .tcc; and preprocessed C++ files use the
1652 suffix .ii. GCC recognizes files with these names and compiles them as
1653 C++ programs even if you call the compiler the same way as for
1654 compiling C programs (usually with the name gcc).
1655
1656 However, the use of gcc does not add the C++ library. g++ is a program
1657 that calls GCC and automatically specifies linking against the C++
1658 library. It treats .c, .h and .i files as C++ source files instead of
1659 C source files unless -x is used. This program is also useful when
1660 precompiling a C header file with a .h extension for use in C++
1661 compilations. On many systems, g++ is also installed with the name
1662 c++.
1663
1664 When you compile C++ programs, you may specify many of the same
1665 command-line options that you use for compiling programs in any
1666 language; or command-line options meaningful for C and related
1667 languages; or options that are meaningful only for C++ programs.
1668
1669 Options Controlling C Dialect
1670 The following options control the dialect of C (or languages derived
1671 from C, such as C++, Objective-C and Objective-C++) that the compiler
1672 accepts:
1673
1674 -ansi
1675 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1676 equivalent to -std=c++98.
1677
1678 This turns off certain features of GCC that are incompatible with
1679 ISO C90 (when compiling C code), or of standard C++ (when compiling
1680 C++ code), such as the "asm" and "typeof" keywords, and predefined
1681 macros such as "unix" and "vax" that identify the type of system
1682 you are using. It also enables the undesirable and rarely used ISO
1683 trigraph feature. For the C compiler, it disables recognition of
1684 C++ style // comments as well as the "inline" keyword.
1685
1686 The alternate keywords "__asm__", "__extension__", "__inline__" and
1687 "__typeof__" continue to work despite -ansi. You would not want to
1688 use them in an ISO C program, of course, but it is useful to put
1689 them in header files that might be included in compilations done
1690 with -ansi. Alternate predefined macros such as "__unix__" and
1691 "__vax__" are also available, with or without -ansi.
1692
1693 The -ansi option does not cause non-ISO programs to be rejected
1694 gratuitously. For that, -Wpedantic is required in addition to
1695 -ansi.
1696
1697 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1698 used. Some header files may notice this macro and refrain from
1699 declaring certain functions or defining certain macros that the ISO
1700 standard doesn't call for; this is to avoid interfering with any
1701 programs that might use these names for other things.
1702
1703 Functions that are normally built in but do not have semantics
1704 defined by ISO C (such as "alloca" and "ffs") are not built-in
1705 functions when -ansi is used.
1706
1707 -std=
1708 Determine the language standard. This option is currently only
1709 supported when compiling C or C++.
1710
1711 The compiler can accept several base standards, such as c90 or
1712 c++98, and GNU dialects of those standards, such as gnu90 or
1713 gnu++98. When a base standard is specified, the compiler accepts
1714 all programs following that standard plus those using GNU
1715 extensions that do not contradict it. For example, -std=c90 turns
1716 off certain features of GCC that are incompatible with ISO C90,
1717 such as the "asm" and "typeof" keywords, but not other GNU
1718 extensions that do not have a meaning in ISO C90, such as omitting
1719 the middle term of a "?:" expression. On the other hand, when a GNU
1720 dialect of a standard is specified, all features supported by the
1721 compiler are enabled, even when those features change the meaning
1722 of the base standard. As a result, some strict-conforming programs
1723 may be rejected. The particular standard is used by -Wpedantic to
1724 identify which features are GNU extensions given that version of
1725 the standard. For example -std=gnu90 -Wpedantic warns about C++
1726 style // comments, while -std=gnu99 -Wpedantic does not.
1727
1728 A value for this option must be provided; possible values are
1729
1730 c90
1731 c89
1732 iso9899:1990
1733 Support all ISO C90 programs (certain GNU extensions that
1734 conflict with ISO C90 are disabled). Same as -ansi for C code.
1735
1736 iso9899:199409
1737 ISO C90 as modified in amendment 1.
1738
1739 c99
1740 c9x
1741 iso9899:1999
1742 iso9899:199x
1743 ISO C99. This standard is substantially completely supported,
1744 modulo bugs and floating-point issues (mainly but not entirely
1745 relating to optional C99 features from Annexes F and G). See
1746 <https://gcc.gnu.org/c99status.html> for more information. The
1747 names c9x and iso9899:199x are deprecated.
1748
1749 c11
1750 c1x
1751 iso9899:2011
1752 ISO C11, the 2011 revision of the ISO C standard. This
1753 standard is substantially completely supported, modulo bugs,
1754 floating-point issues (mainly but not entirely relating to
1755 optional C11 features from Annexes F and G) and the optional
1756 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1757 The name c1x is deprecated.
1758
1759 c17
1760 c18
1761 iso9899:2017
1762 iso9899:2018
1763 ISO C17, the 2017 revision of the ISO C standard (published in
1764 2018). This standard is same as C11 except for corrections of
1765 defects (all of which are also applied with -std=c11) and a new
1766 value of "__STDC_VERSION__", and so is supported to the same
1767 extent as C11.
1768
1769 c2x The next version of the ISO C standard, still under
1770 development. The support for this version is experimental and
1771 incomplete.
1772
1773 gnu90
1774 gnu89
1775 GNU dialect of ISO C90 (including some C99 features).
1776
1777 gnu99
1778 gnu9x
1779 GNU dialect of ISO C99. The name gnu9x is deprecated.
1780
1781 gnu11
1782 gnu1x
1783 GNU dialect of ISO C11. The name gnu1x is deprecated.
1784
1785 gnu17
1786 gnu18
1787 GNU dialect of ISO C17. This is the default for C code.
1788
1789 gnu2x
1790 The next version of the ISO C standard, still under
1791 development, plus GNU extensions. The support for this version
1792 is experimental and incomplete.
1793
1794 c++98
1795 c++03
1796 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1797 and some additional defect reports. Same as -ansi for C++ code.
1798
1799 gnu++98
1800 gnu++03
1801 GNU dialect of -std=c++98.
1802
1803 c++11
1804 c++0x
1805 The 2011 ISO C++ standard plus amendments. The name c++0x is
1806 deprecated.
1807
1808 gnu++11
1809 gnu++0x
1810 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1811
1812 c++14
1813 c++1y
1814 The 2014 ISO C++ standard plus amendments. The name c++1y is
1815 deprecated.
1816
1817 gnu++14
1818 gnu++1y
1819 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1820
1821 c++17
1822 c++1z
1823 The 2017 ISO C++ standard plus amendments. The name c++1z is
1824 deprecated.
1825
1826 gnu++17
1827 gnu++1z
1828 GNU dialect of -std=c++17. This is the default for C++ code.
1829 The name gnu++1z is deprecated.
1830
1831 c++20
1832 c++2a
1833 The 2020 ISO C++ standard plus amendments. Support is
1834 experimental, and could change in incompatible ways in future
1835 releases. The name c++2a is deprecated.
1836
1837 gnu++20
1838 gnu++2a
1839 GNU dialect of -std=c++20. Support is experimental, and could
1840 change in incompatible ways in future releases. The name
1841 gnu++2a is deprecated.
1842
1843 c++2b
1844 c++23
1845 The next revision of the ISO C++ standard, planned for 2023.
1846 Support is highly experimental, and will almost certainly
1847 change in incompatible ways in future releases.
1848
1849 gnu++2b
1850 gnu++23
1851 GNU dialect of -std=c++2b. Support is highly experimental, and
1852 will almost certainly change in incompatible ways in future
1853 releases.
1854
1855 -aux-info filename
1856 Output to the given filename prototyped declarations for all
1857 functions declared and/or defined in a translation unit, including
1858 those in header files. This option is silently ignored in any
1859 language other than C.
1860
1861 Besides declarations, the file indicates, in comments, the origin
1862 of each declaration (source file and line), whether the declaration
1863 was implicit, prototyped or unprototyped (I, N for new or O for
1864 old, respectively, in the first character after the line number and
1865 the colon), and whether it came from a declaration or a definition
1866 (C or F, respectively, in the following character). In the case of
1867 function definitions, a K&R-style list of arguments followed by
1868 their declarations is also provided, inside comments, after the
1869 declaration.
1870
1871 -fallow-parameterless-variadic-functions
1872 Accept variadic functions without named parameters.
1873
1874 Although it is possible to define such a function, this is not very
1875 useful as it is not possible to read the arguments. This is only
1876 supported for C as this construct is allowed by C++.
1877
1878 -fno-asm
1879 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1880 code can use these words as identifiers. You can use the keywords
1881 "__asm__", "__inline__" and "__typeof__" instead. In C, -ansi
1882 implies -fno-asm.
1883
1884 In C++, "inline" is a standard keyword and is not affected by this
1885 switch. You may want to use the -fno-gnu-keywords flag instead,
1886 which disables "typeof" but not "asm" and "inline". In C99 mode
1887 (-std=c99 or -std=gnu99), this switch only affects the "asm" and
1888 "typeof" keywords, since "inline" is a standard keyword in ISO C99.
1889
1890 -fno-builtin
1891 -fno-builtin-function
1892 Don't recognize built-in functions that do not begin with
1893 __builtin_ as prefix.
1894
1895 GCC normally generates special code to handle certain built-in
1896 functions more efficiently; for instance, calls to "alloca" may
1897 become single instructions which adjust the stack directly, and
1898 calls to "memcpy" may become inline copy loops. The resulting code
1899 is often both smaller and faster, but since the function calls no
1900 longer appear as such, you cannot set a breakpoint on those calls,
1901 nor can you change the behavior of the functions by linking with a
1902 different library. In addition, when a function is recognized as a
1903 built-in function, GCC may use information about that function to
1904 warn about problems with calls to that function, or to generate
1905 more efficient code, even if the resulting code still contains
1906 calls to that function. For example, warnings are given with
1907 -Wformat for bad calls to "printf" when "printf" is built in and
1908 "strlen" is known not to modify global memory.
1909
1910 With the -fno-builtin-function option only the built-in function
1911 function is disabled. function must not begin with __builtin_. If
1912 a function is named that is not built-in in this version of GCC,
1913 this option is ignored. There is no corresponding
1914 -fbuiltin-function option; if you wish to enable built-in functions
1915 selectively when using -fno-builtin or -ffreestanding, you may
1916 define macros such as:
1917
1918 #define abs(n) __builtin_abs ((n))
1919 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1920
1921 -fcond-mismatch
1922 Allow conditional expressions with mismatched types in the second
1923 and third arguments. The value of such an expression is void.
1924 This option is not supported for C++.
1925
1926 -ffreestanding
1927 Assert that compilation targets a freestanding environment. This
1928 implies -fno-builtin. A freestanding environment is one in which
1929 the standard library may not exist, and program startup may not
1930 necessarily be at "main". The most obvious example is an OS
1931 kernel. This is equivalent to -fno-hosted.
1932
1933 -fgimple
1934 Enable parsing of function definitions marked with "__GIMPLE".
1935 This is an experimental feature that allows unit testing of GIMPLE
1936 passes.
1937
1938 -fgnu-tm
1939 When the option -fgnu-tm is specified, the compiler generates code
1940 for the Linux variant of Intel's current Transactional Memory ABI
1941 specification document (Revision 1.1, May 6 2009). This is an
1942 experimental feature whose interface may change in future versions
1943 of GCC, as the official specification changes. Please note that
1944 not all architectures are supported for this feature.
1945
1946 For more information on GCC's support for transactional memory,
1947
1948 Note that the transactional memory feature is not supported with
1949 non-call exceptions (-fnon-call-exceptions).
1950
1951 -fgnu89-inline
1952 The option -fgnu89-inline tells GCC to use the traditional GNU
1953 semantics for "inline" functions when in C99 mode.
1954
1955 Using this option is roughly equivalent to adding the "gnu_inline"
1956 function attribute to all inline functions.
1957
1958 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1959 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1960 specifies the default behavior). This option is not supported in
1961 -std=c90 or -std=gnu90 mode.
1962
1963 The preprocessor macros "__GNUC_GNU_INLINE__" and
1964 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1965 effect for "inline" functions.
1966
1967 -fhosted
1968 Assert that compilation targets a hosted environment. This implies
1969 -fbuiltin. A hosted environment is one in which the entire
1970 standard library is available, and in which "main" has a return
1971 type of "int". Examples are nearly everything except a kernel.
1972 This is equivalent to -fno-freestanding.
1973
1974 -flax-vector-conversions
1975 Allow implicit conversions between vectors with differing numbers
1976 of elements and/or incompatible element types. This option should
1977 not be used for new code.
1978
1979 -fms-extensions
1980 Accept some non-standard constructs used in Microsoft header files.
1981
1982 In C++ code, this allows member names in structures to be similar
1983 to previous types declarations.
1984
1985 typedef int UOW;
1986 struct ABC {
1987 UOW UOW;
1988 };
1989
1990 Some cases of unnamed fields in structures and unions are only
1991 accepted with this option.
1992
1993 Note that this option is off for all targets except for x86 targets
1994 using ms-abi.
1995
1996 -foffload=disable
1997 -foffload=default
1998 -foffload=target-list
1999 Specify for which OpenMP and OpenACC offload targets code should be
2000 generated. The default behavior, equivalent to -foffload=default,
2001 is to generate code for all supported offload targets. The
2002 -foffload=disable form generates code only for the host fallback,
2003 while -foffload=target-list generates code only for the specified
2004 comma-separated list of offload targets.
2005
2006 Offload targets are specified in GCC's internal target-triplet
2007 format. You can run the compiler with -v to show the list of
2008 configured offload targets under "OFFLOAD_TARGET_NAMES".
2009
2010 -foffload-options=options
2011 -foffload-options=target-triplet-list=options
2012 With -foffload-options=options, GCC passes the specified options to
2013 the compilers for all enabled offloading targets. You can specify
2014 options that apply only to a specific target or targets by using
2015 the -foffload-options=target-list=options form. The target-list is
2016 a comma-separated list in the same format as for the -foffload=
2017 option.
2018
2019 Typical command lines are
2020
2021 -foffload-options=-lgfortran -foffload-options=-lm
2022 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2023 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2024
2025 -fopenacc
2026 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
2027 "!$acc" in Fortran. When -fopenacc is specified, the compiler
2028 generates accelerated code according to the OpenACC Application
2029 Programming Interface v2.6 <https://www.openacc.org>. This option
2030 implies -pthread, and thus is only supported on targets that have
2031 support for -pthread.
2032
2033 -fopenacc-dim=geom
2034 Specify default compute dimensions for parallel offload regions
2035 that do not explicitly specify. The geom value is a triple of
2036 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
2037 size can be omitted, to use a target-specific default value.
2038
2039 -fopenmp
2040 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
2041 "!$omp" in Fortran. When -fopenmp is specified, the compiler
2042 generates parallel code according to the OpenMP Application Program
2043 Interface v4.5 <https://www.openmp.org>. This option implies
2044 -pthread, and thus is only supported on targets that have support
2045 for -pthread. -fopenmp implies -fopenmp-simd.
2046
2047 -fopenmp-simd
2048 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
2049 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
2050
2051 -fpermitted-flt-eval-methods=style
2052 ISO/IEC TS 18661-3 defines new permissible values for
2053 "FLT_EVAL_METHOD" that indicate that operations and constants with
2054 a semantic type that is an interchange or extended format should be
2055 evaluated to the precision and range of that type. These new
2056 values are a superset of those permitted under C99/C11, which does
2057 not specify the meaning of other positive values of
2058 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
2059 been written expecting the possibility of the new values.
2060
2061 -fpermitted-flt-eval-methods specifies whether the compiler should
2062 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
2063 the extended set of values specified in ISO/IEC TS 18661-3.
2064
2065 style is either "c11" or "ts-18661-3" as appropriate.
2066
2067 The default when in a standards compliant mode (-std=c11 or
2068 similar) is -fpermitted-flt-eval-methods=c11. The default when in
2069 a GNU dialect (-std=gnu11 or similar) is
2070 -fpermitted-flt-eval-methods=ts-18661-3.
2071
2072 -fplan9-extensions
2073 Accept some non-standard constructs used in Plan 9 code.
2074
2075 This enables -fms-extensions, permits passing pointers to
2076 structures with anonymous fields to functions that expect pointers
2077 to elements of the type of the field, and permits referring to
2078 anonymous fields declared using a typedef. This is only
2079 supported for C, not C++.
2080
2081 -fsigned-bitfields
2082 -funsigned-bitfields
2083 -fno-signed-bitfields
2084 -fno-unsigned-bitfields
2085 These options control whether a bit-field is signed or unsigned,
2086 when the declaration does not use either "signed" or "unsigned".
2087 By default, such a bit-field is signed, because this is consistent:
2088 the basic integer types such as "int" are signed types.
2089
2090 -fsigned-char
2091 Let the type "char" be signed, like "signed char".
2092
2093 Note that this is equivalent to -fno-unsigned-char, which is the
2094 negative form of -funsigned-char. Likewise, the option
2095 -fno-signed-char is equivalent to -funsigned-char.
2096
2097 -funsigned-char
2098 Let the type "char" be unsigned, like "unsigned char".
2099
2100 Each kind of machine has a default for what "char" should be. It
2101 is either like "unsigned char" by default or like "signed char" by
2102 default.
2103
2104 Ideally, a portable program should always use "signed char" or
2105 "unsigned char" when it depends on the signedness of an object.
2106 But many programs have been written to use plain "char" and expect
2107 it to be signed, or expect it to be unsigned, depending on the
2108 machines they were written for. This option, and its inverse, let
2109 you make such a program work with the opposite default.
2110
2111 The type "char" is always a distinct type from each of "signed
2112 char" or "unsigned char", even though its behavior is always just
2113 like one of those two.
2114
2115 -fsso-struct=endianness
2116 Set the default scalar storage order of structures and unions to
2117 the specified endianness. The accepted values are big-endian,
2118 little-endian and native for the native endianness of the target
2119 (the default). This option is not supported for C++.
2120
2121 Warning: the -fsso-struct switch causes GCC to generate code that
2122 is not binary compatible with code generated without it if the
2123 specified endianness is not the native endianness of the target.
2124
2125 Options Controlling C++ Dialect
2126 This section describes the command-line options that are only
2127 meaningful for C++ programs. You can also use most of the GNU compiler
2128 options regardless of what language your program is in. For example,
2129 you might compile a file firstClass.C like this:
2130
2131 g++ -g -fstrict-enums -O -c firstClass.C
2132
2133 In this example, only -fstrict-enums is an option meant only for C++
2134 programs; you can use the other options with any language supported by
2135 GCC.
2136
2137 Some options for compiling C programs, such as -std, are also relevant
2138 for C++ programs.
2139
2140 Here is a list of options that are only for compiling C++ programs:
2141
2142 -fabi-version=n
2143 Use version n of the C++ ABI. The default is version 0.
2144
2145 Version 0 refers to the version conforming most closely to the C++
2146 ABI specification. Therefore, the ABI obtained using version 0
2147 will change in different versions of G++ as ABI bugs are fixed.
2148
2149 Version 1 is the version of the C++ ABI that first appeared in G++
2150 3.2.
2151
2152 Version 2 is the version of the C++ ABI that first appeared in G++
2153 3.4, and was the default through G++ 4.9.
2154
2155 Version 3 corrects an error in mangling a constant address as a
2156 template argument.
2157
2158 Version 4, which first appeared in G++ 4.5, implements a standard
2159 mangling for vector types.
2160
2161 Version 5, which first appeared in G++ 4.6, corrects the mangling
2162 of attribute const/volatile on function pointer types, decltype of
2163 a plain decl, and use of a function parameter in the declaration of
2164 another parameter.
2165
2166 Version 6, which first appeared in G++ 4.7, corrects the promotion
2167 behavior of C++11 scoped enums and the mangling of template
2168 argument packs, const/static_cast, prefix ++ and --, and a class
2169 scope function used as a template argument.
2170
2171 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2172 as a builtin type and corrects the mangling of lambdas in default
2173 argument scope.
2174
2175 Version 8, which first appeared in G++ 4.9, corrects the
2176 substitution behavior of function types with function-cv-
2177 qualifiers.
2178
2179 Version 9, which first appeared in G++ 5.2, corrects the alignment
2180 of "nullptr_t".
2181
2182 Version 10, which first appeared in G++ 6.1, adds mangling of
2183 attributes that affect type identity, such as ia32 calling
2184 convention attributes (e.g. stdcall).
2185
2186 Version 11, which first appeared in G++ 7, corrects the mangling of
2187 sizeof... expressions and operator names. For multiple entities
2188 with the same name within a function, that are declared in
2189 different scopes, the mangling now changes starting with the
2190 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2191
2192 Version 12, which first appeared in G++ 8, corrects the calling
2193 conventions for empty classes on the x86_64 target and for classes
2194 with only deleted copy/move constructors. It accidentally changes
2195 the calling convention for classes with a deleted copy constructor
2196 and a trivial move constructor.
2197
2198 Version 13, which first appeared in G++ 8.2, fixes the accidental
2199 change in version 12.
2200
2201 Version 14, which first appeared in G++ 10, corrects the mangling
2202 of the nullptr expression.
2203
2204 Version 15, which first appeared in G++ 11, changes the mangling of
2205 "__alignof__" to be distinct from that of "alignof", and dependent
2206 operator names.
2207
2208 See also -Wabi.
2209
2210 -fabi-compat-version=n
2211 On targets that support strong aliases, G++ works around mangling
2212 changes by creating an alias with the correct mangled name when
2213 defining a symbol with an incorrect mangled name. This switch
2214 specifies which ABI version to use for the alias.
2215
2216 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
2217 compatibility). If another ABI version is explicitly selected,
2218 this defaults to 0. For compatibility with GCC versions 3.2
2219 through 4.9, use -fabi-compat-version=2.
2220
2221 If this option is not provided but -Wabi=n is, that version is used
2222 for compatibility aliases. If this option is provided along with
2223 -Wabi (without the version), the version from this option is used
2224 for the warning.
2225
2226 -fno-access-control
2227 Turn off all access checking. This switch is mainly useful for
2228 working around bugs in the access control code.
2229
2230 -faligned-new
2231 Enable support for C++17 "new" of types that require more alignment
2232 than "void* ::operator new(std::size_t)" provides. A numeric
2233 argument such as "-faligned-new=32" can be used to specify how much
2234 alignment (in bytes) is provided by that function, but few users
2235 will need to override the default of "alignof(std::max_align_t)".
2236
2237 This flag is enabled by default for -std=c++17.
2238
2239 -fchar8_t
2240 -fno-char8_t
2241 Enable support for "char8_t" as adopted for C++20. This includes
2242 the addition of a new "char8_t" fundamental type, changes to the
2243 types of UTF-8 string and character literals, new signatures for
2244 user-defined literals, associated standard library updates, and new
2245 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2246
2247 This option enables functions to be overloaded for ordinary and
2248 UTF-8 strings:
2249
2250 int f(const char *); // #1
2251 int f(const char8_t *); // #2
2252 int v1 = f("text"); // Calls #1
2253 int v2 = f(u8"text"); // Calls #2
2254
2255 and introduces new signatures for user-defined literals:
2256
2257 int operator""_udl1(char8_t);
2258 int v3 = u8'x'_udl1;
2259 int operator""_udl2(const char8_t*, std::size_t);
2260 int v4 = u8"text"_udl2;
2261 template<typename T, T...> int operator""_udl3();
2262 int v5 = u8"text"_udl3;
2263
2264 The change to the types of UTF-8 string and character literals
2265 introduces incompatibilities with ISO C++11 and later standards.
2266 For example, the following code is well-formed under ISO C++11, but
2267 is ill-formed when -fchar8_t is specified.
2268
2269 char ca[] = u8"xx"; // error: char-array initialized from wide
2270 // string
2271 const char *cp = u8"xx";// error: invalid conversion from
2272 // `const char8_t*' to `const char*'
2273 int f(const char*);
2274 auto v = f(u8"xx"); // error: invalid conversion from
2275 // `const char8_t*' to `const char*'
2276 std::string s{u8"xx"}; // error: no matching function for call to
2277 // `std::basic_string<char>::basic_string()'
2278 using namespace std::literals;
2279 s = u8"xx"s; // error: conversion from
2280 // `basic_string<char8_t>' to non-scalar
2281 // type `basic_string<char>' requested
2282
2283 -fcheck-new
2284 Check that the pointer returned by "operator new" is non-null
2285 before attempting to modify the storage allocated. This check is
2286 normally unnecessary because the C++ standard specifies that
2287 "operator new" only returns 0 if it is declared "throw()", in which
2288 case the compiler always checks the return value even without this
2289 option. In all other cases, when "operator new" has a non-empty
2290 exception specification, memory exhaustion is signalled by throwing
2291 "std::bad_alloc". See also new (nothrow).
2292
2293 -fconcepts
2294 -fconcepts-ts
2295 Below -std=c++20, -fconcepts enables support for the C++ Extensions
2296 for Concepts Technical Specification, ISO 19217 (2015).
2297
2298 With -std=c++20 and above, Concepts are part of the language
2299 standard, so -fconcepts defaults to on. But the standard
2300 specification of Concepts differs significantly from the TS, so
2301 some constructs that were allowed in the TS but didn't make it into
2302 the standard can still be enabled by -fconcepts-ts.
2303
2304 -fconstexpr-depth=n
2305 Set the maximum nested evaluation depth for C++11 constexpr
2306 functions to n. A limit is needed to detect endless recursion
2307 during constant expression evaluation. The minimum specified by
2308 the standard is 512.
2309
2310 -fconstexpr-cache-depth=n
2311 Set the maximum level of nested evaluation depth for C++11
2312 constexpr functions that will be cached to n. This is a heuristic
2313 that trades off compilation speed (when the cache avoids repeated
2314 calculations) against memory consumption (when the cache grows very
2315 large from highly recursive evaluations). The default is 8. Very
2316 few users are likely to want to adjust it, but if your code does
2317 heavy constexpr calculations you might want to experiment to find
2318 which value works best for you.
2319
2320 -fconstexpr-fp-except
2321 Annex F of the C standard specifies that IEC559 floating point
2322 exceptions encountered at compile time should not stop compilation.
2323 C++ compilers have historically not followed this guidance, instead
2324 treating floating point division by zero as non-constant even
2325 though it has a well defined value. This flag tells the compiler
2326 to give Annex F priority over other rules saying that a particular
2327 operation is undefined.
2328
2329 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
2330
2331 -fconstexpr-loop-limit=n
2332 Set the maximum number of iterations for a loop in C++14 constexpr
2333 functions to n. A limit is needed to detect infinite loops during
2334 constant expression evaluation. The default is 262144 (1<<18).
2335
2336 -fconstexpr-ops-limit=n
2337 Set the maximum number of operations during a single constexpr
2338 evaluation. Even when number of iterations of a single loop is
2339 limited with the above limit, if there are several nested loops and
2340 each of them has many iterations but still smaller than the above
2341 limit, or if in a body of some loop or even outside of a loop too
2342 many expressions need to be evaluated, the resulting constexpr
2343 evaluation might take too long. The default is 33554432 (1<<25).
2344
2345 -fcoroutines
2346 Enable support for the C++ coroutines extension (experimental).
2347
2348 -fno-elide-constructors
2349 The C++ standard allows an implementation to omit creating a
2350 temporary that is only used to initialize another object of the
2351 same type. Specifying this option disables that optimization, and
2352 forces G++ to call the copy constructor in all cases. This option
2353 also causes G++ to call trivial member functions which otherwise
2354 would be expanded inline.
2355
2356 In C++17, the compiler is required to omit these temporaries, but
2357 this option still affects trivial member functions.
2358
2359 -fno-enforce-eh-specs
2360 Don't generate code to check for violation of exception
2361 specifications at run time. This option violates the C++ standard,
2362 but may be useful for reducing code size in production builds, much
2363 like defining "NDEBUG". This does not give user code permission to
2364 throw exceptions in violation of the exception specifications; the
2365 compiler still optimizes based on the specifications, so throwing
2366 an unexpected exception results in undefined behavior at run time.
2367
2368 -fextern-tls-init
2369 -fno-extern-tls-init
2370 The C++11 and OpenMP standards allow "thread_local" and
2371 "threadprivate" variables to have dynamic (runtime) initialization.
2372 To support this, any use of such a variable goes through a wrapper
2373 function that performs any necessary initialization. When the use
2374 and definition of the variable are in the same translation unit,
2375 this overhead can be optimized away, but when the use is in a
2376 different translation unit there is significant overhead even if
2377 the variable doesn't actually need dynamic initialization. If the
2378 programmer can be sure that no use of the variable in a non-
2379 defining TU needs to trigger dynamic initialization (either because
2380 the variable is statically initialized, or a use of the variable in
2381 the defining TU will be executed before any uses in another TU),
2382 they can avoid this overhead with the -fno-extern-tls-init option.
2383
2384 On targets that support symbol aliases, the default is
2385 -fextern-tls-init. On targets that do not support symbol aliases,
2386 the default is -fno-extern-tls-init.
2387
2388 -ffold-simple-inlines
2389 -fno-fold-simple-inlines
2390 Permit the C++ frontend to fold calls to "std::move",
2391 "std::forward", "std::addressof" and "std::as_const". In contrast
2392 to inlining, this means no debug information will be generated for
2393 such calls. Since these functions are rarely interesting to debug,
2394 this flag is enabled by default unless -fno-inline is active.
2395
2396 -fno-gnu-keywords
2397 Do not recognize "typeof" as a keyword, so that code can use this
2398 word as an identifier. You can use the keyword "__typeof__"
2399 instead. This option is implied by the strict ISO C++ dialects:
2400 -ansi, -std=c++98, -std=c++11, etc.
2401
2402 -fimplicit-constexpr
2403 Make inline functions implicitly constexpr, if they satisfy the
2404 requirements for a constexpr function. This option can be used in
2405 C++14 mode or later. This can result in initialization changing
2406 from dynamic to static and other optimizations.
2407
2408 -fno-implicit-templates
2409 Never emit code for non-inline templates that are instantiated
2410 implicitly (i.e. by use); only emit code for explicit
2411 instantiations. If you use this option, you must take care to
2412 structure your code to include all the necessary explicit
2413 instantiations to avoid getting undefined symbols at link time.
2414
2415 -fno-implicit-inline-templates
2416 Don't emit code for implicit instantiations of inline templates,
2417 either. The default is to handle inlines differently so that
2418 compiles with and without optimization need the same set of
2419 explicit instantiations.
2420
2421 -fno-implement-inlines
2422 To save space, do not emit out-of-line copies of inline functions
2423 controlled by "#pragma implementation". This causes linker errors
2424 if these functions are not inlined everywhere they are called.
2425
2426 -fmodules-ts
2427 -fno-modules-ts
2428 Enable support for C++20 modules. The -fno-modules-ts is usually
2429 not needed, as that is the default. Even though this is a C++20
2430 feature, it is not currently implicitly enabled by selecting that
2431 standard version.
2432
2433 -fmodule-header
2434 -fmodule-header=user
2435 -fmodule-header=system
2436 Compile a header file to create an importable header unit.
2437
2438 -fmodule-implicit-inline
2439 Member functions defined in their class definitions are not
2440 implicitly inline for modular code. This is different to
2441 traditional C++ behavior, for good reasons. However, it may result
2442 in a difficulty during code porting. This option makes such
2443 function definitions implicitly inline. It does however generate
2444 an ABI incompatibility, so you must use it everywhere or nowhere.
2445 (Such definitions outside of a named module remain implicitly
2446 inline, regardless.)
2447
2448 -fno-module-lazy
2449 Disable lazy module importing and module mapper creation.
2450
2451 -fmodule-mapper=[hostname]:port[?ident]
2452 -fmodule-mapper=|program[?ident] args...
2453 -fmodule-mapper==socket[?ident]
2454 -fmodule-mapper=<>[inout][?ident]
2455 -fmodule-mapper=<in>out[?ident]
2456 -fmodule-mapper=file[?ident]
2457 An oracle to query for module name to filename mappings. If
2458 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2459 if that is unset, an in-process default is provided.
2460
2461 -fmodule-only
2462 Only emit the Compiled Module Interface, inhibiting any object
2463 file.
2464
2465 -fms-extensions
2466 Disable Wpedantic warnings about constructs used in MFC, such as
2467 implicit int and getting a pointer to member function via non-
2468 standard syntax.
2469
2470 -fnew-inheriting-ctors
2471 Enable the P0136 adjustment to the semantics of C++11 constructor
2472 inheritance. This is part of C++17 but also considered to be a
2473 Defect Report against C++11 and C++14. This flag is enabled by
2474 default unless -fabi-version=10 or lower is specified.
2475
2476 -fnew-ttp-matching
2477 Enable the P0522 resolution to Core issue 150, template template
2478 parameters and default arguments: this allows a template with
2479 default template arguments as an argument for a template template
2480 parameter with fewer template parameters. This flag is enabled by
2481 default for -std=c++17.
2482
2483 -fno-nonansi-builtins
2484 Disable built-in declarations of functions that are not mandated by
2485 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2486 "bzero", "conjf", and other related functions.
2487
2488 -fnothrow-opt
2489 Treat a "throw()" exception specification as if it were a
2490 "noexcept" specification to reduce or eliminate the text size
2491 overhead relative to a function with no exception specification.
2492 If the function has local variables of types with non-trivial
2493 destructors, the exception specification actually makes the
2494 function smaller because the EH cleanups for those variables can be
2495 optimized away. The semantic effect is that an exception thrown
2496 out of a function with such an exception specification results in a
2497 call to "terminate" rather than "unexpected".
2498
2499 -fno-operator-names
2500 Do not treat the operator name keywords "and", "bitand", "bitor",
2501 "compl", "not", "or" and "xor" as synonyms as keywords.
2502
2503 -fno-optional-diags
2504 Disable diagnostics that the standard says a compiler does not need
2505 to issue. Currently, the only such diagnostic issued by G++ is the
2506 one for a name having multiple meanings within a class.
2507
2508 -fpermissive
2509 Downgrade some diagnostics about nonconformant code from errors to
2510 warnings. Thus, using -fpermissive allows some nonconforming code
2511 to compile.
2512
2513 -fno-pretty-templates
2514 When an error message refers to a specialization of a function
2515 template, the compiler normally prints the signature of the
2516 template followed by the template arguments and any typedefs or
2517 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2518 than "void f(int)") so that it's clear which template is involved.
2519 When an error message refers to a specialization of a class
2520 template, the compiler omits any template arguments that match the
2521 default template arguments for that template. If either of these
2522 behaviors make it harder to understand the error message rather
2523 than easier, you can use -fno-pretty-templates to disable them.
2524
2525 -fno-rtti
2526 Disable generation of information about every class with virtual
2527 functions for use by the C++ run-time type identification features
2528 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2529 language, you can save some space by using this flag. Note that
2530 exception handling uses the same information, but G++ generates it
2531 as needed. The "dynamic_cast" operator can still be used for casts
2532 that do not require run-time type information, i.e. casts to "void
2533 *" or to unambiguous base classes.
2534
2535 Mixing code compiled with -frtti with that compiled with -fno-rtti
2536 may not work. For example, programs may fail to link if a class
2537 compiled with -fno-rtti is used as a base for a class compiled with
2538 -frtti.
2539
2540 -fsized-deallocation
2541 Enable the built-in global declarations
2542
2543 void operator delete (void *, std::size_t) noexcept;
2544 void operator delete[] (void *, std::size_t) noexcept;
2545
2546 as introduced in C++14. This is useful for user-defined
2547 replacement deallocation functions that, for example, use the size
2548 of the object to make deallocation faster. Enabled by default
2549 under -std=c++14 and above. The flag -Wsized-deallocation warns
2550 about places that might want to add a definition.
2551
2552 -fstrict-enums
2553 Allow the compiler to optimize using the assumption that a value of
2554 enumerated type can only be one of the values of the enumeration
2555 (as defined in the C++ standard; basically, a value that can be
2556 represented in the minimum number of bits needed to represent all
2557 the enumerators). This assumption may not be valid if the program
2558 uses a cast to convert an arbitrary integer value to the enumerated
2559 type.
2560
2561 -fstrong-eval-order
2562 Evaluate member access, array subscripting, and shift expressions
2563 in left-to-right order, and evaluate assignment in right-to-left
2564 order, as adopted for C++17. Enabled by default with -std=c++17.
2565 -fstrong-eval-order=some enables just the ordering of member access
2566 and shift expressions, and is the default without -std=c++17.
2567
2568 -ftemplate-backtrace-limit=n
2569 Set the maximum number of template instantiation notes for a single
2570 warning or error to n. The default value is 10.
2571
2572 -ftemplate-depth=n
2573 Set the maximum instantiation depth for template classes to n. A
2574 limit on the template instantiation depth is needed to detect
2575 endless recursions during template class instantiation. ANSI/ISO
2576 C++ conforming programs must not rely on a maximum depth greater
2577 than 17 (changed to 1024 in C++11). The default value is 900, as
2578 the compiler can run out of stack space before hitting 1024 in some
2579 situations.
2580
2581 -fno-threadsafe-statics
2582 Do not emit the extra code to use the routines specified in the C++
2583 ABI for thread-safe initialization of local statics. You can use
2584 this option to reduce code size slightly in code that doesn't need
2585 to be thread-safe.
2586
2587 -fuse-cxa-atexit
2588 Register destructors for objects with static storage duration with
2589 the "__cxa_atexit" function rather than the "atexit" function.
2590 This option is required for fully standards-compliant handling of
2591 static destructors, but only works if your C library supports
2592 "__cxa_atexit".
2593
2594 -fno-use-cxa-get-exception-ptr
2595 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2596 causes "std::uncaught_exception" to be incorrect, but is necessary
2597 if the runtime routine is not available.
2598
2599 -fvisibility-inlines-hidden
2600 This switch declares that the user does not attempt to compare
2601 pointers to inline functions or methods where the addresses of the
2602 two functions are taken in different shared objects.
2603
2604 The effect of this is that GCC may, effectively, mark inline
2605 methods with "__attribute__ ((visibility ("hidden")))" so that they
2606 do not appear in the export table of a DSO and do not require a PLT
2607 indirection when used within the DSO. Enabling this option can
2608 have a dramatic effect on load and link times of a DSO as it
2609 massively reduces the size of the dynamic export table when the
2610 library makes heavy use of templates.
2611
2612 The behavior of this switch is not quite the same as marking the
2613 methods as hidden directly, because it does not affect static
2614 variables local to the function or cause the compiler to deduce
2615 that the function is defined in only one shared object.
2616
2617 You may mark a method as having a visibility explicitly to negate
2618 the effect of the switch for that method. For example, if you do
2619 want to compare pointers to a particular inline method, you might
2620 mark it as having default visibility. Marking the enclosing class
2621 with explicit visibility has no effect.
2622
2623 Explicitly instantiated inline methods are unaffected by this
2624 option as their linkage might otherwise cross a shared library
2625 boundary.
2626
2627 -fvisibility-ms-compat
2628 This flag attempts to use visibility settings to make GCC's C++
2629 linkage model compatible with that of Microsoft Visual Studio.
2630
2631 The flag makes these changes to GCC's linkage model:
2632
2633 1. It sets the default visibility to "hidden", like
2634 -fvisibility=hidden.
2635
2636 2. Types, but not their members, are not hidden by default.
2637
2638 3. The One Definition Rule is relaxed for types without explicit
2639 visibility specifications that are defined in more than one
2640 shared object: those declarations are permitted if they are
2641 permitted when this option is not used.
2642
2643 In new code it is better to use -fvisibility=hidden and export
2644 those classes that are intended to be externally visible.
2645 Unfortunately it is possible for code to rely, perhaps
2646 accidentally, on the Visual Studio behavior.
2647
2648 Among the consequences of these changes are that static data
2649 members of the same type with the same name but defined in
2650 different shared objects are different, so changing one does not
2651 change the other; and that pointers to function members defined in
2652 different shared objects may not compare equal. When this flag is
2653 given, it is a violation of the ODR to define types with the same
2654 name differently.
2655
2656 -fno-weak
2657 Do not use weak symbol support, even if it is provided by the
2658 linker. By default, G++ uses weak symbols if they are available.
2659 This option exists only for testing, and should not be used by end-
2660 users; it results in inferior code and has no benefits. This
2661 option may be removed in a future release of G++.
2662
2663 -fext-numeric-literals (C++ and Objective-C++ only)
2664 Accept imaginary, fixed-point, or machine-defined literal number
2665 suffixes as GNU extensions. When this option is turned off these
2666 suffixes are treated as C++11 user-defined literal numeric
2667 suffixes. This is on by default for all pre-C++11 dialects and all
2668 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2669 This option is off by default for ISO C++11 onwards (-std=c++11,
2670 ...).
2671
2672 -nostdinc++
2673 Do not search for header files in the standard directories specific
2674 to C++, but do still search the other standard directories. (This
2675 option is used when building the C++ library.)
2676
2677 -flang-info-include-translate
2678 -flang-info-include-translate-not
2679 -flang-info-include-translate=header
2680 Inform of include translation events. The first will note accepted
2681 include translations, the second will note declined include
2682 translations. The header form will inform of include translations
2683 relating to that specific header. If header is of the form "user"
2684 or "<system>" it will be resolved to a specific user or system
2685 header using the include path.
2686
2687 -flang-info-module-cmi
2688 -flang-info-module-cmi=module
2689 Inform of Compiled Module Interface pathnames. The first will note
2690 all read CMI pathnames. The module form will not reading a
2691 specific module's CMI. module may be a named module or a header-
2692 unit (the latter indicated by either being a pathname containing
2693 directory separators or enclosed in "<>" or "").
2694
2695 -stdlib=libstdc++,libc++
2696 When G++ is configured to support this option, it allows
2697 specification of alternate C++ runtime libraries. Two options are
2698 available: libstdc++ (the default, native C++ runtime for G++) and
2699 libc++ which is the C++ runtime installed on some operating systems
2700 (e.g. Darwin versions from Darwin11 onwards). The option switches
2701 G++ to use the headers from the specified library and to emit
2702 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2703 for linking.
2704
2705 In addition, these warning options have meanings only for C++ programs:
2706
2707 -Wabi-tag (C++ and Objective-C++ only)
2708 Warn when a type with an ABI tag is used in a context that does not
2709 have that ABI tag. See C++ Attributes for more information about
2710 ABI tags.
2711
2712 -Wcomma-subscript (C++ and Objective-C++ only)
2713 Warn about uses of a comma expression within a subscripting
2714 expression. This usage was deprecated in C++20 and is going to be
2715 removed in C++23. However, a comma expression wrapped in "( )" is
2716 not deprecated. Example:
2717
2718 void f(int *a, int b, int c) {
2719 a[b,c]; // deprecated in C++20, invalid in C++23
2720 a[(b,c)]; // OK
2721 }
2722
2723 In C++23 it is valid to have comma separated expressions in a
2724 subscript when an overloaded subscript operator is found and
2725 supports the right number and types of arguments. G++ will accept
2726 the formerly valid syntax for code that is not valid in C++23 but
2727 used to be valid but deprecated in C++20 with a pedantic warning
2728 that can be disabled with -Wno-comma-subscript.
2729
2730 Enabled by default with -std=c++20 unless -Wno-deprecated, and with
2731 -std=c++23 regardless of -Wno-deprecated.
2732
2733 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2734 Warn when performing class template argument deduction (CTAD) on a
2735 type with no explicitly written deduction guides. This warning
2736 will point out cases where CTAD succeeded only because the compiler
2737 synthesized the implicit deduction guides, which might not be what
2738 the programmer intended. Certain style guides allow CTAD only on
2739 types that specifically "opt-in"; i.e., on types that are designed
2740 to support CTAD. This warning can be suppressed with the following
2741 pattern:
2742
2743 struct allow_ctad_t; // any name works
2744 template <typename T> struct S {
2745 S(T) { }
2746 };
2747 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
2748
2749 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2750 Warn when a class seems unusable because all the constructors or
2751 destructors in that class are private, and it has neither friends
2752 nor public static member functions. Also warn if there are no non-
2753 private methods, and there's at least one private member function
2754 that isn't a constructor or destructor.
2755
2756 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2757 Warn when "delete" is used to destroy an instance of a class that
2758 has virtual functions and non-virtual destructor. It is unsafe to
2759 delete an instance of a derived class through a pointer to a base
2760 class if the base class does not have a virtual destructor. This
2761 warning is enabled by -Wall.
2762
2763 -Wdeprecated-copy (C++ and Objective-C++ only)
2764 Warn that the implicit declaration of a copy constructor or copy
2765 assignment operator is deprecated if the class has a user-provided
2766 copy constructor or copy assignment operator, in C++11 and up.
2767 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2768 also deprecate if the class has a user-provided destructor.
2769
2770 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2771 Disable the warning about the case when the usual arithmetic
2772 conversions are applied on operands where one is of enumeration
2773 type and the other is of a different enumeration type. This
2774 conversion was deprecated in C++20. For example:
2775
2776 enum E1 { e };
2777 enum E2 { f };
2778 int k = f - e;
2779
2780 -Wdeprecated-enum-enum-conversion is enabled by default with
2781 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2782 -Wenum-conversion.
2783
2784 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2785 Disable the warning about the case when the usual arithmetic
2786 conversions are applied on operands where one is of enumeration
2787 type and the other is of a floating-point type. This conversion
2788 was deprecated in C++20. For example:
2789
2790 enum E1 { e };
2791 enum E2 { f };
2792 bool b = e <= 3.7;
2793
2794 -Wdeprecated-enum-float-conversion is enabled by default with
2795 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2796 -Wenum-conversion.
2797
2798 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2799 Do not warn about uses of "std::initializer_list" that are likely
2800 to result in dangling pointers. Since the underlying array for an
2801 "initializer_list" is handled like a normal C++ temporary object,
2802 it is easy to inadvertently keep a pointer to the array past the
2803 end of the array's lifetime. For example:
2804
2805 * If a function returns a temporary "initializer_list", or a
2806 local "initializer_list" variable, the array's lifetime ends at
2807 the end of the return statement, so the value returned has a
2808 dangling pointer.
2809
2810 * If a new-expression creates an "initializer_list", the array
2811 only lives until the end of the enclosing full-expression, so
2812 the "initializer_list" in the heap has a dangling pointer.
2813
2814 * When an "initializer_list" variable is assigned from a brace-
2815 enclosed initializer list, the temporary array created for the
2816 right side of the assignment only lives until the end of the
2817 full-expression, so at the next statement the
2818 "initializer_list" variable has a dangling pointer.
2819
2820 // li's initial underlying array lives as long as li
2821 std::initializer_list<int> li = { 1,2,3 };
2822 // assignment changes li to point to a temporary array
2823 li = { 4, 5 };
2824 // now the temporary is gone and li has a dangling pointer
2825 int i = li.begin()[0] // undefined behavior
2826
2827 * When a list constructor stores the "begin" pointer from the
2828 "initializer_list" argument, this doesn't extend the lifetime
2829 of the array, so if a class variable is constructed from a
2830 temporary "initializer_list", the pointer is left dangling by
2831 the end of the variable declaration statement.
2832
2833 -Winvalid-imported-macros
2834 Verify all imported macro definitions are valid at the end of
2835 compilation. This is not enabled by default, as it requires
2836 additional processing to determine. It may be useful when
2837 preparing sets of header-units to ensure consistent macros.
2838
2839 -Wno-literal-suffix (C++ and Objective-C++ only)
2840 Do not warn when a string or character literal is followed by a ud-
2841 suffix which does not begin with an underscore. As a conforming
2842 extension, GCC treats such suffixes as separate preprocessing
2843 tokens in order to maintain backwards compatibility with code that
2844 uses formatting macros from "<inttypes.h>". For example:
2845
2846 #define __STDC_FORMAT_MACROS
2847 #include <inttypes.h>
2848 #include <stdio.h>
2849
2850 int main() {
2851 int64_t i64 = 123;
2852 printf("My int64: %" PRId64"\n", i64);
2853 }
2854
2855 In this case, "PRId64" is treated as a separate preprocessing
2856 token.
2857
2858 This option also controls warnings when a user-defined literal
2859 operator is declared with a literal suffix identifier that doesn't
2860 begin with an underscore. Literal suffix identifiers that don't
2861 begin with an underscore are reserved for future standardization.
2862
2863 These warnings are enabled by default.
2864
2865 -Wno-narrowing (C++ and Objective-C++ only)
2866 For C++11 and later standards, narrowing conversions are diagnosed
2867 by default, as required by the standard. A narrowing conversion
2868 from a constant produces an error, and a narrowing conversion from
2869 a non-constant produces a warning, but -Wno-narrowing suppresses
2870 the diagnostic. Note that this does not affect the meaning of
2871 well-formed code; narrowing conversions are still considered ill-
2872 formed in SFINAE contexts.
2873
2874 With -Wnarrowing in C++98, warn when a narrowing conversion
2875 prohibited by C++11 occurs within { }, e.g.
2876
2877 int i = { 2.2 }; // error: narrowing from double to int
2878
2879 This flag is included in -Wall and -Wc++11-compat.
2880
2881 -Wnoexcept (C++ and Objective-C++ only)
2882 Warn when a noexcept-expression evaluates to false because of a
2883 call to a function that does not have a non-throwing exception
2884 specification (i.e. "throw()" or "noexcept") but is known by the
2885 compiler to never throw an exception.
2886
2887 -Wnoexcept-type (C++ and Objective-C++ only)
2888 Warn if the C++17 feature making "noexcept" part of a function type
2889 changes the mangled name of a symbol relative to C++14. Enabled by
2890 -Wabi and -Wc++17-compat.
2891
2892 As an example:
2893
2894 template <class T> void f(T t) { t(); };
2895 void g() noexcept;
2896 void h() { f(g); }
2897
2898 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2899 "f<void(*)()noexcept>".
2900
2901 -Wclass-memaccess (C++ and Objective-C++ only)
2902 Warn when the destination of a call to a raw memory function such
2903 as "memset" or "memcpy" is an object of class type, and when
2904 writing into such an object might bypass the class non-trivial or
2905 deleted constructor or copy assignment, violate const-correctness
2906 or encapsulation, or corrupt virtual table pointers. Modifying the
2907 representation of such objects may violate invariants maintained by
2908 member functions of the class. For example, the call to "memset"
2909 below is undefined because it modifies a non-trivial class object
2910 and is, therefore, diagnosed. The safe way to either initialize or
2911 clear the storage of objects of such types is by using the
2912 appropriate constructor or assignment operator, if one is
2913 available.
2914
2915 std::string str = "abc";
2916 memset (&str, 0, sizeof str);
2917
2918 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2919 casting the pointer to the class object to "void *" or to a type
2920 that can be safely accessed by the raw memory function suppresses
2921 the warning.
2922
2923 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2924 Warn when a class has virtual functions and an accessible non-
2925 virtual destructor itself or in an accessible polymorphic base
2926 class, in which case it is possible but unsafe to delete an
2927 instance of a derived class through a pointer to the class itself
2928 or base class. This warning is automatically enabled if -Weffc++
2929 is specified.
2930
2931 -Wregister (C++ and Objective-C++ only)
2932 Warn on uses of the "register" storage class specifier, except when
2933 it is part of the GNU Explicit Register Variables extension. The
2934 use of the "register" keyword as storage class specifier has been
2935 deprecated in C++11 and removed in C++17. Enabled by default with
2936 -std=c++17.
2937
2938 -Wreorder (C++ and Objective-C++ only)
2939 Warn when the order of member initializers given in the code does
2940 not match the order in which they must be executed. For instance:
2941
2942 struct A {
2943 int i;
2944 int j;
2945 A(): j (0), i (1) { }
2946 };
2947
2948 The compiler rearranges the member initializers for "i" and "j" to
2949 match the declaration order of the members, emitting a warning to
2950 that effect. This warning is enabled by -Wall.
2951
2952 -Wno-pessimizing-move (C++ and Objective-C++ only)
2953 This warning warns when a call to "std::move" prevents copy
2954 elision. A typical scenario when copy elision can occur is when
2955 returning in a function with a class return type, when the
2956 expression being returned is the name of a non-volatile automatic
2957 object, and is not a function parameter, and has the same type as
2958 the function return type.
2959
2960 struct T {
2961 ...
2962 };
2963 T fn()
2964 {
2965 T t;
2966 ...
2967 return std::move (t);
2968 }
2969
2970 But in this example, the "std::move" call prevents copy elision.
2971
2972 This warning is enabled by -Wall.
2973
2974 -Wno-redundant-move (C++ and Objective-C++ only)
2975 This warning warns about redundant calls to "std::move"; that is,
2976 when a move operation would have been performed even without the
2977 "std::move" call. This happens because the compiler is forced to
2978 treat the object as if it were an rvalue in certain situations such
2979 as returning a local variable, where copy elision isn't applicable.
2980 Consider:
2981
2982 struct T {
2983 ...
2984 };
2985 T fn(T t)
2986 {
2987 ...
2988 return std::move (t);
2989 }
2990
2991 Here, the "std::move" call is redundant. Because G++ implements
2992 Core Issue 1579, another example is:
2993
2994 struct T { // convertible to U
2995 ...
2996 };
2997 struct U {
2998 ...
2999 };
3000 U fn()
3001 {
3002 T t;
3003 ...
3004 return std::move (t);
3005 }
3006
3007 In this example, copy elision isn't applicable because the type of
3008 the expression being returned and the function return type differ,
3009 yet G++ treats the return value as if it were designated by an
3010 rvalue.
3011
3012 This warning is enabled by -Wextra.
3013
3014 -Wrange-loop-construct (C++ and Objective-C++ only)
3015 This warning warns when a C++ range-based for-loop is creating an
3016 unnecessary copy. This can happen when the range declaration is
3017 not a reference, but probably should be. For example:
3018
3019 struct S { char arr[128]; };
3020 void fn () {
3021 S arr[5];
3022 for (const auto x : arr) { ... }
3023 }
3024
3025 It does not warn when the type being copied is a trivially-copyable
3026 type whose size is less than 64 bytes.
3027
3028 This warning also warns when a loop variable in a range-based for-
3029 loop is initialized with a value of a different type resulting in a
3030 copy. For example:
3031
3032 void fn() {
3033 int arr[10];
3034 for (const double &x : arr) { ... }
3035 }
3036
3037 In the example above, in every iteration of the loop a temporary
3038 value of type "double" is created and destroyed, to which the
3039 reference "const double &" is bound.
3040
3041 This warning is enabled by -Wall.
3042
3043 -Wredundant-tags (C++ and Objective-C++ only)
3044 Warn about redundant class-key and enum-key in references to class
3045 types and enumerated types in contexts where the key can be
3046 eliminated without causing an ambiguity. For example:
3047
3048 struct foo;
3049 struct foo *p; // warn that keyword struct can be eliminated
3050
3051 On the other hand, in this example there is no warning:
3052
3053 struct foo;
3054 void foo (); // "hides" struct foo
3055 void bar (struct foo&); // no warning, keyword struct is necessary
3056
3057 -Wno-subobject-linkage (C++ and Objective-C++ only)
3058 Do not warn if a class type has a base or a field whose type uses
3059 the anonymous namespace or depends on a type with no linkage. If a
3060 type A depends on a type B with no or internal linkage, defining it
3061 in multiple translation units would be an ODR violation because the
3062 meaning of B is different in each translation unit. If A only
3063 appears in a single translation unit, the best way to silence the
3064 warning is to give it internal linkage by putting it in an
3065 anonymous namespace as well. The compiler doesn't give this
3066 warning for types defined in the main .C file, as those are
3067 unlikely to have multiple definitions. -Wsubobject-linkage is
3068 enabled by default.
3069
3070 -Weffc++ (C++ and Objective-C++ only)
3071 Warn about violations of the following style guidelines from Scott
3072 Meyers' Effective C++ series of books:
3073
3074 * Define a copy constructor and an assignment operator for
3075 classes with dynamically-allocated memory.
3076
3077 * Prefer initialization to assignment in constructors.
3078
3079 * Have "operator=" return a reference to *this.
3080
3081 * Don't try to return a reference when you must return an object.
3082
3083 * Distinguish between prefix and postfix forms of increment and
3084 decrement operators.
3085
3086 * Never overload "&&", "||", or ",".
3087
3088 This option also enables -Wnon-virtual-dtor, which is also one of
3089 the effective C++ recommendations. However, the check is extended
3090 to warn about the lack of virtual destructor in accessible non-
3091 polymorphic bases classes too.
3092
3093 When selecting this option, be aware that the standard library
3094 headers do not obey all of these guidelines; use grep -v to filter
3095 out those warnings.
3096
3097 -Wno-exceptions (C++ and Objective-C++ only)
3098 Disable the warning about the case when an exception handler is
3099 shadowed by another handler, which can point out a wrong ordering
3100 of exception handlers.
3101
3102 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3103 Warn about the use of an uncasted "NULL" as sentinel. When
3104 compiling only with GCC this is a valid sentinel, as "NULL" is
3105 defined to "__null". Although it is a null pointer constant rather
3106 than a null pointer, it is guaranteed to be of the same size as a
3107 pointer. But this use is not portable across different compilers.
3108
3109 -Wno-non-template-friend (C++ and Objective-C++ only)
3110 Disable warnings when non-template friend functions are declared
3111 within a template. In very old versions of GCC that predate
3112 implementation of the ISO standard, declarations such as friend int
3113 foo(int), where the name of the friend is an unqualified-id, could
3114 be interpreted as a particular specialization of a template
3115 function; the warning exists to diagnose compatibility problems,
3116 and is enabled by default.
3117
3118 -Wold-style-cast (C++ and Objective-C++ only)
3119 Warn if an old-style (C-style) cast to a non-void type is used
3120 within a C++ program. The new-style casts ("dynamic_cast",
3121 "static_cast", "reinterpret_cast", and "const_cast") are less
3122 vulnerable to unintended effects and much easier to search for.
3123
3124 -Woverloaded-virtual (C++ and Objective-C++ only)
3125 Warn when a function declaration hides virtual functions from a
3126 base class. For example, in:
3127
3128 struct A {
3129 virtual void f();
3130 };
3131
3132 struct B: public A {
3133 void f(int);
3134 };
3135
3136 the "A" class version of "f" is hidden in "B", and code like:
3137
3138 B* b;
3139 b->f();
3140
3141 fails to compile.
3142
3143 -Wno-pmf-conversions (C++ and Objective-C++ only)
3144 Disable the diagnostic for converting a bound pointer to member
3145 function to a plain pointer.
3146
3147 -Wsign-promo (C++ and Objective-C++ only)
3148 Warn when overload resolution chooses a promotion from unsigned or
3149 enumerated type to a signed type, over a conversion to an unsigned
3150 type of the same size. Previous versions of G++ tried to preserve
3151 unsignedness, but the standard mandates the current behavior.
3152
3153 -Wtemplates (C++ and Objective-C++ only)
3154 Warn when a primary template declaration is encountered. Some
3155 coding rules disallow templates, and this may be used to enforce
3156 that rule. The warning is inactive inside a system header file,
3157 such as the STL, so one can still use the STL. One may also
3158 instantiate or specialize templates.
3159
3160 -Wmismatched-new-delete (C++ and Objective-C++ only)
3161 Warn for mismatches between calls to "operator new" or "operator
3162 delete" and the corresponding call to the allocation or
3163 deallocation function. This includes invocations of C++ "operator
3164 delete" with pointers returned from either mismatched forms of
3165 "operator new", or from other functions that allocate objects for
3166 which the "operator delete" isn't a suitable deallocator, as well
3167 as calls to other deallocation functions with pointers returned
3168 from "operator new" for which the deallocation function isn't
3169 suitable.
3170
3171 For example, the "delete" expression in the function below is
3172 diagnosed because it doesn't match the array form of the "new"
3173 expression the pointer argument was returned from. Similarly, the
3174 call to "free" is also diagnosed.
3175
3176 void f ()
3177 {
3178 int *a = new int[n];
3179 delete a; // warning: mismatch in array forms of expressions
3180
3181 char *p = new char[n];
3182 free (p); // warning: mismatch between new and free
3183 }
3184
3185 The related option -Wmismatched-dealloc diagnoses mismatches
3186 involving allocation and deallocation functions other than
3187 "operator new" and "operator delete".
3188
3189 -Wmismatched-new-delete is included in -Wall.
3190
3191 -Wmismatched-tags (C++ and Objective-C++ only)
3192 Warn for declarations of structs, classes, and class templates and
3193 their specializations with a class-key that does not match either
3194 the definition or the first declaration if no definition is
3195 provided.
3196
3197 For example, the declaration of "struct Object" in the argument
3198 list of "draw" triggers the warning. To avoid it, either remove
3199 the redundant class-key "struct" or replace it with "class" to
3200 match its definition.
3201
3202 class Object {
3203 public:
3204 virtual ~Object () = 0;
3205 };
3206 void draw (struct Object*);
3207
3208 It is not wrong to declare a class with the class-key "struct" as
3209 the example above shows. The -Wmismatched-tags option is intended
3210 to help achieve a consistent style of class declarations. In code
3211 that is intended to be portable to Windows-based compilers the
3212 warning helps prevent unresolved references due to the difference
3213 in the mangling of symbols declared with different class-keys. The
3214 option can be used either on its own or in conjunction with
3215 -Wredundant-tags.
3216
3217 -Wmultiple-inheritance (C++ and Objective-C++ only)
3218 Warn when a class is defined with multiple direct base classes.
3219 Some coding rules disallow multiple inheritance, and this may be
3220 used to enforce that rule. The warning is inactive inside a system
3221 header file, such as the STL, so one can still use the STL. One
3222 may also define classes that indirectly use multiple inheritance.
3223
3224 -Wvirtual-inheritance
3225 Warn when a class is defined with a virtual direct base class.
3226 Some coding rules disallow multiple inheritance, and this may be
3227 used to enforce that rule. The warning is inactive inside a system
3228 header file, such as the STL, so one can still use the STL. One
3229 may also define classes that indirectly use virtual inheritance.
3230
3231 -Wno-virtual-move-assign
3232 Suppress warnings about inheriting from a virtual base with a non-
3233 trivial C++11 move assignment operator. This is dangerous because
3234 if the virtual base is reachable along more than one path, it is
3235 moved multiple times, which can mean both objects end up in the
3236 moved-from state. If the move assignment operator is written to
3237 avoid moving from a moved-from object, this warning can be
3238 disabled.
3239
3240 -Wnamespaces
3241 Warn when a namespace definition is opened. Some coding rules
3242 disallow namespaces, and this may be used to enforce that rule.
3243 The warning is inactive inside a system header file, such as the
3244 STL, so one can still use the STL. One may also use using
3245 directives and qualified names.
3246
3247 -Wno-terminate (C++ and Objective-C++ only)
3248 Disable the warning about a throw-expression that will immediately
3249 result in a call to "terminate".
3250
3251 -Wno-vexing-parse (C++ and Objective-C++ only)
3252 Warn about the most vexing parse syntactic ambiguity. This warns
3253 about the cases when a declaration looks like a variable
3254 definition, but the C++ language requires it to be interpreted as a
3255 function declaration. For instance:
3256
3257 void f(double a) {
3258 int i(); // extern int i (void);
3259 int n(int(a)); // extern int n (int);
3260 }
3261
3262 Another example:
3263
3264 struct S { S(int); };
3265 void f(double a) {
3266 S x(int(a)); // extern struct S x (int);
3267 S y(int()); // extern struct S y (int (*) (void));
3268 S z(); // extern struct S z (void);
3269 }
3270
3271 The warning will suggest options how to deal with such an
3272 ambiguity; e.g., it can suggest removing the parentheses or using
3273 braces instead.
3274
3275 This warning is enabled by default.
3276
3277 -Wno-class-conversion (C++ and Objective-C++ only)
3278 Do not warn when a conversion function converts an object to the
3279 same type, to a base class of that type, or to void; such a
3280 conversion function will never be called.
3281
3282 -Wvolatile (C++ and Objective-C++ only)
3283 Warn about deprecated uses of the "volatile" qualifier. This
3284 includes postfix and prefix "++" and "--" expressions of
3285 "volatile"-qualified types, using simple assignments where the left
3286 operand is a "volatile"-qualified non-class type for their value,
3287 compound assignments where the left operand is a
3288 "volatile"-qualified non-class type, "volatile"-qualified function
3289 return type, "volatile"-qualified parameter type, and structured
3290 bindings of a "volatile"-qualified type. This usage was deprecated
3291 in C++20.
3292
3293 Enabled by default with -std=c++20.
3294
3295 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3296 Warn when a literal 0 is used as null pointer constant. This can
3297 be useful to facilitate the conversion to "nullptr" in C++11.
3298
3299 -Waligned-new
3300 Warn about a new-expression of a type that requires greater
3301 alignment than the "alignof(std::max_align_t)" but uses an
3302 allocation function without an explicit alignment parameter. This
3303 option is enabled by -Wall.
3304
3305 Normally this only warns about global allocation functions, but
3306 -Waligned-new=all also warns about class member allocation
3307 functions.
3308
3309 -Wno-placement-new
3310 -Wplacement-new=n
3311 Warn about placement new expressions with undefined behavior, such
3312 as constructing an object in a buffer that is smaller than the type
3313 of the object. For example, the placement new expression below is
3314 diagnosed because it attempts to construct an array of 64 integers
3315 in a buffer only 64 bytes large.
3316
3317 char buf [64];
3318 new (buf) int[64];
3319
3320 This warning is enabled by default.
3321
3322 -Wplacement-new=1
3323 This is the default warning level of -Wplacement-new. At this
3324 level the warning is not issued for some strictly undefined
3325 constructs that GCC allows as extensions for compatibility with
3326 legacy code. For example, the following "new" expression is
3327 not diagnosed at this level even though it has undefined
3328 behavior according to the C++ standard because it writes past
3329 the end of the one-element array.
3330
3331 struct S { int n, a[1]; };
3332 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3333 new (s->a)int [32]();
3334
3335 -Wplacement-new=2
3336 At this level, in addition to diagnosing all the same
3337 constructs as at level 1, a diagnostic is also issued for
3338 placement new expressions that construct an object in the last
3339 member of structure whose type is an array of a single element
3340 and whose size is less than the size of the object being
3341 constructed. While the previous example would be diagnosed,
3342 the following construct makes use of the flexible member array
3343 extension to avoid the warning at level 2.
3344
3345 struct S { int n, a[]; };
3346 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3347 new (s->a)int [32]();
3348
3349 -Wcatch-value
3350 -Wcatch-value=n (C++ and Objective-C++ only)
3351 Warn about catch handlers that do not catch via reference. With
3352 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3353 class types that are caught by value. With -Wcatch-value=2 warn
3354 about all class types that are caught by value. With
3355 -Wcatch-value=3 warn about all types that are not caught by
3356 reference. -Wcatch-value is enabled by -Wall.
3357
3358 -Wconditionally-supported (C++ and Objective-C++ only)
3359 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3360
3361 -Wno-delete-incomplete (C++ and Objective-C++ only)
3362 Do not warn when deleting a pointer to incomplete type, which may
3363 cause undefined behavior at runtime. This warning is enabled by
3364 default.
3365
3366 -Wextra-semi (C++, Objective-C++ only)
3367 Warn about redundant semicolons after in-class function
3368 definitions.
3369
3370 -Wno-inaccessible-base (C++, Objective-C++ only)
3371 This option controls warnings when a base class is inaccessible in
3372 a class derived from it due to ambiguity. The warning is enabled
3373 by default. Note that the warning for ambiguous virtual bases is
3374 enabled by the -Wextra option.
3375
3376 struct A { int a; };
3377
3378 struct B : A { };
3379
3380 struct C : B, A { };
3381
3382 -Wno-inherited-variadic-ctor
3383 Suppress warnings about use of C++11 inheriting constructors when
3384 the base class inherited from has a C variadic constructor; the
3385 warning is on by default because the ellipsis is not inherited.
3386
3387 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3388 Suppress warnings from applying the "offsetof" macro to a non-POD
3389 type. According to the 2014 ISO C++ standard, applying "offsetof"
3390 to a non-standard-layout type is undefined. In existing C++
3391 implementations, however, "offsetof" typically gives meaningful
3392 results. This flag is for users who are aware that they are
3393 writing nonportable code and who have deliberately chosen to ignore
3394 the warning about it.
3395
3396 The restrictions on "offsetof" may be relaxed in a future version
3397 of the C++ standard.
3398
3399 -Wsized-deallocation (C++ and Objective-C++ only)
3400 Warn about a definition of an unsized deallocation function
3401
3402 void operator delete (void *) noexcept;
3403 void operator delete[] (void *) noexcept;
3404
3405 without a definition of the corresponding sized deallocation
3406 function
3407
3408 void operator delete (void *, std::size_t) noexcept;
3409 void operator delete[] (void *, std::size_t) noexcept;
3410
3411 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3412
3413 -Wsuggest-final-types
3414 Warn about types with virtual methods where code quality would be
3415 improved if the type were declared with the C++11 "final"
3416 specifier, or, if possible, declared in an anonymous namespace.
3417 This allows GCC to more aggressively devirtualize the polymorphic
3418 calls. This warning is more effective with link-time optimization,
3419 where the information about the class hierarchy graph is more
3420 complete.
3421
3422 -Wsuggest-final-methods
3423 Warn about virtual methods where code quality would be improved if
3424 the method were declared with the C++11 "final" specifier, or, if
3425 possible, its type were declared in an anonymous namespace or with
3426 the "final" specifier. This warning is more effective with link-
3427 time optimization, where the information about the class hierarchy
3428 graph is more complete. It is recommended to first consider
3429 suggestions of -Wsuggest-final-types and then rebuild with new
3430 annotations.
3431
3432 -Wsuggest-override
3433 Warn about overriding virtual functions that are not marked with
3434 the "override" keyword.
3435
3436 -Wuse-after-free
3437 -Wuse-after-free=n
3438 Warn about uses of pointers to dynamically allocated objects that
3439 have been rendered indeterminate by a call to a deallocation
3440 function. The warning is enabled at all optimization levels but
3441 may yield different results with optimization than without.
3442
3443 -Wuse-after-free=1
3444 At level 1 the warning attempts to diagnose only unconditional
3445 uses of pointers made indeterminate by a deallocation call or a
3446 successful call to "realloc", regardless of whether or not the
3447 call resulted in an actual reallocatio of memory. This
3448 includes double-"free" calls as well as uses in arithmetic and
3449 relational expressions. Although undefined, uses of
3450 indeterminate pointers in equality (or inequality) expressions
3451 are not diagnosed at this level.
3452
3453 -Wuse-after-free=2
3454 At level 2, in addition to unconditional uses, the warning also
3455 diagnoses conditional uses of pointers made indeterminate by a
3456 deallocation call. As at level 2, uses in equality (or
3457 inequality) expressions are not diagnosed. For example, the
3458 second call to "free" in the following function is diagnosed at
3459 this level:
3460
3461 struct A { int refcount; void *data; };
3462
3463 void release (struct A *p)
3464 {
3465 int refcount = --p->refcount;
3466 free (p);
3467 if (refcount == 0)
3468 free (p->data); // warning: p may be used after free
3469 }
3470
3471 -Wuse-after-free=3
3472 At level 3, the warning also diagnoses uses of indeterminate
3473 pointers in equality expressions. All uses of indeterminate
3474 pointers are undefined but equality tests sometimes appear
3475 after calls to "realloc" as an attempt to determine whether the
3476 call resulted in relocating the object to a different address.
3477 They are diagnosed at a separate level to aid legacy code
3478 gradually transition to safe alternatives. For example, the
3479 equality test in the function below is diagnosed at this level:
3480
3481 void adjust_pointers (int**, int);
3482
3483 void grow (int **p, int n)
3484 {
3485 int **q = (int**)realloc (p, n *= 2);
3486 if (q == p)
3487 return;
3488 adjust_pointers ((int**)q, n);
3489 }
3490
3491 To avoid the warning at this level, store offsets into
3492 allocated memory instead of pointers. This approach obviates
3493 needing to adjust the stored pointers after reallocation.
3494
3495 -Wuse-after-free=2 is included in -Wall.
3496
3497 -Wuseless-cast (C++ and Objective-C++ only)
3498 Warn when an expression is casted to its own type.
3499
3500 -Wno-conversion-null (C++ and Objective-C++ only)
3501 Do not warn for conversions between "NULL" and non-pointer types.
3502 -Wconversion-null is enabled by default.
3503
3504 Options Controlling Objective-C and Objective-C++ Dialects
3505 (NOTE: This manual does not describe the Objective-C and Objective-C++
3506 languages themselves.
3507
3508 This section describes the command-line options that are only
3509 meaningful for Objective-C and Objective-C++ programs. You can also
3510 use most of the language-independent GNU compiler options. For
3511 example, you might compile a file some_class.m like this:
3512
3513 gcc -g -fgnu-runtime -O -c some_class.m
3514
3515 In this example, -fgnu-runtime is an option meant only for Objective-C
3516 and Objective-C++ programs; you can use the other options with any
3517 language supported by GCC.
3518
3519 Note that since Objective-C is an extension of the C language,
3520 Objective-C compilations may also use options specific to the C front-
3521 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3522 use C++-specific options (e.g., -Wabi).
3523
3524 Here is a list of options that are only for compiling Objective-C and
3525 Objective-C++ programs:
3526
3527 -fconstant-string-class=class-name
3528 Use class-name as the name of the class to instantiate for each
3529 literal string specified with the syntax "@"..."". The default
3530 class name is "NXConstantString" if the GNU runtime is being used,
3531 and "NSConstantString" if the NeXT runtime is being used (see
3532 below). The -fconstant-cfstrings option, if also present,
3533 overrides the -fconstant-string-class setting and cause "@"...""
3534 literals to be laid out as constant CoreFoundation strings.
3535
3536 -fgnu-runtime
3537 Generate object code compatible with the standard GNU Objective-C
3538 runtime. This is the default for most types of systems.
3539
3540 -fnext-runtime
3541 Generate output compatible with the NeXT runtime. This is the
3542 default for NeXT-based systems, including Darwin and Mac OS X. The
3543 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3544 is used.
3545
3546 -fno-nil-receivers
3547 Assume that all Objective-C message dispatches ("[receiver
3548 message:arg]") in this translation unit ensure that the receiver is
3549 not "nil". This allows for more efficient entry points in the
3550 runtime to be used. This option is only available in conjunction
3551 with the NeXT runtime and ABI version 0 or 1.
3552
3553 -fobjc-abi-version=n
3554 Use version n of the Objective-C ABI for the selected runtime.
3555 This option is currently supported only for the NeXT runtime. In
3556 that case, Version 0 is the traditional (32-bit) ABI without
3557 support for properties and other Objective-C 2.0 additions.
3558 Version 1 is the traditional (32-bit) ABI with support for
3559 properties and other Objective-C 2.0 additions. Version 2 is the
3560 modern (64-bit) ABI. If nothing is specified, the default is
3561 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3562 machines.
3563
3564 -fobjc-call-cxx-cdtors
3565 For each Objective-C class, check if any of its instance variables
3566 is a C++ object with a non-trivial default constructor. If so,
3567 synthesize a special "- (id) .cxx_construct" instance method which
3568 runs non-trivial default constructors on any such instance
3569 variables, in order, and then return "self". Similarly, check if
3570 any instance variable is a C++ object with a non-trivial
3571 destructor, and if so, synthesize a special "- (void)
3572 .cxx_destruct" method which runs all such default destructors, in
3573 reverse order.
3574
3575 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3576 thusly generated only operate on instance variables declared in the
3577 current Objective-C class, and not those inherited from
3578 superclasses. It is the responsibility of the Objective-C runtime
3579 to invoke all such methods in an object's inheritance hierarchy.
3580 The "- (id) .cxx_construct" methods are invoked by the runtime
3581 immediately after a new object instance is allocated; the "- (void)
3582 .cxx_destruct" methods are invoked immediately before the runtime
3583 deallocates an object instance.
3584
3585 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3586 later has support for invoking the "- (id) .cxx_construct" and "-
3587 (void) .cxx_destruct" methods.
3588
3589 -fobjc-direct-dispatch
3590 Allow fast jumps to the message dispatcher. On Darwin this is
3591 accomplished via the comm page.
3592
3593 -fobjc-exceptions
3594 Enable syntactic support for structured exception handling in
3595 Objective-C, similar to what is offered by C++. This option is
3596 required to use the Objective-C keywords @try, @throw, @catch,
3597 @finally and @synchronized. This option is available with both the
3598 GNU runtime and the NeXT runtime (but not available in conjunction
3599 with the NeXT runtime on Mac OS X 10.2 and earlier).
3600
3601 -fobjc-gc
3602 Enable garbage collection (GC) in Objective-C and Objective-C++
3603 programs. This option is only available with the NeXT runtime; the
3604 GNU runtime has a different garbage collection implementation that
3605 does not require special compiler flags.
3606
3607 -fobjc-nilcheck
3608 For the NeXT runtime with version 2 of the ABI, check for a nil
3609 receiver in method invocations before doing the actual method call.
3610 This is the default and can be disabled using -fno-objc-nilcheck.
3611 Class methods and super calls are never checked for nil in this way
3612 no matter what this flag is set to. Currently this flag does
3613 nothing when the GNU runtime, or an older version of the NeXT
3614 runtime ABI, is used.
3615
3616 -fobjc-std=objc1
3617 Conform to the language syntax of Objective-C 1.0, the language
3618 recognized by GCC 4.0. This only affects the Objective-C additions
3619 to the C/C++ language; it does not affect conformance to C/C++
3620 standards, which is controlled by the separate C/C++ dialect option
3621 flags. When this option is used with the Objective-C or
3622 Objective-C++ compiler, any Objective-C syntax that is not
3623 recognized by GCC 4.0 is rejected. This is useful if you need to
3624 make sure that your Objective-C code can be compiled with older
3625 versions of GCC.
3626
3627 -freplace-objc-classes
3628 Emit a special marker instructing ld(1) not to statically link in
3629 the resulting object file, and allow dyld(1) to load it in at run
3630 time instead. This is used in conjunction with the Fix-and-
3631 Continue debugging mode, where the object file in question may be
3632 recompiled and dynamically reloaded in the course of program
3633 execution, without the need to restart the program itself.
3634 Currently, Fix-and-Continue functionality is only available in
3635 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3636
3637 -fzero-link
3638 When compiling for the NeXT runtime, the compiler ordinarily
3639 replaces calls to "objc_getClass("...")" (when the name of the
3640 class is known at compile time) with static class references that
3641 get initialized at load time, which improves run-time performance.
3642 Specifying the -fzero-link flag suppresses this behavior and causes
3643 calls to "objc_getClass("...")" to be retained. This is useful in
3644 Zero-Link debugging mode, since it allows for individual class
3645 implementations to be modified during program execution. The GNU
3646 runtime currently always retains calls to "objc_get_class("...")"
3647 regardless of command-line options.
3648
3649 -fno-local-ivars
3650 By default instance variables in Objective-C can be accessed as if
3651 they were local variables from within the methods of the class
3652 they're declared in. This can lead to shadowing between instance
3653 variables and other variables declared either locally inside a
3654 class method or globally with the same name. Specifying the
3655 -fno-local-ivars flag disables this behavior thus avoiding variable
3656 shadowing issues.
3657
3658 -fivar-visibility=[public|protected|private|package]
3659 Set the default instance variable visibility to the specified
3660 option so that instance variables declared outside the scope of any
3661 access modifier directives default to the specified visibility.
3662
3663 -gen-decls
3664 Dump interface declarations for all classes seen in the source file
3665 to a file named sourcename.decl.
3666
3667 -Wassign-intercept (Objective-C and Objective-C++ only)
3668 Warn whenever an Objective-C assignment is being intercepted by the
3669 garbage collector.
3670
3671 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3672 Do not warn if a property for an Objective-C object has no assign
3673 semantics specified.
3674
3675 -Wno-protocol (Objective-C and Objective-C++ only)
3676 If a class is declared to implement a protocol, a warning is issued
3677 for every method in the protocol that is not implemented by the
3678 class. The default behavior is to issue a warning for every method
3679 not explicitly implemented in the class, even if a method
3680 implementation is inherited from the superclass. If you use the
3681 -Wno-protocol option, then methods inherited from the superclass
3682 are considered to be implemented, and no warning is issued for
3683 them.
3684
3685 -Wobjc-root-class (Objective-C and Objective-C++ only)
3686 Warn if a class interface lacks a superclass. Most classes will
3687 inherit from "NSObject" (or "Object") for example. When declaring
3688 classes intended to be root classes, the warning can be suppressed
3689 by marking their interfaces with
3690 "__attribute__((objc_root_class))".
3691
3692 -Wselector (Objective-C and Objective-C++ only)
3693 Warn if multiple methods of different types for the same selector
3694 are found during compilation. The check is performed on the list
3695 of methods in the final stage of compilation. Additionally, a
3696 check is performed for each selector appearing in a
3697 "@selector(...)" expression, and a corresponding method for that
3698 selector has been found during compilation. Because these checks
3699 scan the method table only at the end of compilation, these
3700 warnings are not produced if the final stage of compilation is not
3701 reached, for example because an error is found during compilation,
3702 or because the -fsyntax-only option is being used.
3703
3704 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3705 Warn if multiple methods with differing argument and/or return
3706 types are found for a given selector when attempting to send a
3707 message using this selector to a receiver of type "id" or "Class".
3708 When this flag is off (which is the default behavior), the compiler
3709 omits such warnings if any differences found are confined to types
3710 that share the same size and alignment.
3711
3712 -Wundeclared-selector (Objective-C and Objective-C++ only)
3713 Warn if a "@selector(...)" expression referring to an undeclared
3714 selector is found. A selector is considered undeclared if no
3715 method with that name has been declared before the "@selector(...)"
3716 expression, either explicitly in an @interface or @protocol
3717 declaration, or implicitly in an @implementation section. This
3718 option always performs its checks as soon as a "@selector(...)"
3719 expression is found, while -Wselector only performs its checks in
3720 the final stage of compilation. This also enforces the coding
3721 style convention that methods and selectors must be declared before
3722 being used.
3723
3724 -print-objc-runtime-info
3725 Generate C header describing the largest structure that is passed
3726 by value, if any.
3727
3728 Options to Control Diagnostic Messages Formatting
3729 Traditionally, diagnostic messages have been formatted irrespective of
3730 the output device's aspect (e.g. its width, ...). You can use the
3731 options described below to control the formatting algorithm for
3732 diagnostic messages, e.g. how many characters per line, how often
3733 source location information should be reported. Note that some
3734 language front ends may not honor these options.
3735
3736 -fmessage-length=n
3737 Try to format error messages so that they fit on lines of about n
3738 characters. If n is zero, then no line-wrapping is done; each
3739 error message appears on a single line. This is the default for
3740 all front ends.
3741
3742 Note - this option also affects the display of the #error and
3743 #warning pre-processor directives, and the deprecated
3744 function/type/variable attribute. It does not however affect the
3745 pragma GCC warning and pragma GCC error pragmas.
3746
3747 -fdiagnostics-plain-output
3748 This option requests that diagnostic output look as plain as
3749 possible, which may be useful when running dejagnu or other
3750 utilities that need to parse diagnostics output and prefer that it
3751 remain more stable over time. -fdiagnostics-plain-output is
3752 currently equivalent to the following options:
3753 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3754 -fdiagnostics-color=never -fdiagnostics-urls=never
3755 -fdiagnostics-path-format=separate-events In the future, if GCC
3756 changes the default appearance of its diagnostics, the
3757 corresponding option to disable the new behavior will be added to
3758 this list.
3759
3760 -fdiagnostics-show-location=once
3761 Only meaningful in line-wrapping mode. Instructs the diagnostic
3762 messages reporter to emit source location information once; that
3763 is, in case the message is too long to fit on a single physical
3764 line and has to be wrapped, the source location won't be emitted
3765 (as prefix) again, over and over, in subsequent continuation lines.
3766 This is the default behavior.
3767
3768 -fdiagnostics-show-location=every-line
3769 Only meaningful in line-wrapping mode. Instructs the diagnostic
3770 messages reporter to emit the same source location information (as
3771 prefix) for physical lines that result from the process of breaking
3772 a message which is too long to fit on a single line.
3773
3774 -fdiagnostics-color[=WHEN]
3775 -fno-diagnostics-color
3776 Use color in diagnostics. WHEN is never, always, or auto. The
3777 default depends on how the compiler has been configured, it can be
3778 any of the above WHEN options or also never if GCC_COLORS
3779 environment variable isn't present in the environment, and auto
3780 otherwise. auto makes GCC use color only when the standard error
3781 is a terminal, and when not executing in an emacs shell. The forms
3782 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3783 -fdiagnostics-color=always and -fdiagnostics-color=never,
3784 respectively.
3785
3786 The colors are defined by the environment variable GCC_COLORS. Its
3787 value is a colon-separated list of capabilities and Select Graphic
3788 Rendition (SGR) substrings. SGR commands are interpreted by the
3789 terminal or terminal emulator. (See the section in the
3790 documentation of your text terminal for permitted values and their
3791 meanings as character attributes.) These substring values are
3792 integers in decimal representation and can be concatenated with
3793 semicolons. Common values to concatenate include 1 for bold, 4 for
3794 underline, 5 for blink, 7 for inverse, 39 for default foreground
3795 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3796 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3797 modes foreground colors, 49 for default background color, 40 to 47
3798 for background colors, 100 to 107 for 16-color mode background
3799 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3800 background colors.
3801
3802 The default GCC_COLORS is
3803
3804 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3805 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3806 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3807 type-diff=01;32
3808
3809 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3810 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3811 GCC_COLORS to the empty string disables colors. Supported
3812 capabilities are as follows.
3813
3814 "error="
3815 SGR substring for error: markers.
3816
3817 "warning="
3818 SGR substring for warning: markers.
3819
3820 "note="
3821 SGR substring for note: markers.
3822
3823 "path="
3824 SGR substring for colorizing paths of control-flow events as
3825 printed via -fdiagnostics-path-format=, such as the identifiers
3826 of individual events and lines indicating interprocedural calls
3827 and returns.
3828
3829 "range1="
3830 SGR substring for first additional range.
3831
3832 "range2="
3833 SGR substring for second additional range.
3834
3835 "locus="
3836 SGR substring for location information, file:line or
3837 file:line:column etc.
3838
3839 "quote="
3840 SGR substring for information printed within quotes.
3841
3842 "fixit-insert="
3843 SGR substring for fix-it hints suggesting text to be inserted
3844 or replaced.
3845
3846 "fixit-delete="
3847 SGR substring for fix-it hints suggesting text to be deleted.
3848
3849 "diff-filename="
3850 SGR substring for filename headers within generated patches.
3851
3852 "diff-hunk="
3853 SGR substring for the starts of hunks within generated patches.
3854
3855 "diff-delete="
3856 SGR substring for deleted lines within generated patches.
3857
3858 "diff-insert="
3859 SGR substring for inserted lines within generated patches.
3860
3861 "type-diff="
3862 SGR substring for highlighting mismatching types within
3863 template arguments in the C++ frontend.
3864
3865 -fdiagnostics-urls[=WHEN]
3866 Use escape sequences to embed URLs in diagnostics. For example,
3867 when -fdiagnostics-show-option emits text showing the command-line
3868 option controlling a diagnostic, embed a URL for documentation of
3869 that option.
3870
3871 WHEN is never, always, or auto. auto makes GCC use URL escape
3872 sequences only when the standard error is a terminal, and when not
3873 executing in an emacs shell or any graphical terminal which is
3874 known to be incompatible with this feature, see below.
3875
3876 The default depends on how the compiler has been configured. It
3877 can be any of the above WHEN options.
3878
3879 GCC can also be configured (via the
3880 --with-diagnostics-urls=auto-if-env configure-time option) so that
3881 the default is affected by environment variables. Under such a
3882 configuration, GCC defaults to using auto if either GCC_URLS or
3883 TERM_URLS environment variables are present and non-empty in the
3884 environment of the compiler, or never if neither are.
3885
3886 However, even with -fdiagnostics-urls=always the behavior is
3887 dependent on those environment variables: If GCC_URLS is set to
3888 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3889 use ST escape sequences. If set to bel, the default, URLs use BEL
3890 escape sequences. Any other non-empty value enables the feature.
3891 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3892 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3893 character, CTRL-G that usually sounds like a beep.
3894
3895 At this time GCC tries to detect also a few terminals that are
3896 known to not implement the URL feature, and have bugs or at least
3897 had bugs in some versions that are still in use, where the URL
3898 escapes are likely to misbehave, i.e. print garbage on the screen.
3899 That list is currently xfce4-terminal, certain known to be buggy
3900 gnome-terminal versions, the linux console, and mingw. This check
3901 can be skipped with the -fdiagnostics-urls=always.
3902
3903 -fno-diagnostics-show-option
3904 By default, each diagnostic emitted includes text indicating the
3905 command-line option that directly controls the diagnostic (if such
3906 an option is known to the diagnostic machinery). Specifying the
3907 -fno-diagnostics-show-option flag suppresses that behavior.
3908
3909 -fno-diagnostics-show-caret
3910 By default, each diagnostic emitted includes the original source
3911 line and a caret ^ indicating the column. This option suppresses
3912 this information. The source line is truncated to n characters, if
3913 the -fmessage-length=n option is given. When the output is done to
3914 the terminal, the width is limited to the width given by the
3915 COLUMNS environment variable or, if not set, to the terminal width.
3916
3917 -fno-diagnostics-show-labels
3918 By default, when printing source code (via
3919 -fdiagnostics-show-caret), diagnostics can label ranges of source
3920 code with pertinent information, such as the types of expressions:
3921
3922 printf ("foo %s bar", long_i + long_j);
3923 ~^ ~~~~~~~~~~~~~~~
3924 | |
3925 char * long int
3926
3927 This option suppresses the printing of these labels (in the example
3928 above, the vertical bars and the "char *" and "long int" text).
3929
3930 -fno-diagnostics-show-cwe
3931 Diagnostic messages can optionally have an associated
3932 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3933 only provides such metadata for some of the -fanalyzer diagnostics.
3934 GCC plugins may also provide diagnostics with such metadata. By
3935 default, if this information is present, it will be printed with
3936 the diagnostic. This option suppresses the printing of this
3937 metadata.
3938
3939 -fno-diagnostics-show-line-numbers
3940 By default, when printing source code (via
3941 -fdiagnostics-show-caret), a left margin is printed, showing line
3942 numbers. This option suppresses this left margin.
3943
3944 -fdiagnostics-minimum-margin-width=width
3945 This option controls the minimum width of the left margin printed
3946 by -fdiagnostics-show-line-numbers. It defaults to 6.
3947
3948 -fdiagnostics-parseable-fixits
3949 Emit fix-it hints in a machine-parseable format, suitable for
3950 consumption by IDEs. For each fix-it, a line will be printed after
3951 the relevant diagnostic, starting with the string "fix-it:". For
3952 example:
3953
3954 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3955
3956 The location is expressed as a half-open range, expressed as a
3957 count of bytes, starting at byte 1 for the initial column. In the
3958 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3959 replaced with the given string:
3960
3961 00000000011111111112222222222
3962 12345678901234567890123456789
3963 gtk_widget_showall (dlg);
3964 ^^^^^^^^^^^^^^^^^^
3965 gtk_widget_show_all
3966
3967 The filename and replacement string escape backslash as "\\", tab
3968 as "\t", newline as "\n", double quotes as "\"", non-printable
3969 characters as octal (e.g. vertical tab as "\013").
3970
3971 An empty replacement string indicates that the given range is to be
3972 removed. An empty range (e.g. "45:3-45:3") indicates that the
3973 string is to be inserted at the given position.
3974
3975 -fdiagnostics-generate-patch
3976 Print fix-it hints to stderr in unified diff format, after any
3977 diagnostics are printed. For example:
3978
3979 --- test.c
3980 +++ test.c
3981 @ -42,5 +42,5 @
3982
3983 void show_cb(GtkDialog *dlg)
3984 {
3985 - gtk_widget_showall(dlg);
3986 + gtk_widget_show_all(dlg);
3987 }
3988
3989 The diff may or may not be colorized, following the same rules as
3990 for diagnostics (see -fdiagnostics-color).
3991
3992 -fdiagnostics-show-template-tree
3993 In the C++ frontend, when printing diagnostics showing mismatching
3994 template types, such as:
3995
3996 could not convert 'std::map<int, std::vector<double> >()'
3997 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3998
3999 the -fdiagnostics-show-template-tree flag enables printing a tree-
4000 like structure showing the common and differing parts of the types,
4001 such as:
4002
4003 map<
4004 [...],
4005 vector<
4006 [double != float]>>
4007
4008 The parts that differ are highlighted with color ("double" and
4009 "float" in this case).
4010
4011 -fno-elide-type
4012 By default when the C++ frontend prints diagnostics showing
4013 mismatching template types, common parts of the types are printed
4014 as "[...]" to simplify the error message. For example:
4015
4016 could not convert 'std::map<int, std::vector<double> >()'
4017 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4018
4019 Specifying the -fno-elide-type flag suppresses that behavior. This
4020 flag also affects the output of the
4021 -fdiagnostics-show-template-tree flag.
4022
4023 -fdiagnostics-path-format=KIND
4024 Specify how to print paths of control-flow events for diagnostics
4025 that have such a path associated with them.
4026
4027 KIND is none, separate-events, or inline-events, the default.
4028
4029 none means to not print diagnostic paths.
4030
4031 separate-events means to print a separate "note" diagnostic for
4032 each event within the diagnostic. For example:
4033
4034 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4035 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4036 test.c:27:3: note: (2) when 'i < count'
4037 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4038
4039 inline-events means to print the events "inline" within the source
4040 code. This view attempts to consolidate the events into runs of
4041 sufficiently-close events, printing them as labelled ranges within
4042 the source.
4043
4044 For example, the same events as above might be printed as:
4045
4046 'test': events 1-3
4047 |
4048 | 25 | list = PyList_New(0);
4049 | | ^~~~~~~~~~~~~
4050 | | |
4051 | | (1) when 'PyList_New' fails, returning NULL
4052 | 26 |
4053 | 27 | for (i = 0; i < count; i++) {
4054 | | ~~~
4055 | | |
4056 | | (2) when 'i < count'
4057 | 28 | item = PyLong_FromLong(random());
4058 | 29 | PyList_Append(list, item);
4059 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4060 | | |
4061 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4062 |
4063
4064 Interprocedural control flow is shown by grouping the events by
4065 stack frame, and using indentation to show how stack frames are
4066 nested, pushed, and popped.
4067
4068 For example:
4069
4070 'test': events 1-2
4071 |
4072 | 133 | {
4073 | | ^
4074 | | |
4075 | | (1) entering 'test'
4076 | 134 | boxed_int *obj = make_boxed_int (i);
4077 | | ~~~~~~~~~~~~~~~~~~
4078 | | |
4079 | | (2) calling 'make_boxed_int'
4080 |
4081 +--> 'make_boxed_int': events 3-4
4082 |
4083 | 120 | {
4084 | | ^
4085 | | |
4086 | | (3) entering 'make_boxed_int'
4087 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4088 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4089 | | |
4090 | | (4) calling 'wrapped_malloc'
4091 |
4092 +--> 'wrapped_malloc': events 5-6
4093 |
4094 | 7 | {
4095 | | ^
4096 | | |
4097 | | (5) entering 'wrapped_malloc'
4098 | 8 | return malloc (size);
4099 | | ~~~~~~~~~~~~~
4100 | | |
4101 | | (6) calling 'malloc'
4102 |
4103 <-------------+
4104 |
4105 'test': event 7
4106 |
4107 | 138 | free_boxed_int (obj);
4108 | | ^~~~~~~~~~~~~~~~~~~~
4109 | | |
4110 | | (7) calling 'free_boxed_int'
4111 |
4112 (etc)
4113
4114 -fdiagnostics-show-path-depths
4115 This option provides additional information when printing control-
4116 flow paths associated with a diagnostic.
4117
4118 If this is option is provided then the stack depth will be printed
4119 for each run of events within
4120 -fdiagnostics-path-format=separate-events.
4121
4122 This is intended for use by GCC developers and plugin developers
4123 when debugging diagnostics that report interprocedural control
4124 flow.
4125
4126 -fno-show-column
4127 Do not print column numbers in diagnostics. This may be necessary
4128 if diagnostics are being scanned by a program that does not
4129 understand the column numbers, such as dejagnu.
4130
4131 -fdiagnostics-column-unit=UNIT
4132 Select the units for the column number. This affects traditional
4133 diagnostics (in the absence of -fno-show-column), as well as JSON
4134 format diagnostics if requested.
4135
4136 The default UNIT, display, considers the number of display columns
4137 occupied by each character. This may be larger than the number of
4138 bytes required to encode the character, in the case of tab
4139 characters, or it may be smaller, in the case of multibyte
4140 characters. For example, the character "GREEK SMALL LETTER PI
4141 (U+03C0)" occupies one display column, and its UTF-8 encoding
4142 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
4143 occupies two display columns, and its UTF-8 encoding requires four
4144 bytes.
4145
4146 Setting UNIT to byte changes the column number to the raw byte
4147 count in all cases, as was traditionally output by GCC prior to
4148 version 11.1.0.
4149
4150 -fdiagnostics-column-origin=ORIGIN
4151 Select the origin for column numbers, i.e. the column number
4152 assigned to the first column. The default value of 1 corresponds
4153 to traditional GCC behavior and to the GNU style guide. Some
4154 utilities may perform better with an origin of 0; any non-negative
4155 value may be specified.
4156
4157 -fdiagnostics-escape-format=FORMAT
4158 When GCC prints pertinent source lines for a diagnostic it normally
4159 attempts to print the source bytes directly. However, some
4160 diagnostics relate to encoding issues in the source file, such as
4161 malformed UTF-8, or issues with Unicode normalization. These
4162 diagnostics are flagged so that GCC will escape bytes that are not
4163 printable ASCII when printing their pertinent source lines.
4164
4165 This option controls how such bytes should be escaped.
4166
4167 The default FORMAT, unicode displays Unicode characters that are
4168 not printable ASCII in the form <U+XXXX>, and bytes that do not
4169 correspond to a Unicode character validly-encoded in UTF-8-encoded
4170 will be displayed as hexadecimal in the form <XX>.
4171
4172 For example, a source line containing the string before followed by
4173 the Unicode character U+03C0 ("GREEK SMALL LETTER PI", with UTF-8
4174 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8
4175 trailing byte), followed by the string after will be printed for
4176 such a diagnostic as:
4177
4178 before<U+03C0><BF>after
4179
4180 Setting FORMAT to bytes will display all non-printable-ASCII bytes
4181 in the form <XX>, thus showing the underlying encoding of non-ASCII
4182 Unicode characters. For the example above, the following will be
4183 printed:
4184
4185 before<CF><80><BF>after
4186
4187 -fdiagnostics-format=FORMAT
4188 Select a different format for printing diagnostics. FORMAT is text
4189 or json. The default is text.
4190
4191 The json format consists of a top-level JSON array containing JSON
4192 objects representing the diagnostics.
4193
4194 The JSON is emitted as one line, without formatting; the examples
4195 below have been formatted for clarity.
4196
4197 Diagnostics can have child diagnostics. For example, this error
4198 and note:
4199
4200 misleading-indentation.c:15:3: warning: this 'if' clause does not
4201 guard... [-Wmisleading-indentation]
4202 15 | if (flag)
4203 | ^~
4204 misleading-indentation.c:17:5: note: ...this statement, but the latter
4205 is misleadingly indented as if it were guarded by the 'if'
4206 17 | y = 2;
4207 | ^
4208
4209 might be printed in JSON form (after formatting) like this:
4210
4211 [
4212 {
4213 "kind": "warning",
4214 "locations": [
4215 {
4216 "caret": {
4217 "display-column": 3,
4218 "byte-column": 3,
4219 "column": 3,
4220 "file": "misleading-indentation.c",
4221 "line": 15
4222 },
4223 "finish": {
4224 "display-column": 4,
4225 "byte-column": 4,
4226 "column": 4,
4227 "file": "misleading-indentation.c",
4228 "line": 15
4229 }
4230 }
4231 ],
4232 "message": "this \u2018if\u2019 clause does not guard...",
4233 "option": "-Wmisleading-indentation",
4234 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4235 "children": [
4236 {
4237 "kind": "note",
4238 "locations": [
4239 {
4240 "caret": {
4241 "display-column": 5,
4242 "byte-column": 5,
4243 "column": 5,
4244 "file": "misleading-indentation.c",
4245 "line": 17
4246 }
4247 }
4248 ],
4249 "escape-source": false,
4250 "message": "...this statement, but the latter is ..."
4251 }
4252 ]
4253 "escape-source": false,
4254 "column-origin": 1,
4255 }
4256 ]
4257
4258 where the "note" is a child of the "warning".
4259
4260 A diagnostic has a "kind". If this is "warning", then there is an
4261 "option" key describing the command-line option controlling the
4262 warning.
4263
4264 A diagnostic can contain zero or more locations. Each location has
4265 an optional "label" string and up to three positions within it: a
4266 "caret" position and optional "start" and "finish" positions. A
4267 position is described by a "file" name, a "line" number, and three
4268 numbers indicating a column position:
4269
4270 * "display-column" counts display columns, accounting for tabs
4271 and multibyte characters.
4272
4273 * "byte-column" counts raw bytes.
4274
4275 * "column" is equal to one of the previous two, as dictated by
4276 the -fdiagnostics-column-unit option.
4277
4278 All three columns are relative to the origin specified by
4279 -fdiagnostics-column-origin, which is typically equal to 1 but may
4280 be set, for instance, to 0 for compatibility with other utilities
4281 that number columns from 0. The column origin is recorded in the
4282 JSON output in the "column-origin" tag. In the remaining examples
4283 below, the extra column number outputs have been omitted for
4284 brevity.
4285
4286 For example, this error:
4287
4288 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4289 'struct s'} and 'T' {aka 'struct t'})
4290 64 | return callee_4a () + callee_4b ();
4291 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4292 | | |
4293 | | T {aka struct t}
4294 | S {aka struct s}
4295
4296 has three locations. Its primary location is at the "+" token at
4297 column 23. It has two secondary locations, describing the left and
4298 right-hand sides of the expression, which have labels. It might be
4299 printed in JSON form as:
4300
4301 {
4302 "children": [],
4303 "kind": "error",
4304 "locations": [
4305 {
4306 "caret": {
4307 "column": 23, "file": "bad-binary-ops.c", "line": 64
4308 }
4309 },
4310 {
4311 "caret": {
4312 "column": 10, "file": "bad-binary-ops.c", "line": 64
4313 },
4314 "finish": {
4315 "column": 21, "file": "bad-binary-ops.c", "line": 64
4316 },
4317 "label": "S {aka struct s}"
4318 },
4319 {
4320 "caret": {
4321 "column": 25, "file": "bad-binary-ops.c", "line": 64
4322 },
4323 "finish": {
4324 "column": 36, "file": "bad-binary-ops.c", "line": 64
4325 },
4326 "label": "T {aka struct t}"
4327 }
4328 ],
4329 "escape-source": false,
4330 "message": "invalid operands to binary + ..."
4331 }
4332
4333 If a diagnostic contains fix-it hints, it has a "fixits" array,
4334 consisting of half-open intervals, similar to the output of
4335 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4336 a replacement fix-it hint:
4337
4338 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4339 mean 'color'?
4340 8 | return ptr->colour;
4341 | ^~~~~~
4342 | color
4343
4344 might be printed in JSON form as:
4345
4346 {
4347 "children": [],
4348 "fixits": [
4349 {
4350 "next": {
4351 "column": 21,
4352 "file": "demo.c",
4353 "line": 8
4354 },
4355 "start": {
4356 "column": 15,
4357 "file": "demo.c",
4358 "line": 8
4359 },
4360 "string": "color"
4361 }
4362 ],
4363 "kind": "error",
4364 "locations": [
4365 {
4366 "caret": {
4367 "column": 15,
4368 "file": "demo.c",
4369 "line": 8
4370 },
4371 "finish": {
4372 "column": 20,
4373 "file": "demo.c",
4374 "line": 8
4375 }
4376 }
4377 ],
4378 "escape-source": false,
4379 "message": "\u2018struct s\u2019 has no member named ..."
4380 }
4381
4382 where the fix-it hint suggests replacing the text from "start" up
4383 to but not including "next" with "string"'s value. Deletions are
4384 expressed via an empty value for "string", insertions by having
4385 "start" equal "next".
4386
4387 If the diagnostic has a path of control-flow events associated with
4388 it, it has a "path" array of objects representing the events. Each
4389 event object has a "description" string, a "location" object, along
4390 with a "function" string and a "depth" number for representing
4391 interprocedural paths. The "function" represents the current
4392 function at that event, and the "depth" represents the stack depth
4393 relative to some baseline: the higher, the more frames are within
4394 the stack.
4395
4396 For example, the intraprocedural example shown for
4397 -fdiagnostics-path-format= might have this JSON for its path:
4398
4399 "path": [
4400 {
4401 "depth": 0,
4402 "description": "when 'PyList_New' fails, returning NULL",
4403 "function": "test",
4404 "location": {
4405 "column": 10,
4406 "file": "test.c",
4407 "line": 25
4408 }
4409 },
4410 {
4411 "depth": 0,
4412 "description": "when 'i < count'",
4413 "function": "test",
4414 "location": {
4415 "column": 3,
4416 "file": "test.c",
4417 "line": 27
4418 }
4419 },
4420 {
4421 "depth": 0,
4422 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4423 "function": "test",
4424 "location": {
4425 "column": 5,
4426 "file": "test.c",
4427 "line": 29
4428 }
4429 }
4430 ]
4431
4432 Diagnostics have a boolean attribute "escape-source", hinting
4433 whether non-ASCII bytes should be escaped when printing the
4434 pertinent lines of source code ("true" for diagnostics involving
4435 source encoding issues).
4436
4437 Options to Request or Suppress Warnings
4438 Warnings are diagnostic messages that report constructions that are not
4439 inherently erroneous but that are risky or suggest there may have been
4440 an error.
4441
4442 The following language-independent options do not enable specific
4443 warnings but control the kinds of diagnostics produced by GCC.
4444
4445 -fsyntax-only
4446 Check the code for syntax errors, but don't do anything beyond
4447 that.
4448
4449 -fmax-errors=n
4450 Limits the maximum number of error messages to n, at which point
4451 GCC bails out rather than attempting to continue processing the
4452 source code. If n is 0 (the default), there is no limit on the
4453 number of error messages produced. If -Wfatal-errors is also
4454 specified, then -Wfatal-errors takes precedence over this option.
4455
4456 -w Inhibit all warning messages.
4457
4458 -Werror
4459 Make all warnings into errors.
4460
4461 -Werror=
4462 Make the specified warning into an error. The specifier for a
4463 warning is appended; for example -Werror=switch turns the warnings
4464 controlled by -Wswitch into errors. This switch takes a negative
4465 form, to be used to negate -Werror for specific warnings; for
4466 example -Wno-error=switch makes -Wswitch warnings not be errors,
4467 even when -Werror is in effect.
4468
4469 The warning message for each controllable warning includes the
4470 option that controls the warning. That option can then be used
4471 with -Werror= and -Wno-error= as described above. (Printing of the
4472 option in the warning message can be disabled using the
4473 -fno-diagnostics-show-option flag.)
4474
4475 Note that specifying -Werror=foo automatically implies -Wfoo.
4476 However, -Wno-error=foo does not imply anything.
4477
4478 -Wfatal-errors
4479 This option causes the compiler to abort compilation on the first
4480 error occurred rather than trying to keep going and printing
4481 further error messages.
4482
4483 You can request many specific warnings with options beginning with -W,
4484 for example -Wimplicit to request warnings on implicit declarations.
4485 Each of these specific warning options also has a negative form
4486 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4487 manual lists only one of the two forms, whichever is not the default.
4488 For further language-specific options also refer to C++ Dialect Options
4489 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4490 can be produced by enabling the static analyzer;
4491
4492 Some options, such as -Wall and -Wextra, turn on other options, such as
4493 -Wunused, which may turn on further options, such as -Wunused-value.
4494 The combined effect of positive and negative forms is that more
4495 specific options have priority over less specific ones, independently
4496 of their position in the command-line. For options of the same
4497 specificity, the last one takes effect. Options enabled or disabled via
4498 pragmas take effect as if they appeared at the end of the command-line.
4499
4500 When an unrecognized warning option is requested (e.g.,
4501 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4502 not recognized. However, if the -Wno- form is used, the behavior is
4503 slightly different: no diagnostic is produced for -Wno-unknown-warning
4504 unless other diagnostics are being produced. This allows the use of
4505 new -Wno- options with old compilers, but if something goes wrong, the
4506 compiler warns that an unrecognized option is present.
4507
4508 The effectiveness of some warnings depends on optimizations also being
4509 enabled. For example -Wsuggest-final-types is more effective with link-
4510 time optimization and some instances of other warnings may not be
4511 issued at all unless optimization is enabled. While optimization in
4512 general improves the efficacy of control and data flow sensitive
4513 warnings, in some cases it may also cause false positives.
4514
4515 -Wpedantic
4516 -pedantic
4517 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4518 all programs that use forbidden extensions, and some other programs
4519 that do not follow ISO C and ISO C++. For ISO C, follows the
4520 version of the ISO C standard specified by any -std option used.
4521
4522 Valid ISO C and ISO C++ programs should compile properly with or
4523 without this option (though a rare few require -ansi or a -std
4524 option specifying the required version of ISO C). However, without
4525 this option, certain GNU extensions and traditional C and C++
4526 features are supported as well. With this option, they are
4527 rejected.
4528
4529 -Wpedantic does not cause warning messages for use of the alternate
4530 keywords whose names begin and end with __. This alternate format
4531 can also be used to disable warnings for non-ISO __intN types, i.e.
4532 __intN__. Pedantic warnings are also disabled in the expression
4533 that follows "__extension__". However, only system header files
4534 should use these escape routes; application programs should avoid
4535 them.
4536
4537 Some users try to use -Wpedantic to check programs for strict ISO C
4538 conformance. They soon find that it does not do quite what they
4539 want: it finds some non-ISO practices, but not all---only those for
4540 which ISO C requires a diagnostic, and some others for which
4541 diagnostics have been added.
4542
4543 A feature to report any failure to conform to ISO C might be useful
4544 in some instances, but would require considerable additional work
4545 and would be quite different from -Wpedantic. We don't have plans
4546 to support such a feature in the near future.
4547
4548 Where the standard specified with -std represents a GNU extended
4549 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4550 standard, the version of ISO C on which the GNU extended dialect is
4551 based. Warnings from -Wpedantic are given where they are required
4552 by the base standard. (It does not make sense for such warnings to
4553 be given only for features not in the specified GNU C dialect,
4554 since by definition the GNU dialects of C include all features the
4555 compiler supports with the given option, and there would be nothing
4556 to warn about.)
4557
4558 -pedantic-errors
4559 Give an error whenever the base standard (see -Wpedantic) requires
4560 a diagnostic, in some cases where there is undefined behavior at
4561 compile-time and in some other cases that do not prevent
4562 compilation of programs that are valid according to the standard.
4563 This is not equivalent to -Werror=pedantic, since there are errors
4564 enabled by this option and not enabled by the latter and vice
4565 versa.
4566
4567 -Wall
4568 This enables all the warnings about constructions that some users
4569 consider questionable, and that are easy to avoid (or modify to
4570 prevent the warning), even in conjunction with macros. This also
4571 enables some language-specific warnings described in C++ Dialect
4572 Options and Objective-C and Objective-C++ Dialect Options.
4573
4574 -Wall turns on the following warning flags:
4575
4576 -Waddress -Warray-bounds=1 (only with -O2) -Warray-compare
4577 -Warray-parameter=2 (C and Objective-C only) -Wbool-compare
4578 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
4579 and Objective-C++ only) -Wchar-subscripts -Wcomment
4580 -Wdangling-pointer=2 -Wduplicate-decl-specifier (C and Objective-C
4581 only) -Wenum-compare (in C/ObjC; this is on by default in C++)
4582 -Wformat -Wformat-overflow -Wformat-truncation
4583 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
4584 -Wimplicit-int (C and Objective-C only)
4585 -Wimplicit-function-declaration (C and Objective-C only)
4586 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
4587 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4588 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4589 (only for C/C++) -Wmismatched-dealloc -Wmismatched-new-delete (only
4590 for C/C++) -Wmissing-attributes -Wmissing-braces (only for C/ObjC)
4591 -Wmultistatement-macros -Wnarrowing (only for C++) -Wnonnull
4592 -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpessimizing-move
4593 (only for C++) -Wpointer-sign -Wrange-loop-construct (only for C++)
4594 -Wreorder -Wrestrict -Wreturn-type -Wsequence-point -Wsign-compare
4595 (only in C++) -Wsizeof-array-div -Wsizeof-pointer-div
4596 -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-overflow=1
4597 -Wswitch -Wtautological-compare -Wtrigraphs -Wuninitialized
4598 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
4599 -Wunused-variable -Wuse-after-free=3 -Wvla-parameter (C and
4600 Objective-C only) -Wvolatile-register-var -Wzero-length-bounds
4601
4602 Note that some warning flags are not implied by -Wall. Some of
4603 them warn about constructions that users generally do not consider
4604 questionable, but which occasionally you might wish to check for;
4605 others warn about constructions that are necessary or hard to avoid
4606 in some cases, and there is no simple way to modify the code to
4607 suppress the warning. Some of them are enabled by -Wextra but many
4608 of them must be enabled individually.
4609
4610 -Wextra
4611 This enables some extra warning flags that are not enabled by
4612 -Wall. (This option used to be called -W. The older name is still
4613 supported, but the newer name is more descriptive.)
4614
4615 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4616 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4617 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4618 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4619 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4620 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4621 -Wshift-negative-value (in C++11 to C++17 and in C99 and newer)
4622 -Wunused-parameter (only with -Wunused or -Wall)
4623 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4624
4625 The option -Wextra also prints warning messages for the following
4626 cases:
4627
4628 * A pointer is compared against integer zero with "<", "<=", ">",
4629 or ">=".
4630
4631 * (C++ only) An enumerator and a non-enumerator both appear in a
4632 conditional expression.
4633
4634 * (C++ only) Ambiguous virtual bases.
4635
4636 * (C++ only) Subscripting an array that has been declared
4637 "register".
4638
4639 * (C++ only) Taking the address of a variable that has been
4640 declared "register".
4641
4642 * (C++ only) A base class is not initialized in the copy
4643 constructor of a derived class.
4644
4645 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4646 Warn about code affected by ABI changes. This includes code that
4647 may not be compatible with the vendor-neutral C++ ABI as well as
4648 the psABI for the particular target.
4649
4650 Since G++ now defaults to updating the ABI with each major release,
4651 normally -Wabi warns only about C++ ABI compatibility problems if
4652 there is a check added later in a release series for an ABI issue
4653 discovered since the initial release. -Wabi warns about more
4654 things if an older ABI version is selected (with -fabi-version=n).
4655
4656 -Wabi can also be used with an explicit version number to warn
4657 about C++ ABI compatibility with a particular -fabi-version level,
4658 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4659
4660 If an explicit version number is provided and -fabi-compat-version
4661 is not specified, the version number from this option is used for
4662 compatibility aliases. If no explicit version number is provided
4663 with this option, but -fabi-compat-version is specified, that
4664 version number is used for C++ ABI warnings.
4665
4666 Although an effort has been made to warn about all such cases,
4667 there are probably some cases that are not warned about, even
4668 though G++ is generating incompatible code. There may also be
4669 cases where warnings are emitted even though the code that is
4670 generated is compatible.
4671
4672 You should rewrite your code to avoid these warnings if you are
4673 concerned about the fact that code generated by G++ may not be
4674 binary compatible with code generated by other compilers.
4675
4676 Known incompatibilities in -fabi-version=2 (which was the default
4677 from GCC 3.4 to 4.9) include:
4678
4679 * A template with a non-type template parameter of reference type
4680 was mangled incorrectly:
4681
4682 extern int N;
4683 template <int &> struct S {};
4684 void n (S<N>) {2}
4685
4686 This was fixed in -fabi-version=3.
4687
4688 * SIMD vector types declared using "__attribute ((vector_size))"
4689 were mangled in a non-standard way that does not allow for
4690 overloading of functions taking vectors of different sizes.
4691
4692 The mangling was changed in -fabi-version=4.
4693
4694 * "__attribute ((const))" and "noreturn" were mangled as type
4695 qualifiers, and "decltype" of a plain declaration was folded
4696 away.
4697
4698 These mangling issues were fixed in -fabi-version=5.
4699
4700 * Scoped enumerators passed as arguments to a variadic function
4701 are promoted like unscoped enumerators, causing "va_arg" to
4702 complain. On most targets this does not actually affect the
4703 parameter passing ABI, as there is no way to pass an argument
4704 smaller than "int".
4705
4706 Also, the ABI changed the mangling of template argument packs,
4707 "const_cast", "static_cast", prefix increment/decrement, and a
4708 class scope function used as a template argument.
4709
4710 These issues were corrected in -fabi-version=6.
4711
4712 * Lambdas in default argument scope were mangled incorrectly, and
4713 the ABI changed the mangling of "nullptr_t".
4714
4715 These issues were corrected in -fabi-version=7.
4716
4717 * When mangling a function type with function-cv-qualifiers, the
4718 un-qualified function type was incorrectly treated as a
4719 substitution candidate.
4720
4721 This was fixed in -fabi-version=8, the default for GCC 5.1.
4722
4723 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
4724 to unaligned accesses. Note that this did not affect the ABI
4725 of a function with a "nullptr_t" parameter, as parameters have
4726 a minimum alignment.
4727
4728 This was fixed in -fabi-version=9, the default for GCC 5.2.
4729
4730 * Target-specific attributes that affect the identity of a type,
4731 such as ia32 calling conventions on a function type (stdcall,
4732 regparm, etc.), did not affect the mangled name, leading to
4733 name collisions when function pointers were used as template
4734 arguments.
4735
4736 This was fixed in -fabi-version=10, the default for GCC 6.1.
4737
4738 This option also enables warnings about psABI-related changes. The
4739 known psABI changes at this point include:
4740
4741 * For SysV/x86-64, unions with "long double" members are passed
4742 in memory as specified in psABI. Prior to GCC 4.4, this was
4743 not the case. For example:
4744
4745 union U {
4746 long double ld;
4747 int i;
4748 };
4749
4750 "union U" is now always passed in memory.
4751
4752 -Wchar-subscripts
4753 Warn if an array subscript has type "char". This is a common cause
4754 of error, as programmers often forget that this type is signed on
4755 some machines. This warning is enabled by -Wall.
4756
4757 -Wno-coverage-mismatch
4758 Warn if feedback profiles do not match when using the -fprofile-use
4759 option. If a source file is changed between compiling with
4760 -fprofile-generate and with -fprofile-use, the files with the
4761 profile feedback can fail to match the source file and GCC cannot
4762 use the profile feedback information. By default, this warning is
4763 enabled and is treated as an error. -Wno-coverage-mismatch can be
4764 used to disable the warning or -Wno-error=coverage-mismatch can be
4765 used to disable the error. Disabling the error for this warning
4766 can result in poorly optimized code and is useful only in the case
4767 of very minor changes such as bug fixes to an existing code-base.
4768 Completely disabling the warning is not recommended.
4769
4770 -Wno-coverage-invalid-line-number
4771 Warn in case a function ends earlier than it begins due to an
4772 invalid linenum macros. The warning is emitted only with
4773 --coverage enabled.
4774
4775 By default, this warning is enabled and is treated as an error.
4776 -Wno-coverage-invalid-line-number can be used to disable the
4777 warning or -Wno-error=coverage-invalid-line-number can be used to
4778 disable the error.
4779
4780 -Wno-cpp (C, Objective-C, C++, Objective-C++ and Fortran only)
4781 Suppress warning messages emitted by "#warning" directives.
4782
4783 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
4784 Give a warning when a value of type "float" is implicitly promoted
4785 to "double". CPUs with a 32-bit "single-precision" floating-point
4786 unit implement "float" in hardware, but emulate "double" in
4787 software. On such a machine, doing computations using "double"
4788 values is much more expensive because of the overhead required for
4789 software emulation.
4790
4791 It is easy to accidentally do computations with "double" because
4792 floating-point literals are implicitly of type "double". For
4793 example, in:
4794
4795 float area(float radius)
4796 {
4797 return 3.14159 * radius * radius;
4798 }
4799
4800 the compiler performs the entire computation with "double" because
4801 the floating-point literal is a "double".
4802
4803 -Wduplicate-decl-specifier (C and Objective-C only)
4804 Warn if a declaration has duplicate "const", "volatile", "restrict"
4805 or "_Atomic" specifier. This warning is enabled by -Wall.
4806
4807 -Wformat
4808 -Wformat=n
4809 Check calls to "printf" and "scanf", etc., to make sure that the
4810 arguments supplied have types appropriate to the format string
4811 specified, and that the conversions specified in the format string
4812 make sense. This includes standard functions, and others specified
4813 by format attributes, in the "printf", "scanf", "strftime" and
4814 "strfmon" (an X/Open extension, not in the C standard) families (or
4815 other target-specific families). Which functions are checked
4816 without format attributes having been specified depends on the
4817 standard version selected, and such checks of functions without the
4818 attribute specified are disabled by -ffreestanding or -fno-builtin.
4819
4820 The formats are checked against the format features supported by
4821 GNU libc version 2.2. These include all ISO C90 and C99 features,
4822 as well as features from the Single Unix Specification and some BSD
4823 and GNU extensions. Other library implementations may not support
4824 all these features; GCC does not support warning about features
4825 that go beyond a particular library's limitations. However, if
4826 -Wpedantic is used with -Wformat, warnings are given about format
4827 features not in the selected standard version (but not for
4828 "strfmon" formats, since those are not in any version of the C
4829 standard).
4830
4831 -Wformat=1
4832 -Wformat
4833 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4834 equivalent to -Wformat=0. Since -Wformat also checks for null
4835 format arguments for several functions, -Wformat also implies
4836 -Wnonnull. Some aspects of this level of format checking can
4837 be disabled by the options: -Wno-format-contains-nul,
4838 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4839 is enabled by -Wall.
4840
4841 -Wformat=2
4842 Enable -Wformat plus additional format checks. Currently
4843 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4844 -Wformat-y2k.
4845
4846 -Wno-format-contains-nul
4847 If -Wformat is specified, do not warn about format strings that
4848 contain NUL bytes.
4849
4850 -Wno-format-extra-args
4851 If -Wformat is specified, do not warn about excess arguments to a
4852 "printf" or "scanf" format function. The C standard specifies that
4853 such arguments are ignored.
4854
4855 Where the unused arguments lie between used arguments that are
4856 specified with $ operand number specifications, normally warnings
4857 are still given, since the implementation could not know what type
4858 to pass to "va_arg" to skip the unused arguments. However, in the
4859 case of "scanf" formats, this option suppresses the warning if the
4860 unused arguments are all pointers, since the Single Unix
4861 Specification says that such unused arguments are allowed.
4862
4863 -Wformat-overflow
4864 -Wformat-overflow=level
4865 Warn about calls to formatted input/output functions such as
4866 "sprintf" and "vsprintf" that might overflow the destination
4867 buffer. When the exact number of bytes written by a format
4868 directive cannot be determined at compile-time it is estimated
4869 based on heuristics that depend on the level argument and on
4870 optimization. While enabling optimization will in most cases
4871 improve the accuracy of the warning, it may also result in false
4872 positives.
4873
4874 -Wformat-overflow
4875 -Wformat-overflow=1
4876 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4877 conservative approach that warns only about calls that most
4878 likely overflow the buffer. At this level, numeric arguments
4879 to format directives with unknown values are assumed to have
4880 the value of one, and strings of unknown length to be empty.
4881 Numeric arguments that are known to be bounded to a subrange of
4882 their type, or string arguments whose output is bounded either
4883 by their directive's precision or by a finite set of string
4884 literals, are assumed to take on the value within the range
4885 that results in the most bytes on output. For example, the
4886 call to "sprintf" below is diagnosed because even with both a
4887 and b equal to zero, the terminating NUL character ('\0')
4888 appended by the function to the destination buffer will be
4889 written past its end. Increasing the size of the buffer by a
4890 single byte is sufficient to avoid the warning, though it may
4891 not be sufficient to avoid the overflow.
4892
4893 void f (int a, int b)
4894 {
4895 char buf [13];
4896 sprintf (buf, "a = %i, b = %i\n", a, b);
4897 }
4898
4899 -Wformat-overflow=2
4900 Level 2 warns also about calls that might overflow the
4901 destination buffer given an argument of sufficient length or
4902 magnitude. At level 2, unknown numeric arguments are assumed
4903 to have the minimum representable value for signed types with a
4904 precision greater than 1, and the maximum representable value
4905 otherwise. Unknown string arguments whose length cannot be
4906 assumed to be bounded either by the directive's precision, or
4907 by a finite set of string literals they may evaluate to, or the
4908 character array they may point to, are assumed to be 1
4909 character long.
4910
4911 At level 2, the call in the example above is again diagnosed,
4912 but this time because with a equal to a 32-bit "INT_MIN" the
4913 first %i directive will write some of its digits beyond the end
4914 of the destination buffer. To make the call safe regardless of
4915 the values of the two variables, the size of the destination
4916 buffer must be increased to at least 34 bytes. GCC includes
4917 the minimum size of the buffer in an informational note
4918 following the warning.
4919
4920 An alternative to increasing the size of the destination buffer
4921 is to constrain the range of formatted values. The maximum
4922 length of string arguments can be bounded by specifying the
4923 precision in the format directive. When numeric arguments of
4924 format directives can be assumed to be bounded by less than the
4925 precision of their type, choosing an appropriate length
4926 modifier to the format specifier will reduce the required
4927 buffer size. For example, if a and b in the example above can
4928 be assumed to be within the precision of the "short int" type
4929 then using either the %hi format directive or casting the
4930 argument to "short" reduces the maximum required size of the
4931 buffer to 24 bytes.
4932
4933 void f (int a, int b)
4934 {
4935 char buf [23];
4936 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4937 }
4938
4939 -Wno-format-zero-length
4940 If -Wformat is specified, do not warn about zero-length formats.
4941 The C standard specifies that zero-length formats are allowed.
4942
4943 -Wformat-nonliteral
4944 If -Wformat is specified, also warn if the format string is not a
4945 string literal and so cannot be checked, unless the format function
4946 takes its format arguments as a "va_list".
4947
4948 -Wformat-security
4949 If -Wformat is specified, also warn about uses of format functions
4950 that represent possible security problems. At present, this warns
4951 about calls to "printf" and "scanf" functions where the format
4952 string is not a string literal and there are no format arguments,
4953 as in "printf (foo);". This may be a security hole if the format
4954 string came from untrusted input and contains %n. (This is
4955 currently a subset of what -Wformat-nonliteral warns about, but in
4956 future warnings may be added to -Wformat-security that are not
4957 included in -Wformat-nonliteral.)
4958
4959 -Wformat-signedness
4960 If -Wformat is specified, also warn if the format string requires
4961 an unsigned argument and the argument is signed and vice versa.
4962
4963 -Wformat-truncation
4964 -Wformat-truncation=level
4965 Warn about calls to formatted input/output functions such as
4966 "snprintf" and "vsnprintf" that might result in output truncation.
4967 When the exact number of bytes written by a format directive cannot
4968 be determined at compile-time it is estimated based on heuristics
4969 that depend on the level argument and on optimization. While
4970 enabling optimization will in most cases improve the accuracy of
4971 the warning, it may also result in false positives. Except as
4972 noted otherwise, the option uses the same logic -Wformat-overflow.
4973
4974 -Wformat-truncation
4975 -Wformat-truncation=1
4976 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4977 conservative approach that warns only about calls to bounded
4978 functions whose return value is unused and that will most
4979 likely result in output truncation.
4980
4981 -Wformat-truncation=2
4982 Level 2 warns also about calls to bounded functions whose
4983 return value is used and that might result in truncation given
4984 an argument of sufficient length or magnitude.
4985
4986 -Wformat-y2k
4987 If -Wformat is specified, also warn about "strftime" formats that
4988 may yield only a two-digit year.
4989
4990 -Wnonnull
4991 Warn about passing a null pointer for arguments marked as requiring
4992 a non-null value by the "nonnull" function attribute.
4993
4994 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4995 with the -Wno-nonnull option.
4996
4997 -Wnonnull-compare
4998 Warn when comparing an argument marked with the "nonnull" function
4999 attribute against null inside the function.
5000
5001 -Wnonnull-compare is included in -Wall. It can be disabled with
5002 the -Wno-nonnull-compare option.
5003
5004 -Wnull-dereference
5005 Warn if the compiler detects paths that trigger erroneous or
5006 undefined behavior due to dereferencing a null pointer. This
5007 option is only active when -fdelete-null-pointer-checks is active,
5008 which is enabled by optimizations in most targets. The precision
5009 of the warnings depends on the optimization options used.
5010
5011 -Winfinite-recursion
5012 Warn about infinitely recursive calls. The warning is effective at
5013 all optimization levels but requires optimization in order to
5014 detect infinite recursion in calls between two or more functions.
5015 -Winfinite-recursion is included in -Wall.
5016
5017 -Winit-self (C, C++, Objective-C and Objective-C++ only)
5018 Warn about uninitialized variables that are initialized with
5019 themselves. Note this option can only be used with the
5020 -Wuninitialized option.
5021
5022 For example, GCC warns about "i" being uninitialized in the
5023 following snippet only when -Winit-self has been specified:
5024
5025 int f()
5026 {
5027 int i = i;
5028 return i;
5029 }
5030
5031 This warning is enabled by -Wall in C++.
5032
5033 -Wno-implicit-int (C and Objective-C only)
5034 This option controls warnings when a declaration does not specify a
5035 type. This warning is enabled by default in C99 and later dialects
5036 of C, and also by -Wall.
5037
5038 -Wno-implicit-function-declaration (C and Objective-C only)
5039 This option controls warnings when a function is used before being
5040 declared. This warning is enabled by default in C99 and later
5041 dialects of C, and also by -Wall. The warning is made into an
5042 error by -pedantic-errors.
5043
5044 -Wimplicit (C and Objective-C only)
5045 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
5046 warning is enabled by -Wall.
5047
5048 -Wimplicit-fallthrough
5049 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
5050 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
5051
5052 -Wimplicit-fallthrough=n
5053 Warn when a switch case falls through. For example:
5054
5055 switch (cond)
5056 {
5057 case 1:
5058 a = 1;
5059 break;
5060 case 2:
5061 a = 2;
5062 case 3:
5063 a = 3;
5064 break;
5065 }
5066
5067 This warning does not warn when the last statement of a case cannot
5068 fall through, e.g. when there is a return statement or a call to
5069 function declared with the noreturn attribute.
5070 -Wimplicit-fallthrough= also takes into account control flow
5071 statements, such as ifs, and only warns when appropriate. E.g.
5072
5073 switch (cond)
5074 {
5075 case 1:
5076 if (i > 3) {
5077 bar (5);
5078 break;
5079 } else if (i < 1) {
5080 bar (0);
5081 } else
5082 return;
5083 default:
5084 ...
5085 }
5086
5087 Since there are occasions where a switch case fall through is
5088 desirable, GCC provides an attribute, "__attribute__
5089 ((fallthrough))", that is to be used along with a null statement to
5090 suppress this warning that would normally occur:
5091
5092 switch (cond)
5093 {
5094 case 1:
5095 bar (0);
5096 __attribute__ ((fallthrough));
5097 default:
5098 ...
5099 }
5100
5101 C++17 provides a standard way to suppress the
5102 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
5103 the GNU attribute. In C++11 or C++14 users can use
5104 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
5105 these attributes, it is also possible to add a fallthrough comment
5106 to silence the warning. The whole body of the C or C++ style
5107 comment should match the given regular expressions listed below.
5108 The option argument n specifies what kind of comments are accepted:
5109
5110 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
5111 *<-Wimplicit-fallthrough=1 matches ".*" regular>
5112 expression, any comment is used as fallthrough comment.
5113
5114 *<-Wimplicit-fallthrough=2 case insensitively matches>
5115 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
5116
5117 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
5118 following regular expressions:
5119
5120 *<"-fallthrough">
5121 *<"@fallthrough@">
5122 *<"lint -fallthrough[ \t]*">
5123 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
5124 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
5125 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
5126 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5127 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
5128 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5129 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
5130 following regular expressions:
5131
5132 *<"-fallthrough">
5133 *<"@fallthrough@">
5134 *<"lint -fallthrough[ \t]*">
5135 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
5136 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
5137 fallthrough comments, only attributes disable the warning.
5138
5139 The comment needs to be followed after optional whitespace and
5140 other comments by "case" or "default" keywords or by a user label
5141 that precedes some "case" or "default" label.
5142
5143 switch (cond)
5144 {
5145 case 1:
5146 bar (0);
5147 /* FALLTHRU */
5148 default:
5149 ...
5150 }
5151
5152 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
5153
5154 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
5155 Control if warnings triggered by the "warn_if_not_aligned"
5156 attribute should be issued. These warnings are enabled by default.
5157
5158 -Wignored-qualifiers (C and C++ only)
5159 Warn if the return type of a function has a type qualifier such as
5160 "const". For ISO C such a type qualifier has no effect, since the
5161 value returned by a function is not an lvalue. For C++, the
5162 warning is only emitted for scalar types or "void". ISO C
5163 prohibits qualified "void" return types on function definitions, so
5164 such return types always receive a warning even without this
5165 option.
5166
5167 This warning is also enabled by -Wextra.
5168
5169 -Wno-ignored-attributes (C and C++ only)
5170 This option controls warnings when an attribute is ignored. This
5171 is different from the -Wattributes option in that it warns whenever
5172 the compiler decides to drop an attribute, not that the attribute
5173 is either unknown, used in a wrong place, etc. This warning is
5174 enabled by default.
5175
5176 -Wmain
5177 Warn if the type of "main" is suspicious. "main" should be a
5178 function with external linkage, returning int, taking either zero
5179 arguments, two, or three arguments of appropriate types. This
5180 warning is enabled by default in C++ and is enabled by either -Wall
5181 or -Wpedantic.
5182
5183 -Wmisleading-indentation (C and C++ only)
5184 Warn when the indentation of the code does not reflect the block
5185 structure. Specifically, a warning is issued for "if", "else",
5186 "while", and "for" clauses with a guarded statement that does not
5187 use braces, followed by an unguarded statement with the same
5188 indentation.
5189
5190 In the following example, the call to "bar" is misleadingly
5191 indented as if it were guarded by the "if" conditional.
5192
5193 if (some_condition ())
5194 foo ();
5195 bar (); /* Gotcha: this is not guarded by the "if". */
5196
5197 In the case of mixed tabs and spaces, the warning uses the
5198 -ftabstop= option to determine if the statements line up
5199 (defaulting to 8).
5200
5201 The warning is not issued for code involving multiline preprocessor
5202 logic such as the following example.
5203
5204 if (flagA)
5205 foo (0);
5206 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5207 if (flagB)
5208 #endif
5209 foo (1);
5210
5211 The warning is not issued after a "#line" directive, since this
5212 typically indicates autogenerated code, and no assumptions can be
5213 made about the layout of the file that the directive references.
5214
5215 This warning is enabled by -Wall in C and C++.
5216
5217 -Wmissing-attributes
5218 Warn when a declaration of a function is missing one or more
5219 attributes that a related function is declared with and whose
5220 absence may adversely affect the correctness or efficiency of
5221 generated code. For example, the warning is issued for
5222 declarations of aliases that use attributes to specify less
5223 restrictive requirements than those of their targets. This
5224 typically represents a potential optimization opportunity. By
5225 contrast, the -Wattribute-alias=2 option controls warnings issued
5226 when the alias is more restrictive than the target, which could
5227 lead to incorrect code generation. Attributes considered include
5228 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5229 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5230 "returns_nonnull", and "returns_twice".
5231
5232 In C++, the warning is issued when an explicit specialization of a
5233 primary template declared with attribute "alloc_align",
5234 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5235 or "nonnull" is declared without it. Attributes "deprecated",
5236 "error", and "warning" suppress the warning..
5237
5238 You can use the "copy" attribute to apply the same set of
5239 attributes to a declaration as that on another declaration without
5240 explicitly enumerating the attributes. This attribute can be
5241 applied to declarations of functions, variables, or types.
5242
5243 -Wmissing-attributes is enabled by -Wall.
5244
5245 For example, since the declaration of the primary function template
5246 below makes use of both attribute "malloc" and "alloc_size" the
5247 declaration of the explicit specialization of the template is
5248 diagnosed because it is missing one of the attributes.
5249
5250 template <class T>
5251 T* __attribute__ ((malloc, alloc_size (1)))
5252 allocate (size_t);
5253
5254 template <>
5255 void* __attribute__ ((malloc)) // missing alloc_size
5256 allocate<void> (size_t);
5257
5258 -Wmissing-braces
5259 Warn if an aggregate or union initializer is not fully bracketed.
5260 In the following example, the initializer for "a" is not fully
5261 bracketed, but that for "b" is fully bracketed.
5262
5263 int a[2][2] = { 0, 1, 2, 3 };
5264 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5265
5266 This warning is enabled by -Wall.
5267
5268 -Wmissing-include-dirs (C, C++, Objective-C, Objective-C++ and Fortran
5269 only)
5270 Warn if a user-supplied include directory does not exist. This
5271 opions is disabled by default for C, C++, Objective-C and
5272 Objective-C++. For Fortran, it is partially enabled by default by
5273 warning for -I and -J, only.
5274
5275 -Wno-missing-profile
5276 This option controls warnings if feedback profiles are missing when
5277 using the -fprofile-use option. This option diagnoses those cases
5278 where a new function or a new file is added between compiling with
5279 -fprofile-generate and with -fprofile-use, without regenerating the
5280 profiles. In these cases, the profile feedback data files do not
5281 contain any profile feedback information for the newly added
5282 function or file respectively. Also, in the case when profile
5283 count data (.gcda) files are removed, GCC cannot use any profile
5284 feedback information. In all these cases, warnings are issued to
5285 inform you that a profile generation step is due. Ignoring the
5286 warning can result in poorly optimized code. -Wno-missing-profile
5287 can be used to disable the warning, but this is not recommended and
5288 should be done only when non-existent profile data is justified.
5289
5290 -Wmismatched-dealloc
5291 Warn for calls to deallocation functions with pointer arguments
5292 returned from from allocations functions for which the former isn't
5293 a suitable deallocator. A pair of functions can be associated as
5294 matching allocators and deallocators by use of attribute "malloc".
5295 Unless disabled by the -fno-builtin option the standard functions
5296 "calloc", "malloc", "realloc", and "free", as well as the
5297 corresponding forms of C++ "operator new" and "operator delete" are
5298 implicitly associated as matching allocators and deallocators. In
5299 the following example "mydealloc" is the deallocator for pointers
5300 returned from "myalloc".
5301
5302 void mydealloc (void*);
5303
5304 __attribute__ ((malloc (mydealloc, 1))) void*
5305 myalloc (size_t);
5306
5307 void f (void)
5308 {
5309 void *p = myalloc (32);
5310 // ...use p...
5311 free (p); // warning: not a matching deallocator for myalloc
5312 mydealloc (p); // ok
5313 }
5314
5315 In C++, the related option -Wmismatched-new-delete diagnoses
5316 mismatches involving either "operator new" or "operator delete".
5317
5318 Option -Wmismatched-dealloc is included in -Wall.
5319
5320 -Wmultistatement-macros
5321 Warn about unsafe multiple statement macros that appear to be
5322 guarded by a clause such as "if", "else", "for", "switch", or
5323 "while", in which only the first statement is actually guarded
5324 after the macro is expanded.
5325
5326 For example:
5327
5328 #define DOIT x++; y++
5329 if (c)
5330 DOIT;
5331
5332 will increment "y" unconditionally, not just when "c" holds. The
5333 can usually be fixed by wrapping the macro in a do-while loop:
5334
5335 #define DOIT do { x++; y++; } while (0)
5336 if (c)
5337 DOIT;
5338
5339 This warning is enabled by -Wall in C and C++.
5340
5341 -Wparentheses
5342 Warn if parentheses are omitted in certain contexts, such as when
5343 there is an assignment in a context where a truth value is
5344 expected, or when operators are nested whose precedence people
5345 often get confused about.
5346
5347 Also warn if a comparison like "x<=y<=z" appears; this is
5348 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5349 interpretation from that of ordinary mathematical notation.
5350
5351 Also warn for dangerous uses of the GNU extension to "?:" with
5352 omitted middle operand. When the condition in the "?": operator is
5353 a boolean expression, the omitted value is always 1. Often
5354 programmers expect it to be a value computed inside the conditional
5355 expression instead.
5356
5357 For C++ this also warns for some cases of unnecessary parentheses
5358 in declarations, which can indicate an attempt at a function call
5359 instead of a declaration:
5360
5361 {
5362 // Declares a local variable called mymutex.
5363 std::unique_lock<std::mutex> (mymutex);
5364 // User meant std::unique_lock<std::mutex> lock (mymutex);
5365 }
5366
5367 This warning is enabled by -Wall.
5368
5369 -Wsequence-point
5370 Warn about code that may have undefined semantics because of
5371 violations of sequence point rules in the C and C++ standards.
5372
5373 The C and C++ standards define the order in which expressions in a
5374 C/C++ program are evaluated in terms of sequence points, which
5375 represent a partial ordering between the execution of parts of the
5376 program: those executed before the sequence point, and those
5377 executed after it. These occur after the evaluation of a full
5378 expression (one which is not part of a larger expression), after
5379 the evaluation of the first operand of a "&&", "||", "? :" or ","
5380 (comma) operator, before a function is called (but after the
5381 evaluation of its arguments and the expression denoting the called
5382 function), and in certain other places. Other than as expressed by
5383 the sequence point rules, the order of evaluation of subexpressions
5384 of an expression is not specified. All these rules describe only a
5385 partial order rather than a total order, since, for example, if two
5386 functions are called within one expression with no sequence point
5387 between them, the order in which the functions are called is not
5388 specified. However, the standards committee have ruled that
5389 function calls do not overlap.
5390
5391 It is not specified when between sequence points modifications to
5392 the values of objects take effect. Programs whose behavior depends
5393 on this have undefined behavior; the C and C++ standards specify
5394 that "Between the previous and next sequence point an object shall
5395 have its stored value modified at most once by the evaluation of an
5396 expression. Furthermore, the prior value shall be read only to
5397 determine the value to be stored.". If a program breaks these
5398 rules, the results on any particular implementation are entirely
5399 unpredictable.
5400
5401 Examples of code with undefined behavior are "a = a++;", "a[n] =
5402 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5403 diagnosed by this option, and it may give an occasional false
5404 positive result, but in general it has been found fairly effective
5405 at detecting this sort of problem in programs.
5406
5407 The C++17 standard will define the order of evaluation of operands
5408 in more cases: in particular it requires that the right-hand side
5409 of an assignment be evaluated before the left-hand side, so the
5410 above examples are no longer undefined. But this option will still
5411 warn about them, to help people avoid writing code that is
5412 undefined in C and earlier revisions of C++.
5413
5414 The standard is worded confusingly, therefore there is some debate
5415 over the precise meaning of the sequence point rules in subtle
5416 cases. Links to discussions of the problem, including proposed
5417 formal definitions, may be found on the GCC readings page, at
5418 <https://gcc.gnu.org/readings.html>.
5419
5420 This warning is enabled by -Wall for C and C++.
5421
5422 -Wno-return-local-addr
5423 Do not warn about returning a pointer (or in C++, a reference) to a
5424 variable that goes out of scope after the function returns.
5425
5426 -Wreturn-type
5427 Warn whenever a function is defined with a return type that
5428 defaults to "int". Also warn about any "return" statement with no
5429 return value in a function whose return type is not "void" (falling
5430 off the end of the function body is considered returning without a
5431 value).
5432
5433 For C only, warn about a "return" statement with an expression in a
5434 function whose return type is "void", unless the expression type is
5435 also "void". As a GNU extension, the latter case is accepted
5436 without a warning unless -Wpedantic is used. Attempting to use the
5437 return value of a non-"void" function other than "main" that flows
5438 off the end by reaching the closing curly brace that terminates the
5439 function is undefined.
5440
5441 Unlike in C, in C++, flowing off the end of a non-"void" function
5442 other than "main" results in undefined behavior even when the value
5443 of the function is not used.
5444
5445 This warning is enabled by default in C++ and by -Wall otherwise.
5446
5447 -Wno-shift-count-negative
5448 Controls warnings if a shift count is negative. This warning is
5449 enabled by default.
5450
5451 -Wno-shift-count-overflow
5452 Controls warnings if a shift count is greater than or equal to the
5453 bit width of the type. This warning is enabled by default.
5454
5455 -Wshift-negative-value
5456 Warn if left shifting a negative value. This warning is enabled by
5457 -Wextra in C99 (and newer) and C++11 to C++17 modes.
5458
5459 -Wno-shift-overflow
5460 -Wshift-overflow=n
5461 These options control warnings about left shift overflows.
5462
5463 -Wshift-overflow=1
5464 This is the warning level of -Wshift-overflow and is enabled by
5465 default in C99 and C++11 modes (and newer). This warning level
5466 does not warn about left-shifting 1 into the sign bit.
5467 (However, in C, such an overflow is still rejected in contexts
5468 where an integer constant expression is required.) No warning
5469 is emitted in C++20 mode (and newer), as signed left shifts
5470 always wrap.
5471
5472 -Wshift-overflow=2
5473 This warning level also warns about left-shifting 1 into the
5474 sign bit, unless C++14 mode (or newer) is active.
5475
5476 -Wswitch
5477 Warn whenever a "switch" statement has an index of enumerated type
5478 and lacks a "case" for one or more of the named codes of that
5479 enumeration. (The presence of a "default" label prevents this
5480 warning.) "case" labels outside the enumeration range also provoke
5481 warnings when this option is used (even if there is a "default"
5482 label). This warning is enabled by -Wall.
5483
5484 -Wswitch-default
5485 Warn whenever a "switch" statement does not have a "default" case.
5486
5487 -Wswitch-enum
5488 Warn whenever a "switch" statement has an index of enumerated type
5489 and lacks a "case" for one or more of the named codes of that
5490 enumeration. "case" labels outside the enumeration range also
5491 provoke warnings when this option is used. The only difference
5492 between -Wswitch and this option is that this option gives a
5493 warning about an omitted enumeration code even if there is a
5494 "default" label.
5495
5496 -Wno-switch-bool
5497 Do not warn when a "switch" statement has an index of boolean type
5498 and the case values are outside the range of a boolean type. It is
5499 possible to suppress this warning by casting the controlling
5500 expression to a type other than "bool". For example:
5501
5502 switch ((int) (a == 4))
5503 {
5504 ...
5505 }
5506
5507 This warning is enabled by default for C and C++ programs.
5508
5509 -Wno-switch-outside-range
5510 This option controls warnings when a "switch" case has a value that
5511 is outside of its respective type range. This warning is enabled
5512 by default for C and C++ programs.
5513
5514 -Wno-switch-unreachable
5515 Do not warn when a "switch" statement contains statements between
5516 the controlling expression and the first case label, which will
5517 never be executed. For example:
5518
5519 switch (cond)
5520 {
5521 i = 15;
5522 ...
5523 case 5:
5524 ...
5525 }
5526
5527 -Wswitch-unreachable does not warn if the statement between the
5528 controlling expression and the first case label is just a
5529 declaration:
5530
5531 switch (cond)
5532 {
5533 int i;
5534 ...
5535 case 5:
5536 i = 5;
5537 ...
5538 }
5539
5540 This warning is enabled by default for C and C++ programs.
5541
5542 -Wsync-nand (C and C++ only)
5543 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5544 built-in functions are used. These functions changed semantics in
5545 GCC 4.4.
5546
5547 -Wtrivial-auto-var-init
5548 Warn when "-ftrivial-auto-var-init" cannot initialize the automatic
5549 variable. A common situation is an automatic variable that is
5550 declared between the controlling expression and the first case
5551 label of a "switch" statement.
5552
5553 -Wunused-but-set-parameter
5554 Warn whenever a function parameter is assigned to, but otherwise
5555 unused (aside from its declaration).
5556
5557 To suppress this warning use the "unused" attribute.
5558
5559 This warning is also enabled by -Wunused together with -Wextra.
5560
5561 -Wunused-but-set-variable
5562 Warn whenever a local variable is assigned to, but otherwise unused
5563 (aside from its declaration). This warning is enabled by -Wall.
5564
5565 To suppress this warning use the "unused" attribute.
5566
5567 This warning is also enabled by -Wunused, which is enabled by
5568 -Wall.
5569
5570 -Wunused-function
5571 Warn whenever a static function is declared but not defined or a
5572 non-inline static function is unused. This warning is enabled by
5573 -Wall.
5574
5575 -Wunused-label
5576 Warn whenever a label is declared but not used. This warning is
5577 enabled by -Wall.
5578
5579 To suppress this warning use the "unused" attribute.
5580
5581 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5582 Warn when a typedef locally defined in a function is not used.
5583 This warning is enabled by -Wall.
5584
5585 -Wunused-parameter
5586 Warn whenever a function parameter is unused aside from its
5587 declaration.
5588
5589 To suppress this warning use the "unused" attribute.
5590
5591 -Wno-unused-result
5592 Do not warn if a caller of a function marked with attribute
5593 "warn_unused_result" does not use its return value. The default is
5594 -Wunused-result.
5595
5596 -Wunused-variable
5597 Warn whenever a local or static variable is unused aside from its
5598 declaration. This option implies -Wunused-const-variable=1 for C,
5599 but not for C++. This warning is enabled by -Wall.
5600
5601 To suppress this warning use the "unused" attribute.
5602
5603 -Wunused-const-variable
5604 -Wunused-const-variable=n
5605 Warn whenever a constant static variable is unused aside from its
5606 declaration. -Wunused-const-variable=1 is enabled by
5607 -Wunused-variable for C, but not for C++. In C this declares
5608 variable storage, but in C++ this is not an error since const
5609 variables take the place of "#define"s.
5610
5611 To suppress this warning use the "unused" attribute.
5612
5613 -Wunused-const-variable=1
5614 This is the warning level that is enabled by -Wunused-variable
5615 for C. It warns only about unused static const variables
5616 defined in the main compilation unit, but not about static
5617 const variables declared in any header included.
5618
5619 -Wunused-const-variable=2
5620 This warning level also warns for unused constant static
5621 variables in headers (excluding system headers). This is the
5622 warning level of -Wunused-const-variable and must be explicitly
5623 requested since in C++ this isn't an error and in C it might be
5624 harder to clean up all headers included.
5625
5626 -Wunused-value
5627 Warn whenever a statement computes a result that is explicitly not
5628 used. To suppress this warning cast the unused expression to
5629 "void". This includes an expression-statement or the left-hand side
5630 of a comma expression that contains no side effects. For example,
5631 an expression such as "x[i,j]" causes a warning, while
5632 "x[(void)i,j]" does not.
5633
5634 This warning is enabled by -Wall.
5635
5636 -Wunused
5637 All the above -Wunused options combined.
5638
5639 In order to get a warning about an unused function parameter, you
5640 must either specify -Wextra -Wunused (note that -Wall implies
5641 -Wunused), or separately specify -Wunused-parameter.
5642
5643 -Wuninitialized
5644 Warn if an object with automatic or allocated storage duration is
5645 used without having been initialized. In C++, also warn if a non-
5646 static reference or non-static "const" member appears in a class
5647 without constructors.
5648
5649 In addition, passing a pointer (or in C++, a reference) to an
5650 uninitialized object to a "const"-qualified argument of a built-in
5651 function known to read the object is also diagnosed by this
5652 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5653
5654 If you want to warn about code that uses the uninitialized value of
5655 the variable in its own initializer, use the -Winit-self option.
5656
5657 These warnings occur for individual uninitialized elements of
5658 structure, union or array variables as well as for variables that
5659 are uninitialized as a whole. They do not occur for variables or
5660 elements declared "volatile". Because these warnings depend on
5661 optimization, the exact variables or elements for which there are
5662 warnings depend on the precise optimization options and version of
5663 GCC used.
5664
5665 Note that there may be no warning about a variable that is used
5666 only to compute a value that itself is never used, because such
5667 computations may be deleted by data flow analysis before the
5668 warnings are printed.
5669
5670 In C++, this warning also warns about using uninitialized objects
5671 in member-initializer-lists. For example, GCC warns about "b"
5672 being uninitialized in the following snippet:
5673
5674 struct A {
5675 int a;
5676 int b;
5677 A() : a(b) { }
5678 };
5679
5680 -Wno-invalid-memory-model
5681 This option controls warnings for invocations of __atomic Builtins,
5682 __sync Builtins, and the C11 atomic generic functions with a memory
5683 consistency argument that is either invalid for the operation or
5684 outside the range of values of the "memory_order" enumeration. For
5685 example, since the "__atomic_store" and "__atomic_store_n" built-
5686 ins are only defined for the relaxed, release, and sequentially
5687 consistent memory orders the following code is diagnosed:
5688
5689 void store (int *i)
5690 {
5691 __atomic_store_n (i, 0, memory_order_consume);
5692 }
5693
5694 -Winvalid-memory-model is enabled by default.
5695
5696 -Wmaybe-uninitialized
5697 For an object with automatic or allocated storage duration, if
5698 there exists a path from the function entry to a use of the object
5699 that is initialized, but there exist some other paths for which the
5700 object is not initialized, the compiler emits a warning if it
5701 cannot prove the uninitialized paths are not executed at run time.
5702
5703 In addition, passing a pointer (or in C++, a reference) to an
5704 uninitialized object to a "const"-qualified function argument is
5705 also diagnosed by this warning. (-Wuninitialized is issued for
5706 built-in functions known to read the object.) Annotating the
5707 function with attribute "access (none)" indicates that the argument
5708 isn't used to access the object and avoids the warning.
5709
5710 These warnings are only possible in optimizing compilation, because
5711 otherwise GCC does not keep track of the state of variables.
5712
5713 These warnings are made optional because GCC may not be able to
5714 determine when the code is correct in spite of appearing to have an
5715 error. Here is one example of how this can happen:
5716
5717 {
5718 int x;
5719 switch (y)
5720 {
5721 case 1: x = 1;
5722 break;
5723 case 2: x = 4;
5724 break;
5725 case 3: x = 5;
5726 }
5727 foo (x);
5728 }
5729
5730 If the value of "y" is always 1, 2 or 3, then "x" is always
5731 initialized, but GCC doesn't know this. To suppress the warning,
5732 you need to provide a default case with assert(0) or similar code.
5733
5734 This option also warns when a non-volatile automatic variable might
5735 be changed by a call to "longjmp". The compiler sees only the
5736 calls to "setjmp". It cannot know where "longjmp" will be called;
5737 in fact, a signal handler could call it at any point in the code.
5738 As a result, you may get a warning even when there is in fact no
5739 problem because "longjmp" cannot in fact be called at the place
5740 that would cause a problem.
5741
5742 Some spurious warnings can be avoided if you declare all the
5743 functions you use that never return as "noreturn".
5744
5745 This warning is enabled by -Wall or -Wextra.
5746
5747 -Wunknown-pragmas
5748 Warn when a "#pragma" directive is encountered that is not
5749 understood by GCC. If this command-line option is used, warnings
5750 are even issued for unknown pragmas in system header files. This
5751 is not the case if the warnings are only enabled by the -Wall
5752 command-line option.
5753
5754 -Wno-pragmas
5755 Do not warn about misuses of pragmas, such as incorrect parameters,
5756 invalid syntax, or conflicts between pragmas. See also
5757 -Wunknown-pragmas.
5758
5759 -Wno-prio-ctor-dtor
5760 Do not warn if a priority from 0 to 100 is used for constructor or
5761 destructor. The use of constructor and destructor attributes allow
5762 you to assign a priority to the constructor/destructor to control
5763 its order of execution before "main" is called or after it returns.
5764 The priority values must be greater than 100 as the compiler
5765 reserves priority values between 0--100 for the implementation.
5766
5767 -Wstrict-aliasing
5768 This option is only active when -fstrict-aliasing is active. It
5769 warns about code that might break the strict aliasing rules that
5770 the compiler is using for optimization. The warning does not catch
5771 all cases, but does attempt to catch the more common pitfalls. It
5772 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
5773
5774 -Wstrict-aliasing=n
5775 This option is only active when -fstrict-aliasing is active. It
5776 warns about code that might break the strict aliasing rules that
5777 the compiler is using for optimization. Higher levels correspond
5778 to higher accuracy (fewer false positives). Higher levels also
5779 correspond to more effort, similar to the way -O works.
5780 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
5781
5782 Level 1: Most aggressive, quick, least accurate. Possibly useful
5783 when higher levels do not warn but -fstrict-aliasing still breaks
5784 the code, as it has very few false negatives. However, it has many
5785 false positives. Warns for all pointer conversions between
5786 possibly incompatible types, even if never dereferenced. Runs in
5787 the front end only.
5788
5789 Level 2: Aggressive, quick, not too precise. May still have many
5790 false positives (not as many as level 1 though), and few false
5791 negatives (but possibly more than level 1). Unlike level 1, it
5792 only warns when an address is taken. Warns about incomplete types.
5793 Runs in the front end only.
5794
5795 Level 3 (default for -Wstrict-aliasing): Should have very few false
5796 positives and few false negatives. Slightly slower than levels 1
5797 or 2 when optimization is enabled. Takes care of the common
5798 pun+dereference pattern in the front end: "*(int*)&some_float". If
5799 optimization is enabled, it also runs in the back end, where it
5800 deals with multiple statement cases using flow-sensitive points-to
5801 information. Only warns when the converted pointer is
5802 dereferenced. Does not warn about incomplete types.
5803
5804 -Wstrict-overflow
5805 -Wstrict-overflow=n
5806 This option is only active when signed overflow is undefined. It
5807 warns about cases where the compiler optimizes based on the
5808 assumption that signed overflow does not occur. Note that it does
5809 not warn about all cases where the code might overflow: it only
5810 warns about cases where the compiler implements some optimization.
5811 Thus this warning depends on the optimization level.
5812
5813 An optimization that assumes that signed overflow does not occur is
5814 perfectly safe if the values of the variables involved are such
5815 that overflow never does, in fact, occur. Therefore this warning
5816 can easily give a false positive: a warning about code that is not
5817 actually a problem. To help focus on important issues, several
5818 warning levels are defined. No warnings are issued for the use of
5819 undefined signed overflow when estimating how many iterations a
5820 loop requires, in particular when determining whether a loop will
5821 be executed at all.
5822
5823 -Wstrict-overflow=1
5824 Warn about cases that are both questionable and easy to avoid.
5825 For example the compiler simplifies "x + 1 > x" to 1. This
5826 level of -Wstrict-overflow is enabled by -Wall; higher levels
5827 are not, and must be explicitly requested.
5828
5829 -Wstrict-overflow=2
5830 Also warn about other cases where a comparison is simplified to
5831 a constant. For example: "abs (x) >= 0". This can only be
5832 simplified when signed integer overflow is undefined, because
5833 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
5834 zero. -Wstrict-overflow (with no level) is the same as
5835 -Wstrict-overflow=2.
5836
5837 -Wstrict-overflow=3
5838 Also warn about other cases where a comparison is simplified.
5839 For example: "x + 1 > 1" is simplified to "x > 0".
5840
5841 -Wstrict-overflow=4
5842 Also warn about other simplifications not covered by the above
5843 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
5844
5845 -Wstrict-overflow=5
5846 Also warn about cases where the compiler reduces the magnitude
5847 of a constant involved in a comparison. For example: "x + 2 >
5848 y" is simplified to "x + 1 >= y". This is reported only at the
5849 highest warning level because this simplification applies to
5850 many comparisons, so this warning level gives a very large
5851 number of false positives.
5852
5853 -Wstring-compare
5854 Warn for calls to "strcmp" and "strncmp" whose result is determined
5855 to be either zero or non-zero in tests for such equality owing to
5856 the length of one argument being greater than the size of the array
5857 the other argument is stored in (or the bound in the case of
5858 "strncmp"). Such calls could be mistakes. For example, the call
5859 to "strcmp" below is diagnosed because its result is necessarily
5860 non-zero irrespective of the contents of the array "a".
5861
5862 extern char a[4];
5863 void f (char *d)
5864 {
5865 strcpy (d, "string");
5866 ...
5867 if (0 == strcmp (a, d)) // cannot be true
5868 puts ("a and d are the same");
5869 }
5870
5871 -Wstring-compare is enabled by -Wextra.
5872
5873 -Wno-stringop-overflow
5874 -Wstringop-overflow
5875 -Wstringop-overflow=type
5876 Warn for calls to string manipulation functions such as "memcpy"
5877 and "strcpy" that are determined to overflow the destination
5878 buffer. The optional argument is one greater than the type of
5879 Object Size Checking to perform to determine the size of the
5880 destination. The argument is meaningful only for functions that
5881 operate on character arrays but not for raw memory functions like
5882 "memcpy" which always make use of Object Size type-0. The option
5883 also warns for calls that specify a size in excess of the largest
5884 possible object or at most "SIZE_MAX / 2" bytes. The option
5885 produces the best results with optimization enabled but can detect
5886 a small subset of simple buffer overflows even without optimization
5887 in calls to the GCC built-in functions like "__builtin_memcpy" that
5888 correspond to the standard functions. In any case, the option
5889 warns about just a subset of buffer overflows detected by the
5890 corresponding overflow checking built-ins. For example, the option
5891 issues a warning for the "strcpy" call below because it copies at
5892 least 5 characters (the string "blue" including the terminating
5893 NUL) into the buffer of size 4.
5894
5895 enum Color { blue, purple, yellow };
5896 const char* f (enum Color clr)
5897 {
5898 static char buf [4];
5899 const char *str;
5900 switch (clr)
5901 {
5902 case blue: str = "blue"; break;
5903 case purple: str = "purple"; break;
5904 case yellow: str = "yellow"; break;
5905 }
5906
5907 return strcpy (buf, str); // warning here
5908 }
5909
5910 Option -Wstringop-overflow=2 is enabled by default.
5911
5912 -Wstringop-overflow
5913 -Wstringop-overflow=1
5914 The -Wstringop-overflow=1 option uses type-zero Object Size
5915 Checking to determine the sizes of destination objects. At
5916 this setting the option does not warn for writes past the end
5917 of subobjects of larger objects accessed by pointers unless the
5918 size of the largest surrounding object is known. When the
5919 destination may be one of several objects it is assumed to be
5920 the largest one of them. On Linux systems, when optimization
5921 is enabled at this setting the option warns for the same code
5922 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
5923 value.
5924
5925 -Wstringop-overflow=2
5926 The -Wstringop-overflow=2 option uses type-one Object Size
5927 Checking to determine the sizes of destination objects. At
5928 this setting the option warns about overflows when writing to
5929 members of the largest complete objects whose exact size is
5930 known. However, it does not warn for excessive writes to the
5931 same members of unknown objects referenced by pointers since
5932 they may point to arrays containing unknown numbers of
5933 elements. This is the default setting of the option.
5934
5935 -Wstringop-overflow=3
5936 The -Wstringop-overflow=3 option uses type-two Object Size
5937 Checking to determine the sizes of destination objects. At
5938 this setting the option warns about overflowing the smallest
5939 object or data member. This is the most restrictive setting of
5940 the option that may result in warnings for safe code.
5941
5942 -Wstringop-overflow=4
5943 The -Wstringop-overflow=4 option uses type-three Object Size
5944 Checking to determine the sizes of destination objects. At
5945 this setting the option warns about overflowing any data
5946 members, and when the destination is one of several objects it
5947 uses the size of the largest of them to decide whether to issue
5948 a warning. Similarly to -Wstringop-overflow=3 this setting of
5949 the option may result in warnings for benign code.
5950
5951 -Wno-stringop-overread
5952 Warn for calls to string manipulation functions such as "memchr",
5953 or "strcpy" that are determined to read past the end of the source
5954 sequence.
5955
5956 Option -Wstringop-overread is enabled by default.
5957
5958 -Wno-stringop-truncation
5959 Do not warn for calls to bounded string manipulation functions such
5960 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5961 copied string or leave the destination unchanged.
5962
5963 In the following example, the call to "strncat" specifies a bound
5964 that is less than the length of the source string. As a result,
5965 the copy of the source will be truncated and so the call is
5966 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5967 as the bound.
5968
5969 void append (char *buf, size_t bufsize)
5970 {
5971 strncat (buf, ".txt", 3);
5972 }
5973
5974 As another example, the following call to "strncpy" results in
5975 copying to "d" just the characters preceding the terminating NUL,
5976 without appending the NUL to the end. Assuming the result of
5977 "strncpy" is necessarily a NUL-terminated string is a common
5978 mistake, and so the call is diagnosed. To avoid the warning when
5979 the result is not expected to be NUL-terminated, call "memcpy"
5980 instead.
5981
5982 void copy (char *d, const char *s)
5983 {
5984 strncpy (d, s, strlen (s));
5985 }
5986
5987 In the following example, the call to "strncpy" specifies the size
5988 of the destination buffer as the bound. If the length of the
5989 source string is equal to or greater than this size the result of
5990 the copy will not be NUL-terminated. Therefore, the call is also
5991 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5992 bound and set the last element of the buffer to "NUL".
5993
5994 void copy (const char *s)
5995 {
5996 char buf[80];
5997 strncpy (buf, s, sizeof buf);
5998 ...
5999 }
6000
6001 In situations where a character array is intended to store a
6002 sequence of bytes with no terminating "NUL" such an array may be
6003 annotated with attribute "nonstring" to avoid this warning. Such
6004 arrays, however, are not suitable arguments to functions that
6005 expect "NUL"-terminated strings. To help detect accidental misuses
6006 of such arrays GCC issues warnings unless it can prove that the use
6007 is safe.
6008
6009 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
6010 Warn for cases where adding an attribute may be beneficial. The
6011 attributes currently supported are listed below.
6012
6013 -Wsuggest-attribute=pure
6014 -Wsuggest-attribute=const
6015 -Wsuggest-attribute=noreturn
6016 -Wmissing-noreturn
6017 -Wsuggest-attribute=malloc
6018 Warn about functions that might be candidates for attributes
6019 "pure", "const" or "noreturn" or "malloc". The compiler only
6020 warns for functions visible in other compilation units or (in
6021 the case of "pure" and "const") if it cannot prove that the
6022 function returns normally. A function returns normally if it
6023 doesn't contain an infinite loop or return abnormally by
6024 throwing, calling "abort" or trapping. This analysis requires
6025 option -fipa-pure-const, which is enabled by default at -O and
6026 higher. Higher optimization levels improve the accuracy of the
6027 analysis.
6028
6029 -Wsuggest-attribute=format
6030 -Wmissing-format-attribute
6031 Warn about function pointers that might be candidates for
6032 "format" attributes. Note these are only possible candidates,
6033 not absolute ones. GCC guesses that function pointers with
6034 "format" attributes that are used in assignment,
6035 initialization, parameter passing or return statements should
6036 have a corresponding "format" attribute in the resulting type.
6037 I.e. the left-hand side of the assignment or initialization,
6038 the type of the parameter variable, or the return type of the
6039 containing function respectively should also have a "format"
6040 attribute to avoid the warning.
6041
6042 GCC also warns about function definitions that might be
6043 candidates for "format" attributes. Again, these are only
6044 possible candidates. GCC guesses that "format" attributes
6045 might be appropriate for any function that calls a function
6046 like "vprintf" or "vscanf", but this might not always be the
6047 case, and some functions for which "format" attributes are
6048 appropriate may not be detected.
6049
6050 -Wsuggest-attribute=cold
6051 Warn about functions that might be candidates for "cold"
6052 attribute. This is based on static detection and generally
6053 only warns about functions which always leads to a call to
6054 another "cold" function such as wrappers of C++ "throw" or
6055 fatal error reporting functions leading to "abort".
6056
6057 -Walloc-zero
6058 Warn about calls to allocation functions decorated with attribute
6059 "alloc_size" that specify zero bytes, including those to the built-
6060 in forms of the functions "aligned_alloc", "alloca", "calloc",
6061 "malloc", and "realloc". Because the behavior of these functions
6062 when called with a zero size differs among implementations (and in
6063 the case of "realloc" has been deprecated) relying on it may result
6064 in subtle portability bugs and should be avoided.
6065
6066 -Walloc-size-larger-than=byte-size
6067 Warn about calls to functions decorated with attribute "alloc_size"
6068 that attempt to allocate objects larger than the specified number
6069 of bytes, or where the result of the size computation in an integer
6070 type with infinite precision would exceed the value of PTRDIFF_MAX
6071 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
6072 default. Warnings controlled by the option can be disabled either
6073 by specifying byte-size of SIZE_MAX or more or by
6074 -Wno-alloc-size-larger-than.
6075
6076 -Wno-alloc-size-larger-than
6077 Disable -Walloc-size-larger-than= warnings. The option is
6078 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
6079
6080 -Walloca
6081 This option warns on all uses of "alloca" in the source.
6082
6083 -Walloca-larger-than=byte-size
6084 This option warns on calls to "alloca" with an integer argument
6085 whose value is either zero, or that is not bounded by a controlling
6086 predicate that limits its value to at most byte-size. It also
6087 warns for calls to "alloca" where the bound value is unknown.
6088 Arguments of non-integer types are considered unbounded even if
6089 they appear to be constrained to the expected range.
6090
6091 For example, a bounded case of "alloca" could be:
6092
6093 void func (size_t n)
6094 {
6095 void *p;
6096 if (n <= 1000)
6097 p = alloca (n);
6098 else
6099 p = malloc (n);
6100 f (p);
6101 }
6102
6103 In the above example, passing "-Walloca-larger-than=1000" would not
6104 issue a warning because the call to "alloca" is known to be at most
6105 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
6106 the compiler would emit a warning.
6107
6108 Unbounded uses, on the other hand, are uses of "alloca" with no
6109 controlling predicate constraining its integer argument. For
6110 example:
6111
6112 void func ()
6113 {
6114 void *p = alloca (n);
6115 f (p);
6116 }
6117
6118 If "-Walloca-larger-than=500" were passed, the above would trigger
6119 a warning, but this time because of the lack of bounds checking.
6120
6121 Note, that even seemingly correct code involving signed integers
6122 could cause a warning:
6123
6124 void func (signed int n)
6125 {
6126 if (n < 500)
6127 {
6128 p = alloca (n);
6129 f (p);
6130 }
6131 }
6132
6133 In the above example, n could be negative, causing a larger than
6134 expected argument to be implicitly cast into the "alloca" call.
6135
6136 This option also warns when "alloca" is used in a loop.
6137
6138 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
6139 usually only effective when -ftree-vrp is active (default for -O2
6140 and above).
6141
6142 See also -Wvla-larger-than=byte-size.
6143
6144 -Wno-alloca-larger-than
6145 Disable -Walloca-larger-than= warnings. The option is equivalent
6146 to -Walloca-larger-than=SIZE_MAX or larger.
6147
6148 -Warith-conversion
6149 Do warn about implicit conversions from arithmetic operations even
6150 when conversion of the operands to the same type cannot change
6151 their values. This affects warnings from -Wconversion,
6152 -Wfloat-conversion, and -Wsign-conversion.
6153
6154 void f (char c, int i)
6155 {
6156 c = c + i; // warns with B<-Wconversion>
6157 c = c + 1; // only warns with B<-Warith-conversion>
6158 }
6159
6160 -Warray-bounds
6161 -Warray-bounds=n
6162 Warn about out of bounds subscripts or offsets into arrays. This
6163 warning is enabled by -Wall. It is more effective when -ftree-vrp
6164 is active (the default for -O2 and above) but a subset of instances
6165 are issued even without optimization.
6166
6167 -Warray-bounds=1
6168 This is the default warning level of -Warray-bounds and is
6169 enabled by -Wall; higher levels are not, and must be explicitly
6170 requested.
6171
6172 -Warray-bounds=2
6173 This warning level also warns about out of bounds accesses to
6174 trailing struct members of one-element array types and about
6175 the intermediate results of pointer arithmetic that may yield
6176 out of bounds values. This warning level may give a larger
6177 number of false positives and is deactivated by default.
6178
6179 -Warray-compare
6180 Warn about equality and relational comparisons between two operands
6181 of array type. This comparison was deprecated in C++20. For
6182 example:
6183
6184 int arr1[5];
6185 int arr2[5];
6186 bool same = arr1 == arr2;
6187
6188 -Warray-compare is enabled by -Wall.
6189
6190 -Warray-parameter
6191 -Warray-parameter=n
6192 Warn about redeclarations of functions involving arguments of array
6193 or pointer types of inconsistent kinds or forms, and enable the
6194 detection of out-of-bounds accesses to such parameters by warnings
6195 such as -Warray-bounds.
6196
6197 If the first function declaration uses the array form the bound
6198 specified in the array is assumed to be the minimum number of
6199 elements expected to be provided in calls to the function and the
6200 maximum number of elements accessed by it. Failing to provide
6201 arguments of sufficient size or accessing more than the maximum
6202 number of elements may be diagnosed by warnings such as
6203 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
6204 involving array parameters declared using the "T[static N]" form.
6205
6206 For example, the warning triggers for the following redeclarations
6207 because the first one allows an array of any size to be passed to
6208 "f" while the second one with the keyword "static" specifies that
6209 the array argument must have at least four elements.
6210
6211 void f (int[static 4]);
6212 void f (int[]); // warning (inconsistent array form)
6213
6214 void g (void)
6215 {
6216 int *p = (int *)malloc (4);
6217 f (p); // warning (array too small)
6218 ...
6219 }
6220
6221 At level 2 the warning also triggers for redeclarations involving
6222 any other inconsistency in array or pointer argument forms denoting
6223 array sizes. Pointers and arrays of unspecified bound are
6224 considered equivalent and do not trigger a warning.
6225
6226 void g (int*);
6227 void g (int[]); // no warning
6228 void g (int[8]); // warning (inconsistent array bound)
6229
6230 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
6231 option triggers warnings for similar inconsistencies involving
6232 Variable Length Array arguments.
6233
6234 -Wattribute-alias=n
6235 -Wno-attribute-alias
6236 Warn about declarations using the "alias" and similar attributes
6237 whose target is incompatible with the type of the alias.
6238
6239 -Wattribute-alias=1
6240 The default warning level of the -Wattribute-alias option
6241 diagnoses incompatibilities between the type of the alias
6242 declaration and that of its target. Such incompatibilities are
6243 typically indicative of bugs.
6244
6245 -Wattribute-alias=2
6246 At this level -Wattribute-alias also diagnoses cases where the
6247 attributes of the alias declaration are more restrictive than
6248 the attributes applied to its target. These mismatches can
6249 potentially result in incorrect code generation. In other
6250 cases they may be benign and could be resolved simply by adding
6251 the missing attribute to the target. For comparison, see the
6252 -Wmissing-attributes option, which controls diagnostics when
6253 the alias declaration is less restrictive than the target,
6254 rather than more restrictive.
6255
6256 Attributes considered include "alloc_align", "alloc_size",
6257 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6258 "noreturn", "nothrow", "pure", "returns_nonnull", and
6259 "returns_twice".
6260
6261 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6262 the default. You can disable these warnings with either
6263 -Wno-attribute-alias or -Wattribute-alias=0.
6264
6265 -Wbidi-chars=[none|unpaired|any|ucn]
6266 Warn about possibly misleading UTF-8 bidirectional control
6267 characters in comments, string literals, character constants, and
6268 identifiers. Such characters can change left-to-right writing
6269 direction into right-to-left (and vice versa), which can cause
6270 confusion between the logical order and visual order. This may be
6271 dangerous; for instance, it may seem that a piece of code is not
6272 commented out, whereas it in fact is.
6273
6274 There are three levels of warning supported by GCC. The default is
6275 -Wbidi-chars=unpaired, which warns about improperly terminated bidi
6276 contexts. -Wbidi-chars=none turns the warning off.
6277 -Wbidi-chars=any warns about any use of bidirectional control
6278 characters.
6279
6280 By default, this warning does not warn about UCNs. It is, however,
6281 possible to turn on such checking by using
6282 -Wbidi-chars=unpaired,ucn or -Wbidi-chars=any,ucn. Using
6283 -Wbidi-chars=ucn is valid, and is equivalent to
6284 -Wbidi-chars=unpaired,ucn, if no previous -Wbidi-chars=any was
6285 specified.
6286
6287 -Wbool-compare
6288 Warn about boolean expression compared with an integer value
6289 different from "true"/"false". For instance, the following
6290 comparison is always false:
6291
6292 int n = 5;
6293 ...
6294 if ((n > 1) == 2) { ... }
6295
6296 This warning is enabled by -Wall.
6297
6298 -Wbool-operation
6299 Warn about suspicious operations on expressions of a boolean type.
6300 For instance, bitwise negation of a boolean is very likely a bug in
6301 the program. For C, this warning also warns about incrementing or
6302 decrementing a boolean, which rarely makes sense. (In C++,
6303 decrementing a boolean is always invalid. Incrementing a boolean
6304 is invalid in C++17, and deprecated otherwise.)
6305
6306 This warning is enabled by -Wall.
6307
6308 -Wduplicated-branches
6309 Warn when an if-else has identical branches. This warning detects
6310 cases like
6311
6312 if (p != NULL)
6313 return 0;
6314 else
6315 return 0;
6316
6317 It doesn't warn when both branches contain just a null statement.
6318 This warning also warn for conditional operators:
6319
6320 int i = x ? *p : *p;
6321
6322 -Wduplicated-cond
6323 Warn about duplicated conditions in an if-else-if chain. For
6324 instance, warn for the following code:
6325
6326 if (p->q != NULL) { ... }
6327 else if (p->q != NULL) { ... }
6328
6329 -Wframe-address
6330 Warn when the __builtin_frame_address or __builtin_return_address
6331 is called with an argument greater than 0. Such calls may return
6332 indeterminate values or crash the program. The warning is included
6333 in -Wall.
6334
6335 -Wno-discarded-qualifiers (C and Objective-C only)
6336 Do not warn if type qualifiers on pointers are being discarded.
6337 Typically, the compiler warns if a "const char *" variable is
6338 passed to a function that takes a "char *" parameter. This option
6339 can be used to suppress such a warning.
6340
6341 -Wno-discarded-array-qualifiers (C and Objective-C only)
6342 Do not warn if type qualifiers on arrays which are pointer targets
6343 are being discarded. Typically, the compiler warns if a "const int
6344 (*)[]" variable is passed to a function that takes a "int (*)[]"
6345 parameter. This option can be used to suppress such a warning.
6346
6347 -Wno-incompatible-pointer-types (C and Objective-C only)
6348 Do not warn when there is a conversion between pointers that have
6349 incompatible types. This warning is for cases not covered by
6350 -Wno-pointer-sign, which warns for pointer argument passing or
6351 assignment with different signedness.
6352
6353 -Wno-int-conversion (C and Objective-C only)
6354 Do not warn about incompatible integer to pointer and pointer to
6355 integer conversions. This warning is about implicit conversions;
6356 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6357 -Wno-pointer-to-int-cast may be used.
6358
6359 -Wzero-length-bounds
6360 Warn about accesses to elements of zero-length array members that
6361 might overlap other members of the same object. Declaring interior
6362 zero-length arrays is discouraged because accesses to them are
6363 undefined. See
6364
6365 For example, the first two stores in function "bad" are diagnosed
6366 because the array elements overlap the subsequent members "b" and
6367 "c". The third store is diagnosed by -Warray-bounds because it is
6368 beyond the bounds of the enclosing object.
6369
6370 struct X { int a[0]; int b, c; };
6371 struct X x;
6372
6373 void bad (void)
6374 {
6375 x.a[0] = 0; // -Wzero-length-bounds
6376 x.a[1] = 1; // -Wzero-length-bounds
6377 x.a[2] = 2; // -Warray-bounds
6378 }
6379
6380 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6381
6382 -Wno-div-by-zero
6383 Do not warn about compile-time integer division by zero. Floating-
6384 point division by zero is not warned about, as it can be a
6385 legitimate way of obtaining infinities and NaNs.
6386
6387 -Wsystem-headers
6388 Print warning messages for constructs found in system header files.
6389 Warnings from system headers are normally suppressed, on the
6390 assumption that they usually do not indicate real problems and
6391 would only make the compiler output harder to read. Using this
6392 command-line option tells GCC to emit warnings from system headers
6393 as if they occurred in user code. However, note that using -Wall
6394 in conjunction with this option does not warn about unknown pragmas
6395 in system headers---for that, -Wunknown-pragmas must also be used.
6396
6397 -Wtautological-compare
6398 Warn if a self-comparison always evaluates to true or false. This
6399 warning detects various mistakes such as:
6400
6401 int i = 1;
6402 ...
6403 if (i > i) { ... }
6404
6405 This warning also warns about bitwise comparisons that always
6406 evaluate to true or false, for instance:
6407
6408 if ((a & 16) == 10) { ... }
6409
6410 will always be false.
6411
6412 This warning is enabled by -Wall.
6413
6414 -Wtrampolines
6415 Warn about trampolines generated for pointers to nested functions.
6416 A trampoline is a small piece of data or code that is created at
6417 run time on the stack when the address of a nested function is
6418 taken, and is used to call the nested function indirectly. For
6419 some targets, it is made up of data only and thus requires no
6420 special treatment. But, for most targets, it is made up of code
6421 and thus requires the stack to be made executable in order for the
6422 program to work properly.
6423
6424 -Wfloat-equal
6425 Warn if floating-point values are used in equality comparisons.
6426
6427 The idea behind this is that sometimes it is convenient (for the
6428 programmer) to consider floating-point values as approximations to
6429 infinitely precise real numbers. If you are doing this, then you
6430 need to compute (by analyzing the code, or in some other way) the
6431 maximum or likely maximum error that the computation introduces,
6432 and allow for it when performing comparisons (and when producing
6433 output, but that's a different problem). In particular, instead of
6434 testing for equality, you should check to see whether the two
6435 values have ranges that overlap; and this is done with the
6436 relational operators, so equality comparisons are probably
6437 mistaken.
6438
6439 -Wtraditional (C and Objective-C only)
6440 Warn about certain constructs that behave differently in
6441 traditional and ISO C. Also warn about ISO C constructs that have
6442 no traditional C equivalent, and/or problematic constructs that
6443 should be avoided.
6444
6445 * Macro parameters that appear within string literals in the
6446 macro body. In traditional C macro replacement takes place
6447 within string literals, but in ISO C it does not.
6448
6449 * In traditional C, some preprocessor directives did not exist.
6450 Traditional preprocessors only considered a line to be a
6451 directive if the # appeared in column 1 on the line. Therefore
6452 -Wtraditional warns about directives that traditional C
6453 understands but ignores because the # does not appear as the
6454 first character on the line. It also suggests you hide
6455 directives like "#pragma" not understood by traditional C by
6456 indenting them. Some traditional implementations do not
6457 recognize "#elif", so this option suggests avoiding it
6458 altogether.
6459
6460 * A function-like macro that appears without arguments.
6461
6462 * The unary plus operator.
6463
6464 * The U integer constant suffix, or the F or L floating-point
6465 constant suffixes. (Traditional C does support the L suffix on
6466 integer constants.) Note, these suffixes appear in macros
6467 defined in the system headers of most modern systems, e.g. the
6468 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6469 code might normally lead to spurious warnings, however GCC's
6470 integrated preprocessor has enough context to avoid warning in
6471 these cases.
6472
6473 * A function declared external in one block and then used after
6474 the end of the block.
6475
6476 * A "switch" statement has an operand of type "long".
6477
6478 * A non-"static" function declaration follows a "static" one.
6479 This construct is not accepted by some traditional C compilers.
6480
6481 * The ISO type of an integer constant has a different width or
6482 signedness from its traditional type. This warning is only
6483 issued if the base of the constant is ten. I.e. hexadecimal or
6484 octal values, which typically represent bit patterns, are not
6485 warned about.
6486
6487 * Usage of ISO string concatenation is detected.
6488
6489 * Initialization of automatic aggregates.
6490
6491 * Identifier conflicts with labels. Traditional C lacks a
6492 separate namespace for labels.
6493
6494 * Initialization of unions. If the initializer is zero, the
6495 warning is omitted. This is done under the assumption that the
6496 zero initializer in user code appears conditioned on e.g.
6497 "__STDC__" to avoid missing initializer warnings and relies on
6498 default initialization to zero in the traditional C case.
6499
6500 * Conversions by prototypes between fixed/floating-point values
6501 and vice versa. The absence of these prototypes when compiling
6502 with traditional C causes serious problems. This is a subset
6503 of the possible conversion warnings; for the full set use
6504 -Wtraditional-conversion.
6505
6506 * Use of ISO C style function definitions. This warning
6507 intentionally is not issued for prototype declarations or
6508 variadic functions because these ISO C features appear in your
6509 code when using libiberty's traditional C compatibility macros,
6510 "PARAMS" and "VPARAMS". This warning is also bypassed for
6511 nested functions because that feature is already a GCC
6512 extension and thus not relevant to traditional C compatibility.
6513
6514 -Wtraditional-conversion (C and Objective-C only)
6515 Warn if a prototype causes a type conversion that is different from
6516 what would happen to the same argument in the absence of a
6517 prototype. This includes conversions of fixed point to floating
6518 and vice versa, and conversions changing the width or signedness of
6519 a fixed-point argument except when the same as the default
6520 promotion.
6521
6522 -Wdeclaration-after-statement (C and Objective-C only)
6523 Warn when a declaration is found after a statement in a block.
6524 This construct, known from C++, was introduced with ISO C99 and is
6525 by default allowed in GCC. It is not supported by ISO C90.
6526
6527 -Wshadow
6528 Warn whenever a local variable or type declaration shadows another
6529 variable, parameter, type, class member (in C++), or instance
6530 variable (in Objective-C) or whenever a built-in function is
6531 shadowed. Note that in C++, the compiler warns if a local variable
6532 shadows an explicit typedef, but not if it shadows a
6533 struct/class/enum. If this warning is enabled, it includes also
6534 all instances of local shadowing. This means that
6535 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6536 -Wshadow is used. Same as -Wshadow=global.
6537
6538 -Wno-shadow-ivar (Objective-C only)
6539 Do not warn whenever a local variable shadows an instance variable
6540 in an Objective-C method.
6541
6542 -Wshadow=global
6543 Warn for any shadowing. Same as -Wshadow.
6544
6545 -Wshadow=local
6546 Warn when a local variable shadows another local variable or
6547 parameter.
6548
6549 -Wshadow=compatible-local
6550 Warn when a local variable shadows another local variable or
6551 parameter whose type is compatible with that of the shadowing
6552 variable. In C++, type compatibility here means the type of the
6553 shadowing variable can be converted to that of the shadowed
6554 variable. The creation of this flag (in addition to
6555 -Wshadow=local) is based on the idea that when a local variable
6556 shadows another one of incompatible type, it is most likely
6557 intentional, not a bug or typo, as shown in the following example:
6558
6559 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6560 {
6561 for (int i = 0; i < N; ++i)
6562 {
6563 ...
6564 }
6565 ...
6566 }
6567
6568 Since the two variable "i" in the example above have incompatible
6569 types, enabling only -Wshadow=compatible-local does not emit a
6570 warning. Because their types are incompatible, if a programmer
6571 accidentally uses one in place of the other, type checking is
6572 expected to catch that and emit an error or warning. Use of this
6573 flag instead of -Wshadow=local can possibly reduce the number of
6574 warnings triggered by intentional shadowing. Note that this also
6575 means that shadowing "const char *i" by "char *i" does not emit a
6576 warning.
6577
6578 This warning is also enabled by -Wshadow=local.
6579
6580 -Wlarger-than=byte-size
6581 Warn whenever an object is defined whose size exceeds byte-size.
6582 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6583 controlled by the option can be disabled either by specifying byte-
6584 size of SIZE_MAX or more or by -Wno-larger-than.
6585
6586 Also warn for calls to bounded functions such as "memchr" or
6587 "strnlen" that specify a bound greater than the largest possible
6588 object, which is PTRDIFF_MAX bytes by default. These warnings can
6589 only be disabled by -Wno-larger-than.
6590
6591 -Wno-larger-than
6592 Disable -Wlarger-than= warnings. The option is equivalent to
6593 -Wlarger-than=SIZE_MAX or larger.
6594
6595 -Wframe-larger-than=byte-size
6596 Warn if the size of a function frame exceeds byte-size. The
6597 computation done to determine the stack frame size is approximate
6598 and not conservative. The actual requirements may be somewhat
6599 greater than byte-size even if you do not get a warning. In
6600 addition, any space allocated via "alloca", variable-length arrays,
6601 or related constructs is not included by the compiler when
6602 determining whether or not to issue a warning.
6603 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6604 controlled by the option can be disabled either by specifying byte-
6605 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6606
6607 -Wno-frame-larger-than
6608 Disable -Wframe-larger-than= warnings. The option is equivalent to
6609 -Wframe-larger-than=SIZE_MAX or larger.
6610
6611 -Wfree-nonheap-object
6612 Warn when attempting to deallocate an object that was either not
6613 allocated on the heap, or by using a pointer that was not returned
6614 from a prior call to the corresponding allocation function. For
6615 example, because the call to "stpcpy" returns a pointer to the
6616 terminating nul character and not to the beginning of the object,
6617 the call to "free" below is diagnosed.
6618
6619 void f (char *p)
6620 {
6621 p = stpcpy (p, "abc");
6622 // ...
6623 free (p); // warning
6624 }
6625
6626 -Wfree-nonheap-object is included in -Wall.
6627
6628 -Wstack-usage=byte-size
6629 Warn if the stack usage of a function might exceed byte-size. The
6630 computation done to determine the stack usage is conservative. Any
6631 space allocated via "alloca", variable-length arrays, or related
6632 constructs is included by the compiler when determining whether or
6633 not to issue a warning.
6634
6635 The message is in keeping with the output of -fstack-usage.
6636
6637 * If the stack usage is fully static but exceeds the specified
6638 amount, it's:
6639
6640 warning: stack usage is 1120 bytes
6641
6642 * If the stack usage is (partly) dynamic but bounded, it's:
6643
6644 warning: stack usage might be 1648 bytes
6645
6646 * If the stack usage is (partly) dynamic and not bounded, it's:
6647
6648 warning: stack usage might be unbounded
6649
6650 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
6651 controlled by the option can be disabled either by specifying byte-
6652 size of SIZE_MAX or more or by -Wno-stack-usage.
6653
6654 -Wno-stack-usage
6655 Disable -Wstack-usage= warnings. The option is equivalent to
6656 -Wstack-usage=SIZE_MAX or larger.
6657
6658 -Wunsafe-loop-optimizations
6659 Warn if the loop cannot be optimized because the compiler cannot
6660 assume anything on the bounds of the loop indices. With
6661 -funsafe-loop-optimizations warn if the compiler makes such
6662 assumptions.
6663
6664 -Wno-pedantic-ms-format (MinGW targets only)
6665 When used in combination with -Wformat and -pedantic without GNU
6666 extensions, this option disables the warnings about non-ISO
6667 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
6668 used on Windows targets, which depend on the MS runtime.
6669
6670 -Wpointer-arith
6671 Warn about anything that depends on the "size of" a function type
6672 or of "void". GNU C assigns these types a size of 1, for
6673 convenience in calculations with "void *" pointers and pointers to
6674 functions. In C++, warn also when an arithmetic operation involves
6675 "NULL". This warning is also enabled by -Wpedantic.
6676
6677 -Wno-pointer-compare
6678 Do not warn if a pointer is compared with a zero character
6679 constant. This usually means that the pointer was meant to be
6680 dereferenced. For example:
6681
6682 const char *p = foo ();
6683 if (p == '\0')
6684 return 42;
6685
6686 Note that the code above is invalid in C++11.
6687
6688 This warning is enabled by default.
6689
6690 -Wtsan
6691 Warn about unsupported features in ThreadSanitizer.
6692
6693 ThreadSanitizer does not support "std::atomic_thread_fence" and can
6694 report false positives.
6695
6696 This warning is enabled by default.
6697
6698 -Wtype-limits
6699 Warn if a comparison is always true or always false due to the
6700 limited range of the data type, but do not warn for constant
6701 expressions. For example, warn if an unsigned variable is compared
6702 against zero with "<" or ">=". This warning is also enabled by
6703 -Wextra.
6704
6705 -Wabsolute-value (C and Objective-C only)
6706 Warn for calls to standard functions that compute the absolute
6707 value of an argument when a more appropriate standard function is
6708 available. For example, calling "abs(3.14)" triggers the warning
6709 because the appropriate function to call to compute the absolute
6710 value of a double argument is "fabs". The option also triggers
6711 warnings when the argument in a call to such a function has an
6712 unsigned type. This warning can be suppressed with an explicit
6713 type cast and it is also enabled by -Wextra.
6714
6715 -Wcomment
6716 -Wcomments
6717 Warn whenever a comment-start sequence /* appears in a /* comment,
6718 or whenever a backslash-newline appears in a // comment. This
6719 warning is enabled by -Wall.
6720
6721 -Wtrigraphs
6722 Warn if any trigraphs are encountered that might change the meaning
6723 of the program. Trigraphs within comments are not warned about,
6724 except those that would form escaped newlines.
6725
6726 This option is implied by -Wall. If -Wall is not given, this
6727 option is still enabled unless trigraphs are enabled. To get
6728 trigraph conversion without warnings, but get the other -Wall
6729 warnings, use -trigraphs -Wall -Wno-trigraphs.
6730
6731 -Wundef
6732 Warn if an undefined identifier is evaluated in an "#if" directive.
6733 Such identifiers are replaced with zero.
6734
6735 -Wexpansion-to-defined
6736 Warn whenever defined is encountered in the expansion of a macro
6737 (including the case where the macro is expanded by an #if
6738 directive). Such usage is not portable. This warning is also
6739 enabled by -Wpedantic and -Wextra.
6740
6741 -Wunused-macros
6742 Warn about macros defined in the main file that are unused. A
6743 macro is used if it is expanded or tested for existence at least
6744 once. The preprocessor also warns if the macro has not been used
6745 at the time it is redefined or undefined.
6746
6747 Built-in macros, macros defined on the command line, and macros
6748 defined in include files are not warned about.
6749
6750 Note: If a macro is actually used, but only used in skipped
6751 conditional blocks, then the preprocessor reports it as unused. To
6752 avoid the warning in such a case, you might improve the scope of
6753 the macro's definition by, for example, moving it into the first
6754 skipped block. Alternatively, you could provide a dummy use with
6755 something like:
6756
6757 #if defined the_macro_causing_the_warning
6758 #endif
6759
6760 -Wno-endif-labels
6761 Do not warn whenever an "#else" or an "#endif" are followed by
6762 text. This sometimes happens in older programs with code of the
6763 form
6764
6765 #if FOO
6766 ...
6767 #else FOO
6768 ...
6769 #endif FOO
6770
6771 The second and third "FOO" should be in comments. This warning is
6772 on by default.
6773
6774 -Wbad-function-cast (C and Objective-C only)
6775 Warn when a function call is cast to a non-matching type. For
6776 example, warn if a call to a function returning an integer type is
6777 cast to a pointer type.
6778
6779 -Wc90-c99-compat (C and Objective-C only)
6780 Warn about features not present in ISO C90, but present in ISO C99.
6781 For instance, warn about use of variable length arrays, "long long"
6782 type, "bool" type, compound literals, designated initializers, and
6783 so on. This option is independent of the standards mode. Warnings
6784 are disabled in the expression that follows "__extension__".
6785
6786 -Wc99-c11-compat (C and Objective-C only)
6787 Warn about features not present in ISO C99, but present in ISO C11.
6788 For instance, warn about use of anonymous structures and unions,
6789 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
6790 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
6791 so on. This option is independent of the standards mode. Warnings
6792 are disabled in the expression that follows "__extension__".
6793
6794 -Wc11-c2x-compat (C and Objective-C only)
6795 Warn about features not present in ISO C11, but present in ISO C2X.
6796 For instance, warn about omitting the string in "_Static_assert",
6797 use of [[]] syntax for attributes, use of decimal floating-point
6798 types, and so on. This option is independent of the standards
6799 mode. Warnings are disabled in the expression that follows
6800 "__extension__".
6801
6802 -Wc++-compat (C and Objective-C only)
6803 Warn about ISO C constructs that are outside of the common subset
6804 of ISO C and ISO C++, e.g. request for implicit conversion from
6805 "void *" to a pointer to non-"void" type.
6806
6807 -Wc++11-compat (C++ and Objective-C++ only)
6808 Warn about C++ constructs whose meaning differs between ISO C++
6809 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
6810 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
6811 enabled by -Wall.
6812
6813 -Wc++14-compat (C++ and Objective-C++ only)
6814 Warn about C++ constructs whose meaning differs between ISO C++
6815 2011 and ISO C++ 2014. This warning is enabled by -Wall.
6816
6817 -Wc++17-compat (C++ and Objective-C++ only)
6818 Warn about C++ constructs whose meaning differs between ISO C++
6819 2014 and ISO C++ 2017. This warning is enabled by -Wall.
6820
6821 -Wc++20-compat (C++ and Objective-C++ only)
6822 Warn about C++ constructs whose meaning differs between ISO C++
6823 2017 and ISO C++ 2020. This warning is enabled by -Wall.
6824
6825 -Wno-c++11-extensions (C++ and Objective-C++ only)
6826 Do not warn about C++11 constructs in code being compiled using an
6827 older C++ standard. Even without this option, some C++11
6828 constructs will only be diagnosed if -Wpedantic is used.
6829
6830 -Wno-c++14-extensions (C++ and Objective-C++ only)
6831 Do not warn about C++14 constructs in code being compiled using an
6832 older C++ standard. Even without this option, some C++14
6833 constructs will only be diagnosed if -Wpedantic is used.
6834
6835 -Wno-c++17-extensions (C++ and Objective-C++ only)
6836 Do not warn about C++17 constructs in code being compiled using an
6837 older C++ standard. Even without this option, some C++17
6838 constructs will only be diagnosed if -Wpedantic is used.
6839
6840 -Wno-c++20-extensions (C++ and Objective-C++ only)
6841 Do not warn about C++20 constructs in code being compiled using an
6842 older C++ standard. Even without this option, some C++20
6843 constructs will only be diagnosed if -Wpedantic is used.
6844
6845 -Wno-c++23-extensions (C++ and Objective-C++ only)
6846 Do not warn about C++23 constructs in code being compiled using an
6847 older C++ standard. Even without this option, some C++23
6848 constructs will only be diagnosed if -Wpedantic is used.
6849
6850 -Wcast-qual
6851 Warn whenever a pointer is cast so as to remove a type qualifier
6852 from the target type. For example, warn if a "const char *" is
6853 cast to an ordinary "char *".
6854
6855 Also warn when making a cast that introduces a type qualifier in an
6856 unsafe way. For example, casting "char **" to "const char **" is
6857 unsafe, as in this example:
6858
6859 /* p is char ** value. */
6860 const char **q = (const char **) p;
6861 /* Assignment of readonly string to const char * is OK. */
6862 *q = "string";
6863 /* Now char** pointer points to read-only memory. */
6864 **p = 'b';
6865
6866 -Wcast-align
6867 Warn whenever a pointer is cast such that the required alignment of
6868 the target is increased. For example, warn if a "char *" is cast
6869 to an "int *" on machines where integers can only be accessed at
6870 two- or four-byte boundaries.
6871
6872 -Wcast-align=strict
6873 Warn whenever a pointer is cast such that the required alignment of
6874 the target is increased. For example, warn if a "char *" is cast
6875 to an "int *" regardless of the target machine.
6876
6877 -Wcast-function-type
6878 Warn when a function pointer is cast to an incompatible function
6879 pointer. In a cast involving function types with a variable
6880 argument list only the types of initial arguments that are provided
6881 are considered. Any parameter of pointer-type matches any other
6882 pointer-type. Any benign differences in integral types are
6883 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
6884 qualifiers are ignored. The function type "void (*) (void)" is
6885 special and matches everything, which can be used to suppress this
6886 warning. In a cast involving pointer to member types this warning
6887 warns whenever the type cast is changing the pointer to member
6888 type. This warning is enabled by -Wextra.
6889
6890 -Wwrite-strings
6891 When compiling C, give string constants the type "const
6892 char[length]" so that copying the address of one into a non-"const"
6893 "char *" pointer produces a warning. These warnings help you find
6894 at compile time code that can try to write into a string constant,
6895 but only if you have been very careful about using "const" in
6896 declarations and prototypes. Otherwise, it is just a nuisance.
6897 This is why we did not make -Wall request these warnings.
6898
6899 When compiling C++, warn about the deprecated conversion from
6900 string literals to "char *". This warning is enabled by default
6901 for C++ programs.
6902
6903 -Wclobbered
6904 Warn for variables that might be changed by "longjmp" or "vfork".
6905 This warning is also enabled by -Wextra.
6906
6907 -Wconversion
6908 Warn for implicit conversions that may alter a value. This includes
6909 conversions between real and integer, like "abs (x)" when "x" is
6910 "double"; conversions between signed and unsigned, like "unsigned
6911 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
6912 not warn for explicit casts like "abs ((int) x)" and "ui =
6913 (unsigned) -1", or if the value is not changed by the conversion
6914 like in "abs (2.0)". Warnings about conversions between signed and
6915 unsigned integers can be disabled by using -Wno-sign-conversion.
6916
6917 For C++, also warn for confusing overload resolution for user-
6918 defined conversions; and conversions that never use a type
6919 conversion operator: conversions to "void", the same type, a base
6920 class or a reference to them. Warnings about conversions between
6921 signed and unsigned integers are disabled by default in C++ unless
6922 -Wsign-conversion is explicitly enabled.
6923
6924 Warnings about conversion from arithmetic on a small type back to
6925 that type are only given with -Warith-conversion.
6926
6927 -Wdangling-else
6928 Warn about constructions where there may be confusion to which "if"
6929 statement an "else" branch belongs. Here is an example of such a
6930 case:
6931
6932 {
6933 if (a)
6934 if (b)
6935 foo ();
6936 else
6937 bar ();
6938 }
6939
6940 In C/C++, every "else" branch belongs to the innermost possible
6941 "if" statement, which in this example is "if (b)". This is often
6942 not what the programmer expected, as illustrated in the above
6943 example by indentation the programmer chose. When there is the
6944 potential for this confusion, GCC issues a warning when this flag
6945 is specified. To eliminate the warning, add explicit braces around
6946 the innermost "if" statement so there is no way the "else" can
6947 belong to the enclosing "if". The resulting code looks like this:
6948
6949 {
6950 if (a)
6951 {
6952 if (b)
6953 foo ();
6954 else
6955 bar ();
6956 }
6957 }
6958
6959 This warning is enabled by -Wparentheses.
6960
6961 -Wdangling-pointer
6962 -Wdangling-pointer=n
6963 Warn about uses of pointers (or C++ references) to objects with
6964 automatic storage duration after their lifetime has ended. This
6965 includes local variables declared in nested blocks, compound
6966 literals and other unnamed temporary objects. In addition, warn
6967 about storing the address of such objects in escaped pointers. The
6968 warning is enabled at all optimization levels but may yield
6969 different results with optimization than without.
6970
6971 -Wdangling-pointer=1
6972 At level 1 the warning diagnoses only unconditional uses of
6973 dangling pointers. For example
6974
6975 int f (int c1, int c2, x)
6976 {
6977 char *p = strchr ((char[]){ c1, c2 }, c3);
6978 return p ? *p : 'x'; // warning: dangling pointer to a compound literal
6979 }
6980
6981 In the following function the store of the address of the local
6982 variable "x" in the escaped pointer *p also triggers the
6983 warning.
6984
6985 void g (int **p)
6986 {
6987 int x = 7;
6988 *p = &x; // warning: storing the address of a local variable in *p
6989 }
6990
6991 -Wdangling-pointer=2
6992 At level 2, in addition to unconditional uses the warning also
6993 diagnoses conditional uses of dangling pointers.
6994
6995 For example, because the array a in the following function is
6996 out of scope when the pointer s that was set to point is used,
6997 the warning triggers at this level.
6998
6999 void f (char *s)
7000 {
7001 if (!s)
7002 {
7003 char a[12] = "tmpname";
7004 s = a;
7005 }
7006 strcat (s, ".tmp"); // warning: dangling pointer to a may be used
7007 ...
7008 }
7009
7010 -Wdangling-pointer=2 is included in -Wall.
7011
7012 -Wdate-time
7013 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
7014 encountered as they might prevent bit-wise-identical reproducible
7015 compilations.
7016
7017 -Wempty-body
7018 Warn if an empty body occurs in an "if", "else" or "do while"
7019 statement. This warning is also enabled by -Wextra.
7020
7021 -Wno-endif-labels
7022 Do not warn about stray tokens after "#else" and "#endif".
7023
7024 -Wenum-compare
7025 Warn about a comparison between values of different enumerated
7026 types. In C++ enumerated type mismatches in conditional
7027 expressions are also diagnosed and the warning is enabled by
7028 default. In C this warning is enabled by -Wall.
7029
7030 -Wenum-conversion
7031 Warn when a value of enumerated type is implicitly converted to a
7032 different enumerated type. This warning is enabled by -Wextra in
7033 C.
7034
7035 -Wjump-misses-init (C, Objective-C only)
7036 Warn if a "goto" statement or a "switch" statement jumps forward
7037 across the initialization of a variable, or jumps backward to a
7038 label after the variable has been initialized. This only warns
7039 about variables that are initialized when they are declared. This
7040 warning is only supported for C and Objective-C; in C++ this sort
7041 of branch is an error in any case.
7042
7043 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
7044 with the -Wno-jump-misses-init option.
7045
7046 -Wsign-compare
7047 Warn when a comparison between signed and unsigned values could
7048 produce an incorrect result when the signed value is converted to
7049 unsigned. In C++, this warning is also enabled by -Wall. In C, it
7050 is also enabled by -Wextra.
7051
7052 -Wsign-conversion
7053 Warn for implicit conversions that may change the sign of an
7054 integer value, like assigning a signed integer expression to an
7055 unsigned integer variable. An explicit cast silences the warning.
7056 In C, this option is enabled also by -Wconversion.
7057
7058 -Wfloat-conversion
7059 Warn for implicit conversions that reduce the precision of a real
7060 value. This includes conversions from real to integer, and from
7061 higher precision real to lower precision real values. This option
7062 is also enabled by -Wconversion.
7063
7064 -Wno-scalar-storage-order
7065 Do not warn on suspicious constructs involving reverse scalar
7066 storage order.
7067
7068 -Wsizeof-array-div
7069 Warn about divisions of two sizeof operators when the first one is
7070 applied to an array and the divisor does not equal the size of the
7071 array element. In such a case, the computation will not yield the
7072 number of elements in the array, which is likely what the user
7073 intended. This warning warns e.g. about
7074
7075 int fn ()
7076 {
7077 int arr[10];
7078 return sizeof (arr) / sizeof (short);
7079 }
7080
7081 This warning is enabled by -Wall.
7082
7083 -Wsizeof-pointer-div
7084 Warn for suspicious divisions of two sizeof expressions that divide
7085 the pointer size by the element size, which is the usual way to
7086 compute the array size but won't work out correctly with pointers.
7087 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
7088 "ptr" is not an array, but a pointer. This warning is enabled by
7089 -Wall.
7090
7091 -Wsizeof-pointer-memaccess
7092 Warn for suspicious length parameters to certain string and memory
7093 built-in functions if the argument uses "sizeof". This warning
7094 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
7095 is not an array, but a pointer, and suggests a possible fix, or
7096 about "memcpy (&foo, ptr, sizeof (&foo));".
7097 -Wsizeof-pointer-memaccess also warns about calls to bounded string
7098 copy functions like "strncat" or "strncpy" that specify as the
7099 bound a "sizeof" expression of the source array. For example, in
7100 the following function the call to "strncat" specifies the size of
7101 the source string as the bound. That is almost certainly a mistake
7102 and so the call is diagnosed.
7103
7104 void make_file (const char *name)
7105 {
7106 char path[PATH_MAX];
7107 strncpy (path, name, sizeof path - 1);
7108 strncat (path, ".text", sizeof ".text");
7109 ...
7110 }
7111
7112 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
7113
7114 -Wno-sizeof-array-argument
7115 Do not warn when the "sizeof" operator is applied to a parameter
7116 that is declared as an array in a function definition. This
7117 warning is enabled by default for C and C++ programs.
7118
7119 -Wmemset-elt-size
7120 Warn for suspicious calls to the "memset" built-in function, if the
7121 first argument references an array, and the third argument is a
7122 number equal to the number of elements, but not equal to the size
7123 of the array in memory. This indicates that the user has omitted a
7124 multiplication by the element size. This warning is enabled by
7125 -Wall.
7126
7127 -Wmemset-transposed-args
7128 Warn for suspicious calls to the "memset" built-in function where
7129 the second argument is not zero and the third argument is zero.
7130 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
7131 because "memset (buf, 0, sizeof buf)" was meant instead. The
7132 diagnostic is only emitted if the third argument is a literal zero.
7133 Otherwise, if it is an expression that is folded to zero, or a cast
7134 of zero to some type, it is far less likely that the arguments have
7135 been mistakenly transposed and no warning is emitted. This warning
7136 is enabled by -Wall.
7137
7138 -Waddress
7139 Warn about suspicious uses of address expressions. These include
7140 comparing the address of a function or a declared object to the
7141 null pointer constant such as in
7142
7143 void f (void);
7144 void g (void)
7145 {
7146 if (!func) // warning: expression evaluates to false
7147 abort ();
7148 }
7149
7150 comparisons of a pointer to a string literal, such as in
7151
7152 void f (const char *x)
7153 {
7154 if (x == "abc") // warning: expression evaluates to false
7155 puts ("equal");
7156 }
7157
7158 and tests of the results of pointer addition or subtraction for
7159 equality to null, such as in
7160
7161 void f (const int *p, int i)
7162 {
7163 return p + i == NULL;
7164 }
7165
7166 Such uses typically indicate a programmer error: the address of
7167 most functions and objects necessarily evaluates to true (the
7168 exception are weak symbols), so their use in a conditional might
7169 indicate missing parentheses in a function call or a missing
7170 dereference in an array expression. The subset of the warning for
7171 object pointers can be suppressed by casting the pointer operand to
7172 an integer type such as "inptr_t" or "uinptr_t". Comparisons
7173 against string literals result in unspecified behavior and are not
7174 portable, and suggest the intent was to call "strcmp". The warning
7175 is suppressed if the suspicious expression is the result of macro
7176 expansion. -Waddress warning is enabled by -Wall.
7177
7178 -Wno-address-of-packed-member
7179 Do not warn when the address of packed member of struct or union is
7180 taken, which usually results in an unaligned pointer value. This
7181 is enabled by default.
7182
7183 -Wlogical-op
7184 Warn about suspicious uses of logical operators in expressions.
7185 This includes using logical operators in contexts where a bit-wise
7186 operator is likely to be expected. Also warns when the operands of
7187 a logical operator are the same:
7188
7189 extern int a;
7190 if (a < 0 && a < 0) { ... }
7191
7192 -Wlogical-not-parentheses
7193 Warn about logical not used on the left hand side operand of a
7194 comparison. This option does not warn if the right operand is
7195 considered to be a boolean expression. Its purpose is to detect
7196 suspicious code like the following:
7197
7198 int a;
7199 ...
7200 if (!a > 1) { ... }
7201
7202 It is possible to suppress the warning by wrapping the LHS into
7203 parentheses:
7204
7205 if ((!a) > 1) { ... }
7206
7207 This warning is enabled by -Wall.
7208
7209 -Waggregate-return
7210 Warn if any functions that return structures or unions are defined
7211 or called. (In languages where you can return an array, this also
7212 elicits a warning.)
7213
7214 -Wno-aggressive-loop-optimizations
7215 Warn if in a loop with constant number of iterations the compiler
7216 detects undefined behavior in some statement during one or more of
7217 the iterations.
7218
7219 -Wno-attributes
7220 Do not warn if an unexpected "__attribute__" is used, such as
7221 unrecognized attributes, function attributes applied to variables,
7222 etc. This does not stop errors for incorrect use of supported
7223 attributes.
7224
7225 Additionally, using -Wno-attributes=, it is possible to suppress
7226 warnings about unknown scoped attributes (in C++11 and C2X). For
7227 example, -Wno-attributes=vendor::attr disables warning about the
7228 following declaration:
7229
7230 [[vendor::attr]] void f();
7231
7232 It is also possible to disable warning about all attributes in a
7233 namespace using -Wno-attributes=vendor:: which prevents warning
7234 about both of these declarations:
7235
7236 [[vendor::safe]] void f();
7237 [[vendor::unsafe]] void f2();
7238
7239 Note that -Wno-attributes= does not imply -Wno-attributes.
7240
7241 -Wno-builtin-declaration-mismatch
7242 Warn if a built-in function is declared with an incompatible
7243 signature or as a non-function, or when a built-in function
7244 declared with a type that does not include a prototype is called
7245 with arguments whose promoted types do not match those expected by
7246 the function. When -Wextra is specified, also warn when a built-in
7247 function that takes arguments is declared without a prototype. The
7248 -Wbuiltin-declaration-mismatch warning is enabled by default. To
7249 avoid the warning include the appropriate header to bring the
7250 prototypes of built-in functions into scope.
7251
7252 For example, the call to "memset" below is diagnosed by the warning
7253 because the function expects a value of type "size_t" as its
7254 argument but the type of 32 is "int". With -Wextra, the
7255 declaration of the function is diagnosed as well.
7256
7257 extern void* memset ();
7258 void f (void *d)
7259 {
7260 memset (d, '\0', 32);
7261 }
7262
7263 -Wno-builtin-macro-redefined
7264 Do not warn if certain built-in macros are redefined. This
7265 suppresses warnings for redefinition of "__TIMESTAMP__",
7266 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
7267
7268 -Wstrict-prototypes (C and Objective-C only)
7269 Warn if a function is declared or defined without specifying the
7270 argument types. (An old-style function definition is permitted
7271 without a warning if preceded by a declaration that specifies the
7272 argument types.)
7273
7274 -Wold-style-declaration (C and Objective-C only)
7275 Warn for obsolescent usages, according to the C Standard, in a
7276 declaration. For example, warn if storage-class specifiers like
7277 "static" are not the first things in a declaration. This warning
7278 is also enabled by -Wextra.
7279
7280 -Wold-style-definition (C and Objective-C only)
7281 Warn if an old-style function definition is used. A warning is
7282 given even if there is a previous prototype. A definition using ()
7283 is not considered an old-style definition in C2X mode, because it
7284 is equivalent to (void) in that case, but is considered an old-
7285 style definition for older standards.
7286
7287 -Wmissing-parameter-type (C and Objective-C only)
7288 A function parameter is declared without a type specifier in
7289 K&R-style functions:
7290
7291 void foo(bar) { }
7292
7293 This warning is also enabled by -Wextra.
7294
7295 -Wmissing-prototypes (C and Objective-C only)
7296 Warn if a global function is defined without a previous prototype
7297 declaration. This warning is issued even if the definition itself
7298 provides a prototype. Use this option to detect global functions
7299 that do not have a matching prototype declaration in a header file.
7300 This option is not valid for C++ because all function declarations
7301 provide prototypes and a non-matching declaration declares an
7302 overload rather than conflict with an earlier declaration. Use
7303 -Wmissing-declarations to detect missing declarations in C++.
7304
7305 -Wmissing-declarations
7306 Warn if a global function is defined without a previous
7307 declaration. Do so even if the definition itself provides a
7308 prototype. Use this option to detect global functions that are not
7309 declared in header files. In C, no warnings are issued for
7310 functions with previous non-prototype declarations; use
7311 -Wmissing-prototypes to detect missing prototypes. In C++, no
7312 warnings are issued for function templates, or for inline
7313 functions, or for functions in anonymous namespaces.
7314
7315 -Wmissing-field-initializers
7316 Warn if a structure's initializer has some fields missing. For
7317 example, the following code causes such a warning, because "x.h" is
7318 implicitly zero:
7319
7320 struct s { int f, g, h; };
7321 struct s x = { 3, 4 };
7322
7323 This option does not warn about designated initializers, so the
7324 following modification does not trigger a warning:
7325
7326 struct s { int f, g, h; };
7327 struct s x = { .f = 3, .g = 4 };
7328
7329 In C this option does not warn about the universal zero initializer
7330 { 0 }:
7331
7332 struct s { int f, g, h; };
7333 struct s x = { 0 };
7334
7335 Likewise, in C++ this option does not warn about the empty { }
7336 initializer, for example:
7337
7338 struct s { int f, g, h; };
7339 s x = { };
7340
7341 This warning is included in -Wextra. To get other -Wextra warnings
7342 without this one, use -Wextra -Wno-missing-field-initializers.
7343
7344 -Wno-missing-requires
7345 By default, the compiler warns about a concept-id appearing as a
7346 C++20 simple-requirement:
7347
7348 bool satisfied = requires { C<T> };
7349
7350 Here satisfied will be true if C<T> is a valid expression, which it
7351 is for all T. Presumably the user meant to write
7352
7353 bool satisfied = requires { requires C<T> };
7354
7355 so satisfied is only true if concept C is satisfied for type T.
7356
7357 This warning can be disabled with -Wno-missing-requires.
7358
7359 -Wno-missing-template-keyword
7360 The member access tokens ., -> and :: must be followed by the
7361 "template" keyword if the parent object is dependent and the member
7362 being named is a template.
7363
7364 template <class X>
7365 void DoStuff (X x)
7366 {
7367 x.template DoSomeOtherStuff<X>(); // Good.
7368 x.DoMoreStuff<X>(); // Warning, x is dependent.
7369 }
7370
7371 In rare cases it is possible to get false positives. To silence
7372 this, wrap the expression in parentheses. For example, the
7373 following is treated as a template, even where m and N are
7374 integers:
7375
7376 void NotATemplate (my_class t)
7377 {
7378 int N = 5;
7379
7380 bool test = t.m < N > (0); // Treated as a template.
7381 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
7382 }
7383
7384 This warning can be disabled with -Wno-missing-template-keyword.
7385
7386 -Wno-multichar
7387 Do not warn if a multicharacter constant ('FOOF') is used. Usually
7388 they indicate a typo in the user's code, as they have
7389 implementation-defined values, and should not be used in portable
7390 code.
7391
7392 -Wnormalized=[none|id|nfc|nfkc]
7393 In ISO C and ISO C++, two identifiers are different if they are
7394 different sequences of characters. However, sometimes when
7395 characters outside the basic ASCII character set are used, you can
7396 have two different character sequences that look the same. To
7397 avoid confusion, the ISO 10646 standard sets out some normalization
7398 rules which when applied ensure that two sequences that look the
7399 same are turned into the same sequence. GCC can warn you if you
7400 are using identifiers that have not been normalized; this option
7401 controls that warning.
7402
7403 There are four levels of warning supported by GCC. The default is
7404 -Wnormalized=nfc, which warns about any identifier that is not in
7405 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
7406 form for most uses. It is equivalent to -Wnormalized.
7407
7408 Unfortunately, there are some characters allowed in identifiers by
7409 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7410 identifiers. That is, there's no way to use these symbols in
7411 portable ISO C or C++ and have all your identifiers in NFC.
7412 -Wnormalized=id suppresses the warning for these characters. It is
7413 hoped that future versions of the standards involved will correct
7414 this, which is why this option is not the default.
7415
7416 You can switch the warning off for all characters by writing
7417 -Wnormalized=none or -Wno-normalized. You should only do this if
7418 you are using some other normalization scheme (like "D"), because
7419 otherwise you can easily create bugs that are literally impossible
7420 to see.
7421
7422 Some characters in ISO 10646 have distinct meanings but look
7423 identical in some fonts or display methodologies, especially once
7424 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7425 LATIN SMALL LETTER N", displays just like a regular "n" that has
7426 been placed in a superscript. ISO 10646 defines the NFKC
7427 normalization scheme to convert all these into a standard form as
7428 well, and GCC warns if your code is not in NFKC if you use
7429 -Wnormalized=nfkc. This warning is comparable to warning about
7430 every identifier that contains the letter O because it might be
7431 confused with the digit 0, and so is not the default, but may be
7432 useful as a local coding convention if the programming environment
7433 cannot be fixed to display these characters distinctly.
7434
7435 -Wno-attribute-warning
7436 Do not warn about usage of functions declared with "warning"
7437 attribute. By default, this warning is enabled.
7438 -Wno-attribute-warning can be used to disable the warning or
7439 -Wno-error=attribute-warning can be used to disable the error when
7440 compiled with -Werror flag.
7441
7442 -Wno-deprecated
7443 Do not warn about usage of deprecated features.
7444
7445 -Wno-deprecated-declarations
7446 Do not warn about uses of functions, variables, and types marked as
7447 deprecated by using the "deprecated" attribute.
7448
7449 -Wno-overflow
7450 Do not warn about compile-time overflow in constant expressions.
7451
7452 -Wno-odr
7453 Warn about One Definition Rule violations during link-time
7454 optimization. Enabled by default.
7455
7456 -Wopenacc-parallelism
7457 Warn about potentially suboptimal choices related to OpenACC
7458 parallelism.
7459
7460 -Wopenmp-simd
7461 Warn if the vectorizer cost model overrides the OpenMP simd
7462 directive set by user. The -fsimd-cost-model=unlimited option can
7463 be used to relax the cost model.
7464
7465 -Woverride-init (C and Objective-C only)
7466 Warn if an initialized field without side effects is overridden
7467 when using designated initializers.
7468
7469 This warning is included in -Wextra. To get other -Wextra warnings
7470 without this one, use -Wextra -Wno-override-init.
7471
7472 -Wno-override-init-side-effects (C and Objective-C only)
7473 Do not warn if an initialized field with side effects is overridden
7474 when using designated initializers. This warning is enabled by
7475 default.
7476
7477 -Wpacked
7478 Warn if a structure is given the packed attribute, but the packed
7479 attribute has no effect on the layout or size of the structure.
7480 Such structures may be mis-aligned for little benefit. For
7481 instance, in this code, the variable "f.x" in "struct bar" is
7482 misaligned even though "struct bar" does not itself have the packed
7483 attribute:
7484
7485 struct foo {
7486 int x;
7487 char a, b, c, d;
7488 } __attribute__((packed));
7489 struct bar {
7490 char z;
7491 struct foo f;
7492 };
7493
7494 -Wnopacked-bitfield-compat
7495 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7496 bit-fields of type "char". This was fixed in GCC 4.4 but the
7497 change can lead to differences in the structure layout. GCC
7498 informs you when the offset of such a field has changed in GCC 4.4.
7499 For example there is no longer a 4-bit padding between field "a"
7500 and "b" in this structure:
7501
7502 struct foo
7503 {
7504 char a:4;
7505 char b:8;
7506 } __attribute__ ((packed));
7507
7508 This warning is enabled by default. Use
7509 -Wno-packed-bitfield-compat to disable this warning.
7510
7511 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7512 Warn if a structure field with explicitly specified alignment in a
7513 packed struct or union is misaligned. For example, a warning will
7514 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7515 is less than 8", in this code:
7516
7517 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7518 struct __attribute__ ((packed)) S {
7519 struct S8 s8;
7520 };
7521
7522 This warning is enabled by -Wall.
7523
7524 -Wpadded
7525 Warn if padding is included in a structure, either to align an
7526 element of the structure or to align the whole structure.
7527 Sometimes when this happens it is possible to rearrange the fields
7528 of the structure to reduce the padding and so make the structure
7529 smaller.
7530
7531 -Wredundant-decls
7532 Warn if anything is declared more than once in the same scope, even
7533 in cases where multiple declaration is valid and changes nothing.
7534
7535 -Wrestrict
7536 Warn when an object referenced by a "restrict"-qualified parameter
7537 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7538 another argument, or when copies between such objects overlap. For
7539 example, the call to the "strcpy" function below attempts to
7540 truncate the string by replacing its initial characters with the
7541 last four. However, because the call writes the terminating NUL
7542 into "a[4]", the copies overlap and the call is diagnosed.
7543
7544 void foo (void)
7545 {
7546 char a[] = "abcd1234";
7547 strcpy (a, a + 4);
7548 ...
7549 }
7550
7551 The -Wrestrict option detects some instances of simple overlap even
7552 without optimization but works best at -O2 and above. It is
7553 included in -Wall.
7554
7555 -Wnested-externs (C and Objective-C only)
7556 Warn if an "extern" declaration is encountered within a function.
7557
7558 -Winline
7559 Warn if a function that is declared as inline cannot be inlined.
7560 Even with this option, the compiler does not warn about failures to
7561 inline functions declared in system headers.
7562
7563 The compiler uses a variety of heuristics to determine whether or
7564 not to inline a function. For example, the compiler takes into
7565 account the size of the function being inlined and the amount of
7566 inlining that has already been done in the current function.
7567 Therefore, seemingly insignificant changes in the source program
7568 can cause the warnings produced by -Winline to appear or disappear.
7569
7570 -Winterference-size
7571 Warn about use of C++17
7572 "std::hardware_destructive_interference_size" without specifying
7573 its value with --param destructive-interference-size. Also warn
7574 about questionable values for that option.
7575
7576 This variable is intended to be used for controlling class layout,
7577 to avoid false sharing in concurrent code:
7578
7579 struct independent_fields {
7580 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
7581 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
7582 };
7583
7584 Here one and two are intended to be far enough apart that stores to
7585 one won't require accesses to the other to reload the cache line.
7586
7587 By default, --param destructive-interference-size and --param
7588 constructive-interference-size are set based on the current -mtune
7589 option, typically to the L1 cache line size for the particular
7590 target CPU, sometimes to a range if tuning for a generic target.
7591 So all translation units that depend on ABI compatibility for the
7592 use of these variables must be compiled with the same -mtune (or
7593 -mcpu).
7594
7595 If ABI stability is important, such as if the use is in a header
7596 for a library, you should probably not use the hardware
7597 interference size variables at all. Alternatively, you can force a
7598 particular value with --param.
7599
7600 If you are confident that your use of the variable does not affect
7601 ABI outside a single build of your project, you can turn off the
7602 warning with -Wno-interference-size.
7603
7604 -Wint-in-bool-context
7605 Warn for suspicious use of integer values where boolean values are
7606 expected, such as conditional expressions (?:) using non-boolean
7607 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7608 Or left shifting of signed integers in boolean context, like "for
7609 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7610 regardless of the data type. This warning is enabled by -Wall.
7611
7612 -Wno-int-to-pointer-cast
7613 Suppress warnings from casts to pointer type of an integer of a
7614 different size. In C++, casting to a pointer type of smaller size
7615 is an error. Wint-to-pointer-cast is enabled by default.
7616
7617 -Wno-pointer-to-int-cast (C and Objective-C only)
7618 Suppress warnings from casts from a pointer to an integer type of a
7619 different size.
7620
7621 -Winvalid-pch
7622 Warn if a precompiled header is found in the search path but cannot
7623 be used.
7624
7625 -Wlong-long
7626 Warn if "long long" type is used. This is enabled by either
7627 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
7628 the warning messages, use -Wno-long-long.
7629
7630 -Wvariadic-macros
7631 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7632 alternate syntax is used in ISO C99 mode. This is enabled by
7633 either -Wpedantic or -Wtraditional. To inhibit the warning
7634 messages, use -Wno-variadic-macros.
7635
7636 -Wno-varargs
7637 Do not warn upon questionable usage of the macros used to handle
7638 variable arguments like "va_start". These warnings are enabled by
7639 default.
7640
7641 -Wvector-operation-performance
7642 Warn if vector operation is not implemented via SIMD capabilities
7643 of the architecture. Mainly useful for the performance tuning.
7644 Vector operation can be implemented "piecewise", which means that
7645 the scalar operation is performed on every vector element; "in
7646 parallel", which means that the vector operation is implemented
7647 using scalars of wider type, which normally is more performance
7648 efficient; and "as a single scalar", which means that vector fits
7649 into a scalar type.
7650
7651 -Wvla
7652 Warn if a variable-length array is used in the code. -Wno-vla
7653 prevents the -Wpedantic warning of the variable-length array.
7654
7655 -Wvla-larger-than=byte-size
7656 If this option is used, the compiler warns for declarations of
7657 variable-length arrays whose size is either unbounded, or bounded
7658 by an argument that allows the array size to exceed byte-size
7659 bytes. This is similar to how -Walloca-larger-than=byte-size
7660 works, but with variable-length arrays.
7661
7662 Note that GCC may optimize small variable-length arrays of a known
7663 value into plain arrays, so this warning may not get triggered for
7664 such arrays.
7665
7666 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
7667 typically only effective when -ftree-vrp is active (default for -O2
7668 and above).
7669
7670 See also -Walloca-larger-than=byte-size.
7671
7672 -Wno-vla-larger-than
7673 Disable -Wvla-larger-than= warnings. The option is equivalent to
7674 -Wvla-larger-than=SIZE_MAX or larger.
7675
7676 -Wvla-parameter
7677 Warn about redeclarations of functions involving arguments of
7678 Variable Length Array types of inconsistent kinds or forms, and
7679 enable the detection of out-of-bounds accesses to such parameters
7680 by warnings such as -Warray-bounds.
7681
7682 If the first function declaration uses the VLA form the bound
7683 specified in the array is assumed to be the minimum number of
7684 elements expected to be provided in calls to the function and the
7685 maximum number of elements accessed by it. Failing to provide
7686 arguments of sufficient size or accessing more than the maximum
7687 number of elements may be diagnosed.
7688
7689 For example, the warning triggers for the following redeclarations
7690 because the first one allows an array of any size to be passed to
7691 "f" while the second one specifies that the array argument must
7692 have at least "n" elements. In addition, calling "f" with the
7693 associated VLA bound parameter in excess of the actual VLA bound
7694 triggers a warning as well.
7695
7696 void f (int n, int[n]);
7697 void f (int, int[]); // warning: argument 2 previously declared as a VLA
7698
7699 void g (int n)
7700 {
7701 if (n > 4)
7702 return;
7703 int a[n];
7704 f (sizeof a, a); // warning: access to a by f may be out of bounds
7705 ...
7706 }
7707
7708 -Wvla-parameter is included in -Wall. The -Warray-parameter option
7709 triggers warnings for similar problems involving ordinary array
7710 arguments.
7711
7712 -Wvolatile-register-var
7713 Warn if a register variable is declared volatile. The volatile
7714 modifier does not inhibit all optimizations that may eliminate
7715 reads and/or writes to register variables. This warning is enabled
7716 by -Wall.
7717
7718 -Wdisabled-optimization
7719 Warn if a requested optimization pass is disabled. This warning
7720 does not generally indicate that there is anything wrong with your
7721 code; it merely indicates that GCC's optimizers are unable to
7722 handle the code effectively. Often, the problem is that your code
7723 is too big or too complex; GCC refuses to optimize programs when
7724 the optimization itself is likely to take inordinate amounts of
7725 time.
7726
7727 -Wpointer-sign (C and Objective-C only)
7728 Warn for pointer argument passing or assignment with different
7729 signedness. This option is only supported for C and Objective-C.
7730 It is implied by -Wall and by -Wpedantic, which can be disabled
7731 with -Wno-pointer-sign.
7732
7733 -Wstack-protector
7734 This option is only active when -fstack-protector is active. It
7735 warns about functions that are not protected against stack
7736 smashing.
7737
7738 -Woverlength-strings
7739 Warn about string constants that are longer than the "minimum
7740 maximum" length specified in the C standard. Modern compilers
7741 generally allow string constants that are much longer than the
7742 standard's minimum limit, but very portable programs should avoid
7743 using longer strings.
7744
7745 The limit applies after string constant concatenation, and does not
7746 count the trailing NUL. In C90, the limit was 509 characters; in
7747 C99, it was raised to 4095. C++98 does not specify a normative
7748 minimum maximum, so we do not diagnose overlength strings in C++.
7749
7750 This option is implied by -Wpedantic, and can be disabled with
7751 -Wno-overlength-strings.
7752
7753 -Wunsuffixed-float-constants (C and Objective-C only)
7754 Issue a warning for any floating constant that does not have a
7755 suffix. When used together with -Wsystem-headers it warns about
7756 such constants in system header files. This can be useful when
7757 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
7758 the decimal floating-point extension to C99.
7759
7760 -Wno-lto-type-mismatch
7761 During the link-time optimization, do not warn about type
7762 mismatches in global declarations from different compilation units.
7763 Requires -flto to be enabled. Enabled by default.
7764
7765 -Wno-designated-init (C and Objective-C only)
7766 Suppress warnings when a positional initializer is used to
7767 initialize a structure that has been marked with the
7768 "designated_init" attribute.
7769
7770 Options That Control Static Analysis
7771 -fanalyzer
7772 This option enables an static analysis of program flow which looks
7773 for "interesting" interprocedural paths through the code, and
7774 issues warnings for problems found on them.
7775
7776 This analysis is much more expensive than other GCC warnings.
7777
7778 Enabling this option effectively enables the following warnings:
7779
7780 -Wanalyzer-double-fclose -Wanalyzer-double-free
7781 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
7782 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
7783 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
7784 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
7785 -Wanalyzer-possible-null-dereference
7786 -Wanalyzer-shift-count-negative -Wanalyzer-shift-count-overflow
7787 -Wanalyzer-stale-setjmp-buffer
7788 -Wanalyzer-unsafe-call-within-signal-handler
7789 -Wanalyzer-use-after-free
7790 -Wanalyzer-use-of-pointer-in-stale-stack-frame
7791 -Wanalyzer-use-of-uninitialized-value -Wanalyzer-write-to-const
7792 -Wanalyzer-write-to-string-literal
7793
7794 This option is only available if GCC was configured with analyzer
7795 support enabled.
7796
7797 -Wanalyzer-too-complex
7798 If -fanalyzer is enabled, the analyzer uses various heuristics to
7799 attempt to explore the control flow and data flow in the program,
7800 but these can be defeated by sufficiently complicated code.
7801
7802 By default, the analysis silently stops if the code is too
7803 complicated for the analyzer to fully explore and it reaches an
7804 internal limit. The -Wanalyzer-too-complex option warns if this
7805 occurs.
7806
7807 -Wno-analyzer-double-fclose
7808 This warning requires -fanalyzer, which enables it; use
7809 -Wno-analyzer-double-fclose to disable it.
7810
7811 This diagnostic warns for paths through the code in which a "FILE
7812 *" can have "fclose" called on it more than once.
7813
7814 -Wno-analyzer-double-free
7815 This warning requires -fanalyzer, which enables it; use
7816 -Wno-analyzer-double-free to disable it.
7817
7818 This diagnostic warns for paths through the code in which a pointer
7819 can have a deallocator called on it more than once, either "free",
7820 or a deallocator referenced by attribute "malloc".
7821
7822 -Wno-analyzer-exposure-through-output-file
7823 This warning requires -fanalyzer, which enables it; use
7824 -Wno-analyzer-exposure-through-output-file to disable it.
7825
7826 This diagnostic warns for paths through the code in which a
7827 security-sensitive value is written to an output file (such as
7828 writing a password to a log file).
7829
7830 -Wno-analyzer-file-leak
7831 This warning requires -fanalyzer, which enables it; use
7832 -Wno-analyzer-file-leak to disable it.
7833
7834 This diagnostic warns for paths through the code in which a
7835 "<stdio.h>" "FILE *" stream object is leaked.
7836
7837 -Wno-analyzer-free-of-non-heap
7838 This warning requires -fanalyzer, which enables it; use
7839 -Wno-analyzer-free-of-non-heap to disable it.
7840
7841 This diagnostic warns for paths through the code in which "free" is
7842 called on a non-heap pointer (e.g. an on-stack buffer, or a
7843 global).
7844
7845 -Wno-analyzer-malloc-leak
7846 This warning requires -fanalyzer, which enables it; use
7847 -Wno-analyzer-malloc-leak to disable it.
7848
7849 This diagnostic warns for paths through the code in which a pointer
7850 allocated via an allocator is leaked: either "malloc", or a
7851 function marked with attribute "malloc".
7852
7853 -Wno-analyzer-mismatching-deallocation
7854 This warning requires -fanalyzer, which enables it; use
7855 -Wno-analyzer-mismatching-deallocation to disable it.
7856
7857 This diagnostic warns for paths through the code in which the wrong
7858 deallocation function is called on a pointer value, based on which
7859 function was used to allocate the pointer value. The diagnostic
7860 will warn about mismatches between "free", scalar "delete" and
7861 vector "delete[]", and those marked as allocator/deallocator pairs
7862 using attribute "malloc".
7863
7864 -Wno-analyzer-possible-null-argument
7865 This warning requires -fanalyzer, which enables it; use
7866 -Wno-analyzer-possible-null-argument to disable it.
7867
7868 This diagnostic warns for paths through the code in which a
7869 possibly-NULL value is passed to a function argument marked with
7870 "__attribute__((nonnull))" as requiring a non-NULL value.
7871
7872 -Wno-analyzer-possible-null-dereference
7873 This warning requires -fanalyzer, which enables it; use
7874 -Wno-analyzer-possible-null-dereference to disable it.
7875
7876 This diagnostic warns for paths through the code in which a
7877 possibly-NULL value is dereferenced.
7878
7879 -Wno-analyzer-null-argument
7880 This warning requires -fanalyzer, which enables it; use
7881 -Wno-analyzer-null-argument to disable it.
7882
7883 This diagnostic warns for paths through the code in which a value
7884 known to be NULL is passed to a function argument marked with
7885 "__attribute__((nonnull))" as requiring a non-NULL value.
7886
7887 -Wno-analyzer-null-dereference
7888 This warning requires -fanalyzer, which enables it; use
7889 -Wno-analyzer-null-dereference to disable it.
7890
7891 This diagnostic warns for paths through the code in which a value
7892 known to be NULL is dereferenced.
7893
7894 -Wno-analyzer-shift-count-negative
7895 This warning requires -fanalyzer, which enables it; use
7896 -Wno-analyzer-shift-count-negative to disable it.
7897
7898 This diagnostic warns for paths through the code in which a shift
7899 is attempted with a negative count. It is analogous to the
7900 -Wshift-count-negative diagnostic implemented in the C/C++ front
7901 ends, but is implemented based on analyzing interprocedural paths,
7902 rather than merely parsing the syntax tree. However, the analyzer
7903 does not prioritize detection of such paths, so false negatives are
7904 more likely relative to other warnings.
7905
7906 -Wno-analyzer-shift-count-overflow
7907 This warning requires -fanalyzer, which enables it; use
7908 -Wno-analyzer-shift-count-overflow to disable it.
7909
7910 This diagnostic warns for paths through the code in which a shift
7911 is attempted with a count greater than or equal to the precision of
7912 the operand's type. It is analogous to the -Wshift-count-overflow
7913 diagnostic implemented in the C/C++ front ends, but is implemented
7914 based on analyzing interprocedural paths, rather than merely
7915 parsing the syntax tree. However, the analyzer does not prioritize
7916 detection of such paths, so false negatives are more likely
7917 relative to other warnings.
7918
7919 -Wno-analyzer-stale-setjmp-buffer
7920 This warning requires -fanalyzer, which enables it; use
7921 -Wno-analyzer-stale-setjmp-buffer to disable it.
7922
7923 This diagnostic warns for paths through the code in which "longjmp"
7924 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
7925 function that has returned.
7926
7927 When "setjmp" is called on a "jmp_buf" to record a rewind location,
7928 it records the stack frame. The stack frame becomes invalid when
7929 the function containing the "setjmp" call returns. Attempting to
7930 rewind to it via "longjmp" would reference a stack frame that no
7931 longer exists, and likely lead to a crash (or worse).
7932
7933 -Wno-analyzer-tainted-allocation-size
7934 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7935 to enable it; use -Wno-analyzer-tainted-allocation-size to disable
7936 it.
7937
7938 This diagnostic warns for paths through the code in which a value
7939 that could be under an attacker's control is used as the size of an
7940 allocation without being sanitized, so that an attacker could
7941 inject an excessively large allocation and potentially cause a
7942 denial of service attack.
7943
7944 See @url{https://cwe.mitre.org/data/definitions/789.html, CWE-789:
7945 Memory Allocation with Excessive Size Value}.
7946
7947 -Wno-analyzer-tainted-array-index
7948 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7949 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
7950
7951 This diagnostic warns for paths through the code in which a value
7952 that could be under an attacker's control is used as the index of
7953 an array access without being sanitized, so that an attacker could
7954 inject an out-of-bounds access.
7955
7956 See @url{https://cwe.mitre.org/data/definitions/129.html, CWE-129:
7957 Improper Validation of Array Index}.
7958
7959 -Wno-analyzer-tainted-divisor
7960 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7961 to enable it; use -Wno-analyzer-tainted-divisor to disable it.
7962
7963 This diagnostic warns for paths through the code in which a value
7964 that could be under an attacker's control is used as the divisor in
7965 a division or modulus operation without being sanitized, so that an
7966 attacker could inject a division-by-zero.
7967
7968 -Wno-analyzer-tainted-offset
7969 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7970 to enable it; use -Wno-analyzer-tainted-offset to disable it.
7971
7972 This diagnostic warns for paths through the code in which a value
7973 that could be under an attacker's control is used as a pointer
7974 offset without being sanitized, so that an attacker could inject an
7975 out-of-bounds access.
7976
7977 See @url{https://cwe.mitre.org/data/definitions/823.html, CWE-823:
7978 Use of Out-of-range Pointer Offset}.
7979
7980 -Wno-analyzer-tainted-size
7981 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7982 to enable it; use -Wno-analyzer-tainted-size to disable it.
7983
7984 This diagnostic warns for paths through the code in which a value
7985 that could be under an attacker's control is used as the size of an
7986 operation such as "memset" without being sanitized, so that an
7987 attacker could inject an out-of-bounds access.
7988
7989 -Wno-analyzer-unsafe-call-within-signal-handler
7990 This warning requires -fanalyzer, which enables it; use
7991 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
7992
7993 This diagnostic warns for paths through the code in which a
7994 function known to be async-signal-unsafe (such as "fprintf") is
7995 called from a signal handler.
7996
7997 -Wno-analyzer-use-after-free
7998 This warning requires -fanalyzer, which enables it; use
7999 -Wno-analyzer-use-after-free to disable it.
8000
8001 This diagnostic warns for paths through the code in which a pointer
8002 is used after a deallocator is called on it: either "free", or a
8003 deallocator referenced by attribute "malloc".
8004
8005 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8006 This warning requires -fanalyzer, which enables it; use
8007 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
8008
8009 This diagnostic warns for paths through the code in which a pointer
8010 is dereferenced that points to a variable in a stale stack frame.
8011
8012 -Wno-analyzer-write-to-const
8013 This warning requires -fanalyzer, which enables it; use
8014 -Wno-analyzer-write-to-const to disable it.
8015
8016 This diagnostic warns for paths through the code in which the
8017 analyzer detects an attempt to write through a pointer to a "const"
8018 object. However, the analyzer does not prioritize detection of
8019 such paths, so false negatives are more likely relative to other
8020 warnings.
8021
8022 -Wno-analyzer-write-to-string-literal
8023 This warning requires -fanalyzer, which enables it; use
8024 -Wno-analyzer-write-to-string-literal to disable it.
8025
8026 This diagnostic warns for paths through the code in which the
8027 analyzer detects an attempt to write through a pointer to a string
8028 literal. However, the analyzer does not prioritize detection of
8029 such paths, so false negatives are more likely relative to other
8030 warnings.
8031
8032 -Wno-analyzer-use-of-uninitialized-value
8033 This warning requires -fanalyzer, which enables it; use
8034 -Wno-analyzer-use-of-uninitialized-value to disable it.
8035
8036 This diagnostic warns for paths through the code in which an
8037 uninitialized value is used.
8038
8039 Pertinent parameters for controlling the exploration are: --param
8040 analyzer-bb-explosion-factor=value, --param
8041 analyzer-max-enodes-per-program-point=value, --param
8042 analyzer-max-recursion-depth=value, and --param
8043 analyzer-min-snodes-for-call-summary=value.
8044
8045 The following options control the analyzer.
8046
8047 -fanalyzer-call-summaries
8048 Simplify interprocedural analysis by computing the effect of
8049 certain calls, rather than exploring all paths through the function
8050 from callsite to each possible return.
8051
8052 If enabled, call summaries are only used for functions with more
8053 than one call site, and that are sufficiently complicated (as per
8054 --param analyzer-min-snodes-for-call-summary=value).
8055
8056 -fanalyzer-checker=name
8057 Restrict the analyzer to run just the named checker, and enable it.
8058
8059 Some checkers are disabled by default (even with -fanalyzer), such
8060 as the "taint" checker that implements
8061 -Wanalyzer-tainted-array-index, and this option is required to
8062 enable them.
8063
8064 Note: currently, -fanalyzer-checker=taint disables the following
8065 warnings from -fanalyzer:
8066
8067 -Wanalyzer-double-fclose -Wanalyzer-double-free
8068 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
8069 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
8070 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
8071 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
8072 -Wanalyzer-possible-null-dereference
8073 -Wanalyzer-unsafe-call-within-signal-handler
8074 -Wanalyzer-use-after-free
8075
8076 -fno-analyzer-feasibility
8077 This option is intended for analyzer developers.
8078
8079 By default the analyzer verifies that there is a feasible control
8080 flow path for each diagnostic it emits: that the conditions that
8081 hold are not mutually exclusive. Diagnostics for which no feasible
8082 path can be found are rejected. This filtering can be suppressed
8083 with -fno-analyzer-feasibility, for debugging issues in this code.
8084
8085 -fanalyzer-fine-grained
8086 This option is intended for analyzer developers.
8087
8088 Internally the analyzer builds an "exploded graph" that combines
8089 control flow graphs with data flow information.
8090
8091 By default, an edge in this graph can contain the effects of a run
8092 of multiple statements within a basic block. With
8093 -fanalyzer-fine-grained, each statement gets its own edge.
8094
8095 -fanalyzer-show-duplicate-count
8096 This option is intended for analyzer developers: if multiple
8097 diagnostics have been detected as being duplicates of each other,
8098 it emits a note when reporting the best diagnostic, giving the
8099 number of additional diagnostics that were suppressed by the
8100 deduplication logic.
8101
8102 -fno-analyzer-state-merge
8103 This option is intended for analyzer developers.
8104
8105 By default the analyzer attempts to simplify analysis by merging
8106 sufficiently similar states at each program point as it builds its
8107 "exploded graph". With -fno-analyzer-state-merge this merging can
8108 be suppressed, for debugging state-handling issues.
8109
8110 -fno-analyzer-state-purge
8111 This option is intended for analyzer developers.
8112
8113 By default the analyzer attempts to simplify analysis by purging
8114 aspects of state at a program point that appear to no longer be
8115 relevant e.g. the values of locals that aren't accessed later in
8116 the function and which aren't relevant to leak analysis.
8117
8118 With -fno-analyzer-state-purge this purging of state can be
8119 suppressed, for debugging state-handling issues.
8120
8121 -fanalyzer-transitivity
8122 This option enables transitivity of constraints within the
8123 analyzer.
8124
8125 -fanalyzer-verbose-edges
8126 This option is intended for analyzer developers. It enables more
8127 verbose, lower-level detail in the descriptions of control flow
8128 within diagnostic paths.
8129
8130 -fanalyzer-verbose-state-changes
8131 This option is intended for analyzer developers. It enables more
8132 verbose, lower-level detail in the descriptions of events relating
8133 to state machines within diagnostic paths.
8134
8135 -fanalyzer-verbosity=level
8136 This option controls the complexity of the control flow paths that
8137 are emitted for analyzer diagnostics.
8138
8139 The level can be one of:
8140
8141 0 At this level, interprocedural call and return events are
8142 displayed, along with the most pertinent state-change events
8143 relating to a diagnostic. For example, for a double-"free"
8144 diagnostic, both calls to "free" will be shown.
8145
8146 1 As per the previous level, but also show events for the entry
8147 to each function.
8148
8149 2 As per the previous level, but also show events relating to
8150 control flow that are significant to triggering the issue (e.g.
8151 "true path taken" at a conditional).
8152
8153 This level is the default.
8154
8155 3 As per the previous level, but show all control flow events,
8156 not just significant ones.
8157
8158 4 This level is intended for analyzer developers; it adds various
8159 other events intended for debugging the analyzer.
8160
8161 -fdump-analyzer
8162 Dump internal details about what the analyzer is doing to
8163 file.analyzer.txt. This option is overridden by
8164 -fdump-analyzer-stderr.
8165
8166 -fdump-analyzer-stderr
8167 Dump internal details about what the analyzer is doing to stderr.
8168 This option overrides -fdump-analyzer.
8169
8170 -fdump-analyzer-callgraph
8171 Dump a representation of the call graph suitable for viewing with
8172 GraphViz to file.callgraph.dot.
8173
8174 -fdump-analyzer-exploded-graph
8175 Dump a representation of the "exploded graph" suitable for viewing
8176 with GraphViz to file.eg.dot. Nodes are color-coded based on
8177 state-machine states to emphasize state changes.
8178
8179 -fdump-analyzer-exploded-nodes
8180 Emit diagnostics showing where nodes in the "exploded graph" are in
8181 relation to the program source.
8182
8183 -fdump-analyzer-exploded-nodes-2
8184 Dump a textual representation of the "exploded graph" to
8185 file.eg.txt.
8186
8187 -fdump-analyzer-exploded-nodes-3
8188 Dump a textual representation of the "exploded graph" to one dump
8189 file per node, to file.eg-id.txt. This is typically a large number
8190 of dump files.
8191
8192 -fdump-analyzer-exploded-paths
8193 Dump a textual representation of the "exploded path" for each
8194 diagnostic to file.idx.kind.epath.txt.
8195
8196 -fdump-analyzer-feasibility
8197 Dump internal details about the analyzer's search for feasible
8198 paths. The details are written in a form suitable for viewing with
8199 GraphViz to filenames of the form file.*.fg.dot, file.*.tg.dot, and
8200 file.*.fpath.txt.
8201
8202 -fdump-analyzer-json
8203 Dump a compressed JSON representation of analyzer internals to
8204 file.analyzer.json.gz. The precise format is subject to change.
8205
8206 -fdump-analyzer-state-purge
8207 As per -fdump-analyzer-supergraph, dump a representation of the
8208 "supergraph" suitable for viewing with GraphViz, but annotate the
8209 graph with information on what state will be purged at each node.
8210 The graph is written to file.state-purge.dot.
8211
8212 -fdump-analyzer-supergraph
8213 Dump representations of the "supergraph" suitable for viewing with
8214 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
8215 These show all of the control flow graphs in the program, with
8216 interprocedural edges for calls and returns. The second dump
8217 contains annotations showing nodes in the "exploded graph" and
8218 diagnostics associated with them.
8219
8220 -fdump-analyzer-untracked
8221 Emit custom warnings with internal details intended for analyzer
8222 developers.
8223
8224 Options for Debugging Your Program
8225 To tell GCC to emit extra information for use by a debugger, in almost
8226 all cases you need only to add -g to your other options. Some debug
8227 formats can co-exist (like DWARF with CTF) when each of them is enabled
8228 explicitly by adding the respective command line option to your other
8229 options.
8230
8231 GCC allows you to use -g with -O. The shortcuts taken by optimized
8232 code may occasionally be surprising: some variables you declared may
8233 not exist at all; flow of control may briefly move where you did not
8234 expect it; some statements may not be executed because they compute
8235 constant results or their values are already at hand; some statements
8236 may execute in different places because they have been moved out of
8237 loops. Nevertheless it is possible to debug optimized output. This
8238 makes it reasonable to use the optimizer for programs that might have
8239 bugs.
8240
8241 If you are not using some other optimization option, consider using -Og
8242 with -g. With no -O option at all, some compiler passes that collect
8243 information useful for debugging do not run at all, so that -Og may
8244 result in a better debugging experience.
8245
8246 -g Produce debugging information in the operating system's native
8247 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
8248 debugging information.
8249
8250 On most systems that use stabs format, -g enables use of extra
8251 debugging information that only GDB can use; this extra information
8252 makes debugging work better in GDB but probably makes other
8253 debuggers crash or refuse to read the program. If you want to
8254 control for certain whether to generate the extra information, use
8255 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
8256
8257 -ggdb
8258 Produce debugging information for use by GDB. This means to use
8259 the most expressive format available (DWARF, stabs, or the native
8260 format if neither of those are supported), including GDB extensions
8261 if at all possible.
8262
8263 -gdwarf
8264 -gdwarf-version
8265 Produce debugging information in DWARF format (if that is
8266 supported). The value of version may be either 2, 3, 4 or 5; the
8267 default version for most targets is 5 (with the exception of
8268 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
8269 AIX, which defaults to version 4).
8270
8271 Note that with DWARF Version 2, some ports require and always use
8272 some non-conflicting DWARF 3 extensions in the unwind tables.
8273
8274 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
8275 maximum benefit. Version 5 requires GDB 8.0 or higher.
8276
8277 GCC no longer supports DWARF Version 1, which is substantially
8278 different than Version 2 and later. For historical reasons, some
8279 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
8280 reference to DWARF Version 2 in their names, but apply to all
8281 currently-supported versions of DWARF.
8282
8283 -gbtf
8284 Request BTF debug information. BTF is the default debugging format
8285 for the eBPF target. On other targets, like x86, BTF debug
8286 information can be generated along with DWARF debug information
8287 when both of the debug formats are enabled explicitly via their
8288 respective command line options.
8289
8290 -gctf
8291 -gctflevel
8292 Request CTF debug information and use level to specify how much CTF
8293 debug information should be produced. If -gctf is specified
8294 without a value for level, the default level of CTF debug
8295 information is 2.
8296
8297 CTF debug information can be generated along with DWARF debug
8298 information when both of the debug formats are enabled explicitly
8299 via their respective command line options.
8300
8301 Level 0 produces no CTF debug information at all. Thus, -gctf0
8302 negates -gctf.
8303
8304 Level 1 produces CTF information for tracebacks only. This
8305 includes callsite information, but does not include type
8306 information.
8307
8308 Level 2 produces type information for entities (functions, data
8309 objects etc.) at file-scope or global-scope only.
8310
8311 -gstabs
8312 Produce debugging information in stabs format (if that is
8313 supported), without GDB extensions. This is the format used by DBX
8314 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
8315 this option produces stabs debugging output that is not understood
8316 by DBX. On System V Release 4 systems this option requires the GNU
8317 assembler.
8318
8319 -gstabs+
8320 Produce debugging information in stabs format (if that is
8321 supported), using GNU extensions understood only by the GNU
8322 debugger (GDB). The use of these extensions is likely to make
8323 other debuggers crash or refuse to read the program.
8324
8325 -gxcoff
8326 Produce debugging information in XCOFF format (if that is
8327 supported). This is the format used by the DBX debugger on IBM
8328 RS/6000 systems.
8329
8330 -gxcoff+
8331 Produce debugging information in XCOFF format (if that is
8332 supported), using GNU extensions understood only by the GNU
8333 debugger (GDB). The use of these extensions is likely to make
8334 other debuggers crash or refuse to read the program, and may cause
8335 assemblers other than the GNU assembler (GAS) to fail with an
8336 error.
8337
8338 -gvms
8339 Produce debugging information in Alpha/VMS debug format (if that is
8340 supported). This is the format used by DEBUG on Alpha/VMS systems.
8341
8342 -glevel
8343 -ggdblevel
8344 -gstabslevel
8345 -gxcofflevel
8346 -gvmslevel
8347 Request debugging information and also use level to specify how
8348 much information. The default level is 2.
8349
8350 Level 0 produces no debug information at all. Thus, -g0 negates
8351 -g.
8352
8353 Level 1 produces minimal information, enough for making backtraces
8354 in parts of the program that you don't plan to debug. This
8355 includes descriptions of functions and external variables, and line
8356 number tables, but no information about local variables.
8357
8358 Level 3 includes extra information, such as all the macro
8359 definitions present in the program. Some debuggers support macro
8360 expansion when you use -g3.
8361
8362 If you use multiple -g options, with or without level numbers, the
8363 last such option is the one that is effective.
8364
8365 -gdwarf does not accept a concatenated debug level, to avoid
8366 confusion with -gdwarf-level. Instead use an additional -glevel
8367 option to change the debug level for DWARF.
8368
8369 -fno-eliminate-unused-debug-symbols
8370 By default, no debug information is produced for symbols that are
8371 not actually used. Use this option if you want debug information
8372 for all symbols.
8373
8374 -femit-class-debug-always
8375 Instead of emitting debugging information for a C++ class in only
8376 one object file, emit it in all object files using the class. This
8377 option should be used only with debuggers that are unable to handle
8378 the way GCC normally emits debugging information for classes
8379 because using this option increases the size of debugging
8380 information by as much as a factor of two.
8381
8382 -fno-merge-debug-strings
8383 Direct the linker to not merge together strings in the debugging
8384 information that are identical in different object files. Merging
8385 is not supported by all assemblers or linkers. Merging decreases
8386 the size of the debug information in the output file at the cost of
8387 increasing link processing time. Merging is enabled by default.
8388
8389 -fdebug-prefix-map=old=new
8390 When compiling files residing in directory old, record debugging
8391 information describing them as if the files resided in directory
8392 new instead. This can be used to replace a build-time path with an
8393 install-time path in the debug info. It can also be used to change
8394 an absolute path to a relative path by using . for new. This can
8395 give more reproducible builds, which are location independent, but
8396 may require an extra command to tell GDB where to find the source
8397 files. See also -ffile-prefix-map.
8398
8399 -fvar-tracking
8400 Run variable tracking pass. It computes where variables are stored
8401 at each position in code. Better debugging information is then
8402 generated (if the debugging information format supports this
8403 information).
8404
8405 It is enabled by default when compiling with optimization (-Os, -O,
8406 -O2, ...), debugging information (-g) and the debug info format
8407 supports it.
8408
8409 -fvar-tracking-assignments
8410 Annotate assignments to user variables early in the compilation and
8411 attempt to carry the annotations over throughout the compilation
8412 all the way to the end, in an attempt to improve debug information
8413 while optimizing. Use of -gdwarf-4 is recommended along with it.
8414
8415 It can be enabled even if var-tracking is disabled, in which case
8416 annotations are created and maintained, but discarded at the end.
8417 By default, this flag is enabled together with -fvar-tracking,
8418 except when selective scheduling is enabled.
8419
8420 -gsplit-dwarf
8421 If DWARF debugging information is enabled, separate as much
8422 debugging information as possible into a separate output file with
8423 the extension .dwo. This option allows the build system to avoid
8424 linking files with debug information. To be useful, this option
8425 requires a debugger capable of reading .dwo files.
8426
8427 -gdwarf32
8428 -gdwarf64
8429 If DWARF debugging information is enabled, the -gdwarf32 selects
8430 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
8431 format. The default is target specific, on most targets it is
8432 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
8433 support more than 2GiB of debug information in any of the DWARF
8434 debug information sections. The 64-bit DWARF format allows larger
8435 debug information and might not be well supported by all consumers
8436 yet.
8437
8438 -gdescribe-dies
8439 Add description attributes to some DWARF DIEs that have no name
8440 attribute, such as artificial variables, external references and
8441 call site parameter DIEs.
8442
8443 -gpubnames
8444 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
8445
8446 -ggnu-pubnames
8447 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
8448 format suitable for conversion into a GDB index. This option is
8449 only useful with a linker that can produce GDB index version 7.
8450
8451 -fdebug-types-section
8452 When using DWARF Version 4 or higher, type DIEs can be put into
8453 their own ".debug_types" section instead of making them part of the
8454 ".debug_info" section. It is more efficient to put them in a
8455 separate comdat section since the linker can then remove
8456 duplicates. But not all DWARF consumers support ".debug_types"
8457 sections yet and on some objects ".debug_types" produces larger
8458 instead of smaller debugging information.
8459
8460 -grecord-gcc-switches
8461 -gno-record-gcc-switches
8462 This switch causes the command-line options used to invoke the
8463 compiler that may affect code generation to be appended to the
8464 DW_AT_producer attribute in DWARF debugging information. The
8465 options are concatenated with spaces separating them from each
8466 other and from the compiler version. It is enabled by default.
8467 See also -frecord-gcc-switches for another way of storing compiler
8468 options into the object file.
8469
8470 -gstrict-dwarf
8471 Disallow using extensions of later DWARF standard version than
8472 selected with -gdwarf-version. On most targets using non-
8473 conflicting DWARF extensions from later standard versions is
8474 allowed.
8475
8476 -gno-strict-dwarf
8477 Allow using extensions of later DWARF standard version than
8478 selected with -gdwarf-version.
8479
8480 -gas-loc-support
8481 Inform the compiler that the assembler supports ".loc" directives.
8482 It may then use them for the assembler to generate DWARF2+ line
8483 number tables.
8484
8485 This is generally desirable, because assembler-generated line-
8486 number tables are a lot more compact than those the compiler can
8487 generate itself.
8488
8489 This option will be enabled by default if, at GCC configure time,
8490 the assembler was found to support such directives.
8491
8492 -gno-as-loc-support
8493 Force GCC to generate DWARF2+ line number tables internally, if
8494 DWARF2+ line number tables are to be generated.
8495
8496 -gas-locview-support
8497 Inform the compiler that the assembler supports "view" assignment
8498 and reset assertion checking in ".loc" directives.
8499
8500 This option will be enabled by default if, at GCC configure time,
8501 the assembler was found to support them.
8502
8503 -gno-as-locview-support
8504 Force GCC to assign view numbers internally, if
8505 -gvariable-location-views are explicitly requested.
8506
8507 -gcolumn-info
8508 -gno-column-info
8509 Emit location column information into DWARF debugging information,
8510 rather than just file and line. This option is enabled by default.
8511
8512 -gstatement-frontiers
8513 -gno-statement-frontiers
8514 This option causes GCC to create markers in the internal
8515 representation at the beginning of statements, and to keep them
8516 roughly in place throughout compilation, using them to guide the
8517 output of "is_stmt" markers in the line number table. This is
8518 enabled by default when compiling with optimization (-Os, -O1, -O2,
8519 ...), and outputting DWARF 2 debug information at the normal level.
8520
8521 -gvariable-location-views
8522 -gvariable-location-views=incompat5
8523 -gno-variable-location-views
8524 Augment variable location lists with progressive view numbers
8525 implied from the line number table. This enables debug information
8526 consumers to inspect state at certain points of the program, even
8527 if no instructions associated with the corresponding source
8528 locations are present at that point. If the assembler lacks
8529 support for view numbers in line number tables, this will cause the
8530 compiler to emit the line number table, which generally makes them
8531 somewhat less compact. The augmented line number tables and
8532 location lists are fully backward-compatible, so they can be
8533 consumed by debug information consumers that are not aware of these
8534 augmentations, but they won't derive any benefit from them either.
8535
8536 This is enabled by default when outputting DWARF 2 debug
8537 information at the normal level, as long as there is assembler
8538 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
8539 is not. When assembler support is not available, this may still be
8540 enabled, but it will force GCC to output internal line number
8541 tables, and if -ginternal-reset-location-views is not enabled, that
8542 will most certainly lead to silently mismatching location views.
8543
8544 There is a proposed representation for view numbers that is not
8545 backward compatible with the location list format introduced in
8546 DWARF 5, that can be enabled with
8547 -gvariable-location-views=incompat5. This option may be removed in
8548 the future, is only provided as a reference implementation of the
8549 proposed representation. Debug information consumers are not
8550 expected to support this extended format, and they would be
8551 rendered unable to decode location lists using it.
8552
8553 -ginternal-reset-location-views
8554 -gno-internal-reset-location-views
8555 Attempt to determine location views that can be omitted from
8556 location view lists. This requires the compiler to have very
8557 accurate insn length estimates, which isn't always the case, and it
8558 may cause incorrect view lists to be generated silently when using
8559 an assembler that does not support location view lists. The GNU
8560 assembler will flag any such error as a "view number mismatch".
8561 This is only enabled on ports that define a reliable estimation
8562 function.
8563
8564 -ginline-points
8565 -gno-inline-points
8566 Generate extended debug information for inlined functions.
8567 Location view tracking markers are inserted at inlined entry
8568 points, so that address and view numbers can be computed and output
8569 in debug information. This can be enabled independently of
8570 location views, in which case the view numbers won't be output, but
8571 it can only be enabled along with statement frontiers, and it is
8572 only enabled by default if location views are enabled.
8573
8574 -gz[=type]
8575 Produce compressed debug sections in DWARF format, if that is
8576 supported. If type is not given, the default type depends on the
8577 capabilities of the assembler and linker used. type may be one of
8578 none (don't compress debug sections), zlib (use zlib compression in
8579 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8580 GNU format). If the linker doesn't support writing compressed
8581 debug sections, the option is rejected. Otherwise, if the
8582 assembler does not support them, -gz is silently ignored when
8583 producing object files.
8584
8585 -femit-struct-debug-baseonly
8586 Emit debug information for struct-like types only when the base
8587 name of the compilation source file matches the base name of file
8588 in which the struct is defined.
8589
8590 This option substantially reduces the size of debugging
8591 information, but at significant potential loss in type information
8592 to the debugger. See -femit-struct-debug-reduced for a less
8593 aggressive option. See -femit-struct-debug-detailed for more
8594 detailed control.
8595
8596 This option works only with DWARF debug output.
8597
8598 -femit-struct-debug-reduced
8599 Emit debug information for struct-like types only when the base
8600 name of the compilation source file matches the base name of file
8601 in which the type is defined, unless the struct is a template or
8602 defined in a system header.
8603
8604 This option significantly reduces the size of debugging
8605 information, with some potential loss in type information to the
8606 debugger. See -femit-struct-debug-baseonly for a more aggressive
8607 option. See -femit-struct-debug-detailed for more detailed
8608 control.
8609
8610 This option works only with DWARF debug output.
8611
8612 -femit-struct-debug-detailed[=spec-list]
8613 Specify the struct-like types for which the compiler generates
8614 debug information. The intent is to reduce duplicate struct debug
8615 information between different object files within the same program.
8616
8617 This option is a detailed version of -femit-struct-debug-reduced
8618 and -femit-struct-debug-baseonly, which serves for most needs.
8619
8620 A specification has the
8621 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8622
8623 The optional first word limits the specification to structs that
8624 are used directly (dir:) or used indirectly (ind:). A struct type
8625 is used directly when it is the type of a variable, member.
8626 Indirect uses arise through pointers to structs. That is, when use
8627 of an incomplete struct is valid, the use is indirect. An example
8628 is struct one direct; struct two * indirect;.
8629
8630 The optional second word limits the specification to ordinary
8631 structs (ord:) or generic structs (gen:). Generic structs are a
8632 bit complicated to explain. For C++, these are non-explicit
8633 specializations of template classes, or non-template classes within
8634 the above. Other programming languages have generics, but
8635 -femit-struct-debug-detailed does not yet implement them.
8636
8637 The third word specifies the source files for those structs for
8638 which the compiler should emit debug information. The values none
8639 and any have the normal meaning. The value base means that the
8640 base of name of the file in which the type declaration appears must
8641 match the base of the name of the main compilation file. In
8642 practice, this means that when compiling foo.c, debug information
8643 is generated for types declared in that file and foo.h, but not
8644 other header files. The value sys means those types satisfying
8645 base or declared in system or compiler headers.
8646
8647 You may need to experiment to determine the best settings for your
8648 application.
8649
8650 The default is -femit-struct-debug-detailed=all.
8651
8652 This option works only with DWARF debug output.
8653
8654 -fno-dwarf2-cfi-asm
8655 Emit DWARF unwind info as compiler generated ".eh_frame" section
8656 instead of using GAS ".cfi_*" directives.
8657
8658 -fno-eliminate-unused-debug-types
8659 Normally, when producing DWARF output, GCC avoids producing debug
8660 symbol output for types that are nowhere used in the source file
8661 being compiled. Sometimes it is useful to have GCC emit debugging
8662 information for all types declared in a compilation unit,
8663 regardless of whether or not they are actually used in that
8664 compilation unit, for example if, in the debugger, you want to cast
8665 a value to a type that is not actually used in your program (but is
8666 declared). More often, however, this results in a significant
8667 amount of wasted space.
8668
8669 Options That Control Optimization
8670 These options control various sorts of optimizations.
8671
8672 Without any optimization option, the compiler's goal is to reduce the
8673 cost of compilation and to make debugging produce the expected results.
8674 Statements are independent: if you stop the program with a breakpoint
8675 between statements, you can then assign a new value to any variable or
8676 change the program counter to any other statement in the function and
8677 get exactly the results you expect from the source code.
8678
8679 Turning on optimization flags makes the compiler attempt to improve the
8680 performance and/or code size at the expense of compilation time and
8681 possibly the ability to debug the program.
8682
8683 The compiler performs optimization based on the knowledge it has of the
8684 program. Compiling multiple files at once to a single output file mode
8685 allows the compiler to use information gained from all of the files
8686 when compiling each of them.
8687
8688 Not all optimizations are controlled directly by a flag. Only
8689 optimizations that have a flag are listed in this section.
8690
8691 Most optimizations are completely disabled at -O0 or if an -O level is
8692 not set on the command line, even if individual optimization flags are
8693 specified. Similarly, -Og suppresses many optimization passes.
8694
8695 Depending on the target and how GCC was configured, a slightly
8696 different set of optimizations may be enabled at each -O level than
8697 those listed here. You can invoke GCC with -Q --help=optimizers to
8698 find out the exact set of optimizations that are enabled at each level.
8699
8700 -O
8701 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8702 lot more memory for a large function.
8703
8704 With -O, the compiler tries to reduce code size and execution time,
8705 without performing any optimizations that take a great deal of
8706 compilation time.
8707
8708 -O turns on the following optimization flags:
8709
8710 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8711 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8712 -fdse -fforward-propagate -fguess-branch-probability
8713 -fif-conversion -fif-conversion2 -finline-functions-called-once
8714 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8715 -fipa-reference-addressable -fmerge-constants
8716 -fmove-loop-invariants -fmove-loop-stores -fomit-frame-pointer
8717 -freorder-blocks -fshrink-wrap -fshrink-wrap-separate
8718 -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp
8719 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
8720 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
8721 -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink
8722 -ftree-slsr -ftree-sra -ftree-ter -funit-at-a-time
8723
8724 -O2 Optimize even more. GCC performs nearly all supported
8725 optimizations that do not involve a space-speed tradeoff. As
8726 compared to -O, this option increases both compilation time and the
8727 performance of the generated code.
8728
8729 -O2 turns on all optimization flags specified by -O1. It also
8730 turns on the following optimization flags:
8731
8732 -falign-functions -falign-jumps -falign-labels -falign-loops
8733 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8734 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8735 -fdevirtualize-speculatively -fexpensive-optimizations
8736 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8737 -finline-functions -finline-small-functions -findirect-inlining
8738 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8739 -fisolate-erroneous-paths-dereference -flra-remat
8740 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8741 -fpeephole2 -freorder-blocks-algorithm=stc
8742 -freorder-blocks-and-partition -freorder-functions
8743 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8744 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8745 -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize
8746 -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion
8747 -ftree-tail-merge -ftree-vrp -fvect-cost-model=very-cheap
8748
8749 Please note the warning under -fgcse about invoking -O2 on programs
8750 that use computed gotos.
8751
8752 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8753 and also turns on the following optimization flags:
8754
8755 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8756 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8757 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8758 -ftree-partial-pre -funswitch-loops -fvect-cost-model=dynamic
8759 -fversion-loops-for-strides
8760
8761 -O0 Reduce compilation time and make debugging produce the expected
8762 results. This is the default.
8763
8764 -Os Optimize for size. -Os enables all -O2 optimizations except those
8765 that often increase code size:
8766
8767 -falign-functions -falign-jumps -falign-labels -falign-loops
8768 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8769
8770 It also enables -finline-functions, causes the compiler to tune for
8771 code size rather than execution speed, and performs further
8772 optimizations designed to reduce code size.
8773
8774 -Ofast
8775 Disregard strict standards compliance. -Ofast enables all -O3
8776 optimizations. It also enables optimizations that are not valid
8777 for all standard-compliant programs. It turns on -ffast-math,
8778 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8779 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8780 It turns off -fsemantic-interposition.
8781
8782 -Og Optimize debugging experience. -Og should be the optimization
8783 level of choice for the standard edit-compile-debug cycle, offering
8784 a reasonable level of optimization while maintaining fast
8785 compilation and a good debugging experience. It is a better choice
8786 than -O0 for producing debuggable code because some compiler passes
8787 that collect debug information are disabled at -O0.
8788
8789 Like -O0, -Og completely disables a number of optimization passes
8790 so that individual options controlling them have no effect.
8791 Otherwise -Og enables all -O1 optimization flags except for those
8792 that may interfere with debugging:
8793
8794 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8795 -fif-conversion2 -finline-functions-called-once
8796 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
8797 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra
8798
8799 -Oz Optimize aggressively for size rather than speed. This may
8800 increase the number of instructions executed if those instructions
8801 require fewer bytes to encode. -Oz behaves similarly to -Os
8802 including enabling most -O2 optimizations.
8803
8804 If you use multiple -O options, with or without level numbers, the last
8805 such option is the one that is effective.
8806
8807 Options of the form -fflag specify machine-independent flags. Most
8808 flags have both positive and negative forms; the negative form of -ffoo
8809 is -fno-foo. In the table below, only one of the forms is listed---the
8810 one you typically use. You can figure out the other form by either
8811 removing no- or adding it.
8812
8813 The following options control specific optimizations. They are either
8814 activated by -O options or are related to ones that are. You can use
8815 the following flags in the rare cases when "fine-tuning" of
8816 optimizations to be performed is desired.
8817
8818 -fno-defer-pop
8819 For machines that must pop arguments after a function call, always
8820 pop the arguments as soon as each function returns. At levels -O1
8821 and higher, -fdefer-pop is the default; this allows the compiler to
8822 let arguments accumulate on the stack for several function calls
8823 and pop them all at once.
8824
8825 -fforward-propagate
8826 Perform a forward propagation pass on RTL. The pass tries to
8827 combine two instructions and checks if the result can be
8828 simplified. If loop unrolling is active, two passes are performed
8829 and the second is scheduled after loop unrolling.
8830
8831 This option is enabled by default at optimization levels -O1, -O2,
8832 -O3, -Os.
8833
8834 -ffp-contract=style
8835 -ffp-contract=off disables floating-point expression contraction.
8836 -ffp-contract=fast enables floating-point expression contraction
8837 such as forming of fused multiply-add operations if the target has
8838 native support for them. -ffp-contract=on enables floating-point
8839 expression contraction if allowed by the language standard. This
8840 is currently not implemented and treated equal to
8841 -ffp-contract=off.
8842
8843 The default is -ffp-contract=fast.
8844
8845 -fomit-frame-pointer
8846 Omit the frame pointer in functions that don't need one. This
8847 avoids the instructions to save, set up and restore the frame
8848 pointer; on many targets it also makes an extra register available.
8849
8850 On some targets this flag has no effect because the standard
8851 calling sequence always uses a frame pointer, so it cannot be
8852 omitted.
8853
8854 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8855 pointer is used in all functions. Several targets always omit the
8856 frame pointer in leaf functions.
8857
8858 Enabled by default at -O1 and higher.
8859
8860 -foptimize-sibling-calls
8861 Optimize sibling and tail recursive calls.
8862
8863 Enabled at levels -O2, -O3, -Os.
8864
8865 -foptimize-strlen
8866 Optimize various standard C string functions (e.g. "strlen",
8867 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8868 faster alternatives.
8869
8870 Enabled at levels -O2, -O3.
8871
8872 -fno-inline
8873 Do not expand any functions inline apart from those marked with the
8874 "always_inline" attribute. This is the default when not
8875 optimizing.
8876
8877 Single functions can be exempted from inlining by marking them with
8878 the "noinline" attribute.
8879
8880 -finline-small-functions
8881 Integrate functions into their callers when their body is smaller
8882 than expected function call code (so overall size of program gets
8883 smaller). The compiler heuristically decides which functions are
8884 simple enough to be worth integrating in this way. This inlining
8885 applies to all functions, even those not declared inline.
8886
8887 Enabled at levels -O2, -O3, -Os.
8888
8889 -findirect-inlining
8890 Inline also indirect calls that are discovered to be known at
8891 compile time thanks to previous inlining. This option has any
8892 effect only when inlining itself is turned on by the
8893 -finline-functions or -finline-small-functions options.
8894
8895 Enabled at levels -O2, -O3, -Os.
8896
8897 -finline-functions
8898 Consider all functions for inlining, even if they are not declared
8899 inline. The compiler heuristically decides which functions are
8900 worth integrating in this way.
8901
8902 If all calls to a given function are integrated, and the function
8903 is declared "static", then the function is normally not output as
8904 assembler code in its own right.
8905
8906 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8907 -fauto-profile.
8908
8909 -finline-functions-called-once
8910 Consider all "static" functions called once for inlining into their
8911 caller even if they are not marked "inline". If a call to a given
8912 function is integrated, then the function is not output as
8913 assembler code in its own right.
8914
8915 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8916
8917 -fearly-inlining
8918 Inline functions marked by "always_inline" and functions whose body
8919 seems smaller than the function call overhead early before doing
8920 -fprofile-generate instrumentation and real inlining pass. Doing
8921 so makes profiling significantly cheaper and usually inlining
8922 faster on programs having large chains of nested wrapper functions.
8923
8924 Enabled by default.
8925
8926 -fipa-sra
8927 Perform interprocedural scalar replacement of aggregates, removal
8928 of unused parameters and replacement of parameters passed by
8929 reference by parameters passed by value.
8930
8931 Enabled at levels -O2, -O3 and -Os.
8932
8933 -finline-limit=n
8934 By default, GCC limits the size of functions that can be inlined.
8935 This flag allows coarse control of this limit. n is the size of
8936 functions that can be inlined in number of pseudo instructions.
8937
8938 Inlining is actually controlled by a number of parameters, which
8939 may be specified individually by using --param name=value. The
8940 -finline-limit=n option sets some of these parameters as follows:
8941
8942 max-inline-insns-single
8943 is set to n/2.
8944
8945 max-inline-insns-auto
8946 is set to n/2.
8947
8948 See below for a documentation of the individual parameters
8949 controlling inlining and for the defaults of these parameters.
8950
8951 Note: there may be no value to -finline-limit that results in
8952 default behavior.
8953
8954 Note: pseudo instruction represents, in this particular context, an
8955 abstract measurement of function's size. In no way does it
8956 represent a count of assembly instructions and as such its exact
8957 meaning might change from one release to an another.
8958
8959 -fno-keep-inline-dllexport
8960 This is a more fine-grained version of -fkeep-inline-functions,
8961 which applies only to functions that are declared using the
8962 "dllexport" attribute or declspec.
8963
8964 -fkeep-inline-functions
8965 In C, emit "static" functions that are declared "inline" into the
8966 object file, even if the function has been inlined into all of its
8967 callers. This switch does not affect functions using the "extern
8968 inline" extension in GNU C90. In C++, emit any and all inline
8969 functions into the object file.
8970
8971 -fkeep-static-functions
8972 Emit "static" functions into the object file, even if the function
8973 is never used.
8974
8975 -fkeep-static-consts
8976 Emit variables declared "static const" when optimization isn't
8977 turned on, even if the variables aren't referenced.
8978
8979 GCC enables this option by default. If you want to force the
8980 compiler to check if a variable is referenced, regardless of
8981 whether or not optimization is turned on, use the
8982 -fno-keep-static-consts option.
8983
8984 -fmerge-constants
8985 Attempt to merge identical constants (string constants and
8986 floating-point constants) across compilation units.
8987
8988 This option is the default for optimized compilation if the
8989 assembler and linker support it. Use -fno-merge-constants to
8990 inhibit this behavior.
8991
8992 Enabled at levels -O1, -O2, -O3, -Os.
8993
8994 -fmerge-all-constants
8995 Attempt to merge identical constants and identical variables.
8996
8997 This option implies -fmerge-constants. In addition to
8998 -fmerge-constants this considers e.g. even constant initialized
8999 arrays or initialized constant variables with integral or floating-
9000 point types. Languages like C or C++ require each variable,
9001 including multiple instances of the same variable in recursive
9002 calls, to have distinct locations, so using this option results in
9003 non-conforming behavior.
9004
9005 -fmodulo-sched
9006 Perform swing modulo scheduling immediately before the first
9007 scheduling pass. This pass looks at innermost loops and reorders
9008 their instructions by overlapping different iterations.
9009
9010 -fmodulo-sched-allow-regmoves
9011 Perform more aggressive SMS-based modulo scheduling with register
9012 moves allowed. By setting this flag certain anti-dependences edges
9013 are deleted, which triggers the generation of reg-moves based on
9014 the life-range analysis. This option is effective only with
9015 -fmodulo-sched enabled.
9016
9017 -fno-branch-count-reg
9018 Disable the optimization pass that scans for opportunities to use
9019 "decrement and branch" instructions on a count register instead of
9020 instruction sequences that decrement a register, compare it against
9021 zero, and then branch based upon the result. This option is only
9022 meaningful on architectures that support such instructions, which
9023 include x86, PowerPC, IA-64 and S/390. Note that the
9024 -fno-branch-count-reg option doesn't remove the decrement and
9025 branch instructions from the generated instruction stream
9026 introduced by other optimization passes.
9027
9028 The default is -fbranch-count-reg at -O1 and higher, except for
9029 -Og.
9030
9031 -fno-function-cse
9032 Do not put function addresses in registers; make each instruction
9033 that calls a constant function contain the function's address
9034 explicitly.
9035
9036 This option results in less efficient code, but some strange hacks
9037 that alter the assembler output may be confused by the
9038 optimizations performed when this option is not used.
9039
9040 The default is -ffunction-cse
9041
9042 -fno-zero-initialized-in-bss
9043 If the target supports a BSS section, GCC by default puts variables
9044 that are initialized to zero into BSS. This can save space in the
9045 resulting code.
9046
9047 This option turns off this behavior because some programs
9048 explicitly rely on variables going to the data section---e.g., so
9049 that the resulting executable can find the beginning of that
9050 section and/or make assumptions based on that.
9051
9052 The default is -fzero-initialized-in-bss.
9053
9054 -fthread-jumps
9055 Perform optimizations that check to see if a jump branches to a
9056 location where another comparison subsumed by the first is found.
9057 If so, the first branch is redirected to either the destination of
9058 the second branch or a point immediately following it, depending on
9059 whether the condition is known to be true or false.
9060
9061 Enabled at levels -O1, -O2, -O3, -Os.
9062
9063 -fsplit-wide-types
9064 When using a type that occupies multiple registers, such as "long
9065 long" on a 32-bit system, split the registers apart and allocate
9066 them independently. This normally generates better code for those
9067 types, but may make debugging more difficult.
9068
9069 Enabled at levels -O1, -O2, -O3, -Os.
9070
9071 -fsplit-wide-types-early
9072 Fully split wide types early, instead of very late. This option
9073 has no effect unless -fsplit-wide-types is turned on.
9074
9075 This is the default on some targets.
9076
9077 -fcse-follow-jumps
9078 In common subexpression elimination (CSE), scan through jump
9079 instructions when the target of the jump is not reached by any
9080 other path. For example, when CSE encounters an "if" statement
9081 with an "else" clause, CSE follows the jump when the condition
9082 tested is false.
9083
9084 Enabled at levels -O2, -O3, -Os.
9085
9086 -fcse-skip-blocks
9087 This is similar to -fcse-follow-jumps, but causes CSE to follow
9088 jumps that conditionally skip over blocks. When CSE encounters a
9089 simple "if" statement with no else clause, -fcse-skip-blocks causes
9090 CSE to follow the jump around the body of the "if".
9091
9092 Enabled at levels -O2, -O3, -Os.
9093
9094 -frerun-cse-after-loop
9095 Re-run common subexpression elimination after loop optimizations
9096 are performed.
9097
9098 Enabled at levels -O2, -O3, -Os.
9099
9100 -fgcse
9101 Perform a global common subexpression elimination pass. This pass
9102 also performs global constant and copy propagation.
9103
9104 Note: When compiling a program using computed gotos, a GCC
9105 extension, you may get better run-time performance if you disable
9106 the global common subexpression elimination pass by adding
9107 -fno-gcse to the command line.
9108
9109 Enabled at levels -O2, -O3, -Os.
9110
9111 -fgcse-lm
9112 When -fgcse-lm is enabled, global common subexpression elimination
9113 attempts to move loads that are only killed by stores into
9114 themselves. This allows a loop containing a load/store sequence to
9115 be changed to a load outside the loop, and a copy/store within the
9116 loop.
9117
9118 Enabled by default when -fgcse is enabled.
9119
9120 -fgcse-sm
9121 When -fgcse-sm is enabled, a store motion pass is run after global
9122 common subexpression elimination. This pass attempts to move
9123 stores out of loops. When used in conjunction with -fgcse-lm,
9124 loops containing a load/store sequence can be changed to a load
9125 before the loop and a store after the loop.
9126
9127 Not enabled at any optimization level.
9128
9129 -fgcse-las
9130 When -fgcse-las is enabled, the global common subexpression
9131 elimination pass eliminates redundant loads that come after stores
9132 to the same memory location (both partial and full redundancies).
9133
9134 Not enabled at any optimization level.
9135
9136 -fgcse-after-reload
9137 When -fgcse-after-reload is enabled, a redundant load elimination
9138 pass is performed after reload. The purpose of this pass is to
9139 clean up redundant spilling.
9140
9141 Enabled by -O3, -fprofile-use and -fauto-profile.
9142
9143 -faggressive-loop-optimizations
9144 This option tells the loop optimizer to use language constraints to
9145 derive bounds for the number of iterations of a loop. This assumes
9146 that loop code does not invoke undefined behavior by for example
9147 causing signed integer overflows or out-of-bound array accesses.
9148 The bounds for the number of iterations of a loop are used to guide
9149 loop unrolling and peeling and loop exit test optimizations. This
9150 option is enabled by default.
9151
9152 -funconstrained-commons
9153 This option tells the compiler that variables declared in common
9154 blocks (e.g. Fortran) may later be overridden with longer trailing
9155 arrays. This prevents certain optimizations that depend on knowing
9156 the array bounds.
9157
9158 -fcrossjumping
9159 Perform cross-jumping transformation. This transformation unifies
9160 equivalent code and saves code size. The resulting code may or may
9161 not perform better than without cross-jumping.
9162
9163 Enabled at levels -O2, -O3, -Os.
9164
9165 -fauto-inc-dec
9166 Combine increments or decrements of addresses with memory accesses.
9167 This pass is always skipped on architectures that do not have
9168 instructions to support this. Enabled by default at -O1 and higher
9169 on architectures that support this.
9170
9171 -fdce
9172 Perform dead code elimination (DCE) on RTL. Enabled by default at
9173 -O1 and higher.
9174
9175 -fdse
9176 Perform dead store elimination (DSE) on RTL. Enabled by default at
9177 -O1 and higher.
9178
9179 -fif-conversion
9180 Attempt to transform conditional jumps into branch-less
9181 equivalents. This includes use of conditional moves, min, max, set
9182 flags and abs instructions, and some tricks doable by standard
9183 arithmetics. The use of conditional execution on chips where it is
9184 available is controlled by -fif-conversion2.
9185
9186 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9187
9188 -fif-conversion2
9189 Use conditional execution (where available) to transform
9190 conditional jumps into branch-less equivalents.
9191
9192 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9193
9194 -fdeclone-ctor-dtor
9195 The C++ ABI requires multiple entry points for constructors and
9196 destructors: one for a base subobject, one for a complete object,
9197 and one for a virtual destructor that calls operator delete
9198 afterwards. For a hierarchy with virtual bases, the base and
9199 complete variants are clones, which means two copies of the
9200 function. With this option, the base and complete variants are
9201 changed to be thunks that call a common implementation.
9202
9203 Enabled by -Os.
9204
9205 -fdelete-null-pointer-checks
9206 Assume that programs cannot safely dereference null pointers, and
9207 that no code or data element resides at address zero. This option
9208 enables simple constant folding optimizations at all optimization
9209 levels. In addition, other optimization passes in GCC use this
9210 flag to control global dataflow analyses that eliminate useless
9211 checks for null pointers; these assume that a memory access to
9212 address zero always results in a trap, so that if a pointer is
9213 checked after it has already been dereferenced, it cannot be null.
9214
9215 Note however that in some environments this assumption is not true.
9216 Use -fno-delete-null-pointer-checks to disable this optimization
9217 for programs that depend on that behavior.
9218
9219 This option is enabled by default on most targets. On Nios II ELF,
9220 it defaults to off. On AVR, CR16, and MSP430, this option is
9221 completely disabled.
9222
9223 Passes that use the dataflow information are enabled independently
9224 at different optimization levels.
9225
9226 -fdevirtualize
9227 Attempt to convert calls to virtual functions to direct calls.
9228 This is done both within a procedure and interprocedurally as part
9229 of indirect inlining (-findirect-inlining) and interprocedural
9230 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
9231
9232 -fdevirtualize-speculatively
9233 Attempt to convert calls to virtual functions to speculative direct
9234 calls. Based on the analysis of the type inheritance graph,
9235 determine for a given call the set of likely targets. If the set is
9236 small, preferably of size 1, change the call into a conditional
9237 deciding between direct and indirect calls. The speculative calls
9238 enable more optimizations, such as inlining. When they seem
9239 useless after further optimization, they are converted back into
9240 original form.
9241
9242 -fdevirtualize-at-ltrans
9243 Stream extra information needed for aggressive devirtualization
9244 when running the link-time optimizer in local transformation mode.
9245 This option enables more devirtualization but significantly
9246 increases the size of streamed data. For this reason it is disabled
9247 by default.
9248
9249 -fexpensive-optimizations
9250 Perform a number of minor optimizations that are relatively
9251 expensive.
9252
9253 Enabled at levels -O2, -O3, -Os.
9254
9255 -free
9256 Attempt to remove redundant extension instructions. This is
9257 especially helpful for the x86-64 architecture, which implicitly
9258 zero-extends in 64-bit registers after writing to their lower
9259 32-bit half.
9260
9261 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
9262
9263 -fno-lifetime-dse
9264 In C++ the value of an object is only affected by changes within
9265 its lifetime: when the constructor begins, the object has an
9266 indeterminate value, and any changes during the lifetime of the
9267 object are dead when the object is destroyed. Normally dead store
9268 elimination will take advantage of this; if your code relies on the
9269 value of the object storage persisting beyond the lifetime of the
9270 object, you can use this flag to disable this optimization. To
9271 preserve stores before the constructor starts (e.g. because your
9272 operator new clears the object storage) but still treat the object
9273 as dead after the destructor, you can use -flifetime-dse=1. The
9274 default behavior can be explicitly selected with -flifetime-dse=2.
9275 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
9276
9277 -flive-range-shrinkage
9278 Attempt to decrease register pressure through register live range
9279 shrinkage. This is helpful for fast processors with small or
9280 moderate size register sets.
9281
9282 -fira-algorithm=algorithm
9283 Use the specified coloring algorithm for the integrated register
9284 allocator. The algorithm argument can be priority, which specifies
9285 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
9286 coloring. Chaitin-Briggs coloring is not implemented for all
9287 architectures, but for those targets that do support it, it is the
9288 default because it generates better code.
9289
9290 -fira-region=region
9291 Use specified regions for the integrated register allocator. The
9292 region argument should be one of the following:
9293
9294 all Use all loops as register allocation regions. This can give
9295 the best results for machines with a small and/or irregular
9296 register set.
9297
9298 mixed
9299 Use all loops except for loops with small register pressure as
9300 the regions. This value usually gives the best results in most
9301 cases and for most architectures, and is enabled by default
9302 when compiling with optimization for speed (-O, -O2, ...).
9303
9304 one Use all functions as a single region. This typically results
9305 in the smallest code size, and is enabled by default for -Os or
9306 -O0.
9307
9308 -fira-hoist-pressure
9309 Use IRA to evaluate register pressure in the code hoisting pass for
9310 decisions to hoist expressions. This option usually results in
9311 smaller code, but it can slow the compiler down.
9312
9313 This option is enabled at level -Os for all targets.
9314
9315 -fira-loop-pressure
9316 Use IRA to evaluate register pressure in loops for decisions to
9317 move loop invariants. This option usually results in generation of
9318 faster and smaller code on machines with large register files (>=
9319 32 registers), but it can slow the compiler down.
9320
9321 This option is enabled at level -O3 for some targets.
9322
9323 -fno-ira-share-save-slots
9324 Disable sharing of stack slots used for saving call-used hard
9325 registers living through a call. Each hard register gets a
9326 separate stack slot, and as a result function stack frames are
9327 larger.
9328
9329 -fno-ira-share-spill-slots
9330 Disable sharing of stack slots allocated for pseudo-registers.
9331 Each pseudo-register that does not get a hard register gets a
9332 separate stack slot, and as a result function stack frames are
9333 larger.
9334
9335 -flra-remat
9336 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9337 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9338 values if it is profitable.
9339
9340 Enabled at levels -O2, -O3, -Os.
9341
9342 -fdelayed-branch
9343 If supported for the target machine, attempt to reorder
9344 instructions to exploit instruction slots available after delayed
9345 branch instructions.
9346
9347 Enabled at levels -O1, -O2, -O3, -Os, but not at -Og.
9348
9349 -fschedule-insns
9350 If supported for the target machine, attempt to reorder
9351 instructions to eliminate execution stalls due to required data
9352 being unavailable. This helps machines that have slow floating
9353 point or memory load instructions by allowing other instructions to
9354 be issued until the result of the load or floating-point
9355 instruction is required.
9356
9357 Enabled at levels -O2, -O3.
9358
9359 -fschedule-insns2
9360 Similar to -fschedule-insns, but requests an additional pass of
9361 instruction scheduling after register allocation has been done.
9362 This is especially useful on machines with a relatively small
9363 number of registers and where memory load instructions take more
9364 than one cycle.
9365
9366 Enabled at levels -O2, -O3, -Os.
9367
9368 -fno-sched-interblock
9369 Disable instruction scheduling across basic blocks, which is
9370 normally enabled when scheduling before register allocation, i.e.
9371 with -fschedule-insns or at -O2 or higher.
9372
9373 -fno-sched-spec
9374 Disable speculative motion of non-load instructions, which is
9375 normally enabled when scheduling before register allocation, i.e.
9376 with -fschedule-insns or at -O2 or higher.
9377
9378 -fsched-pressure
9379 Enable register pressure sensitive insn scheduling before register
9380 allocation. This only makes sense when scheduling before register
9381 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
9382 higher. Usage of this option can improve the generated code and
9383 decrease its size by preventing register pressure increase above
9384 the number of available hard registers and subsequent spills in
9385 register allocation.
9386
9387 -fsched-spec-load
9388 Allow speculative motion of some load instructions. This only
9389 makes sense when scheduling before register allocation, i.e. with
9390 -fschedule-insns or at -O2 or higher.
9391
9392 -fsched-spec-load-dangerous
9393 Allow speculative motion of more load instructions. This only
9394 makes sense when scheduling before register allocation, i.e. with
9395 -fschedule-insns or at -O2 or higher.
9396
9397 -fsched-stalled-insns
9398 -fsched-stalled-insns=n
9399 Define how many insns (if any) can be moved prematurely from the
9400 queue of stalled insns into the ready list during the second
9401 scheduling pass. -fno-sched-stalled-insns means that no insns are
9402 moved prematurely, -fsched-stalled-insns=0 means there is no limit
9403 on how many queued insns can be moved prematurely.
9404 -fsched-stalled-insns without a value is equivalent to
9405 -fsched-stalled-insns=1.
9406
9407 -fsched-stalled-insns-dep
9408 -fsched-stalled-insns-dep=n
9409 Define how many insn groups (cycles) are examined for a dependency
9410 on a stalled insn that is a candidate for premature removal from
9411 the queue of stalled insns. This has an effect only during the
9412 second scheduling pass, and only if -fsched-stalled-insns is used.
9413 -fno-sched-stalled-insns-dep is equivalent to
9414 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
9415 value is equivalent to -fsched-stalled-insns-dep=1.
9416
9417 -fsched2-use-superblocks
9418 When scheduling after register allocation, use superblock
9419 scheduling. This allows motion across basic block boundaries,
9420 resulting in faster schedules. This option is experimental, as not
9421 all machine descriptions used by GCC model the CPU closely enough
9422 to avoid unreliable results from the algorithm.
9423
9424 This only makes sense when scheduling after register allocation,
9425 i.e. with -fschedule-insns2 or at -O2 or higher.
9426
9427 -fsched-group-heuristic
9428 Enable the group heuristic in the scheduler. This heuristic favors
9429 the instruction that belongs to a schedule group. This is enabled
9430 by default when scheduling is enabled, i.e. with -fschedule-insns
9431 or -fschedule-insns2 or at -O2 or higher.
9432
9433 -fsched-critical-path-heuristic
9434 Enable the critical-path heuristic in the scheduler. This
9435 heuristic favors instructions on the critical path. This is
9436 enabled by default when scheduling is enabled, i.e. with
9437 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
9438
9439 -fsched-spec-insn-heuristic
9440 Enable the speculative instruction heuristic in the scheduler.
9441 This heuristic favors speculative instructions with greater
9442 dependency weakness. This is enabled by default when scheduling is
9443 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9444 or higher.
9445
9446 -fsched-rank-heuristic
9447 Enable the rank heuristic in the scheduler. This heuristic favors
9448 the instruction belonging to a basic block with greater size or
9449 frequency. This is enabled by default when scheduling is enabled,
9450 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
9451 higher.
9452
9453 -fsched-last-insn-heuristic
9454 Enable the last-instruction heuristic in the scheduler. This
9455 heuristic favors the instruction that is less dependent on the last
9456 instruction scheduled. This is enabled by default when scheduling
9457 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
9458 -O2 or higher.
9459
9460 -fsched-dep-count-heuristic
9461 Enable the dependent-count heuristic in the scheduler. This
9462 heuristic favors the instruction that has more instructions
9463 depending on it. This is enabled by default when scheduling is
9464 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9465 or higher.
9466
9467 -freschedule-modulo-scheduled-loops
9468 Modulo scheduling is performed before traditional scheduling. If a
9469 loop is modulo scheduled, later scheduling passes may change its
9470 schedule. Use this option to control that behavior.
9471
9472 -fselective-scheduling
9473 Schedule instructions using selective scheduling algorithm.
9474 Selective scheduling runs instead of the first scheduler pass.
9475
9476 -fselective-scheduling2
9477 Schedule instructions using selective scheduling algorithm.
9478 Selective scheduling runs instead of the second scheduler pass.
9479
9480 -fsel-sched-pipelining
9481 Enable software pipelining of innermost loops during selective
9482 scheduling. This option has no effect unless one of
9483 -fselective-scheduling or -fselective-scheduling2 is turned on.
9484
9485 -fsel-sched-pipelining-outer-loops
9486 When pipelining loops during selective scheduling, also pipeline
9487 outer loops. This option has no effect unless
9488 -fsel-sched-pipelining is turned on.
9489
9490 -fsemantic-interposition
9491 Some object formats, like ELF, allow interposing of symbols by the
9492 dynamic linker. This means that for symbols exported from the DSO,
9493 the compiler cannot perform interprocedural propagation, inlining
9494 and other optimizations in anticipation that the function or
9495 variable in question may change. While this feature is useful, for
9496 example, to rewrite memory allocation functions by a debugging
9497 implementation, it is expensive in the terms of code quality. With
9498 -fno-semantic-interposition the compiler assumes that if
9499 interposition happens for functions the overwriting function will
9500 have precisely the same semantics (and side effects). Similarly if
9501 interposition happens for variables, the constructor of the
9502 variable will be the same. The flag has no effect for functions
9503 explicitly declared inline (where it is never allowed for
9504 interposition to change semantics) and for symbols explicitly
9505 declared weak.
9506
9507 -fshrink-wrap
9508 Emit function prologues only before parts of the function that need
9509 it, rather than at the top of the function. This flag is enabled
9510 by default at -O and higher.
9511
9512 -fshrink-wrap-separate
9513 Shrink-wrap separate parts of the prologue and epilogue separately,
9514 so that those parts are only executed when needed. This option is
9515 on by default, but has no effect unless -fshrink-wrap is also
9516 turned on and the target supports this.
9517
9518 -fcaller-saves
9519 Enable allocation of values to registers that are clobbered by
9520 function calls, by emitting extra instructions to save and restore
9521 the registers around such calls. Such allocation is done only when
9522 it seems to result in better code.
9523
9524 This option is always enabled by default on certain machines,
9525 usually those which have no call-preserved registers to use
9526 instead.
9527
9528 Enabled at levels -O2, -O3, -Os.
9529
9530 -fcombine-stack-adjustments
9531 Tracks stack adjustments (pushes and pops) and stack memory
9532 references and then tries to find ways to combine them.
9533
9534 Enabled by default at -O1 and higher.
9535
9536 -fipa-ra
9537 Use caller save registers for allocation if those registers are not
9538 used by any called function. In that case it is not necessary to
9539 save and restore them around calls. This is only possible if
9540 called functions are part of same compilation unit as current
9541 function and they are compiled before it.
9542
9543 Enabled at levels -O2, -O3, -Os, however the option is disabled if
9544 generated code will be instrumented for profiling (-p, or -pg) or
9545 if callee's register usage cannot be known exactly (this happens on
9546 targets that do not expose prologues and epilogues in RTL).
9547
9548 -fconserve-stack
9549 Attempt to minimize stack usage. The compiler attempts to use less
9550 stack space, even if that makes the program slower. This option
9551 implies setting the large-stack-frame parameter to 100 and the
9552 large-stack-frame-growth parameter to 400.
9553
9554 -ftree-reassoc
9555 Perform reassociation on trees. This flag is enabled by default at
9556 -O1 and higher.
9557
9558 -fcode-hoisting
9559 Perform code hoisting. Code hoisting tries to move the evaluation
9560 of expressions executed on all paths to the function exit as early
9561 as possible. This is especially useful as a code size
9562 optimization, but it often helps for code speed as well. This flag
9563 is enabled by default at -O2 and higher.
9564
9565 -ftree-pre
9566 Perform partial redundancy elimination (PRE) on trees. This flag
9567 is enabled by default at -O2 and -O3.
9568
9569 -ftree-partial-pre
9570 Make partial redundancy elimination (PRE) more aggressive. This
9571 flag is enabled by default at -O3.
9572
9573 -ftree-forwprop
9574 Perform forward propagation on trees. This flag is enabled by
9575 default at -O1 and higher.
9576
9577 -ftree-fre
9578 Perform full redundancy elimination (FRE) on trees. The difference
9579 between FRE and PRE is that FRE only considers expressions that are
9580 computed on all paths leading to the redundant computation. This
9581 analysis is faster than PRE, though it exposes fewer redundancies.
9582 This flag is enabled by default at -O1 and higher.
9583
9584 -ftree-phiprop
9585 Perform hoisting of loads from conditional pointers on trees. This
9586 pass is enabled by default at -O1 and higher.
9587
9588 -fhoist-adjacent-loads
9589 Speculatively hoist loads from both branches of an if-then-else if
9590 the loads are from adjacent locations in the same structure and the
9591 target architecture has a conditional move instruction. This flag
9592 is enabled by default at -O2 and higher.
9593
9594 -ftree-copy-prop
9595 Perform copy propagation on trees. This pass eliminates
9596 unnecessary copy operations. This flag is enabled by default at
9597 -O1 and higher.
9598
9599 -fipa-pure-const
9600 Discover which functions are pure or constant. Enabled by default
9601 at -O1 and higher.
9602
9603 -fipa-reference
9604 Discover which static variables do not escape the compilation unit.
9605 Enabled by default at -O1 and higher.
9606
9607 -fipa-reference-addressable
9608 Discover read-only, write-only and non-addressable static
9609 variables. Enabled by default at -O1 and higher.
9610
9611 -fipa-stack-alignment
9612 Reduce stack alignment on call sites if possible. Enabled by
9613 default.
9614
9615 -fipa-pta
9616 Perform interprocedural pointer analysis and interprocedural
9617 modification and reference analysis. This option can cause
9618 excessive memory and compile-time usage on large compilation units.
9619 It is not enabled by default at any optimization level.
9620
9621 -fipa-profile
9622 Perform interprocedural profile propagation. The functions called
9623 only from cold functions are marked as cold. Also functions
9624 executed once (such as "cold", "noreturn", static constructors or
9625 destructors) are identified. Cold functions and loop less parts of
9626 functions executed once are then optimized for size. Enabled by
9627 default at -O1 and higher.
9628
9629 -fipa-modref
9630 Perform interprocedural mod/ref analysis. This optimization
9631 analyzes the side effects of functions (memory locations that are
9632 modified or referenced) and enables better optimization across the
9633 function call boundary. This flag is enabled by default at -O1 and
9634 higher.
9635
9636 -fipa-cp
9637 Perform interprocedural constant propagation. This optimization
9638 analyzes the program to determine when values passed to functions
9639 are constants and then optimizes accordingly. This optimization
9640 can substantially increase performance if the application has
9641 constants passed to functions. This flag is enabled by default at
9642 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9643 -fauto-profile.
9644
9645 -fipa-cp-clone
9646 Perform function cloning to make interprocedural constant
9647 propagation stronger. When enabled, interprocedural constant
9648 propagation performs function cloning when externally visible
9649 function can be called with constant arguments. Because this
9650 optimization can create multiple copies of functions, it may
9651 significantly increase code size (see --param
9652 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9653 It is also enabled by -fprofile-use and -fauto-profile.
9654
9655 -fipa-bit-cp
9656 When enabled, perform interprocedural bitwise constant propagation.
9657 This flag is enabled by default at -O2 and by -fprofile-use and
9658 -fauto-profile. It requires that -fipa-cp is enabled.
9659
9660 -fipa-vrp
9661 When enabled, perform interprocedural propagation of value ranges.
9662 This flag is enabled by default at -O2. It requires that -fipa-cp
9663 is enabled.
9664
9665 -fipa-icf
9666 Perform Identical Code Folding for functions and read-only
9667 variables. The optimization reduces code size and may disturb
9668 unwind stacks by replacing a function by equivalent one with a
9669 different name. The optimization works more effectively with link-
9670 time optimization enabled.
9671
9672 Although the behavior is similar to the Gold Linker's ICF
9673 optimization, GCC ICF works on different levels and thus the
9674 optimizations are not same - there are equivalences that are found
9675 only by GCC and equivalences found only by Gold.
9676
9677 This flag is enabled by default at -O2 and -Os.
9678
9679 -flive-patching=level
9680 Control GCC's optimizations to produce output suitable for live-
9681 patching.
9682
9683 If the compiler's optimization uses a function's body or
9684 information extracted from its body to optimize/change another
9685 function, the latter is called an impacted function of the former.
9686 If a function is patched, its impacted functions should be patched
9687 too.
9688
9689 The impacted functions are determined by the compiler's
9690 interprocedural optimizations. For example, a caller is impacted
9691 when inlining a function into its caller, cloning a function and
9692 changing its caller to call this new clone, or extracting a
9693 function's pureness/constness information to optimize its direct or
9694 indirect callers, etc.
9695
9696 Usually, the more IPA optimizations enabled, the larger the number
9697 of impacted functions for each function. In order to control the
9698 number of impacted functions and more easily compute the list of
9699 impacted function, IPA optimizations can be partially enabled at
9700 two different levels.
9701
9702 The level argument should be one of the following:
9703
9704 inline-clone
9705 Only enable inlining and cloning optimizations, which includes
9706 inlining, cloning, interprocedural scalar replacement of
9707 aggregates and partial inlining. As a result, when patching a
9708 function, all its callers and its clones' callers are impacted,
9709 therefore need to be patched as well.
9710
9711 -flive-patching=inline-clone disables the following
9712 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9713 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9714 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9715 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9716
9717 inline-only-static
9718 Only enable inlining of static functions. As a result, when
9719 patching a static function, all its callers are impacted and so
9720 need to be patched as well.
9721
9722 In addition to all the flags that -flive-patching=inline-clone
9723 disables, -flive-patching=inline-only-static disables the
9724 following additional optimization flags: -fipa-cp-clone
9725 -fipa-sra -fpartial-inlining -fipa-cp
9726
9727 When -flive-patching is specified without any value, the default
9728 value is inline-clone.
9729
9730 This flag is disabled by default.
9731
9732 Note that -flive-patching is not supported with link-time
9733 optimization (-flto).
9734
9735 -fisolate-erroneous-paths-dereference
9736 Detect paths that trigger erroneous or undefined behavior due to
9737 dereferencing a null pointer. Isolate those paths from the main
9738 control flow and turn the statement with erroneous or undefined
9739 behavior into a trap. This flag is enabled by default at -O2 and
9740 higher and depends on -fdelete-null-pointer-checks also being
9741 enabled.
9742
9743 -fisolate-erroneous-paths-attribute
9744 Detect paths that trigger erroneous or undefined behavior due to a
9745 null value being used in a way forbidden by a "returns_nonnull" or
9746 "nonnull" attribute. Isolate those paths from the main control
9747 flow and turn the statement with erroneous or undefined behavior
9748 into a trap. This is not currently enabled, but may be enabled by
9749 -O2 in the future.
9750
9751 -ftree-sink
9752 Perform forward store motion on trees. This flag is enabled by
9753 default at -O1 and higher.
9754
9755 -ftree-bit-ccp
9756 Perform sparse conditional bit constant propagation on trees and
9757 propagate pointer alignment information. This pass only operates
9758 on local scalar variables and is enabled by default at -O1 and
9759 higher, except for -Og. It requires that -ftree-ccp is enabled.
9760
9761 -ftree-ccp
9762 Perform sparse conditional constant propagation (CCP) on trees.
9763 This pass only operates on local scalar variables and is enabled by
9764 default at -O1 and higher.
9765
9766 -fssa-backprop
9767 Propagate information about uses of a value up the definition chain
9768 in order to simplify the definitions. For example, this pass
9769 strips sign operations if the sign of a value never matters. The
9770 flag is enabled by default at -O1 and higher.
9771
9772 -fssa-phiopt
9773 Perform pattern matching on SSA PHI nodes to optimize conditional
9774 code. This pass is enabled by default at -O1 and higher, except
9775 for -Og.
9776
9777 -ftree-switch-conversion
9778 Perform conversion of simple initializations in a switch to
9779 initializations from a scalar array. This flag is enabled by
9780 default at -O2 and higher.
9781
9782 -ftree-tail-merge
9783 Look for identical code sequences. When found, replace one with a
9784 jump to the other. This optimization is known as tail merging or
9785 cross jumping. This flag is enabled by default at -O2 and higher.
9786 The compilation time in this pass can be limited using max-tail-
9787 merge-comparisons parameter and max-tail-merge-iterations
9788 parameter.
9789
9790 -ftree-dce
9791 Perform dead code elimination (DCE) on trees. This flag is enabled
9792 by default at -O1 and higher.
9793
9794 -ftree-builtin-call-dce
9795 Perform conditional dead code elimination (DCE) for calls to built-
9796 in functions that may set "errno" but are otherwise free of side
9797 effects. This flag is enabled by default at -O2 and higher if -Os
9798 is not also specified.
9799
9800 -ffinite-loops
9801 Assume that a loop with an exit will eventually take the exit and
9802 not loop indefinitely. This allows the compiler to remove loops
9803 that otherwise have no side-effects, not considering eventual
9804 endless looping as such.
9805
9806 This option is enabled by default at -O2 for C++ with -std=c++11 or
9807 higher.
9808
9809 -ftree-dominator-opts
9810 Perform a variety of simple scalar cleanups (constant/copy
9811 propagation, redundancy elimination, range propagation and
9812 expression simplification) based on a dominator tree traversal.
9813 This also performs jump threading (to reduce jumps to jumps). This
9814 flag is enabled by default at -O1 and higher.
9815
9816 -ftree-dse
9817 Perform dead store elimination (DSE) on trees. A dead store is a
9818 store into a memory location that is later overwritten by another
9819 store without any intervening loads. In this case the earlier
9820 store can be deleted. This flag is enabled by default at -O1 and
9821 higher.
9822
9823 -ftree-ch
9824 Perform loop header copying on trees. This is beneficial since it
9825 increases effectiveness of code motion optimizations. It also
9826 saves one jump. This flag is enabled by default at -O1 and higher.
9827 It is not enabled for -Os, since it usually increases code size.
9828
9829 -ftree-loop-optimize
9830 Perform loop optimizations on trees. This flag is enabled by
9831 default at -O1 and higher.
9832
9833 -ftree-loop-linear
9834 -floop-strip-mine
9835 -floop-block
9836 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9837 use this code transformation, GCC has to be configured with
9838 --with-isl to enable the Graphite loop transformation
9839 infrastructure.
9840
9841 -fgraphite-identity
9842 Enable the identity transformation for graphite. For every SCoP we
9843 generate the polyhedral representation and transform it back to
9844 gimple. Using -fgraphite-identity we can check the costs or
9845 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9846 minimal optimizations are also performed by the code generator isl,
9847 like index splitting and dead code elimination in loops.
9848
9849 -floop-nest-optimize
9850 Enable the isl based loop nest optimizer. This is a generic loop
9851 nest optimizer based on the Pluto optimization algorithms. It
9852 calculates a loop structure optimized for data-locality and
9853 parallelism. This option is experimental.
9854
9855 -floop-parallelize-all
9856 Use the Graphite data dependence analysis to identify loops that
9857 can be parallelized. Parallelize all the loops that can be
9858 analyzed to not contain loop carried dependences without checking
9859 that it is profitable to parallelize the loops.
9860
9861 -ftree-coalesce-vars
9862 While transforming the program out of the SSA representation,
9863 attempt to reduce copying by coalescing versions of different user-
9864 defined variables, instead of just compiler temporaries. This may
9865 severely limit the ability to debug an optimized program compiled
9866 with -fno-var-tracking-assignments. In the negated form, this flag
9867 prevents SSA coalescing of user variables. This option is enabled
9868 by default if optimization is enabled, and it does very little
9869 otherwise.
9870
9871 -ftree-loop-if-convert
9872 Attempt to transform conditional jumps in the innermost loops to
9873 branch-less equivalents. The intent is to remove control-flow from
9874 the innermost loops in order to improve the ability of the
9875 vectorization pass to handle these loops. This is enabled by
9876 default if vectorization is enabled.
9877
9878 -ftree-loop-distribution
9879 Perform loop distribution. This flag can improve cache performance
9880 on big loop bodies and allow further loop optimizations, like
9881 parallelization or vectorization, to take place. For example, the
9882 loop
9883
9884 DO I = 1, N
9885 A(I) = B(I) + C
9886 D(I) = E(I) * F
9887 ENDDO
9888
9889 is transformed to
9890
9891 DO I = 1, N
9892 A(I) = B(I) + C
9893 ENDDO
9894 DO I = 1, N
9895 D(I) = E(I) * F
9896 ENDDO
9897
9898 This flag is enabled by default at -O3. It is also enabled by
9899 -fprofile-use and -fauto-profile.
9900
9901 -ftree-loop-distribute-patterns
9902 Perform loop distribution of patterns that can be code generated
9903 with calls to a library. This flag is enabled by default at -O2
9904 and higher, and by -fprofile-use and -fauto-profile.
9905
9906 This pass distributes the initialization loops and generates a call
9907 to memset zero. For example, the loop
9908
9909 DO I = 1, N
9910 A(I) = 0
9911 B(I) = A(I) + I
9912 ENDDO
9913
9914 is transformed to
9915
9916 DO I = 1, N
9917 A(I) = 0
9918 ENDDO
9919 DO I = 1, N
9920 B(I) = A(I) + I
9921 ENDDO
9922
9923 and the initialization loop is transformed into a call to memset
9924 zero. This flag is enabled by default at -O3. It is also enabled
9925 by -fprofile-use and -fauto-profile.
9926
9927 -floop-interchange
9928 Perform loop interchange outside of graphite. This flag can
9929 improve cache performance on loop nest and allow further loop
9930 optimizations, like vectorization, to take place. For example, the
9931 loop
9932
9933 for (int i = 0; i < N; i++)
9934 for (int j = 0; j < N; j++)
9935 for (int k = 0; k < N; k++)
9936 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9937
9938 is transformed to
9939
9940 for (int i = 0; i < N; i++)
9941 for (int k = 0; k < N; k++)
9942 for (int j = 0; j < N; j++)
9943 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9944
9945 This flag is enabled by default at -O3. It is also enabled by
9946 -fprofile-use and -fauto-profile.
9947
9948 -floop-unroll-and-jam
9949 Apply unroll and jam transformations on feasible loops. In a loop
9950 nest this unrolls the outer loop by some factor and fuses the
9951 resulting multiple inner loops. This flag is enabled by default at
9952 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9953
9954 -ftree-loop-im
9955 Perform loop invariant motion on trees. This pass moves only
9956 invariants that are hard to handle at RTL level (function calls,
9957 operations that expand to nontrivial sequences of insns). With
9958 -funswitch-loops it also moves operands of conditions that are
9959 invariant out of the loop, so that we can use just trivial
9960 invariantness analysis in loop unswitching. The pass also includes
9961 store motion.
9962
9963 -ftree-loop-ivcanon
9964 Create a canonical counter for number of iterations in loops for
9965 which determining number of iterations requires complicated
9966 analysis. Later optimizations then may determine the number
9967 easily. Useful especially in connection with unrolling.
9968
9969 -ftree-scev-cprop
9970 Perform final value replacement. If a variable is modified in a
9971 loop in such a way that its value when exiting the loop can be
9972 determined using only its initial value and the number of loop
9973 iterations, replace uses of the final value by such a computation,
9974 provided it is sufficiently cheap. This reduces data dependencies
9975 and may allow further simplifications. Enabled by default at -O1
9976 and higher.
9977
9978 -fivopts
9979 Perform induction variable optimizations (strength reduction,
9980 induction variable merging and induction variable elimination) on
9981 trees.
9982
9983 -ftree-parallelize-loops=n
9984 Parallelize loops, i.e., split their iteration space to run in n
9985 threads. This is only possible for loops whose iterations are
9986 independent and can be arbitrarily reordered. The optimization is
9987 only profitable on multiprocessor machines, for loops that are CPU-
9988 intensive, rather than constrained e.g. by memory bandwidth. This
9989 option implies -pthread, and thus is only supported on targets that
9990 have support for -pthread.
9991
9992 -ftree-pta
9993 Perform function-local points-to analysis on trees. This flag is
9994 enabled by default at -O1 and higher, except for -Og.
9995
9996 -ftree-sra
9997 Perform scalar replacement of aggregates. This pass replaces
9998 structure references with scalars to prevent committing structures
9999 to memory too early. This flag is enabled by default at -O1 and
10000 higher, except for -Og.
10001
10002 -fstore-merging
10003 Perform merging of narrow stores to consecutive memory addresses.
10004 This pass merges contiguous stores of immediate values narrower
10005 than a word into fewer wider stores to reduce the number of
10006 instructions. This is enabled by default at -O2 and higher as well
10007 as -Os.
10008
10009 -ftree-ter
10010 Perform temporary expression replacement during the SSA->normal
10011 phase. Single use/single def temporaries are replaced at their use
10012 location with their defining expression. This results in non-
10013 GIMPLE code, but gives the expanders much more complex trees to
10014 work on resulting in better RTL generation. This is enabled by
10015 default at -O1 and higher.
10016
10017 -ftree-slsr
10018 Perform straight-line strength reduction on trees. This recognizes
10019 related expressions involving multiplications and replaces them by
10020 less expensive calculations when possible. This is enabled by
10021 default at -O1 and higher.
10022
10023 -ftree-vectorize
10024 Perform vectorization on trees. This flag enables
10025 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
10026 specified.
10027
10028 -ftree-loop-vectorize
10029 Perform loop vectorization on trees. This flag is enabled by
10030 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10031 -fauto-profile.
10032
10033 -ftree-slp-vectorize
10034 Perform basic block vectorization on trees. This flag is enabled by
10035 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10036 -fauto-profile.
10037
10038 -ftrivial-auto-var-init=choice
10039 Initialize automatic variables with either a pattern or with zeroes
10040 to increase the security and predictability of a program by
10041 preventing uninitialized memory disclosure and use. GCC still
10042 considers an automatic variable that doesn't have an explicit
10043 initializer as uninitialized, -Wuninitialized and
10044 -Wanalyzer-use-of-uninitialized-value will still report warning
10045 messages on such automatic variables. With this option, GCC will
10046 also initialize any padding of automatic variables that have
10047 structure or union types to zeroes. However, the current
10048 implementation cannot initialize automatic variables that are
10049 declared between the controlling expression and the first case of a
10050 "switch" statement. Using -Wtrivial-auto-var-init to report all
10051 such cases.
10052
10053 The three values of choice are:
10054
10055 * uninitialized doesn't initialize any automatic variables. This
10056 is C and C++'s default.
10057
10058 * pattern Initialize automatic variables with values which will
10059 likely transform logic bugs into crashes down the line, are
10060 easily recognized in a crash dump and without being values that
10061 programmers can rely on for useful program semantics. The
10062 current value is byte-repeatable pattern with byte "0xFE". The
10063 values used for pattern initialization might be changed in the
10064 future.
10065
10066 * zero Initialize automatic variables with zeroes.
10067
10068 The default is uninitialized.
10069
10070 You can control this behavior for a specific variable by using the
10071 variable attribute "uninitialized".
10072
10073 -fvect-cost-model=model
10074 Alter the cost model used for vectorization. The model argument
10075 should be one of unlimited, dynamic, cheap or very-cheap. With the
10076 unlimited model the vectorized code-path is assumed to be
10077 profitable while with the dynamic model a runtime check guards the
10078 vectorized code-path to enable it only for iteration counts that
10079 will likely execute faster than when executing the original scalar
10080 loop. The cheap model disables vectorization of loops where doing
10081 so would be cost prohibitive for example due to required runtime
10082 checks for data dependence or alignment but otherwise is equal to
10083 the dynamic model. The very-cheap model only allows vectorization
10084 if the vector code would entirely replace the scalar code that is
10085 being vectorized. For example, if each iteration of a vectorized
10086 loop would only be able to handle exactly four iterations of the
10087 scalar loop, the very-cheap model would only allow vectorization if
10088 the scalar iteration count is known to be a multiple of four.
10089
10090 The default cost model depends on other optimization flags and is
10091 either dynamic or cheap.
10092
10093 -fsimd-cost-model=model
10094 Alter the cost model used for vectorization of loops marked with
10095 the OpenMP simd directive. The model argument should be one of
10096 unlimited, dynamic, cheap. All values of model have the same
10097 meaning as described in -fvect-cost-model and by default a cost
10098 model defined with -fvect-cost-model is used.
10099
10100 -ftree-vrp
10101 Perform Value Range Propagation on trees. This is similar to the
10102 constant propagation pass, but instead of values, ranges of values
10103 are propagated. This allows the optimizers to remove unnecessary
10104 range checks like array bound checks and null pointer checks. This
10105 is enabled by default at -O2 and higher. Null pointer check
10106 elimination is only done if -fdelete-null-pointer-checks is
10107 enabled.
10108
10109 -fsplit-paths
10110 Split paths leading to loop backedges. This can improve dead code
10111 elimination and common subexpression elimination. This is enabled
10112 by default at -O3 and above.
10113
10114 -fsplit-ivs-in-unroller
10115 Enables expression of values of induction variables in later
10116 iterations of the unrolled loop using the value in the first
10117 iteration. This breaks long dependency chains, thus improving
10118 efficiency of the scheduling passes.
10119
10120 A combination of -fweb and CSE is often sufficient to obtain the
10121 same effect. However, that is not reliable in cases where the loop
10122 body is more complicated than a single basic block. It also does
10123 not work at all on some architectures due to restrictions in the
10124 CSE pass.
10125
10126 This optimization is enabled by default.
10127
10128 -fvariable-expansion-in-unroller
10129 With this option, the compiler creates multiple copies of some
10130 local variables when unrolling a loop, which can result in superior
10131 code.
10132
10133 This optimization is enabled by default for PowerPC targets, but
10134 disabled by default otherwise.
10135
10136 -fpartial-inlining
10137 Inline parts of functions. This option has any effect only when
10138 inlining itself is turned on by the -finline-functions or
10139 -finline-small-functions options.
10140
10141 Enabled at levels -O2, -O3, -Os.
10142
10143 -fpredictive-commoning
10144 Perform predictive commoning optimization, i.e., reusing
10145 computations (especially memory loads and stores) performed in
10146 previous iterations of loops.
10147
10148 This option is enabled at level -O3. It is also enabled by
10149 -fprofile-use and -fauto-profile.
10150
10151 -fprefetch-loop-arrays
10152 If supported by the target machine, generate instructions to
10153 prefetch memory to improve the performance of loops that access
10154 large arrays.
10155
10156 This option may generate better or worse code; results are highly
10157 dependent on the structure of loops within the source code.
10158
10159 Disabled at level -Os.
10160
10161 -fno-printf-return-value
10162 Do not substitute constants for known return value of formatted
10163 output functions such as "sprintf", "snprintf", "vsprintf", and
10164 "vsnprintf" (but not "printf" of "fprintf"). This transformation
10165 allows GCC to optimize or even eliminate branches based on the
10166 known return value of these functions called with arguments that
10167 are either constant, or whose values are known to be in a range
10168 that makes determining the exact return value possible. For
10169 example, when -fprintf-return-value is in effect, both the branch
10170 and the body of the "if" statement (but not the call to "snprint")
10171 can be optimized away when "i" is a 32-bit or smaller integer
10172 because the return value is guaranteed to be at most 8.
10173
10174 char buf[9];
10175 if (snprintf (buf, "%08x", i) >= sizeof buf)
10176 ...
10177
10178 The -fprintf-return-value option relies on other optimizations and
10179 yields best results with -O2 and above. It works in tandem with
10180 the -Wformat-overflow and -Wformat-truncation options. The
10181 -fprintf-return-value option is enabled by default.
10182
10183 -fno-peephole
10184 -fno-peephole2
10185 Disable any machine-specific peephole optimizations. The
10186 difference between -fno-peephole and -fno-peephole2 is in how they
10187 are implemented in the compiler; some targets use one, some use the
10188 other, a few use both.
10189
10190 -fpeephole is enabled by default. -fpeephole2 enabled at levels
10191 -O2, -O3, -Os.
10192
10193 -fno-guess-branch-probability
10194 Do not guess branch probabilities using heuristics.
10195
10196 GCC uses heuristics to guess branch probabilities if they are not
10197 provided by profiling feedback (-fprofile-arcs). These heuristics
10198 are based on the control flow graph. If some branch probabilities
10199 are specified by "__builtin_expect", then the heuristics are used
10200 to guess branch probabilities for the rest of the control flow
10201 graph, taking the "__builtin_expect" info into account. The
10202 interactions between the heuristics and "__builtin_expect" can be
10203 complex, and in some cases, it may be useful to disable the
10204 heuristics so that the effects of "__builtin_expect" are easier to
10205 understand.
10206
10207 It is also possible to specify expected probability of the
10208 expression with "__builtin_expect_with_probability" built-in
10209 function.
10210
10211 The default is -fguess-branch-probability at levels -O, -O2, -O3,
10212 -Os.
10213
10214 -freorder-blocks
10215 Reorder basic blocks in the compiled function in order to reduce
10216 number of taken branches and improve code locality.
10217
10218 Enabled at levels -O1, -O2, -O3, -Os.
10219
10220 -freorder-blocks-algorithm=algorithm
10221 Use the specified algorithm for basic block reordering. The
10222 algorithm argument can be simple, which does not increase code size
10223 (except sometimes due to secondary effects like alignment), or stc,
10224 the "software trace cache" algorithm, which tries to put all often
10225 executed code together, minimizing the number of branches executed
10226 by making extra copies of code.
10227
10228 The default is simple at levels -O1, -Os, and stc at levels -O2,
10229 -O3.
10230
10231 -freorder-blocks-and-partition
10232 In addition to reordering basic blocks in the compiled function, in
10233 order to reduce number of taken branches, partitions hot and cold
10234 basic blocks into separate sections of the assembly and .o files,
10235 to improve paging and cache locality performance.
10236
10237 This optimization is automatically turned off in the presence of
10238 exception handling or unwind tables (on targets using
10239 setjump/longjump or target specific scheme), for linkonce sections,
10240 for functions with a user-defined section attribute and on any
10241 architecture that does not support named sections. When
10242 -fsplit-stack is used this option is not enabled by default (to
10243 avoid linker errors), but may be enabled explicitly (if using a
10244 working linker).
10245
10246 Enabled for x86 at levels -O2, -O3, -Os.
10247
10248 -freorder-functions
10249 Reorder functions in the object file in order to improve code
10250 locality. This is implemented by using special subsections
10251 ".text.hot" for most frequently executed functions and
10252 ".text.unlikely" for unlikely executed functions. Reordering is
10253 done by the linker so object file format must support named
10254 sections and linker must place them in a reasonable way.
10255
10256 This option isn't effective unless you either provide profile
10257 feedback (see -fprofile-arcs for details) or manually annotate
10258 functions with "hot" or "cold" attributes.
10259
10260 Enabled at levels -O2, -O3, -Os.
10261
10262 -fstrict-aliasing
10263 Allow the compiler to assume the strictest aliasing rules
10264 applicable to the language being compiled. For C (and C++), this
10265 activates optimizations based on the type of expressions. In
10266 particular, an object of one type is assumed never to reside at the
10267 same address as an object of a different type, unless the types are
10268 almost the same. For example, an "unsigned int" can alias an
10269 "int", but not a "void*" or a "double". A character type may alias
10270 any other type.
10271
10272 Pay special attention to code like this:
10273
10274 union a_union {
10275 int i;
10276 double d;
10277 };
10278
10279 int f() {
10280 union a_union t;
10281 t.d = 3.0;
10282 return t.i;
10283 }
10284
10285 The practice of reading from a different union member than the one
10286 most recently written to (called "type-punning") is common. Even
10287 with -fstrict-aliasing, type-punning is allowed, provided the
10288 memory is accessed through the union type. So, the code above
10289 works as expected. However, this code might not:
10290
10291 int f() {
10292 union a_union t;
10293 int* ip;
10294 t.d = 3.0;
10295 ip = &t.i;
10296 return *ip;
10297 }
10298
10299 Similarly, access by taking the address, casting the resulting
10300 pointer and dereferencing the result has undefined behavior, even
10301 if the cast uses a union type, e.g.:
10302
10303 int f() {
10304 double d = 3.0;
10305 return ((union a_union *) &d)->i;
10306 }
10307
10308 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
10309
10310 -fipa-strict-aliasing
10311 Controls whether rules of -fstrict-aliasing are applied across
10312 function boundaries. Note that if multiple functions gets inlined
10313 into a single function the memory accesses are no longer considered
10314 to be crossing a function boundary.
10315
10316 The -fipa-strict-aliasing option is enabled by default and is
10317 effective only in combination with -fstrict-aliasing.
10318
10319 -falign-functions
10320 -falign-functions=n
10321 -falign-functions=n:m
10322 -falign-functions=n:m:n2
10323 -falign-functions=n:m:n2:m2
10324 Align the start of functions to the next power-of-two greater than
10325 or equal to n, skipping up to m-1 bytes. This ensures that at
10326 least the first m bytes of the function can be fetched by the CPU
10327 without crossing an n-byte alignment boundary.
10328
10329 If m is not specified, it defaults to n.
10330
10331 Examples: -falign-functions=32 aligns functions to the next 32-byte
10332 boundary, -falign-functions=24 aligns to the next 32-byte boundary
10333 only if this can be done by skipping 23 bytes or less,
10334 -falign-functions=32:7 aligns to the next 32-byte boundary only if
10335 this can be done by skipping 6 bytes or less.
10336
10337 The second pair of n2:m2 values allows you to specify a secondary
10338 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
10339 boundary if this can be done by skipping 6 bytes or less, otherwise
10340 aligns to the next 32-byte boundary if this can be done by skipping
10341 2 bytes or less. If m2 is not specified, it defaults to n2.
10342
10343 Some assemblers only support this flag when n is a power of two; in
10344 that case, it is rounded up.
10345
10346 -fno-align-functions and -falign-functions=1 are equivalent and
10347 mean that functions are not aligned.
10348
10349 If n is not specified or is zero, use a machine-dependent default.
10350 The maximum allowed n option value is 65536.
10351
10352 Enabled at levels -O2, -O3.
10353
10354 -flimit-function-alignment
10355 If this option is enabled, the compiler tries to avoid
10356 unnecessarily overaligning functions. It attempts to instruct the
10357 assembler to align by the amount specified by -falign-functions,
10358 but not to skip more bytes than the size of the function.
10359
10360 -falign-labels
10361 -falign-labels=n
10362 -falign-labels=n:m
10363 -falign-labels=n:m:n2
10364 -falign-labels=n:m:n2:m2
10365 Align all branch targets to a power-of-two boundary.
10366
10367 Parameters of this option are analogous to the -falign-functions
10368 option. -fno-align-labels and -falign-labels=1 are equivalent and
10369 mean that labels are not aligned.
10370
10371 If -falign-loops or -falign-jumps are applicable and are greater
10372 than this value, then their values are used instead.
10373
10374 If n is not specified or is zero, use a machine-dependent default
10375 which is very likely to be 1, meaning no alignment. The maximum
10376 allowed n option value is 65536.
10377
10378 Enabled at levels -O2, -O3.
10379
10380 -falign-loops
10381 -falign-loops=n
10382 -falign-loops=n:m
10383 -falign-loops=n:m:n2
10384 -falign-loops=n:m:n2:m2
10385 Align loops to a power-of-two boundary. If the loops are executed
10386 many times, this makes up for any execution of the dummy padding
10387 instructions.
10388
10389 If -falign-labels is greater than this value, then its value is
10390 used instead.
10391
10392 Parameters of this option are analogous to the -falign-functions
10393 option. -fno-align-loops and -falign-loops=1 are equivalent and
10394 mean that loops are not aligned. The maximum allowed n option
10395 value is 65536.
10396
10397 If n is not specified or is zero, use a machine-dependent default.
10398
10399 Enabled at levels -O2, -O3.
10400
10401 -falign-jumps
10402 -falign-jumps=n
10403 -falign-jumps=n:m
10404 -falign-jumps=n:m:n2
10405 -falign-jumps=n:m:n2:m2
10406 Align branch targets to a power-of-two boundary, for branch targets
10407 where the targets can only be reached by jumping. In this case, no
10408 dummy operations need be executed.
10409
10410 If -falign-labels is greater than this value, then its value is
10411 used instead.
10412
10413 Parameters of this option are analogous to the -falign-functions
10414 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
10415 mean that loops are not aligned.
10416
10417 If n is not specified or is zero, use a machine-dependent default.
10418 The maximum allowed n option value is 65536.
10419
10420 Enabled at levels -O2, -O3.
10421
10422 -fno-allocation-dce
10423 Do not remove unused C++ allocations in dead code elimination.
10424
10425 -fallow-store-data-races
10426 Allow the compiler to perform optimizations that may introduce new
10427 data races on stores, without proving that the variable cannot be
10428 concurrently accessed by other threads. Does not affect
10429 optimization of local data. It is safe to use this option if it is
10430 known that global data will not be accessed by multiple threads.
10431
10432 Examples of optimizations enabled by -fallow-store-data-races
10433 include hoisting or if-conversions that may cause a value that was
10434 already in memory to be re-written with that same value. Such re-
10435 writing is safe in a single threaded context but may be unsafe in a
10436 multi-threaded context. Note that on some processors, if-
10437 conversions may be required in order to enable vectorization.
10438
10439 Enabled at level -Ofast.
10440
10441 -funit-at-a-time
10442 This option is left for compatibility reasons. -funit-at-a-time has
10443 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
10444 and -fno-section-anchors.
10445
10446 Enabled by default.
10447
10448 -fno-toplevel-reorder
10449 Do not reorder top-level functions, variables, and "asm"
10450 statements. Output them in the same order that they appear in the
10451 input file. When this option is used, unreferenced static
10452 variables are not removed. This option is intended to support
10453 existing code that relies on a particular ordering. For new code,
10454 it is better to use attributes when possible.
10455
10456 -ftoplevel-reorder is the default at -O1 and higher, and also at
10457 -O0 if -fsection-anchors is explicitly requested. Additionally
10458 -fno-toplevel-reorder implies -fno-section-anchors.
10459
10460 -fweb
10461 Constructs webs as commonly used for register allocation purposes
10462 and assign each web individual pseudo register. This allows the
10463 register allocation pass to operate on pseudos directly, but also
10464 strengthens several other optimization passes, such as CSE, loop
10465 optimizer and trivial dead code remover. It can, however, make
10466 debugging impossible, since variables no longer stay in a "home
10467 register".
10468
10469 Enabled by default with -funroll-loops.
10470
10471 -fwhole-program
10472 Assume that the current compilation unit represents the whole
10473 program being compiled. All public functions and variables with
10474 the exception of "main" and those merged by attribute
10475 "externally_visible" become static functions and in effect are
10476 optimized more aggressively by interprocedural optimizers.
10477
10478 This option should not be used in combination with -flto. Instead
10479 relying on a linker plugin should provide safer and more precise
10480 information.
10481
10482 -flto[=n]
10483 This option runs the standard link-time optimizer. When invoked
10484 with source code, it generates GIMPLE (one of GCC's internal
10485 representations) and writes it to special ELF sections in the
10486 object file. When the object files are linked together, all the
10487 function bodies are read from these ELF sections and instantiated
10488 as if they had been part of the same translation unit.
10489
10490 To use the link-time optimizer, -flto and optimization options
10491 should be specified at compile time and during the final link. It
10492 is recommended that you compile all the files participating in the
10493 same link with the same options and also specify those options at
10494 link time. For example:
10495
10496 gcc -c -O2 -flto foo.c
10497 gcc -c -O2 -flto bar.c
10498 gcc -o myprog -flto -O2 foo.o bar.o
10499
10500 The first two invocations to GCC save a bytecode representation of
10501 GIMPLE into special ELF sections inside foo.o and bar.o. The final
10502 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
10503 the two files into a single internal image, and compiles the result
10504 as usual. Since both foo.o and bar.o are merged into a single
10505 image, this causes all the interprocedural analyses and
10506 optimizations in GCC to work across the two files as if they were a
10507 single one. This means, for example, that the inliner is able to
10508 inline functions in bar.o into functions in foo.o and vice-versa.
10509
10510 Another (simpler) way to enable link-time optimization is:
10511
10512 gcc -o myprog -flto -O2 foo.c bar.c
10513
10514 The above generates bytecode for foo.c and bar.c, merges them
10515 together into a single GIMPLE representation and optimizes them as
10516 usual to produce myprog.
10517
10518 The important thing to keep in mind is that to enable link-time
10519 optimizations you need to use the GCC driver to perform the link
10520 step. GCC automatically performs link-time optimization if any of
10521 the objects involved were compiled with the -flto command-line
10522 option. You can always override the automatic decision to do link-
10523 time optimization by passing -fno-lto to the link command.
10524
10525 To make whole program optimization effective, it is necessary to
10526 make certain whole program assumptions. The compiler needs to know
10527 what functions and variables can be accessed by libraries and
10528 runtime outside of the link-time optimized unit. When supported by
10529 the linker, the linker plugin (see -fuse-linker-plugin) passes
10530 information to the compiler about used and externally visible
10531 symbols. When the linker plugin is not available, -fwhole-program
10532 should be used to allow the compiler to make these assumptions,
10533 which leads to more aggressive optimization decisions.
10534
10535 When a file is compiled with -flto without -fuse-linker-plugin, the
10536 generated object file is larger than a regular object file because
10537 it contains GIMPLE bytecodes and the usual final code (see
10538 -ffat-lto-objects). This means that object files with LTO
10539 information can be linked as normal object files; if -fno-lto is
10540 passed to the linker, no interprocedural optimizations are applied.
10541 Note that when -fno-fat-lto-objects is enabled the compile stage is
10542 faster but you cannot perform a regular, non-LTO link on them.
10543
10544 When producing the final binary, GCC only applies link-time
10545 optimizations to those files that contain bytecode. Therefore, you
10546 can mix and match object files and libraries with GIMPLE bytecodes
10547 and final object code. GCC automatically selects which files to
10548 optimize in LTO mode and which files to link without further
10549 processing.
10550
10551 Generally, options specified at link time override those specified
10552 at compile time, although in some cases GCC attempts to infer link-
10553 time options from the settings used to compile the input files.
10554
10555 If you do not specify an optimization level option -O at link time,
10556 then GCC uses the highest optimization level used when compiling
10557 the object files. Note that it is generally ineffective to specify
10558 an optimization level option only at link time and not at compile
10559 time, for two reasons. First, compiling without optimization
10560 suppresses compiler passes that gather information needed for
10561 effective optimization at link time. Second, some early
10562 optimization passes can be performed only at compile time and not
10563 at link time.
10564
10565 There are some code generation flags preserved by GCC when
10566 generating bytecodes, as they need to be used during the final
10567 link. Currently, the following options and their settings are
10568 taken from the first object file that explicitly specifies them:
10569 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
10570 -m target flags.
10571
10572 The following options -fPIC, -fpic, -fpie and -fPIE are combined
10573 based on the following scheme:
10574
10575 B<-fPIC> + B<-fpic> = B<-fpic>
10576 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
10577 B<-fpic/-fPIC> + (no option) = (no option)
10578 B<-fPIC> + B<-fPIE> = B<-fPIE>
10579 B<-fpic> + B<-fPIE> = B<-fpie>
10580 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
10581
10582 Certain ABI-changing flags are required to match in all compilation
10583 units, and trying to override this at link time with a conflicting
10584 value is ignored. This includes options such as
10585 -freg-struct-return and -fpcc-struct-return.
10586
10587 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
10588 -fno-trapv or -fno-strict-aliasing are passed through to the link
10589 stage and merged conservatively for conflicting translation units.
10590 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
10591 precedence; and for example -ffp-contract=off takes precedence over
10592 -ffp-contract=fast. You can override them at link time.
10593
10594 Diagnostic options such as -Wstringop-overflow are passed through
10595 to the link stage and their setting matches that of the compile-
10596 step at function granularity. Note that this matters only for
10597 diagnostics emitted during optimization. Note that code transforms
10598 such as inlining can lead to warnings being enabled or disabled for
10599 regions if code not consistent with the setting at compile time.
10600
10601 When you need to pass options to the assembler via -Wa or
10602 -Xassembler make sure to either compile such translation units with
10603 -fno-lto or consistently use the same assembler options on all
10604 translation units. You can alternatively also specify assembler
10605 options at LTO link time.
10606
10607 To enable debug info generation you need to supply -g at compile
10608 time. If any of the input files at link time were built with debug
10609 info generation enabled the link will enable debug info generation
10610 as well. Any elaborate debug info settings like the dwarf level
10611 -gdwarf-5 need to be explicitly repeated at the linker command line
10612 and mixing different settings in different translation units is
10613 discouraged.
10614
10615 If LTO encounters objects with C linkage declared with incompatible
10616 types in separate translation units to be linked together
10617 (undefined behavior according to ISO C99 6.2.7), a non-fatal
10618 diagnostic may be issued. The behavior is still undefined at run
10619 time. Similar diagnostics may be raised for other languages.
10620
10621 Another feature of LTO is that it is possible to apply
10622 interprocedural optimizations on files written in different
10623 languages:
10624
10625 gcc -c -flto foo.c
10626 g++ -c -flto bar.cc
10627 gfortran -c -flto baz.f90
10628 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10629
10630 Notice that the final link is done with g++ to get the C++ runtime
10631 libraries and -lgfortran is added to get the Fortran runtime
10632 libraries. In general, when mixing languages in LTO mode, you
10633 should use the same link command options as when mixing languages
10634 in a regular (non-LTO) compilation.
10635
10636 If object files containing GIMPLE bytecode are stored in a library
10637 archive, say libfoo.a, it is possible to extract and use them in an
10638 LTO link if you are using a linker with plugin support. To create
10639 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10640 instead of ar and ranlib; to show the symbols of object files with
10641 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10642 ranlib and nm have been compiled with plugin support. At link
10643 time, use the flag -fuse-linker-plugin to ensure that the library
10644 participates in the LTO optimization process:
10645
10646 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10647
10648 With the linker plugin enabled, the linker extracts the needed
10649 GIMPLE files from libfoo.a and passes them on to the running GCC to
10650 make them part of the aggregated GIMPLE image to be optimized.
10651
10652 If you are not using a linker with plugin support and/or do not
10653 enable the linker plugin, then the objects inside libfoo.a are
10654 extracted and linked as usual, but they do not participate in the
10655 LTO optimization process. In order to make a static library
10656 suitable for both LTO optimization and usual linkage, compile its
10657 object files with -flto -ffat-lto-objects.
10658
10659 Link-time optimizations do not require the presence of the whole
10660 program to operate. If the program does not require any symbols to
10661 be exported, it is possible to combine -flto and -fwhole-program to
10662 allow the interprocedural optimizers to use more aggressive
10663 assumptions which may lead to improved optimization opportunities.
10664 Use of -fwhole-program is not needed when linker plugin is active
10665 (see -fuse-linker-plugin).
10666
10667 The current implementation of LTO makes no attempt to generate
10668 bytecode that is portable between different types of hosts. The
10669 bytecode files are versioned and there is a strict version check,
10670 so bytecode files generated in one version of GCC do not work with
10671 an older or newer version of GCC.
10672
10673 Link-time optimization does not work well with generation of
10674 debugging information on systems other than those using a
10675 combination of ELF and DWARF.
10676
10677 If you specify the optional n, the optimization and code generation
10678 done at link time is executed in parallel using n parallel jobs by
10679 utilizing an installed make program. The environment variable MAKE
10680 may be used to override the program used.
10681
10682 You can also specify -flto=jobserver to use GNU make's job server
10683 mode to determine the number of parallel jobs. This is useful when
10684 the Makefile calling GCC is already executing in parallel. You
10685 must prepend a + to the command recipe in the parent Makefile for
10686 this to work. This option likely only works if MAKE is GNU make.
10687 Even without the option value, GCC tries to automatically detect a
10688 running GNU make's job server.
10689
10690 Use -flto=auto to use GNU make's job server, if available, or
10691 otherwise fall back to autodetection of the number of CPU threads
10692 present in your system.
10693
10694 -flto-partition=alg
10695 Specify the partitioning algorithm used by the link-time optimizer.
10696 The value is either 1to1 to specify a partitioning mirroring the
10697 original source files or balanced to specify partitioning into
10698 equally sized chunks (whenever possible) or max to create new
10699 partition for every symbol where possible. Specifying none as an
10700 algorithm disables partitioning and streaming completely. The
10701 default value is balanced. While 1to1 can be used as an workaround
10702 for various code ordering issues, the max partitioning is intended
10703 for internal testing only. The value one specifies that exactly
10704 one partition should be used while the value none bypasses
10705 partitioning and executes the link-time optimization step directly
10706 from the WPA phase.
10707
10708 -flto-compression-level=n
10709 This option specifies the level of compression used for
10710 intermediate language written to LTO object files, and is only
10711 meaningful in conjunction with LTO mode (-flto). GCC currently
10712 supports two LTO compression algorithms. For zstd, valid values are
10713 0 (no compression) to 19 (maximum compression), while zlib supports
10714 values from 0 to 9. Values outside this range are clamped to
10715 either minimum or maximum of the supported values. If the option
10716 is not given, a default balanced compression setting is used.
10717
10718 -fuse-linker-plugin
10719 Enables the use of a linker plugin during link-time optimization.
10720 This option relies on plugin support in the linker, which is
10721 available in gold or in GNU ld 2.21 or newer.
10722
10723 This option enables the extraction of object files with GIMPLE
10724 bytecode out of library archives. This improves the quality of
10725 optimization by exposing more code to the link-time optimizer.
10726 This information specifies what symbols can be accessed externally
10727 (by non-LTO object or during dynamic linking). Resulting code
10728 quality improvements on binaries (and shared libraries that use
10729 hidden visibility) are similar to -fwhole-program. See -flto for a
10730 description of the effect of this flag and how to use it.
10731
10732 This option is enabled by default when LTO support in GCC is
10733 enabled and GCC was configured for use with a linker supporting
10734 plugins (GNU ld 2.21 or newer or gold).
10735
10736 -ffat-lto-objects
10737 Fat LTO objects are object files that contain both the intermediate
10738 language and the object code. This makes them usable for both LTO
10739 linking and normal linking. This option is effective only when
10740 compiling with -flto and is ignored at link time.
10741
10742 -fno-fat-lto-objects improves compilation time over plain LTO, but
10743 requires the complete toolchain to be aware of LTO. It requires a
10744 linker with linker plugin support for basic functionality.
10745 Additionally, nm, ar and ranlib need to support linker plugins to
10746 allow a full-featured build environment (capable of building static
10747 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10748 wrappers to pass the right options to these tools. With non fat LTO
10749 makefiles need to be modified to use them.
10750
10751 Note that modern binutils provide plugin auto-load mechanism.
10752 Installing the linker plugin into $libdir/bfd-plugins has the same
10753 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10754 ranlib).
10755
10756 The default is -fno-fat-lto-objects on targets with linker plugin
10757 support.
10758
10759 -fcompare-elim
10760 After register allocation and post-register allocation instruction
10761 splitting, identify arithmetic instructions that compute processor
10762 flags similar to a comparison operation based on that arithmetic.
10763 If possible, eliminate the explicit comparison operation.
10764
10765 This pass only applies to certain targets that cannot explicitly
10766 represent the comparison operation before register allocation is
10767 complete.
10768
10769 Enabled at levels -O1, -O2, -O3, -Os.
10770
10771 -fcprop-registers
10772 After register allocation and post-register allocation instruction
10773 splitting, perform a copy-propagation pass to try to reduce
10774 scheduling dependencies and occasionally eliminate the copy.
10775
10776 Enabled at levels -O1, -O2, -O3, -Os.
10777
10778 -fprofile-correction
10779 Profiles collected using an instrumented binary for multi-threaded
10780 programs may be inconsistent due to missed counter updates. When
10781 this option is specified, GCC uses heuristics to correct or smooth
10782 out such inconsistencies. By default, GCC emits an error message
10783 when an inconsistent profile is detected.
10784
10785 This option is enabled by -fauto-profile.
10786
10787 -fprofile-partial-training
10788 With "-fprofile-use" all portions of programs not executed during
10789 train run are optimized agressively for size rather than speed. In
10790 some cases it is not practical to train all possible hot paths in
10791 the program. (For example, program may contain functions specific
10792 for a given hardware and trianing may not cover all hardware
10793 configurations program is run on.) With
10794 "-fprofile-partial-training" profile feedback will be ignored for
10795 all functions not executed during the train run leading them to be
10796 optimized as if they were compiled without profile feedback. This
10797 leads to better performance when train run is not representative
10798 but also leads to significantly bigger code.
10799
10800 -fprofile-use
10801 -fprofile-use=path
10802 Enable profile feedback-directed optimizations, and the following
10803 optimizations, many of which are generally profitable only with
10804 profile feedback available:
10805
10806 -fbranch-probabilities -fprofile-values -funroll-loops
10807 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10808 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10809 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10810 -ftree-slp-vectorize -fvect-cost-model=dynamic
10811 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10812
10813 Before you can use this option, you must first generate profiling
10814 information.
10815
10816 By default, GCC emits an error message if the feedback profiles do
10817 not match the source code. This error can be turned into a warning
10818 by using -Wno-error=coverage-mismatch. Note this may result in
10819 poorly optimized code. Additionally, by default, GCC also emits a
10820 warning message if the feedback profiles do not exist (see
10821 -Wmissing-profile).
10822
10823 If path is specified, GCC looks at the path to find the profile
10824 feedback data files. See -fprofile-dir.
10825
10826 -fauto-profile
10827 -fauto-profile=path
10828 Enable sampling-based feedback-directed optimizations, and the
10829 following optimizations, many of which are generally profitable
10830 only with profile feedback available:
10831
10832 -fbranch-probabilities -fprofile-values -funroll-loops
10833 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10834 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10835 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10836 -ftree-slp-vectorize -fvect-cost-model=dynamic
10837 -ftree-loop-distribute-patterns -fprofile-correction
10838
10839 path is the name of a file containing AutoFDO profile information.
10840 If omitted, it defaults to fbdata.afdo in the current directory.
10841
10842 Producing an AutoFDO profile data file requires running your
10843 program with the perf utility on a supported GNU/Linux target
10844 system. For more information, see <https://perf.wiki.kernel.org/>.
10845
10846 E.g.
10847
10848 perf record -e br_inst_retired:near_taken -b -o perf.data \
10849 -- your_program
10850
10851 Then use the create_gcov tool to convert the raw profile data to a
10852 format that can be used by GCC. You must also supply the
10853 unstripped binary for your program to this tool. See
10854 <https://github.com/google/autofdo>.
10855
10856 E.g.
10857
10858 create_gcov --binary=your_program.unstripped --profile=perf.data \
10859 --gcov=profile.afdo
10860
10861 The following options control compiler behavior regarding floating-
10862 point arithmetic. These options trade off between speed and
10863 correctness. All must be specifically enabled.
10864
10865 -ffloat-store
10866 Do not store floating-point variables in registers, and inhibit
10867 other options that might change whether a floating-point value is
10868 taken from a register or memory.
10869
10870 This option prevents undesirable excess precision on machines such
10871 as the 68000 where the floating registers (of the 68881) keep more
10872 precision than a "double" is supposed to have. Similarly for the
10873 x86 architecture. For most programs, the excess precision does
10874 only good, but a few programs rely on the precise definition of
10875 IEEE floating point. Use -ffloat-store for such programs, after
10876 modifying them to store all pertinent intermediate computations
10877 into variables.
10878
10879 -fexcess-precision=style
10880 This option allows further control over excess precision on
10881 machines where floating-point operations occur in a format with
10882 more precision or range than the IEEE standard and interchange
10883 floating-point types. By default, -fexcess-precision=fast is in
10884 effect; this means that operations may be carried out in a wider
10885 precision than the types specified in the source if that would
10886 result in faster code, and it is unpredictable when rounding to the
10887 types specified in the source code takes place. When compiling C,
10888 if -fexcess-precision=standard is specified then excess precision
10889 follows the rules specified in ISO C99; in particular, both casts
10890 and assignments cause values to be rounded to their semantic types
10891 (whereas -ffloat-store only affects assignments). This option is
10892 enabled by default for C if a strict conformance option such as
10893 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10894 default regardless of whether a strict conformance option is used.
10895
10896 -fexcess-precision=standard is not implemented for languages other
10897 than C. On the x86, it has no effect if -mfpmath=sse or
10898 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10899 apply without excess precision, and in the latter, rounding is
10900 unpredictable.
10901
10902 -ffast-math
10903 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10904 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10905 -fcx-limited-range and -fexcess-precision=fast.
10906
10907 This option causes the preprocessor macro "__FAST_MATH__" to be
10908 defined.
10909
10910 This option is not turned on by any -O option besides -Ofast since
10911 it can result in incorrect output for programs that depend on an
10912 exact implementation of IEEE or ISO rules/specifications for math
10913 functions. It may, however, yield faster code for programs that do
10914 not require the guarantees of these specifications.
10915
10916 -fno-math-errno
10917 Do not set "errno" after calling math functions that are executed
10918 with a single instruction, e.g., "sqrt". A program that relies on
10919 IEEE exceptions for math error handling may want to use this flag
10920 for speed while maintaining IEEE arithmetic compatibility.
10921
10922 This option is not turned on by any -O option since it can result
10923 in incorrect output for programs that depend on an exact
10924 implementation of IEEE or ISO rules/specifications for math
10925 functions. It may, however, yield faster code for programs that do
10926 not require the guarantees of these specifications.
10927
10928 The default is -fmath-errno.
10929
10930 On Darwin systems, the math library never sets "errno". There is
10931 therefore no reason for the compiler to consider the possibility
10932 that it might, and -fno-math-errno is the default.
10933
10934 -funsafe-math-optimizations
10935 Allow optimizations for floating-point arithmetic that (a) assume
10936 that arguments and results are valid and (b) may violate IEEE or
10937 ANSI standards. When used at link time, it may include libraries
10938 or startup files that change the default FPU control word or other
10939 similar optimizations.
10940
10941 This option is not turned on by any -O option since it can result
10942 in incorrect output for programs that depend on an exact
10943 implementation of IEEE or ISO rules/specifications for math
10944 functions. It may, however, yield faster code for programs that do
10945 not require the guarantees of these specifications. Enables
10946 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10947 -freciprocal-math.
10948
10949 The default is -fno-unsafe-math-optimizations.
10950
10951 -fassociative-math
10952 Allow re-association of operands in series of floating-point
10953 operations. This violates the ISO C and C++ language standard by
10954 possibly changing computation result. NOTE: re-ordering may change
10955 the sign of zero as well as ignore NaNs and inhibit or create
10956 underflow or overflow (and thus cannot be used on code that relies
10957 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10958 floating-point comparisons and thus may not be used when ordered
10959 comparisons are required. This option requires that both
10960 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10961 it doesn't make much sense with -frounding-math. For Fortran the
10962 option is automatically enabled when both -fno-signed-zeros and
10963 -fno-trapping-math are in effect.
10964
10965 The default is -fno-associative-math.
10966
10967 -freciprocal-math
10968 Allow the reciprocal of a value to be used instead of dividing by
10969 the value if this enables optimizations. For example "x / y" can
10970 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10971 to common subexpression elimination. Note that this loses
10972 precision and increases the number of flops operating on the value.
10973
10974 The default is -fno-reciprocal-math.
10975
10976 -ffinite-math-only
10977 Allow optimizations for floating-point arithmetic that assume that
10978 arguments and results are not NaNs or +-Infs.
10979
10980 This option is not turned on by any -O option since it can result
10981 in incorrect output for programs that depend on an exact
10982 implementation of IEEE or ISO rules/specifications for math
10983 functions. It may, however, yield faster code for programs that do
10984 not require the guarantees of these specifications.
10985
10986 The default is -fno-finite-math-only.
10987
10988 -fno-signed-zeros
10989 Allow optimizations for floating-point arithmetic that ignore the
10990 signedness of zero. IEEE arithmetic specifies the behavior of
10991 distinct +0.0 and -0.0 values, which then prohibits simplification
10992 of expressions such as x+0.0 or 0.0*x (even with
10993 -ffinite-math-only). This option implies that the sign of a zero
10994 result isn't significant.
10995
10996 The default is -fsigned-zeros.
10997
10998 -fno-trapping-math
10999 Compile code assuming that floating-point operations cannot
11000 generate user-visible traps. These traps include division by zero,
11001 overflow, underflow, inexact result and invalid operation. This
11002 option requires that -fno-signaling-nans be in effect. Setting
11003 this option may allow faster code if one relies on "non-stop" IEEE
11004 arithmetic, for example.
11005
11006 This option should never be turned on by any -O option since it can
11007 result in incorrect output for programs that depend on an exact
11008 implementation of IEEE or ISO rules/specifications for math
11009 functions.
11010
11011 The default is -ftrapping-math.
11012
11013 -frounding-math
11014 Disable transformations and optimizations that assume default
11015 floating-point rounding behavior. This is round-to-zero for all
11016 floating point to integer conversions, and round-to-nearest for all
11017 other arithmetic truncations. This option should be specified for
11018 programs that change the FP rounding mode dynamically, or that may
11019 be executed with a non-default rounding mode. This option disables
11020 constant folding of floating-point expressions at compile time
11021 (which may be affected by rounding mode) and arithmetic
11022 transformations that are unsafe in the presence of sign-dependent
11023 rounding modes.
11024
11025 The default is -fno-rounding-math.
11026
11027 This option is experimental and does not currently guarantee to
11028 disable all GCC optimizations that are affected by rounding mode.
11029 Future versions of GCC may provide finer control of this setting
11030 using C99's "FENV_ACCESS" pragma. This command-line option will be
11031 used to specify the default state for "FENV_ACCESS".
11032
11033 -fsignaling-nans
11034 Compile code assuming that IEEE signaling NaNs may generate user-
11035 visible traps during floating-point operations. Setting this
11036 option disables optimizations that may change the number of
11037 exceptions visible with signaling NaNs. This option implies
11038 -ftrapping-math.
11039
11040 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
11041 defined.
11042
11043 The default is -fno-signaling-nans.
11044
11045 This option is experimental and does not currently guarantee to
11046 disable all GCC optimizations that affect signaling NaN behavior.
11047
11048 -fno-fp-int-builtin-inexact
11049 Do not allow the built-in functions "ceil", "floor", "round" and
11050 "trunc", and their "float" and "long double" variants, to generate
11051 code that raises the "inexact" floating-point exception for
11052 noninteger arguments. ISO C99 and C11 allow these functions to
11053 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
11054 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
11055 allow these functions to do so.
11056
11057 The default is -ffp-int-builtin-inexact, allowing the exception to
11058 be raised, unless C2X or a later C standard is selected. This
11059 option does nothing unless -ftrapping-math is in effect.
11060
11061 Even if -fno-fp-int-builtin-inexact is used, if the functions
11062 generate a call to a library function then the "inexact" exception
11063 may be raised if the library implementation does not follow TS
11064 18661.
11065
11066 -fsingle-precision-constant
11067 Treat floating-point constants as single precision instead of
11068 implicitly converting them to double-precision constants.
11069
11070 -fcx-limited-range
11071 When enabled, this option states that a range reduction step is not
11072 needed when performing complex division. Also, there is no
11073 checking whether the result of a complex multiplication or division
11074 is "NaN + I*NaN", with an attempt to rescue the situation in that
11075 case. The default is -fno-cx-limited-range, but is enabled by
11076 -ffast-math.
11077
11078 This option controls the default setting of the ISO C99
11079 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
11080 languages.
11081
11082 -fcx-fortran-rules
11083 Complex multiplication and division follow Fortran rules. Range
11084 reduction is done as part of complex division, but there is no
11085 checking whether the result of a complex multiplication or division
11086 is "NaN + I*NaN", with an attempt to rescue the situation in that
11087 case.
11088
11089 The default is -fno-cx-fortran-rules.
11090
11091 The following options control optimizations that may improve
11092 performance, but are not enabled by any -O options. This section
11093 includes experimental options that may produce broken code.
11094
11095 -fbranch-probabilities
11096 After running a program compiled with -fprofile-arcs, you can
11097 compile it a second time using -fbranch-probabilities, to improve
11098 optimizations based on the number of times each branch was taken.
11099 When a program compiled with -fprofile-arcs exits, it saves arc
11100 execution counts to a file called sourcename.gcda for each source
11101 file. The information in this data file is very dependent on the
11102 structure of the generated code, so you must use the same source
11103 code and the same optimization options for both compilations. See
11104 details about the file naming in -fprofile-arcs.
11105
11106 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
11107 JUMP_INSN and CALL_INSN. These can be used to improve
11108 optimization. Currently, they are only used in one place: in
11109 reorg.cc, instead of guessing which path a branch is most likely to
11110 take, the REG_BR_PROB values are used to exactly determine which
11111 path is taken more often.
11112
11113 Enabled by -fprofile-use and -fauto-profile.
11114
11115 -fprofile-values
11116 If combined with -fprofile-arcs, it adds code so that some data
11117 about values of expressions in the program is gathered.
11118
11119 With -fbranch-probabilities, it reads back the data gathered from
11120 profiling values of expressions for usage in optimizations.
11121
11122 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
11123
11124 -fprofile-reorder-functions
11125 Function reordering based on profile instrumentation collects first
11126 time of execution of a function and orders these functions in
11127 ascending order.
11128
11129 Enabled with -fprofile-use.
11130
11131 -fvpt
11132 If combined with -fprofile-arcs, this option instructs the compiler
11133 to add code to gather information about values of expressions.
11134
11135 With -fbranch-probabilities, it reads back the data gathered and
11136 actually performs the optimizations based on them. Currently the
11137 optimizations include specialization of division operations using
11138 the knowledge about the value of the denominator.
11139
11140 Enabled with -fprofile-use and -fauto-profile.
11141
11142 -frename-registers
11143 Attempt to avoid false dependencies in scheduled code by making use
11144 of registers left over after register allocation. This
11145 optimization most benefits processors with lots of registers.
11146 Depending on the debug information format adopted by the target,
11147 however, it can make debugging impossible, since variables no
11148 longer stay in a "home register".
11149
11150 Enabled by default with -funroll-loops.
11151
11152 -fschedule-fusion
11153 Performs a target dependent pass over the instruction stream to
11154 schedule instructions of same type together because target machine
11155 can execute them more efficiently if they are adjacent to each
11156 other in the instruction flow.
11157
11158 Enabled at levels -O2, -O3, -Os.
11159
11160 -ftracer
11161 Perform tail duplication to enlarge superblock size. This
11162 transformation simplifies the control flow of the function allowing
11163 other optimizations to do a better job.
11164
11165 Enabled by -fprofile-use and -fauto-profile.
11166
11167 -funroll-loops
11168 Unroll loops whose number of iterations can be determined at
11169 compile time or upon entry to the loop. -funroll-loops implies
11170 -frerun-cse-after-loop, -fweb and -frename-registers. It also
11171 turns on complete loop peeling (i.e. complete removal of loops with
11172 a small constant number of iterations). This option makes code
11173 larger, and may or may not make it run faster.
11174
11175 Enabled by -fprofile-use and -fauto-profile.
11176
11177 -funroll-all-loops
11178 Unroll all loops, even if their number of iterations is uncertain
11179 when the loop is entered. This usually makes programs run more
11180 slowly. -funroll-all-loops implies the same options as
11181 -funroll-loops.
11182
11183 -fpeel-loops
11184 Peels loops for which there is enough information that they do not
11185 roll much (from profile feedback or static analysis). It also
11186 turns on complete loop peeling (i.e. complete removal of loops with
11187 small constant number of iterations).
11188
11189 Enabled by -O3, -fprofile-use, and -fauto-profile.
11190
11191 -fmove-loop-invariants
11192 Enables the loop invariant motion pass in the RTL loop optimizer.
11193 Enabled at level -O1 and higher, except for -Og.
11194
11195 -fmove-loop-stores
11196 Enables the loop store motion pass in the GIMPLE loop optimizer.
11197 This moves invariant stores to after the end of the loop in
11198 exchange for carrying the stored value in a register across the
11199 iteration. Note for this option to have an effect -ftree-loop-im
11200 has to be enabled as well. Enabled at level -O1 and higher, except
11201 for -Og.
11202
11203 -fsplit-loops
11204 Split a loop into two if it contains a condition that's always true
11205 for one side of the iteration space and false for the other.
11206
11207 Enabled by -fprofile-use and -fauto-profile.
11208
11209 -funswitch-loops
11210 Move branches with loop invariant conditions out of the loop, with
11211 duplicates of the loop on both branches (modified according to
11212 result of the condition).
11213
11214 Enabled by -fprofile-use and -fauto-profile.
11215
11216 -fversion-loops-for-strides
11217 If a loop iterates over an array with a variable stride, create
11218 another version of the loop that assumes the stride is always one.
11219 For example:
11220
11221 for (int i = 0; i < n; ++i)
11222 x[i * stride] = ...;
11223
11224 becomes:
11225
11226 if (stride == 1)
11227 for (int i = 0; i < n; ++i)
11228 x[i] = ...;
11229 else
11230 for (int i = 0; i < n; ++i)
11231 x[i * stride] = ...;
11232
11233 This is particularly useful for assumed-shape arrays in Fortran
11234 where (for example) it allows better vectorization assuming
11235 contiguous accesses. This flag is enabled by default at -O3. It
11236 is also enabled by -fprofile-use and -fauto-profile.
11237
11238 -ffunction-sections
11239 -fdata-sections
11240 Place each function or data item into its own section in the output
11241 file if the target supports arbitrary sections. The name of the
11242 function or the name of the data item determines the section's name
11243 in the output file.
11244
11245 Use these options on systems where the linker can perform
11246 optimizations to improve locality of reference in the instruction
11247 space. Most systems using the ELF object format have linkers with
11248 such optimizations. On AIX, the linker rearranges sections
11249 (CSECTs) based on the call graph. The performance impact varies.
11250
11251 Together with a linker garbage collection (linker --gc-sections
11252 option) these options may lead to smaller statically-linked
11253 executables (after stripping).
11254
11255 On ELF/DWARF systems these options do not degenerate the quality of
11256 the debug information. There could be issues with other object
11257 files/debug info formats.
11258
11259 Only use these options when there are significant benefits from
11260 doing so. When you specify these options, the assembler and linker
11261 create larger object and executable files and are also slower.
11262 These options affect code generation. They prevent optimizations
11263 by the compiler and assembler using relative locations inside a
11264 translation unit since the locations are unknown until link time.
11265 An example of such an optimization is relaxing calls to short call
11266 instructions.
11267
11268 -fstdarg-opt
11269 Optimize the prologue of variadic argument functions with respect
11270 to usage of those arguments.
11271
11272 -fsection-anchors
11273 Try to reduce the number of symbolic address calculations by using
11274 shared "anchor" symbols to address nearby objects. This
11275 transformation can help to reduce the number of GOT entries and GOT
11276 accesses on some targets.
11277
11278 For example, the implementation of the following function "foo":
11279
11280 static int a, b, c;
11281 int foo (void) { return a + b + c; }
11282
11283 usually calculates the addresses of all three variables, but if you
11284 compile it with -fsection-anchors, it accesses the variables from a
11285 common anchor point instead. The effect is similar to the
11286 following pseudocode (which isn't valid C):
11287
11288 int foo (void)
11289 {
11290 register int *xr = &x;
11291 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11292 }
11293
11294 Not all targets support this option.
11295
11296 -fzero-call-used-regs=choice
11297 Zero call-used registers at function return to increase program
11298 security by either mitigating Return-Oriented Programming (ROP)
11299 attacks or preventing information leakage through registers.
11300
11301 The possible values of choice are the same as for the
11302 "zero_call_used_regs" attribute. The default is skip.
11303
11304 You can control this behavior for a specific function by using the
11305 function attribute "zero_call_used_regs".
11306
11307 --param name=value
11308 In some places, GCC uses various constants to control the amount of
11309 optimization that is done. For example, GCC does not inline
11310 functions that contain more than a certain number of instructions.
11311 You can control some of these constants on the command line using
11312 the --param option.
11313
11314 The names of specific parameters, and the meaning of the values,
11315 are tied to the internals of the compiler, and are subject to
11316 change without notice in future releases.
11317
11318 In order to get minimal, maximal and default value of a parameter,
11319 one can use --help=param -Q options.
11320
11321 In each case, the value is an integer. The following choices of
11322 name are recognized for all targets:
11323
11324 predictable-branch-outcome
11325 When branch is predicted to be taken with probability lower
11326 than this threshold (in percent), then it is considered well
11327 predictable.
11328
11329 max-rtl-if-conversion-insns
11330 RTL if-conversion tries to remove conditional branches around a
11331 block and replace them with conditionally executed
11332 instructions. This parameter gives the maximum number of
11333 instructions in a block which should be considered for if-
11334 conversion. The compiler will also use other heuristics to
11335 decide whether if-conversion is likely to be profitable.
11336
11337 max-rtl-if-conversion-predictable-cost
11338 RTL if-conversion will try to remove conditional branches
11339 around a block and replace them with conditionally executed
11340 instructions. These parameters give the maximum permissible
11341 cost for the sequence that would be generated by if-conversion
11342 depending on whether the branch is statically determined to be
11343 predictable or not. The units for this parameter are the same
11344 as those for the GCC internal seq_cost metric. The compiler
11345 will try to provide a reasonable default for this parameter
11346 using the BRANCH_COST target macro.
11347
11348 max-crossjump-edges
11349 The maximum number of incoming edges to consider for cross-
11350 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
11351 number of edges incoming to each block. Increasing values mean
11352 more aggressive optimization, making the compilation time
11353 increase with probably small improvement in executable size.
11354
11355 min-crossjump-insns
11356 The minimum number of instructions that must be matched at the
11357 end of two blocks before cross-jumping is performed on them.
11358 This value is ignored in the case where all instructions in the
11359 block being cross-jumped from are matched.
11360
11361 max-grow-copy-bb-insns
11362 The maximum code size expansion factor when copying basic
11363 blocks instead of jumping. The expansion is relative to a jump
11364 instruction.
11365
11366 max-goto-duplication-insns
11367 The maximum number of instructions to duplicate to a block that
11368 jumps to a computed goto. To avoid O(N^2) behavior in a number
11369 of passes, GCC factors computed gotos early in the compilation
11370 process, and unfactors them as late as possible. Only computed
11371 jumps at the end of a basic blocks with no more than max-goto-
11372 duplication-insns are unfactored.
11373
11374 max-delay-slot-insn-search
11375 The maximum number of instructions to consider when looking for
11376 an instruction to fill a delay slot. If more than this
11377 arbitrary number of instructions are searched, the time savings
11378 from filling the delay slot are minimal, so stop searching.
11379 Increasing values mean more aggressive optimization, making the
11380 compilation time increase with probably small improvement in
11381 execution time.
11382
11383 max-delay-slot-live-search
11384 When trying to fill delay slots, the maximum number of
11385 instructions to consider when searching for a block with valid
11386 live register information. Increasing this arbitrarily chosen
11387 value means more aggressive optimization, increasing the
11388 compilation time. This parameter should be removed when the
11389 delay slot code is rewritten to maintain the control-flow
11390 graph.
11391
11392 max-gcse-memory
11393 The approximate maximum amount of memory in "kB" that can be
11394 allocated in order to perform the global common subexpression
11395 elimination optimization. If more memory than specified is
11396 required, the optimization is not done.
11397
11398 max-gcse-insertion-ratio
11399 If the ratio of expression insertions to deletions is larger
11400 than this value for any expression, then RTL PRE inserts or
11401 removes the expression and thus leaves partially redundant
11402 computations in the instruction stream.
11403
11404 max-pending-list-length
11405 The maximum number of pending dependencies scheduling allows
11406 before flushing the current state and starting over. Large
11407 functions with few branches or calls can create excessively
11408 large lists which needlessly consume memory and resources.
11409
11410 max-modulo-backtrack-attempts
11411 The maximum number of backtrack attempts the scheduler should
11412 make when modulo scheduling a loop. Larger values can
11413 exponentially increase compilation time.
11414
11415 max-inline-functions-called-once-loop-depth
11416 Maximal loop depth of a call considered by inline heuristics
11417 that tries to inline all functions called once.
11418
11419 max-inline-functions-called-once-insns
11420 Maximal estimated size of functions produced while inlining
11421 functions called once.
11422
11423 max-inline-insns-single
11424 Several parameters control the tree inliner used in GCC. This
11425 number sets the maximum number of instructions (counted in
11426 GCC's internal representation) in a single function that the
11427 tree inliner considers for inlining. This only affects
11428 functions declared inline and methods implemented in a class
11429 declaration (C++).
11430
11431 max-inline-insns-auto
11432 When you use -finline-functions (included in -O3), a lot of
11433 functions that would otherwise not be considered for inlining
11434 by the compiler are investigated. To those functions, a
11435 different (more restrictive) limit compared to functions
11436 declared inline can be applied (--param max-inline-insns-auto).
11437
11438 max-inline-insns-small
11439 This is bound applied to calls which are considered relevant
11440 with -finline-small-functions.
11441
11442 max-inline-insns-size
11443 This is bound applied to calls which are optimized for size.
11444 Small growth may be desirable to anticipate optimization
11445 oppurtunities exposed by inlining.
11446
11447 uninlined-function-insns
11448 Number of instructions accounted by inliner for function
11449 overhead such as function prologue and epilogue.
11450
11451 uninlined-function-time
11452 Extra time accounted by inliner for function overhead such as
11453 time needed to execute function prologue and epilogue.
11454
11455 inline-heuristics-hint-percent
11456 The scale (in percents) applied to inline-insns-single,
11457 inline-insns-single-O2, inline-insns-auto when inline
11458 heuristics hints that inlining is very profitable (will enable
11459 later optimizations).
11460
11461 uninlined-thunk-insns
11462 uninlined-thunk-time
11463 Same as --param uninlined-function-insns and --param uninlined-
11464 function-time but applied to function thunks.
11465
11466 inline-min-speedup
11467 When estimated performance improvement of caller + callee
11468 runtime exceeds this threshold (in percent), the function can
11469 be inlined regardless of the limit on --param max-inline-insns-
11470 single and --param max-inline-insns-auto.
11471
11472 large-function-insns
11473 The limit specifying really large functions. For functions
11474 larger than this limit after inlining, inlining is constrained
11475 by --param large-function-growth. This parameter is useful
11476 primarily to avoid extreme compilation time caused by non-
11477 linear algorithms used by the back end.
11478
11479 large-function-growth
11480 Specifies maximal growth of large function caused by inlining
11481 in percents. For example, parameter value 100 limits large
11482 function growth to 2.0 times the original size.
11483
11484 large-unit-insns
11485 The limit specifying large translation unit. Growth caused by
11486 inlining of units larger than this limit is limited by --param
11487 inline-unit-growth. For small units this might be too tight.
11488 For example, consider a unit consisting of function A that is
11489 inline and B that just calls A three times. If B is small
11490 relative to A, the growth of unit is 300\% and yet such
11491 inlining is very sane. For very large units consisting of
11492 small inlineable functions, however, the overall unit growth
11493 limit is needed to avoid exponential explosion of code size.
11494 Thus for smaller units, the size is increased to --param large-
11495 unit-insns before applying --param inline-unit-growth.
11496
11497 lazy-modules
11498 Maximum number of concurrently open C++ module files when lazy
11499 loading.
11500
11501 inline-unit-growth
11502 Specifies maximal overall growth of the compilation unit caused
11503 by inlining. For example, parameter value 20 limits unit
11504 growth to 1.2 times the original size. Cold functions (either
11505 marked cold via an attribute or by profile feedback) are not
11506 accounted into the unit size.
11507
11508 ipa-cp-unit-growth
11509 Specifies maximal overall growth of the compilation unit caused
11510 by interprocedural constant propagation. For example,
11511 parameter value 10 limits unit growth to 1.1 times the original
11512 size.
11513
11514 ipa-cp-large-unit-insns
11515 The size of translation unit that IPA-CP pass considers large.
11516
11517 large-stack-frame
11518 The limit specifying large stack frames. While inlining the
11519 algorithm is trying to not grow past this limit too much.
11520
11521 large-stack-frame-growth
11522 Specifies maximal growth of large stack frames caused by
11523 inlining in percents. For example, parameter value 1000 limits
11524 large stack frame growth to 11 times the original size.
11525
11526 max-inline-insns-recursive
11527 max-inline-insns-recursive-auto
11528 Specifies the maximum number of instructions an out-of-line
11529 copy of a self-recursive inline function can grow into by
11530 performing recursive inlining.
11531
11532 --param max-inline-insns-recursive applies to functions
11533 declared inline. For functions not declared inline, recursive
11534 inlining happens only when -finline-functions (included in -O3)
11535 is enabled; --param max-inline-insns-recursive-auto applies
11536 instead.
11537
11538 max-inline-recursive-depth
11539 max-inline-recursive-depth-auto
11540 Specifies the maximum recursion depth used for recursive
11541 inlining.
11542
11543 --param max-inline-recursive-depth applies to functions
11544 declared inline. For functions not declared inline, recursive
11545 inlining happens only when -finline-functions (included in -O3)
11546 is enabled; --param max-inline-recursive-depth-auto applies
11547 instead.
11548
11549 min-inline-recursive-probability
11550 Recursive inlining is profitable only for function having deep
11551 recursion in average and can hurt for function having little
11552 recursion depth by increasing the prologue size or complexity
11553 of function body to other optimizers.
11554
11555 When profile feedback is available (see -fprofile-generate) the
11556 actual recursion depth can be guessed from the probability that
11557 function recurses via a given call expression. This parameter
11558 limits inlining only to call expressions whose probability
11559 exceeds the given threshold (in percents).
11560
11561 early-inlining-insns
11562 Specify growth that the early inliner can make. In effect it
11563 increases the amount of inlining for code having a large
11564 abstraction penalty.
11565
11566 max-early-inliner-iterations
11567 Limit of iterations of the early inliner. This basically
11568 bounds the number of nested indirect calls the early inliner
11569 can resolve. Deeper chains are still handled by late inlining.
11570
11571 comdat-sharing-probability
11572 Probability (in percent) that C++ inline function with comdat
11573 visibility are shared across multiple compilation units.
11574
11575 modref-max-bases
11576 modref-max-refs
11577 modref-max-accesses
11578 Specifies the maximal number of base pointers, references and
11579 accesses stored for a single function by mod/ref analysis.
11580
11581 modref-max-tests
11582 Specifies the maxmal number of tests alias oracle can perform
11583 to disambiguate memory locations using the mod/ref information.
11584 This parameter ought to be bigger than --param modref-max-bases
11585 and --param modref-max-refs.
11586
11587 modref-max-depth
11588 Specifies the maximum depth of DFS walk used by modref escape
11589 analysis. Setting to 0 disables the analysis completely.
11590
11591 modref-max-escape-points
11592 Specifies the maximum number of escape points tracked by modref
11593 per SSA-name.
11594
11595 modref-max-adjustments
11596 Specifies the maximum number the access range is enlarged
11597 during modref dataflow analysis.
11598
11599 profile-func-internal-id
11600 A parameter to control whether to use function internal id in
11601 profile database lookup. If the value is 0, the compiler uses
11602 an id that is based on function assembler name and filename,
11603 which makes old profile data more tolerant to source changes
11604 such as function reordering etc.
11605
11606 min-vect-loop-bound
11607 The minimum number of iterations under which loops are not
11608 vectorized when -ftree-vectorize is used. The number of
11609 iterations after vectorization needs to be greater than the
11610 value specified by this option to allow vectorization.
11611
11612 gcse-cost-distance-ratio
11613 Scaling factor in calculation of maximum distance an expression
11614 can be moved by GCSE optimizations. This is currently
11615 supported only in the code hoisting pass. The bigger the
11616 ratio, the more aggressive code hoisting is with simple
11617 expressions, i.e., the expressions that have cost less than
11618 gcse-unrestricted-cost. Specifying 0 disables hoisting of
11619 simple expressions.
11620
11621 gcse-unrestricted-cost
11622 Cost, roughly measured as the cost of a single typical machine
11623 instruction, at which GCSE optimizations do not constrain the
11624 distance an expression can travel. This is currently supported
11625 only in the code hoisting pass. The lesser the cost, the more
11626 aggressive code hoisting is. Specifying 0 allows all
11627 expressions to travel unrestricted distances.
11628
11629 max-hoist-depth
11630 The depth of search in the dominator tree for expressions to
11631 hoist. This is used to avoid quadratic behavior in hoisting
11632 algorithm. The value of 0 does not limit on the search, but
11633 may slow down compilation of huge functions.
11634
11635 max-tail-merge-comparisons
11636 The maximum amount of similar bbs to compare a bb with. This
11637 is used to avoid quadratic behavior in tree tail merging.
11638
11639 max-tail-merge-iterations
11640 The maximum amount of iterations of the pass over the function.
11641 This is used to limit compilation time in tree tail merging.
11642
11643 store-merging-allow-unaligned
11644 Allow the store merging pass to introduce unaligned stores if
11645 it is legal to do so.
11646
11647 max-stores-to-merge
11648 The maximum number of stores to attempt to merge into wider
11649 stores in the store merging pass.
11650
11651 max-store-chains-to-track
11652 The maximum number of store chains to track at the same time in
11653 the attempt to merge them into wider stores in the store
11654 merging pass.
11655
11656 max-stores-to-track
11657 The maximum number of stores to track at the same time in the
11658 attemt to to merge them into wider stores in the store merging
11659 pass.
11660
11661 max-unrolled-insns
11662 The maximum number of instructions that a loop may have to be
11663 unrolled. If a loop is unrolled, this parameter also
11664 determines how many times the loop code is unrolled.
11665
11666 max-average-unrolled-insns
11667 The maximum number of instructions biased by probabilities of
11668 their execution that a loop may have to be unrolled. If a loop
11669 is unrolled, this parameter also determines how many times the
11670 loop code is unrolled.
11671
11672 max-unroll-times
11673 The maximum number of unrollings of a single loop.
11674
11675 max-peeled-insns
11676 The maximum number of instructions that a loop may have to be
11677 peeled. If a loop is peeled, this parameter also determines
11678 how many times the loop code is peeled.
11679
11680 max-peel-times
11681 The maximum number of peelings of a single loop.
11682
11683 max-peel-branches
11684 The maximum number of branches on the hot path through the
11685 peeled sequence.
11686
11687 max-completely-peeled-insns
11688 The maximum number of insns of a completely peeled loop.
11689
11690 max-completely-peel-times
11691 The maximum number of iterations of a loop to be suitable for
11692 complete peeling.
11693
11694 max-completely-peel-loop-nest-depth
11695 The maximum depth of a loop nest suitable for complete peeling.
11696
11697 max-unswitch-insns
11698 The maximum number of insns of an unswitched loop.
11699
11700 max-unswitch-level
11701 The maximum number of branches unswitched in a single loop.
11702
11703 lim-expensive
11704 The minimum cost of an expensive expression in the loop
11705 invariant motion.
11706
11707 min-loop-cond-split-prob
11708 When FDO profile information is available, min-loop-cond-split-
11709 prob specifies minimum threshold for probability of semi-
11710 invariant condition statement to trigger loop split.
11711
11712 iv-consider-all-candidates-bound
11713 Bound on number of candidates for induction variables, below
11714 which all candidates are considered for each use in induction
11715 variable optimizations. If there are more candidates than
11716 this, only the most relevant ones are considered to avoid
11717 quadratic time complexity.
11718
11719 iv-max-considered-uses
11720 The induction variable optimizations give up on loops that
11721 contain more induction variable uses.
11722
11723 iv-always-prune-cand-set-bound
11724 If the number of candidates in the set is smaller than this
11725 value, always try to remove unnecessary ivs from the set when
11726 adding a new one.
11727
11728 avg-loop-niter
11729 Average number of iterations of a loop.
11730
11731 dse-max-object-size
11732 Maximum size (in bytes) of objects tracked bytewise by dead
11733 store elimination. Larger values may result in larger
11734 compilation times.
11735
11736 dse-max-alias-queries-per-store
11737 Maximum number of queries into the alias oracle per store.
11738 Larger values result in larger compilation times and may result
11739 in more removed dead stores.
11740
11741 scev-max-expr-size
11742 Bound on size of expressions used in the scalar evolutions
11743 analyzer. Large expressions slow the analyzer.
11744
11745 scev-max-expr-complexity
11746 Bound on the complexity of the expressions in the scalar
11747 evolutions analyzer. Complex expressions slow the analyzer.
11748
11749 max-tree-if-conversion-phi-args
11750 Maximum number of arguments in a PHI supported by TREE if
11751 conversion unless the loop is marked with simd pragma.
11752
11753 vect-max-version-for-alignment-checks
11754 The maximum number of run-time checks that can be performed
11755 when doing loop versioning for alignment in the vectorizer.
11756
11757 vect-max-version-for-alias-checks
11758 The maximum number of run-time checks that can be performed
11759 when doing loop versioning for alias in the vectorizer.
11760
11761 vect-max-peeling-for-alignment
11762 The maximum number of loop peels to enhance access alignment
11763 for vectorizer. Value -1 means no limit.
11764
11765 max-iterations-to-track
11766 The maximum number of iterations of a loop the brute-force
11767 algorithm for analysis of the number of iterations of the loop
11768 tries to evaluate.
11769
11770 hot-bb-count-fraction
11771 The denominator n of fraction 1/n of the maximal execution
11772 count of a basic block in the entire program that a basic block
11773 needs to at least have in order to be considered hot. The
11774 default is 10000, which means that a basic block is considered
11775 hot if its execution count is greater than 1/10000 of the
11776 maximal execution count. 0 means that it is never considered
11777 hot. Used in non-LTO mode.
11778
11779 hot-bb-count-ws-permille
11780 The number of most executed permilles, ranging from 0 to 1000,
11781 of the profiled execution of the entire program to which the
11782 execution count of a basic block must be part of in order to be
11783 considered hot. The default is 990, which means that a basic
11784 block is considered hot if its execution count contributes to
11785 the upper 990 permilles, or 99.0%, of the profiled execution of
11786 the entire program. 0 means that it is never considered hot.
11787 Used in LTO mode.
11788
11789 hot-bb-frequency-fraction
11790 The denominator n of fraction 1/n of the execution frequency of
11791 the entry block of a function that a basic block of this
11792 function needs to at least have in order to be considered hot.
11793 The default is 1000, which means that a basic block is
11794 considered hot in a function if it is executed more frequently
11795 than 1/1000 of the frequency of the entry block of the
11796 function. 0 means that it is never considered hot.
11797
11798 unlikely-bb-count-fraction
11799 The denominator n of fraction 1/n of the number of profiled
11800 runs of the entire program below which the execution count of a
11801 basic block must be in order for the basic block to be
11802 considered unlikely executed. The default is 20, which means
11803 that a basic block is considered unlikely executed if it is
11804 executed in fewer than 1/20, or 5%, of the runs of the program.
11805 0 means that it is always considered unlikely executed.
11806
11807 max-predicted-iterations
11808 The maximum number of loop iterations we predict statically.
11809 This is useful in cases where a function contains a single loop
11810 with known bound and another loop with unknown bound. The
11811 known number of iterations is predicted correctly, while the
11812 unknown number of iterations average to roughly 10. This means
11813 that the loop without bounds appears artificially cold relative
11814 to the other one.
11815
11816 builtin-expect-probability
11817 Control the probability of the expression having the specified
11818 value. This parameter takes a percentage (i.e. 0 ... 100) as
11819 input.
11820
11821 builtin-string-cmp-inline-length
11822 The maximum length of a constant string for a builtin string
11823 cmp call eligible for inlining.
11824
11825 align-threshold
11826 Select fraction of the maximal frequency of executions of a
11827 basic block in a function to align the basic block.
11828
11829 align-loop-iterations
11830 A loop expected to iterate at least the selected number of
11831 iterations is aligned.
11832
11833 tracer-dynamic-coverage
11834 tracer-dynamic-coverage-feedback
11835 This value is used to limit superblock formation once the given
11836 percentage of executed instructions is covered. This limits
11837 unnecessary code size expansion.
11838
11839 The tracer-dynamic-coverage-feedback parameter is used only
11840 when profile feedback is available. The real profiles (as
11841 opposed to statically estimated ones) are much less balanced
11842 allowing the threshold to be larger value.
11843
11844 tracer-max-code-growth
11845 Stop tail duplication once code growth has reached given
11846 percentage. This is a rather artificial limit, as most of the
11847 duplicates are eliminated later in cross jumping, so it may be
11848 set to much higher values than is the desired code growth.
11849
11850 tracer-min-branch-ratio
11851 Stop reverse growth when the reverse probability of best edge
11852 is less than this threshold (in percent).
11853
11854 tracer-min-branch-probability
11855 tracer-min-branch-probability-feedback
11856 Stop forward growth if the best edge has probability lower than
11857 this threshold.
11858
11859 Similarly to tracer-dynamic-coverage two parameters are
11860 provided. tracer-min-branch-probability-feedback is used for
11861 compilation with profile feedback and tracer-min-branch-
11862 probability compilation without. The value for compilation
11863 with profile feedback needs to be more conservative (higher) in
11864 order to make tracer effective.
11865
11866 stack-clash-protection-guard-size
11867 Specify the size of the operating system provided stack guard
11868 as 2 raised to num bytes. Higher values may reduce the number
11869 of explicit probes, but a value larger than the operating
11870 system provided guard will leave code vulnerable to stack clash
11871 style attacks.
11872
11873 stack-clash-protection-probe-interval
11874 Stack clash protection involves probing stack space as it is
11875 allocated. This param controls the maximum distance between
11876 probes into the stack as 2 raised to num bytes. Higher values
11877 may reduce the number of explicit probes, but a value larger
11878 than the operating system provided guard will leave code
11879 vulnerable to stack clash style attacks.
11880
11881 max-cse-path-length
11882 The maximum number of basic blocks on path that CSE considers.
11883
11884 max-cse-insns
11885 The maximum number of instructions CSE processes before
11886 flushing.
11887
11888 ggc-min-expand
11889 GCC uses a garbage collector to manage its own memory
11890 allocation. This parameter specifies the minimum percentage by
11891 which the garbage collector's heap should be allowed to expand
11892 between collections. Tuning this may improve compilation
11893 speed; it has no effect on code generation.
11894
11895 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11896 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11897 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11898 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11899 particular platform, the lower bound of 30% is used. Setting
11900 this parameter and ggc-min-heapsize to zero causes a full
11901 collection to occur at every opportunity. This is extremely
11902 slow, but can be useful for debugging.
11903
11904 ggc-min-heapsize
11905 Minimum size of the garbage collector's heap before it begins
11906 bothering to collect garbage. The first collection occurs
11907 after the heap expands by ggc-min-expand% beyond ggc-min-
11908 heapsize. Again, tuning this may improve compilation speed,
11909 and has no effect on code generation.
11910
11911 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11912 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11913 exceeded, but with a lower bound of 4096 (four megabytes) and
11914 an upper bound of 131072 (128 megabytes). If GCC is not able
11915 to calculate RAM on a particular platform, the lower bound is
11916 used. Setting this parameter very large effectively disables
11917 garbage collection. Setting this parameter and ggc-min-expand
11918 to zero causes a full collection to occur at every opportunity.
11919
11920 max-reload-search-insns
11921 The maximum number of instruction reload should look backward
11922 for equivalent register. Increasing values mean more
11923 aggressive optimization, making the compilation time increase
11924 with probably slightly better performance.
11925
11926 max-cselib-memory-locations
11927 The maximum number of memory locations cselib should take into
11928 account. Increasing values mean more aggressive optimization,
11929 making the compilation time increase with probably slightly
11930 better performance.
11931
11932 max-sched-ready-insns
11933 The maximum number of instructions ready to be issued the
11934 scheduler should consider at any given time during the first
11935 scheduling pass. Increasing values mean more thorough
11936 searches, making the compilation time increase with probably
11937 little benefit.
11938
11939 max-sched-region-blocks
11940 The maximum number of blocks in a region to be considered for
11941 interblock scheduling.
11942
11943 max-pipeline-region-blocks
11944 The maximum number of blocks in a region to be considered for
11945 pipelining in the selective scheduler.
11946
11947 max-sched-region-insns
11948 The maximum number of insns in a region to be considered for
11949 interblock scheduling.
11950
11951 max-pipeline-region-insns
11952 The maximum number of insns in a region to be considered for
11953 pipelining in the selective scheduler.
11954
11955 min-spec-prob
11956 The minimum probability (in percents) of reaching a source
11957 block for interblock speculative scheduling.
11958
11959 max-sched-extend-regions-iters
11960 The maximum number of iterations through CFG to extend regions.
11961 A value of 0 disables region extensions.
11962
11963 max-sched-insn-conflict-delay
11964 The maximum conflict delay for an insn to be considered for
11965 speculative motion.
11966
11967 sched-spec-prob-cutoff
11968 The minimal probability of speculation success (in percents),
11969 so that speculative insns are scheduled.
11970
11971 sched-state-edge-prob-cutoff
11972 The minimum probability an edge must have for the scheduler to
11973 save its state across it.
11974
11975 sched-mem-true-dep-cost
11976 Minimal distance (in CPU cycles) between store and load
11977 targeting same memory locations.
11978
11979 selsched-max-lookahead
11980 The maximum size of the lookahead window of selective
11981 scheduling. It is a depth of search for available
11982 instructions.
11983
11984 selsched-max-sched-times
11985 The maximum number of times that an instruction is scheduled
11986 during selective scheduling. This is the limit on the number
11987 of iterations through which the instruction may be pipelined.
11988
11989 selsched-insns-to-rename
11990 The maximum number of best instructions in the ready list that
11991 are considered for renaming in the selective scheduler.
11992
11993 sms-min-sc
11994 The minimum value of stage count that swing modulo scheduler
11995 generates.
11996
11997 max-last-value-rtl
11998 The maximum size measured as number of RTLs that can be
11999 recorded in an expression in combiner for a pseudo register as
12000 last known value of that register.
12001
12002 max-combine-insns
12003 The maximum number of instructions the RTL combiner tries to
12004 combine.
12005
12006 integer-share-limit
12007 Small integer constants can use a shared data structure,
12008 reducing the compiler's memory usage and increasing its speed.
12009 This sets the maximum value of a shared integer constant.
12010
12011 ssp-buffer-size
12012 The minimum size of buffers (i.e. arrays) that receive stack
12013 smashing protection when -fstack-protector is used.
12014
12015 min-size-for-stack-sharing
12016 The minimum size of variables taking part in stack slot sharing
12017 when not optimizing.
12018
12019 max-jump-thread-duplication-stmts
12020 Maximum number of statements allowed in a block that needs to
12021 be duplicated when threading jumps.
12022
12023 max-fields-for-field-sensitive
12024 Maximum number of fields in a structure treated in a field
12025 sensitive manner during pointer analysis.
12026
12027 prefetch-latency
12028 Estimate on average number of instructions that are executed
12029 before prefetch finishes. The distance prefetched ahead is
12030 proportional to this constant. Increasing this number may also
12031 lead to less streams being prefetched (see simultaneous-
12032 prefetches).
12033
12034 simultaneous-prefetches
12035 Maximum number of prefetches that can run at the same time.
12036
12037 l1-cache-line-size
12038 The size of cache line in L1 data cache, in bytes.
12039
12040 l1-cache-size
12041 The size of L1 data cache, in kilobytes.
12042
12043 l2-cache-size
12044 The size of L2 data cache, in kilobytes.
12045
12046 prefetch-dynamic-strides
12047 Whether the loop array prefetch pass should issue software
12048 prefetch hints for strides that are non-constant. In some
12049 cases this may be beneficial, though the fact the stride is
12050 non-constant may make it hard to predict when there is clear
12051 benefit to issuing these hints.
12052
12053 Set to 1 if the prefetch hints should be issued for non-
12054 constant strides. Set to 0 if prefetch hints should be issued
12055 only for strides that are known to be constant and below
12056 prefetch-minimum-stride.
12057
12058 prefetch-minimum-stride
12059 Minimum constant stride, in bytes, to start using prefetch
12060 hints for. If the stride is less than this threshold, prefetch
12061 hints will not be issued.
12062
12063 This setting is useful for processors that have hardware
12064 prefetchers, in which case there may be conflicts between the
12065 hardware prefetchers and the software prefetchers. If the
12066 hardware prefetchers have a maximum stride they can handle, it
12067 should be used here to improve the use of software prefetchers.
12068
12069 A value of -1 means we don't have a threshold and therefore
12070 prefetch hints can be issued for any constant stride.
12071
12072 This setting is only useful for strides that are known and
12073 constant.
12074
12075 destructive-interference-size
12076 constructive-interference-size
12077 The values for the C++17 variables
12078 "std::hardware_destructive_interference_size" and
12079 "std::hardware_constructive_interference_size". The
12080 destructive interference size is the minimum recommended offset
12081 between two independent concurrently-accessed objects; the
12082 constructive interference size is the maximum recommended size
12083 of contiguous memory accessed together. Typically both will be
12084 the size of an L1 cache line for the target, in bytes. For a
12085 generic target covering a range of L1 cache line sizes,
12086 typically the constructive interference size will be the small
12087 end of the range and the destructive size will be the large
12088 end.
12089
12090 The destructive interference size is intended to be used for
12091 layout, and thus has ABI impact. The default value is not
12092 expected to be stable, and on some targets varies with -mtune,
12093 so use of this variable in a context where ABI stability is
12094 important, such as the public interface of a library, is
12095 strongly discouraged; if it is used in that context, users can
12096 stabilize the value using this option.
12097
12098 The constructive interference size is less sensitive, as it is
12099 typically only used in a static_assert to make sure that a type
12100 fits within a cache line.
12101
12102 See also -Winterference-size.
12103
12104 loop-interchange-max-num-stmts
12105 The maximum number of stmts in a loop to be interchanged.
12106
12107 loop-interchange-stride-ratio
12108 The minimum ratio between stride of two loops for interchange
12109 to be profitable.
12110
12111 min-insn-to-prefetch-ratio
12112 The minimum ratio between the number of instructions and the
12113 number of prefetches to enable prefetching in a loop.
12114
12115 prefetch-min-insn-to-mem-ratio
12116 The minimum ratio between the number of instructions and the
12117 number of memory references to enable prefetching in a loop.
12118
12119 use-canonical-types
12120 Whether the compiler should use the "canonical" type system.
12121 Should always be 1, which uses a more efficient internal
12122 mechanism for comparing types in C++ and Objective-C++.
12123 However, if bugs in the canonical type system are causing
12124 compilation failures, set this value to 0 to disable canonical
12125 types.
12126
12127 switch-conversion-max-branch-ratio
12128 Switch initialization conversion refuses to create arrays that
12129 are bigger than switch-conversion-max-branch-ratio times the
12130 number of branches in the switch.
12131
12132 max-partial-antic-length
12133 Maximum length of the partial antic set computed during the
12134 tree partial redundancy elimination optimization (-ftree-pre)
12135 when optimizing at -O3 and above. For some sorts of source
12136 code the enhanced partial redundancy elimination optimization
12137 can run away, consuming all of the memory available on the host
12138 machine. This parameter sets a limit on the length of the sets
12139 that are computed, which prevents the runaway behavior.
12140 Setting a value of 0 for this parameter allows an unlimited set
12141 length.
12142
12143 rpo-vn-max-loop-depth
12144 Maximum loop depth that is value-numbered optimistically. When
12145 the limit hits the innermost rpo-vn-max-loop-depth loops and
12146 the outermost loop in the loop nest are value-numbered
12147 optimistically and the remaining ones not.
12148
12149 sccvn-max-alias-queries-per-access
12150 Maximum number of alias-oracle queries we perform when looking
12151 for redundancies for loads and stores. If this limit is hit
12152 the search is aborted and the load or store is not considered
12153 redundant. The number of queries is algorithmically limited to
12154 the number of stores on all paths from the load to the function
12155 entry.
12156
12157 ira-max-loops-num
12158 IRA uses regional register allocation by default. If a
12159 function contains more loops than the number given by this
12160 parameter, only at most the given number of the most
12161 frequently-executed loops form regions for regional register
12162 allocation.
12163
12164 ira-max-conflict-table-size
12165 Although IRA uses a sophisticated algorithm to compress the
12166 conflict table, the table can still require excessive amounts
12167 of memory for huge functions. If the conflict table for a
12168 function could be more than the size in MB given by this
12169 parameter, the register allocator instead uses a faster,
12170 simpler, and lower-quality algorithm that does not require
12171 building a pseudo-register conflict table.
12172
12173 ira-loop-reserved-regs
12174 IRA can be used to evaluate more accurate register pressure in
12175 loops for decisions to move loop invariants (see -O3). The
12176 number of available registers reserved for some other purposes
12177 is given by this parameter. Default of the parameter is the
12178 best found from numerous experiments.
12179
12180 ira-consider-dup-in-all-alts
12181 Make IRA to consider matching constraint (duplicated operand
12182 number) heavily in all available alternatives for preferred
12183 register class. If it is set as zero, it means IRA only
12184 respects the matching constraint when it's in the only
12185 available alternative with an appropriate register class.
12186 Otherwise, it means IRA will check all available alternatives
12187 for preferred register class even if it has found some choice
12188 with an appropriate register class and respect the found
12189 qualified matching constraint.
12190
12191 lra-inheritance-ebb-probability-cutoff
12192 LRA tries to reuse values reloaded in registers in subsequent
12193 insns. This optimization is called inheritance. EBB is used
12194 as a region to do this optimization. The parameter defines a
12195 minimal fall-through edge probability in percentage used to add
12196 BB to inheritance EBB in LRA. The default value was chosen
12197 from numerous runs of SPEC2000 on x86-64.
12198
12199 loop-invariant-max-bbs-in-loop
12200 Loop invariant motion can be very expensive, both in
12201 compilation time and in amount of needed compile-time memory,
12202 with very large loops. Loops with more basic blocks than this
12203 parameter won't have loop invariant motion optimization
12204 performed on them.
12205
12206 loop-max-datarefs-for-datadeps
12207 Building data dependencies is expensive for very large loops.
12208 This parameter limits the number of data references in loops
12209 that are considered for data dependence analysis. These large
12210 loops are no handled by the optimizations using loop data
12211 dependencies.
12212
12213 max-vartrack-size
12214 Sets a maximum number of hash table slots to use during
12215 variable tracking dataflow analysis of any function. If this
12216 limit is exceeded with variable tracking at assignments
12217 enabled, analysis for that function is retried without it,
12218 after removing all debug insns from the function. If the limit
12219 is exceeded even without debug insns, var tracking analysis is
12220 completely disabled for the function. Setting the parameter to
12221 zero makes it unlimited.
12222
12223 max-vartrack-expr-depth
12224 Sets a maximum number of recursion levels when attempting to
12225 map variable names or debug temporaries to value expressions.
12226 This trades compilation time for more complete debug
12227 information. If this is set too low, value expressions that
12228 are available and could be represented in debug information may
12229 end up not being used; setting this higher may enable the
12230 compiler to find more complex debug expressions, but compile
12231 time and memory use may grow.
12232
12233 max-debug-marker-count
12234 Sets a threshold on the number of debug markers (e.g. begin
12235 stmt markers) to avoid complexity explosion at inlining or
12236 expanding to RTL. If a function has more such gimple stmts
12237 than the set limit, such stmts will be dropped from the inlined
12238 copy of a function, and from its RTL expansion.
12239
12240 min-nondebug-insn-uid
12241 Use uids starting at this parameter for nondebug insns. The
12242 range below the parameter is reserved exclusively for debug
12243 insns created by -fvar-tracking-assignments, but debug insns
12244 may get (non-overlapping) uids above it if the reserved range
12245 is exhausted.
12246
12247 ipa-sra-ptr-growth-factor
12248 IPA-SRA replaces a pointer to an aggregate with one or more new
12249 parameters only when their cumulative size is less or equal to
12250 ipa-sra-ptr-growth-factor times the size of the original
12251 pointer parameter.
12252
12253 ipa-sra-max-replacements
12254 Maximum pieces of an aggregate that IPA-SRA tracks. As a
12255 consequence, it is also the maximum number of replacements of a
12256 formal parameter.
12257
12258 sra-max-scalarization-size-Ospeed
12259 sra-max-scalarization-size-Osize
12260 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
12261 aim to replace scalar parts of aggregates with uses of
12262 independent scalar variables. These parameters control the
12263 maximum size, in storage units, of aggregate which is
12264 considered for replacement when compiling for speed (sra-max-
12265 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
12266 Osize) respectively.
12267
12268 sra-max-propagations
12269 The maximum number of artificial accesses that Scalar
12270 Replacement of Aggregates (SRA) will track, per one local
12271 variable, in order to facilitate copy propagation.
12272
12273 tm-max-aggregate-size
12274 When making copies of thread-local variables in a transaction,
12275 this parameter specifies the size in bytes after which
12276 variables are saved with the logging functions as opposed to
12277 save/restore code sequence pairs. This option only applies
12278 when using -fgnu-tm.
12279
12280 graphite-max-nb-scop-params
12281 To avoid exponential effects in the Graphite loop transforms,
12282 the number of parameters in a Static Control Part (SCoP) is
12283 bounded. A value of zero can be used to lift the bound. A
12284 variable whose value is unknown at compilation time and defined
12285 outside a SCoP is a parameter of the SCoP.
12286
12287 loop-block-tile-size
12288 Loop blocking or strip mining transforms, enabled with
12289 -floop-block or -floop-strip-mine, strip mine each loop in the
12290 loop nest by a given number of iterations. The strip length
12291 can be changed using the loop-block-tile-size parameter.
12292
12293 ipa-jump-function-lookups
12294 Specifies number of statements visited during jump function
12295 offset discovery.
12296
12297 ipa-cp-value-list-size
12298 IPA-CP attempts to track all possible values and types passed
12299 to a function's parameter in order to propagate them and
12300 perform devirtualization. ipa-cp-value-list-size is the
12301 maximum number of values and types it stores per one formal
12302 parameter of a function.
12303
12304 ipa-cp-eval-threshold
12305 IPA-CP calculates its own score of cloning profitability
12306 heuristics and performs those cloning opportunities with scores
12307 that exceed ipa-cp-eval-threshold.
12308
12309 ipa-cp-max-recursive-depth
12310 Maximum depth of recursive cloning for self-recursive function.
12311
12312 ipa-cp-min-recursive-probability
12313 Recursive cloning only when the probability of call being
12314 executed exceeds the parameter.
12315
12316 ipa-cp-profile-count-base
12317 When using -fprofile-use option, IPA-CP will consider the
12318 measured execution count of a call graph edge at this
12319 percentage position in their histogram as the basis for its
12320 heuristics calculation.
12321
12322 ipa-cp-recursive-freq-factor
12323 The number of times interprocedural copy propagation expects
12324 recursive functions to call themselves.
12325
12326 ipa-cp-recursion-penalty
12327 Percentage penalty the recursive functions will receive when
12328 they are evaluated for cloning.
12329
12330 ipa-cp-single-call-penalty
12331 Percentage penalty functions containing a single call to
12332 another function will receive when they are evaluated for
12333 cloning.
12334
12335 ipa-max-agg-items
12336 IPA-CP is also capable to propagate a number of scalar values
12337 passed in an aggregate. ipa-max-agg-items controls the maximum
12338 number of such values per one parameter.
12339
12340 ipa-cp-loop-hint-bonus
12341 When IPA-CP determines that a cloning candidate would make the
12342 number of iterations of a loop known, it adds a bonus of ipa-
12343 cp-loop-hint-bonus to the profitability score of the candidate.
12344
12345 ipa-max-loop-predicates
12346 The maximum number of different predicates IPA will use to
12347 describe when loops in a function have known properties.
12348
12349 ipa-max-aa-steps
12350 During its analysis of function bodies, IPA-CP employs alias
12351 analysis in order to track values pointed to by function
12352 parameters. In order not spend too much time analyzing huge
12353 functions, it gives up and consider all memory clobbered after
12354 examining ipa-max-aa-steps statements modifying memory.
12355
12356 ipa-max-switch-predicate-bounds
12357 Maximal number of boundary endpoints of case ranges of switch
12358 statement. For switch exceeding this limit, IPA-CP will not
12359 construct cloning cost predicate, which is used to estimate
12360 cloning benefit, for default case of the switch statement.
12361
12362 ipa-max-param-expr-ops
12363 IPA-CP will analyze conditional statement that references some
12364 function parameter to estimate benefit for cloning upon certain
12365 constant value. But if number of operations in a parameter
12366 expression exceeds ipa-max-param-expr-ops, the expression is
12367 treated as complicated one, and is not handled by IPA analysis.
12368
12369 lto-partitions
12370 Specify desired number of partitions produced during WHOPR
12371 compilation. The number of partitions should exceed the number
12372 of CPUs used for compilation.
12373
12374 lto-min-partition
12375 Size of minimal partition for WHOPR (in estimated
12376 instructions). This prevents expenses of splitting very small
12377 programs into too many partitions.
12378
12379 lto-max-partition
12380 Size of max partition for WHOPR (in estimated instructions).
12381 to provide an upper bound for individual size of partition.
12382 Meant to be used only with balanced partitioning.
12383
12384 lto-max-streaming-parallelism
12385 Maximal number of parallel processes used for LTO streaming.
12386
12387 cxx-max-namespaces-for-diagnostic-help
12388 The maximum number of namespaces to consult for suggestions
12389 when C++ name lookup fails for an identifier.
12390
12391 sink-frequency-threshold
12392 The maximum relative execution frequency (in percents) of the
12393 target block relative to a statement's original block to allow
12394 statement sinking of a statement. Larger numbers result in
12395 more aggressive statement sinking. A small positive adjustment
12396 is applied for statements with memory operands as those are
12397 even more profitable so sink.
12398
12399 max-stores-to-sink
12400 The maximum number of conditional store pairs that can be sunk.
12401 Set to 0 if either vectorization (-ftree-vectorize) or if-
12402 conversion (-ftree-loop-if-convert) is disabled.
12403
12404 case-values-threshold
12405 The smallest number of different values for which it is best to
12406 use a jump-table instead of a tree of conditional branches. If
12407 the value is 0, use the default for the machine.
12408
12409 jump-table-max-growth-ratio-for-size
12410 The maximum code size growth ratio when expanding into a jump
12411 table (in percent). The parameter is used when optimizing for
12412 size.
12413
12414 jump-table-max-growth-ratio-for-speed
12415 The maximum code size growth ratio when expanding into a jump
12416 table (in percent). The parameter is used when optimizing for
12417 speed.
12418
12419 tree-reassoc-width
12420 Set the maximum number of instructions executed in parallel in
12421 reassociated tree. This parameter overrides target dependent
12422 heuristics used by default if has non zero value.
12423
12424 sched-pressure-algorithm
12425 Choose between the two available implementations of
12426 -fsched-pressure. Algorithm 1 is the original implementation
12427 and is the more likely to prevent instructions from being
12428 reordered. Algorithm 2 was designed to be a compromise between
12429 the relatively conservative approach taken by algorithm 1 and
12430 the rather aggressive approach taken by the default scheduler.
12431 It relies more heavily on having a regular register file and
12432 accurate register pressure classes. See haifa-sched.cc in the
12433 GCC sources for more details.
12434
12435 The default choice depends on the target.
12436
12437 max-slsr-cand-scan
12438 Set the maximum number of existing candidates that are
12439 considered when seeking a basis for a new straight-line
12440 strength reduction candidate.
12441
12442 asan-globals
12443 Enable buffer overflow detection for global objects. This kind
12444 of protection is enabled by default if you are using
12445 -fsanitize=address option. To disable global objects
12446 protection use --param asan-globals=0.
12447
12448 asan-stack
12449 Enable buffer overflow detection for stack objects. This kind
12450 of protection is enabled by default when using
12451 -fsanitize=address. To disable stack protection use --param
12452 asan-stack=0 option.
12453
12454 asan-instrument-reads
12455 Enable buffer overflow detection for memory reads. This kind
12456 of protection is enabled by default when using
12457 -fsanitize=address. To disable memory reads protection use
12458 --param asan-instrument-reads=0.
12459
12460 asan-instrument-writes
12461 Enable buffer overflow detection for memory writes. This kind
12462 of protection is enabled by default when using
12463 -fsanitize=address. To disable memory writes protection use
12464 --param asan-instrument-writes=0 option.
12465
12466 asan-memintrin
12467 Enable detection for built-in functions. This kind of
12468 protection is enabled by default when using -fsanitize=address.
12469 To disable built-in functions protection use --param
12470 asan-memintrin=0.
12471
12472 asan-use-after-return
12473 Enable detection of use-after-return. This kind of protection
12474 is enabled by default when using the -fsanitize=address option.
12475 To disable it use --param asan-use-after-return=0.
12476
12477 Note: By default the check is disabled at run time. To enable
12478 it, add "detect_stack_use_after_return=1" to the environment
12479 variable ASAN_OPTIONS.
12480
12481 asan-instrumentation-with-call-threshold
12482 If number of memory accesses in function being instrumented is
12483 greater or equal to this number, use callbacks instead of
12484 inline checks. E.g. to disable inline code use --param
12485 asan-instrumentation-with-call-threshold=0.
12486
12487 hwasan-instrument-stack
12488 Enable hwasan instrumentation of statically sized stack-
12489 allocated variables. This kind of instrumentation is enabled
12490 by default when using -fsanitize=hwaddress and disabled by
12491 default when using -fsanitize=kernel-hwaddress. To disable
12492 stack instrumentation use --param hwasan-instrument-stack=0,
12493 and to enable it use --param hwasan-instrument-stack=1.
12494
12495 hwasan-random-frame-tag
12496 When using stack instrumentation, decide tags for stack
12497 variables using a deterministic sequence beginning at a random
12498 tag for each frame. With this parameter unset tags are chosen
12499 using the same sequence but beginning from 1. This is enabled
12500 by default for -fsanitize=hwaddress and unavailable for
12501 -fsanitize=kernel-hwaddress. To disable it use --param
12502 hwasan-random-frame-tag=0.
12503
12504 hwasan-instrument-allocas
12505 Enable hwasan instrumentation of dynamically sized stack-
12506 allocated variables. This kind of instrumentation is enabled
12507 by default when using -fsanitize=hwaddress and disabled by
12508 default when using -fsanitize=kernel-hwaddress. To disable
12509 instrumentation of such variables use --param
12510 hwasan-instrument-allocas=0, and to enable it use --param
12511 hwasan-instrument-allocas=1.
12512
12513 hwasan-instrument-reads
12514 Enable hwasan checks on memory reads. Instrumentation of reads
12515 is enabled by default for both -fsanitize=hwaddress and
12516 -fsanitize=kernel-hwaddress. To disable checking memory reads
12517 use --param hwasan-instrument-reads=0.
12518
12519 hwasan-instrument-writes
12520 Enable hwasan checks on memory writes. Instrumentation of
12521 writes is enabled by default for both -fsanitize=hwaddress and
12522 -fsanitize=kernel-hwaddress. To disable checking memory writes
12523 use --param hwasan-instrument-writes=0.
12524
12525 hwasan-instrument-mem-intrinsics
12526 Enable hwasan instrumentation of builtin functions.
12527 Instrumentation of these builtin functions is enabled by
12528 default for both -fsanitize=hwaddress and
12529 -fsanitize=kernel-hwaddress. To disable instrumentation of
12530 builtin functions use --param
12531 hwasan-instrument-mem-intrinsics=0.
12532
12533 use-after-scope-direct-emission-threshold
12534 If the size of a local variable in bytes is smaller or equal to
12535 this number, directly poison (or unpoison) shadow memory
12536 instead of using run-time callbacks.
12537
12538 tsan-distinguish-volatile
12539 Emit special instrumentation for accesses to volatiles.
12540
12541 tsan-instrument-func-entry-exit
12542 Emit instrumentation calls to __tsan_func_entry() and
12543 __tsan_func_exit().
12544
12545 max-fsm-thread-path-insns
12546 Maximum number of instructions to copy when duplicating blocks
12547 on a finite state automaton jump thread path.
12548
12549 max-fsm-thread-length
12550 Maximum number of basic blocks on a jump thread path.
12551
12552 threader-debug
12553 threader-debug=[none|all] Enables verbose dumping of the
12554 threader solver.
12555
12556 parloops-chunk-size
12557 Chunk size of omp schedule for loops parallelized by parloops.
12558
12559 parloops-schedule
12560 Schedule type of omp schedule for loops parallelized by
12561 parloops (static, dynamic, guided, auto, runtime).
12562
12563 parloops-min-per-thread
12564 The minimum number of iterations per thread of an innermost
12565 parallelized loop for which the parallelized variant is
12566 preferred over the single threaded one. Note that for a
12567 parallelized loop nest the minimum number of iterations of the
12568 outermost loop per thread is two.
12569
12570 max-ssa-name-query-depth
12571 Maximum depth of recursion when querying properties of SSA
12572 names in things like fold routines. One level of recursion
12573 corresponds to following a use-def chain.
12574
12575 max-speculative-devirt-maydefs
12576 The maximum number of may-defs we analyze when looking for a
12577 must-def specifying the dynamic type of an object that invokes
12578 a virtual call we may be able to devirtualize speculatively.
12579
12580 max-vrp-switch-assertions
12581 The maximum number of assertions to add along the default edge
12582 of a switch statement during VRP.
12583
12584 evrp-sparse-threshold
12585 Maximum number of basic blocks before EVRP uses a sparse cache.
12586
12587 evrp-mode
12588 Specifies the mode Early VRP should operate in.
12589
12590 vrp1-mode
12591 Specifies the mode VRP pass 1 should operate in.
12592
12593 vrp2-mode
12594 Specifies the mode VRP pass 2 should operate in.
12595
12596 ranger-debug
12597 Specifies the type of debug output to be issued for ranges.
12598
12599 evrp-switch-limit
12600 Specifies the maximum number of switch cases before EVRP
12601 ignores a switch.
12602
12603 unroll-jam-min-percent
12604 The minimum percentage of memory references that must be
12605 optimized away for the unroll-and-jam transformation to be
12606 considered profitable.
12607
12608 unroll-jam-max-unroll
12609 The maximum number of times the outer loop should be unrolled
12610 by the unroll-and-jam transformation.
12611
12612 max-rtl-if-conversion-unpredictable-cost
12613 Maximum permissible cost for the sequence that would be
12614 generated by the RTL if-conversion pass for a branch that is
12615 considered unpredictable.
12616
12617 max-variable-expansions-in-unroller
12618 If -fvariable-expansion-in-unroller is used, the maximum number
12619 of times that an individual variable will be expanded during
12620 loop unrolling.
12621
12622 partial-inlining-entry-probability
12623 Maximum probability of the entry BB of split region (in percent
12624 relative to entry BB of the function) to make partial inlining
12625 happen.
12626
12627 max-tracked-strlens
12628 Maximum number of strings for which strlen optimization pass
12629 will track string lengths.
12630
12631 gcse-after-reload-partial-fraction
12632 The threshold ratio for performing partial redundancy
12633 elimination after reload.
12634
12635 gcse-after-reload-critical-fraction
12636 The threshold ratio of critical edges execution count that
12637 permit performing redundancy elimination after reload.
12638
12639 max-loop-header-insns
12640 The maximum number of insns in loop header duplicated by the
12641 copy loop headers pass.
12642
12643 vect-epilogues-nomask
12644 Enable loop epilogue vectorization using smaller vector size.
12645
12646 vect-partial-vector-usage
12647 Controls when the loop vectorizer considers using partial
12648 vector loads and stores as an alternative to falling back to
12649 scalar code. 0 stops the vectorizer from ever using partial
12650 vector loads and stores. 1 allows partial vector loads and
12651 stores if vectorization removes the need for the code to
12652 iterate. 2 allows partial vector loads and stores in all
12653 loops. The parameter only has an effect on targets that
12654 support partial vector loads and stores.
12655
12656 vect-inner-loop-cost-factor
12657 The maximum factor which the loop vectorizer applies to the
12658 cost of statements in an inner loop relative to the loop being
12659 vectorized. The factor applied is the maximum of the estimated
12660 number of iterations of the inner loop and this parameter. The
12661 default value of this parameter is 50.
12662
12663 vect-induction-float
12664 Enable loop vectorization of floating point inductions.
12665
12666 avoid-fma-max-bits
12667 Maximum number of bits for which we avoid creating FMAs.
12668
12669 sms-loop-average-count-threshold
12670 A threshold on the average loop count considered by the swing
12671 modulo scheduler.
12672
12673 sms-dfa-history
12674 The number of cycles the swing modulo scheduler considers when
12675 checking conflicts using DFA.
12676
12677 graphite-allow-codegen-errors
12678 Whether codegen errors should be ICEs when -fchecking.
12679
12680 sms-max-ii-factor
12681 A factor for tuning the upper bound that swing modulo scheduler
12682 uses for scheduling a loop.
12683
12684 lra-max-considered-reload-pseudos
12685 The max number of reload pseudos which are considered during
12686 spilling a non-reload pseudo.
12687
12688 max-pow-sqrt-depth
12689 Maximum depth of sqrt chains to use when synthesizing
12690 exponentiation by a real constant.
12691
12692 max-dse-active-local-stores
12693 Maximum number of active local stores in RTL dead store
12694 elimination.
12695
12696 asan-instrument-allocas
12697 Enable asan allocas/VLAs protection.
12698
12699 max-iterations-computation-cost
12700 Bound on the cost of an expression to compute the number of
12701 iterations.
12702
12703 max-isl-operations
12704 Maximum number of isl operations, 0 means unlimited.
12705
12706 graphite-max-arrays-per-scop
12707 Maximum number of arrays per scop.
12708
12709 max-vartrack-reverse-op-size
12710 Max. size of loc list for which reverse ops should be added.
12711
12712 fsm-scale-path-stmts
12713 Scale factor to apply to the number of statements in a
12714 threading path when comparing to the number of (scaled) blocks.
12715
12716 uninit-control-dep-attempts
12717 Maximum number of nested calls to search for control
12718 dependencies during uninitialized variable analysis.
12719
12720 fsm-scale-path-blocks
12721 Scale factor to apply to the number of blocks in a threading
12722 path when comparing to the number of (scaled) statements.
12723
12724 sched-autopref-queue-depth
12725 Hardware autoprefetcher scheduler model control flag. Number
12726 of lookahead cycles the model looks into; at ' ' only enable
12727 instruction sorting heuristic.
12728
12729 loop-versioning-max-inner-insns
12730 The maximum number of instructions that an inner loop can have
12731 before the loop versioning pass considers it too big to copy.
12732
12733 loop-versioning-max-outer-insns
12734 The maximum number of instructions that an outer loop can have
12735 before the loop versioning pass considers it too big to copy,
12736 discounting any instructions in inner loops that directly
12737 benefit from versioning.
12738
12739 ssa-name-def-chain-limit
12740 The maximum number of SSA_NAME assignments to follow in
12741 determining a property of a variable such as its value. This
12742 limits the number of iterations or recursive calls GCC performs
12743 when optimizing certain statements or when determining their
12744 validity prior to issuing diagnostics.
12745
12746 store-merging-max-size
12747 Maximum size of a single store merging region in bytes.
12748
12749 hash-table-verification-limit
12750 The number of elements for which hash table verification is
12751 done for each searched element.
12752
12753 max-find-base-term-values
12754 Maximum number of VALUEs handled during a single find_base_term
12755 call.
12756
12757 analyzer-max-enodes-per-program-point
12758 The maximum number of exploded nodes per program point within
12759 the analyzer, before terminating analysis of that point.
12760
12761 analyzer-max-constraints
12762 The maximum number of constraints per state.
12763
12764 analyzer-min-snodes-for-call-summary
12765 The minimum number of supernodes within a function for the
12766 analyzer to consider summarizing its effects at call sites.
12767
12768 analyzer-max-enodes-for-full-dump
12769 The maximum depth of exploded nodes that should appear in a dot
12770 dump before switching to a less verbose format.
12771
12772 analyzer-max-recursion-depth
12773 The maximum number of times a callsite can appear in a call
12774 stack within the analyzer, before terminating analysis of a
12775 call that would recurse deeper.
12776
12777 analyzer-max-svalue-depth
12778 The maximum depth of a symbolic value, before approximating the
12779 value as unknown.
12780
12781 analyzer-max-infeasible-edges
12782 The maximum number of infeasible edges to reject before
12783 declaring a diagnostic as infeasible.
12784
12785 gimple-fe-computed-hot-bb-threshold
12786 The number of executions of a basic block which is considered
12787 hot. The parameter is used only in GIMPLE FE.
12788
12789 analyzer-bb-explosion-factor
12790 The maximum number of 'after supernode' exploded nodes within
12791 the analyzer per supernode, before terminating analysis.
12792
12793 ranger-logical-depth
12794 Maximum depth of logical expression evaluation ranger will look
12795 through when evaluating outgoing edge ranges.
12796
12797 relation-block-limit
12798 Maximum number of relations the oracle will register in a basic
12799 block.
12800
12801 min-pagesize
12802 Minimum page size for warning purposes.
12803
12804 openacc-kernels
12805 Specify mode of OpenACC `kernels' constructs handling. With
12806 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12807 are decomposed into parts, a sequence of compute constructs,
12808 each then handled individually. This is work in progress.
12809 With --param=openacc-kernels=parloops, OpenACC `kernels'
12810 constructs are handled by the parloops pass, en bloc. This is
12811 the current default.
12812
12813 openacc-privatization
12814 Specify mode of OpenACC privatization diagnostics for
12815 -fopt-info-omp-note and applicable -fdump-tree-*-details. With
12816 --param=openacc-privatization=quiet, don't diagnose. This is
12817 the current default. With --param=openacc-privatization=noisy,
12818 do diagnose.
12819
12820 The following choices of name are available on AArch64 targets:
12821
12822 aarch64-sve-compare-costs
12823 When vectorizing for SVE, consider using "unpacked" vectors for
12824 smaller elements and use the cost model to pick the cheapest
12825 approach. Also use the cost model to choose between SVE and
12826 Advanced SIMD vectorization.
12827
12828 Using unpacked vectors includes storing smaller elements in
12829 larger containers and accessing elements with extending loads
12830 and truncating stores.
12831
12832 aarch64-float-recp-precision
12833 The number of Newton iterations for calculating the reciprocal
12834 for float type. The precision of division is proportional to
12835 this param when division approximation is enabled. The default
12836 value is 1.
12837
12838 aarch64-double-recp-precision
12839 The number of Newton iterations for calculating the reciprocal
12840 for double type. The precision of division is propotional to
12841 this param when division approximation is enabled. The default
12842 value is 2.
12843
12844 aarch64-autovec-preference
12845 Force an ISA selection strategy for auto-vectorization.
12846 Accepts values from 0 to 4, inclusive.
12847
12848 0 Use the default heuristics.
12849
12850 1 Use only Advanced SIMD for auto-vectorization.
12851
12852 2 Use only SVE for auto-vectorization.
12853
12854 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12855 the costs are deemed equal.
12856
12857 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12858 are deemed equal.
12859
12860 The default value is 0.
12861
12862 aarch64-loop-vect-issue-rate-niters
12863 The tuning for some AArch64 CPUs tries to take both latencies
12864 and issue rates into account when deciding whether a loop
12865 should be vectorized using SVE, vectorized using Advanced SIMD,
12866 or not vectorized at all. If this parameter is set to n, GCC
12867 will not use this heuristic for loops that are known to execute
12868 in fewer than n Advanced SIMD iterations.
12869
12870 aarch64-vect-unroll-limit
12871 The vectorizer will use available tuning information to
12872 determine whether it would be beneficial to unroll the main
12873 vectorized loop and by how much. This parameter set's the
12874 upper bound of how much the vectorizer will unroll the main
12875 loop. The default value is four.
12876
12877 The following choices of name are available on i386 and x86_64
12878 targets:
12879
12880 x86-stlf-window-ninsns
12881 Instructions number above which STFL stall penalty can be
12882 compensated.
12883
12884 Program Instrumentation Options
12885 GCC supports a number of command-line options that control adding run-
12886 time instrumentation to the code it normally generates. For example,
12887 one purpose of instrumentation is collect profiling statistics for use
12888 in finding program hot spots, code coverage analysis, or profile-guided
12889 optimizations. Another class of program instrumentation is adding run-
12890 time checking to detect programming errors like invalid pointer
12891 dereferences or out-of-bounds array accesses, as well as deliberately
12892 hostile attacks such as stack smashing or C++ vtable hijacking. There
12893 is also a general hook which can be used to implement other forms of
12894 tracing or function-level instrumentation for debug or program analysis
12895 purposes.
12896
12897 -p
12898 -pg Generate extra code to write profile information suitable for the
12899 analysis program prof (for -p) or gprof (for -pg). You must use
12900 this option when compiling the source files you want data about,
12901 and you must also use it when linking.
12902
12903 You can use the function attribute "no_instrument_function" to
12904 suppress profiling of individual functions when compiling with
12905 these options.
12906
12907 -fprofile-arcs
12908 Add code so that program flow arcs are instrumented. During
12909 execution the program records how many times each branch and call
12910 is executed and how many times it is taken or returns. On targets
12911 that support constructors with priority support, profiling properly
12912 handles constructors, destructors and C++ constructors (and
12913 destructors) of classes which are used as a type of a global
12914 variable.
12915
12916 When the compiled program exits it saves this data to a file called
12917 auxname.gcda for each source file. The data may be used for
12918 profile-directed optimizations (-fbranch-probabilities), or for
12919 test coverage analysis (-ftest-coverage). Each object file's
12920 auxname is generated from the name of the output file, if
12921 explicitly specified and it is not the final executable, otherwise
12922 it is the basename of the source file. In both cases any suffix is
12923 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12924 for output file specified as -o dir/foo.o).
12925
12926 Note that if a command line directly links source files, the
12927 corresponding .gcda files will be prefixed with the unsuffixed name
12928 of the output file. E.g. "gcc a.c b.c -o binary" would generate
12929 binary-a.gcda and binary-b.gcda files.
12930
12931 --coverage
12932 This option is used to compile and link code instrumented for
12933 coverage analysis. The option is a synonym for -fprofile-arcs
12934 -ftest-coverage (when compiling) and -lgcov (when linking). See
12935 the documentation for those options for more details.
12936
12937 * Compile the source files with -fprofile-arcs plus optimization
12938 and code generation options. For test coverage analysis, use
12939 the additional -ftest-coverage option. You do not need to
12940 profile every source file in a program.
12941
12942 * Compile the source files additionally with -fprofile-abs-path
12943 to create absolute path names in the .gcno files. This allows
12944 gcov to find the correct sources in projects where compilations
12945 occur with different working directories.
12946
12947 * Link your object files with -lgcov or -fprofile-arcs (the
12948 latter implies the former).
12949
12950 * Run the program on a representative workload to generate the
12951 arc profile information. This may be repeated any number of
12952 times. You can run concurrent instances of your program, and
12953 provided that the file system supports locking, the data files
12954 will be correctly updated. Unless a strict ISO C dialect
12955 option is in effect, "fork" calls are detected and correctly
12956 handled without double counting.
12957
12958 Moreover, an object file can be recompiled multiple times and
12959 the corresponding .gcda file merges as long as the source file
12960 and the compiler options are unchanged.
12961
12962 * For profile-directed optimizations, compile the source files
12963 again with the same optimization and code generation options
12964 plus -fbranch-probabilities.
12965
12966 * For test coverage analysis, use gcov to produce human readable
12967 information from the .gcno and .gcda files. Refer to the gcov
12968 documentation for further information.
12969
12970 With -fprofile-arcs, for each function of your program GCC creates
12971 a program flow graph, then finds a spanning tree for the graph.
12972 Only arcs that are not on the spanning tree have to be
12973 instrumented: the compiler adds code to count the number of times
12974 that these arcs are executed. When an arc is the only exit or only
12975 entrance to a block, the instrumentation code can be added to the
12976 block; otherwise, a new basic block must be created to hold the
12977 instrumentation code.
12978
12979 -ftest-coverage
12980 Produce a notes file that the gcov code-coverage utility can use to
12981 show program coverage. Each source file's note file is called
12982 auxname.gcno. Refer to the -fprofile-arcs option above for a
12983 description of auxname and instructions on how to generate test
12984 coverage data. Coverage data matches the source files more closely
12985 if you do not optimize.
12986
12987 -fprofile-abs-path
12988 Automatically convert relative source file names to absolute path
12989 names in the .gcno files. This allows gcov to find the correct
12990 sources in projects where compilations occur with different working
12991 directories.
12992
12993 -fprofile-dir=path
12994 Set the directory to search for the profile data files in to path.
12995 This option affects only the profile data generated by
12996 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12997 -fprofile-use and -fbranch-probabilities and its related options.
12998 Both absolute and relative paths can be used. By default, GCC uses
12999 the current directory as path, thus the profile data file appears
13000 in the same directory as the object file. In order to prevent the
13001 file name clashing, if the object file name is not an absolute
13002 path, we mangle the absolute path of the sourcename.gcda file and
13003 use it as the file name of a .gcda file. See details about the
13004 file naming in -fprofile-arcs. See similar option -fprofile-note.
13005
13006 When an executable is run in a massive parallel environment, it is
13007 recommended to save profile to different folders. That can be done
13008 with variables in path that are exported during run-time:
13009
13010 %p process ID.
13011
13012 %q{VAR}
13013 value of environment variable VAR
13014
13015 -fprofile-generate
13016 -fprofile-generate=path
13017 Enable options usually used for instrumenting application to
13018 produce profile useful for later recompilation with profile
13019 feedback based optimization. You must use -fprofile-generate both
13020 when compiling and when linking your program.
13021
13022 The following options are enabled: -fprofile-arcs,
13023 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13024
13025 If path is specified, GCC looks at the path to find the profile
13026 feedback data files. See -fprofile-dir.
13027
13028 To optimize the program based on the collected profile information,
13029 use -fprofile-use.
13030
13031 -fprofile-info-section
13032 -fprofile-info-section=name
13033 Register the profile information in the specified section instead
13034 of using a constructor/destructor. The section name is name if it
13035 is specified, otherwise the section name defaults to ".gcov_info".
13036 A pointer to the profile information generated by -fprofile-arcs is
13037 placed in the specified section for each translation unit. This
13038 option disables the profile information registration through a
13039 constructor and it disables the profile information processing
13040 through a destructor. This option is not intended to be used in
13041 hosted environments such as GNU/Linux. It targets free-standing
13042 environments (for example embedded systems) with limited resources
13043 which do not support constructors/destructors or the C library file
13044 I/O.
13045
13046 The linker could collect the input sections in a continuous memory
13047 block and define start and end symbols. A GNU linker script
13048 example which defines a linker output section follows:
13049
13050 .gcov_info :
13051 {
13052 PROVIDE (__gcov_info_start = .);
13053 KEEP (*(.gcov_info))
13054 PROVIDE (__gcov_info_end = .);
13055 }
13056
13057 The program could dump the profiling information registered in this
13058 linker set for example like this:
13059
13060 #include <gcov.h>
13061 #include <stdio.h>
13062 #include <stdlib.h>
13063
13064 extern const struct gcov_info *__gcov_info_start[];
13065 extern const struct gcov_info *__gcov_info_end[];
13066
13067 static void
13068 filename (const char *f, void *arg)
13069 {
13070 puts (f);
13071 }
13072
13073 static void
13074 dump (const void *d, unsigned n, void *arg)
13075 {
13076 const unsigned char *c = d;
13077
13078 for (unsigned i = 0; i < n; ++i)
13079 printf ("%02x", c[i]);
13080 }
13081
13082 static void *
13083 allocate (unsigned length, void *arg)
13084 {
13085 return malloc (length);
13086 }
13087
13088 static void
13089 dump_gcov_info (void)
13090 {
13091 const struct gcov_info **info = __gcov_info_start;
13092 const struct gcov_info **end = __gcov_info_end;
13093
13094 /* Obfuscate variable to prevent compiler optimizations. */
13095 __asm__ ("" : "+r" (info));
13096
13097 while (info != end)
13098 {
13099 void *arg = NULL;
13100 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
13101 putchar ('\n');
13102 ++info;
13103 }
13104 }
13105
13106 int
13107 main()
13108 {
13109 dump_gcov_info();
13110 return 0;
13111 }
13112
13113 -fprofile-note=path
13114 If path is specified, GCC saves .gcno file into path location. If
13115 you combine the option with multiple source files, the .gcno file
13116 will be overwritten.
13117
13118 -fprofile-prefix-path=path
13119 This option can be used in combination with
13120 profile-generate=profile_dir and profile-use=profile_dir to inform
13121 GCC where is the base directory of built source tree. By default
13122 profile_dir will contain files with mangled absolute paths of all
13123 object files in the built project. This is not desirable when
13124 directory used to build the instrumented binary differs from the
13125 directory used to build the binary optimized with profile feedback
13126 because the profile data will not be found during the optimized
13127 build. In such setups -fprofile-prefix-path=path with path
13128 pointing to the base directory of the build can be used to strip
13129 the irrelevant part of the path and keep all file names relative to
13130 the main build directory.
13131
13132 -fprofile-prefix-map=old=new
13133 When compiling files residing in directory old, record profiling
13134 information (with --coverage) describing them as if the files
13135 resided in directory new instead. See also -ffile-prefix-map.
13136
13137 -fprofile-update=method
13138 Alter the update method for an application instrumented for profile
13139 feedback based optimization. The method argument should be one of
13140 single, atomic or prefer-atomic. The first one is useful for
13141 single-threaded applications, while the second one prevents profile
13142 corruption by emitting thread-safe code.
13143
13144 Warning: When an application does not properly join all threads (or
13145 creates an detached thread), a profile file can be still corrupted.
13146
13147 Using prefer-atomic would be transformed either to atomic, when
13148 supported by a target, or to single otherwise. The GCC driver
13149 automatically selects prefer-atomic when -pthread is present in the
13150 command line.
13151
13152 -fprofile-filter-files=regex
13153 Instrument only functions from files whose name matches any of the
13154 regular expressions (separated by semi-colons).
13155
13156 For example, -fprofile-filter-files=main\.c;module.*\.c will
13157 instrument only main.c and all C files starting with 'module'.
13158
13159 -fprofile-exclude-files=regex
13160 Instrument only functions from files whose name does not match any
13161 of the regular expressions (separated by semi-colons).
13162
13163 For example, -fprofile-exclude-files=/usr/.* will prevent
13164 instrumentation of all files that are located in the /usr/ folder.
13165
13166 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
13167 Control level of reproducibility of profile gathered by
13168 "-fprofile-generate". This makes it possible to rebuild program
13169 with same outcome which is useful, for example, for distribution
13170 packages.
13171
13172 With -fprofile-reproducible=serial the profile gathered by
13173 -fprofile-generate is reproducible provided the trained program
13174 behaves the same at each invocation of the train run, it is not
13175 multi-threaded and profile data streaming is always done in the
13176 same order. Note that profile streaming happens at the end of
13177 program run but also before "fork" function is invoked.
13178
13179 Note that it is quite common that execution counts of some part of
13180 programs depends, for example, on length of temporary file names or
13181 memory space randomization (that may affect hash-table collision
13182 rate). Such non-reproducible part of programs may be annotated by
13183 "no_instrument_function" function attribute. gcov-dump with -l can
13184 be used to dump gathered data and verify that they are indeed
13185 reproducible.
13186
13187 With -fprofile-reproducible=parallel-runs collected profile stays
13188 reproducible regardless the order of streaming of the data into
13189 gcda files. This setting makes it possible to run multiple
13190 instances of instrumented program in parallel (such as with "make
13191 -j"). This reduces quality of gathered data, in particular of
13192 indirect call profiling.
13193
13194 -fsanitize=address
13195 Enable AddressSanitizer, a fast memory error detector. Memory
13196 access instructions are instrumented to detect out-of-bounds and
13197 use-after-free bugs. The option enables
13198 -fsanitize-address-use-after-scope. See
13199 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
13200 more details. The run-time behavior can be influenced using the
13201 ASAN_OPTIONS environment variable. When set to "help=1", the
13202 available options are shown at startup of the instrumented program.
13203 See
13204 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
13205 for a list of supported options. The option cannot be combined
13206 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
13207 target -fsanitize=hwaddress is currently supported on is AArch64.
13208
13209 -fsanitize=kernel-address
13210 Enable AddressSanitizer for Linux kernel. See
13211 <https://github.com/google/kasan> for more details.
13212
13213 -fsanitize=hwaddress
13214 Enable Hardware-assisted AddressSanitizer, which uses a hardware
13215 ability to ignore the top byte of a pointer to allow the detection
13216 of memory errors with a low memory overhead. Memory access
13217 instructions are instrumented to detect out-of-bounds and use-
13218 after-free bugs. The option enables
13219 -fsanitize-address-use-after-scope. See
13220 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
13221 for more details. The run-time behavior can be influenced using
13222 the HWASAN_OPTIONS environment variable. When set to "help=1", the
13223 available options are shown at startup of the instrumented program.
13224 The option cannot be combined with -fsanitize=thread or
13225 -fsanitize=address, and is currently only available on AArch64.
13226
13227 -fsanitize=kernel-hwaddress
13228 Enable Hardware-assisted AddressSanitizer for compilation of the
13229 Linux kernel. Similar to -fsanitize=kernel-address but using an
13230 alternate instrumentation method, and similar to
13231 -fsanitize=hwaddress but with instrumentation differences necessary
13232 for compiling the Linux kernel. These differences are to avoid
13233 hwasan library initialization calls and to account for the stack
13234 pointer having a different value in its top byte.
13235
13236 Note: This option has different defaults to the
13237 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
13238 not on by default but are still possible by specifying the command-
13239 line options --param hwasan-instrument-stack=1 and --param
13240 hwasan-instrument-allocas=1 respectively. Using a random frame tag
13241 is not implemented for kernel instrumentation.
13242
13243 -fsanitize=pointer-compare
13244 Instrument comparison operation (<, <=, >, >=) with pointer
13245 operands. The option must be combined with either
13246 -fsanitize=kernel-address or -fsanitize=address The option cannot
13247 be combined with -fsanitize=thread. Note: By default the check is
13248 disabled at run time. To enable it, add
13249 "detect_invalid_pointer_pairs=2" to the environment variable
13250 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
13251 invalid operation only when both pointers are non-null.
13252
13253 -fsanitize=pointer-subtract
13254 Instrument subtraction with pointer operands. The option must be
13255 combined with either -fsanitize=kernel-address or
13256 -fsanitize=address The option cannot be combined with
13257 -fsanitize=thread. Note: By default the check is disabled at run
13258 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
13259 environment variable ASAN_OPTIONS. Using
13260 "detect_invalid_pointer_pairs=1" detects invalid operation only
13261 when both pointers are non-null.
13262
13263 -fsanitize=shadow-call-stack
13264 Enable ShadowCallStack, a security enhancement mechanism used to
13265 protect programs against return address overwrites (e.g. stack
13266 buffer overflows.) It works by saving a function's return address
13267 to a separately allocated shadow call stack in the function
13268 prologue and restoring the return address from the shadow call
13269 stack in the function epilogue. Instrumentation only occurs in
13270 functions that need to save the return address to the stack.
13271
13272 Currently it only supports the aarch64 platform. It is
13273 specifically designed for linux kernels that enable the
13274 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
13275 runtime support is not currently provided in libc and libgcc.
13276 Users who want to use this feature in user space need to provide
13277 their own support for the runtime. It should be noted that this
13278 may cause the ABI rules to be broken.
13279
13280 On aarch64, the instrumentation makes use of the platform register
13281 "x18". This generally means that any code that may run on the same
13282 thread as code compiled with ShadowCallStack must be compiled with
13283 the flag -ffixed-x18, otherwise functions compiled without
13284 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
13285 pointer.
13286
13287 Also, because there is no userspace runtime support, code compiled
13288 with ShadowCallStack cannot use exception handling. Use
13289 -fno-exceptions to turn off exceptions.
13290
13291 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
13292 details.
13293
13294 -fsanitize=thread
13295 Enable ThreadSanitizer, a fast data race detector. Memory access
13296 instructions are instrumented to detect data race bugs. See
13297 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
13298 more details. The run-time behavior can be influenced using the
13299 TSAN_OPTIONS environment variable; see
13300 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
13301 for a list of supported options. The option cannot be combined
13302 with -fsanitize=address, -fsanitize=leak.
13303
13304 Note that sanitized atomic builtins cannot throw exceptions when
13305 operating on invalid memory addresses with non-call exceptions
13306 (-fnon-call-exceptions).
13307
13308 -fsanitize=leak
13309 Enable LeakSanitizer, a memory leak detector. This option only
13310 matters for linking of executables and the executable is linked
13311 against a library that overrides "malloc" and other allocator
13312 functions. See
13313 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
13314 for more details. The run-time behavior can be influenced using
13315 the LSAN_OPTIONS environment variable. The option cannot be
13316 combined with -fsanitize=thread.
13317
13318 -fsanitize=undefined
13319 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
13320 detector. Various computations are instrumented to detect
13321 undefined behavior at runtime. See
13322 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
13323 more details. The run-time behavior can be influenced using the
13324 UBSAN_OPTIONS environment variable. Current suboptions are:
13325
13326 -fsanitize=shift
13327 This option enables checking that the result of a shift
13328 operation is not undefined. Note that what exactly is
13329 considered undefined differs slightly between C and C++, as
13330 well as between ISO C90 and C99, etc. This option has two
13331 suboptions, -fsanitize=shift-base and
13332 -fsanitize=shift-exponent.
13333
13334 -fsanitize=shift-exponent
13335 This option enables checking that the second argument of a
13336 shift operation is not negative and is smaller than the
13337 precision of the promoted first argument.
13338
13339 -fsanitize=shift-base
13340 If the second argument of a shift operation is within range,
13341 check that the result of a shift operation is not undefined.
13342 Note that what exactly is considered undefined differs slightly
13343 between C and C++, as well as between ISO C90 and C99, etc.
13344
13345 -fsanitize=integer-divide-by-zero
13346 Detect integer division by zero.
13347
13348 -fsanitize=unreachable
13349 With this option, the compiler turns the
13350 "__builtin_unreachable" call into a diagnostics message call
13351 instead. When reaching the "__builtin_unreachable" call, the
13352 behavior is undefined.
13353
13354 -fsanitize=vla-bound
13355 This option instructs the compiler to check that the size of a
13356 variable length array is positive.
13357
13358 -fsanitize=null
13359 This option enables pointer checking. Particularly, the
13360 application built with this option turned on will issue an
13361 error message when it tries to dereference a NULL pointer, or
13362 if a reference (possibly an rvalue reference) is bound to a
13363 NULL pointer, or if a method is invoked on an object pointed by
13364 a NULL pointer.
13365
13366 -fsanitize=return
13367 This option enables return statement checking. Programs built
13368 with this option turned on will issue an error message when the
13369 end of a non-void function is reached without actually
13370 returning a value. This option works in C++ only.
13371
13372 -fsanitize=signed-integer-overflow
13373 This option enables signed integer overflow checking. We check
13374 that the result of "+", "*", and both unary and binary "-" does
13375 not overflow in the signed arithmetics. This also detects
13376 "INT_MIN / -1" signed division. Note, integer promotion rules
13377 must be taken into account. That is, the following is not an
13378 overflow:
13379
13380 signed char a = SCHAR_MAX;
13381 a++;
13382
13383 -fsanitize=bounds
13384 This option enables instrumentation of array bounds. Various
13385 out of bounds accesses are detected. Flexible array members,
13386 flexible array member-like arrays, and initializers of
13387 variables with static storage are not instrumented.
13388
13389 -fsanitize=bounds-strict
13390 This option enables strict instrumentation of array bounds.
13391 Most out of bounds accesses are detected, including flexible
13392 array members and flexible array member-like arrays.
13393 Initializers of variables with static storage are not
13394 instrumented.
13395
13396 -fsanitize=alignment
13397 This option enables checking of alignment of pointers when they
13398 are dereferenced, or when a reference is bound to
13399 insufficiently aligned target, or when a method or constructor
13400 is invoked on insufficiently aligned object.
13401
13402 -fsanitize=object-size
13403 This option enables instrumentation of memory references using
13404 the "__builtin_object_size" function. Various out of bounds
13405 pointer accesses are detected.
13406
13407 -fsanitize=float-divide-by-zero
13408 Detect floating-point division by zero. Unlike other similar
13409 options, -fsanitize=float-divide-by-zero is not enabled by
13410 -fsanitize=undefined, since floating-point division by zero can
13411 be a legitimate way of obtaining infinities and NaNs.
13412
13413 -fsanitize=float-cast-overflow
13414 This option enables floating-point type to integer conversion
13415 checking. We check that the result of the conversion does not
13416 overflow. Unlike other similar options,
13417 -fsanitize=float-cast-overflow is not enabled by
13418 -fsanitize=undefined. This option does not work well with
13419 "FE_INVALID" exceptions enabled.
13420
13421 -fsanitize=nonnull-attribute
13422 This option enables instrumentation of calls, checking whether
13423 null values are not passed to arguments marked as requiring a
13424 non-null value by the "nonnull" function attribute.
13425
13426 -fsanitize=returns-nonnull-attribute
13427 This option enables instrumentation of return statements in
13428 functions marked with "returns_nonnull" function attribute, to
13429 detect returning of null values from such functions.
13430
13431 -fsanitize=bool
13432 This option enables instrumentation of loads from bool. If a
13433 value other than 0/1 is loaded, a run-time error is issued.
13434
13435 -fsanitize=enum
13436 This option enables instrumentation of loads from an enum type.
13437 If a value outside the range of values for the enum type is
13438 loaded, a run-time error is issued.
13439
13440 -fsanitize=vptr
13441 This option enables instrumentation of C++ member function
13442 calls, member accesses and some conversions between pointers to
13443 base and derived classes, to verify the referenced object has
13444 the correct dynamic type.
13445
13446 -fsanitize=pointer-overflow
13447 This option enables instrumentation of pointer arithmetics. If
13448 the pointer arithmetics overflows, a run-time error is issued.
13449
13450 -fsanitize=builtin
13451 This option enables instrumentation of arguments to selected
13452 builtin functions. If an invalid value is passed to such
13453 arguments, a run-time error is issued. E.g. passing 0 as the
13454 argument to "__builtin_ctz" or "__builtin_clz" invokes
13455 undefined behavior and is diagnosed by this option.
13456
13457 While -ftrapv causes traps for signed overflows to be emitted,
13458 -fsanitize=undefined gives a diagnostic message. This currently
13459 works only for the C family of languages.
13460
13461 -fno-sanitize=all
13462 This option disables all previously enabled sanitizers.
13463 -fsanitize=all is not allowed, as some sanitizers cannot be used
13464 together.
13465
13466 -fasan-shadow-offset=number
13467 This option forces GCC to use custom shadow offset in
13468 AddressSanitizer checks. It is useful for experimenting with
13469 different shadow memory layouts in Kernel AddressSanitizer.
13470
13471 -fsanitize-sections=s1,s2,...
13472 Sanitize global variables in selected user-defined sections. si
13473 may contain wildcards.
13474
13475 -fsanitize-recover[=opts]
13476 -fsanitize-recover= controls error recovery mode for sanitizers
13477 mentioned in comma-separated list of opts. Enabling this option
13478 for a sanitizer component causes it to attempt to continue running
13479 the program as if no error happened. This means multiple runtime
13480 errors can be reported in a single program run, and the exit code
13481 of the program may indicate success even when errors have been
13482 reported. The -fno-sanitize-recover= option can be used to alter
13483 this behavior: only the first detected error is reported and
13484 program then exits with a non-zero exit code.
13485
13486 Currently this feature only works for -fsanitize=undefined (and its
13487 suboptions except for -fsanitize=unreachable and
13488 -fsanitize=return), -fsanitize=float-cast-overflow,
13489 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
13490 -fsanitize=kernel-address and -fsanitize=address. For these
13491 sanitizers error recovery is turned on by default, except
13492 -fsanitize=address, for which this feature is experimental.
13493 -fsanitize-recover=all and -fno-sanitize-recover=all is also
13494 accepted, the former enables recovery for all sanitizers that
13495 support it, the latter disables recovery for all sanitizers that
13496 support it.
13497
13498 Even if a recovery mode is turned on the compiler side, it needs to
13499 be also enabled on the runtime library side, otherwise the failures
13500 are still fatal. The runtime library defaults to "halt_on_error=0"
13501 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
13502 value for AddressSanitizer is "halt_on_error=1". This can be
13503 overridden through setting the "halt_on_error" flag in the
13504 corresponding environment variable.
13505
13506 Syntax without an explicit opts parameter is deprecated. It is
13507 equivalent to specifying an opts list of:
13508
13509 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13510
13511 -fsanitize-address-use-after-scope
13512 Enable sanitization of local variables to detect use-after-scope
13513 bugs. The option sets -fstack-reuse to none.
13514
13515 -fsanitize-undefined-trap-on-error
13516 The -fsanitize-undefined-trap-on-error option instructs the
13517 compiler to report undefined behavior using "__builtin_trap" rather
13518 than a "libubsan" library routine. The advantage of this is that
13519 the "libubsan" library is not needed and is not linked in, so this
13520 is usable even in freestanding environments.
13521
13522 -fsanitize-coverage=trace-pc
13523 Enable coverage-guided fuzzing code instrumentation. Inserts a
13524 call to "__sanitizer_cov_trace_pc" into every basic block.
13525
13526 -fsanitize-coverage=trace-cmp
13527 Enable dataflow guided fuzzing code instrumentation. Inserts a
13528 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
13529 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
13530 integral comparison with both operands variable or
13531 "__sanitizer_cov_trace_const_cmp1",
13532 "__sanitizer_cov_trace_const_cmp2",
13533 "__sanitizer_cov_trace_const_cmp4" or
13534 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
13535 operand constant, "__sanitizer_cov_trace_cmpf" or
13536 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
13537 "__sanitizer_cov_trace_switch" for switch statements.
13538
13539 -fcf-protection=[full|branch|return|none|check]
13540 Enable code instrumentation of control-flow transfers to increase
13541 program security by checking that target addresses of control-flow
13542 transfer instructions (such as indirect function call, function
13543 return, indirect jump) are valid. This prevents diverting the flow
13544 of control to an unexpected target. This is intended to protect
13545 against such threats as Return-oriented Programming (ROP), and
13546 similarly call/jmp-oriented programming (COP/JOP).
13547
13548 The value "branch" tells the compiler to implement checking of
13549 validity of control-flow transfer at the point of indirect branch
13550 instructions, i.e. call/jmp instructions. The value "return"
13551 implements checking of validity at the point of returning from a
13552 function. The value "full" is an alias for specifying both
13553 "branch" and "return". The value "none" turns off instrumentation.
13554
13555 The value "check" is used for the final link with link-time
13556 optimization (LTO). An error is issued if LTO object files are
13557 compiled with different -fcf-protection values. The value "check"
13558 is ignored at the compile time.
13559
13560 The macro "__CET__" is defined when -fcf-protection is used. The
13561 first bit of "__CET__" is set to 1 for the value "branch" and the
13562 second bit of "__CET__" is set to 1 for the "return".
13563
13564 You can also use the "nocf_check" attribute to identify which
13565 functions and calls should be skipped from instrumentation.
13566
13567 Currently the x86 GNU/Linux target provides an implementation based
13568 on Intel Control-flow Enforcement Technology (CET) which works for
13569 i686 processor or newer.
13570
13571 -fharden-compares
13572 For every logical test that survives gimple optimizations and is
13573 not the condition in a conditional branch (for example, conditions
13574 tested for conditional moves, or to store in boolean variables),
13575 emit extra code to compute and verify the reversed condition, and
13576 to call "__builtin_trap" if the results do not match. Use with
13577 -fharden-conditional-branches to cover all conditionals.
13578
13579 -fharden-conditional-branches
13580 For every non-vectorized conditional branch that survives gimple
13581 optimizations, emit extra code to compute and verify the reversed
13582 condition, and to call "__builtin_trap" if the result is
13583 unexpected. Use with -fharden-compares to cover all conditionals.
13584
13585 -fstack-protector
13586 Emit extra code to check for buffer overflows, such as stack
13587 smashing attacks. This is done by adding a guard variable to
13588 functions with vulnerable objects. This includes functions that
13589 call "alloca", and functions with buffers larger than or equal to 8
13590 bytes. The guards are initialized when a function is entered and
13591 then checked when the function exits. If a guard check fails, an
13592 error message is printed and the program exits. Only variables
13593 that are actually allocated on the stack are considered, optimized
13594 away variables or variables allocated in registers don't count.
13595
13596 -fstack-protector-all
13597 Like -fstack-protector except that all functions are protected.
13598
13599 -fstack-protector-strong
13600 Like -fstack-protector but includes additional functions to be
13601 protected --- those that have local array definitions, or have
13602 references to local frame addresses. Only variables that are
13603 actually allocated on the stack are considered, optimized away
13604 variables or variables allocated in registers don't count.
13605
13606 -fstack-protector-explicit
13607 Like -fstack-protector but only protects those functions which have
13608 the "stack_protect" attribute.
13609
13610 -fstack-check
13611 Generate code to verify that you do not go beyond the boundary of
13612 the stack. You should specify this flag if you are running in an
13613 environment with multiple threads, but you only rarely need to
13614 specify it in a single-threaded environment since stack overflow is
13615 automatically detected on nearly all systems if there is only one
13616 stack.
13617
13618 Note that this switch does not actually cause checking to be done;
13619 the operating system or the language runtime must do that. The
13620 switch causes generation of code to ensure that they see the stack
13621 being extended.
13622
13623 You can additionally specify a string parameter: no means no
13624 checking, generic means force the use of old-style checking,
13625 specific means use the best checking method and is equivalent to
13626 bare -fstack-check.
13627
13628 Old-style checking is a generic mechanism that requires no specific
13629 target support in the compiler but comes with the following
13630 drawbacks:
13631
13632 1. Modified allocation strategy for large objects: they are always
13633 allocated dynamically if their size exceeds a fixed threshold.
13634 Note this may change the semantics of some code.
13635
13636 2. Fixed limit on the size of the static frame of functions: when
13637 it is topped by a particular function, stack checking is not
13638 reliable and a warning is issued by the compiler.
13639
13640 3. Inefficiency: because of both the modified allocation strategy
13641 and the generic implementation, code performance is hampered.
13642
13643 Note that old-style stack checking is also the fallback method for
13644 specific if no target support has been added in the compiler.
13645
13646 -fstack-check= is designed for Ada's needs to detect infinite
13647 recursion and stack overflows. specific is an excellent choice
13648 when compiling Ada code. It is not generally sufficient to protect
13649 against stack-clash attacks. To protect against those you want
13650 -fstack-clash-protection.
13651
13652 -fstack-clash-protection
13653 Generate code to prevent stack clash style attacks. When this
13654 option is enabled, the compiler will only allocate one page of
13655 stack space at a time and each page is accessed immediately after
13656 allocation. Thus, it prevents allocations from jumping over any
13657 stack guard page provided by the operating system.
13658
13659 Most targets do not fully support stack clash protection. However,
13660 on those targets -fstack-clash-protection will protect dynamic
13661 stack allocations. -fstack-clash-protection may also provide
13662 limited protection for static stack allocations if the target
13663 supports -fstack-check=specific.
13664
13665 -fstack-limit-register=reg
13666 -fstack-limit-symbol=sym
13667 -fno-stack-limit
13668 Generate code to ensure that the stack does not grow beyond a
13669 certain value, either the value of a register or the address of a
13670 symbol. If a larger stack is required, a signal is raised at run
13671 time. For most targets, the signal is raised before the stack
13672 overruns the boundary, so it is possible to catch the signal
13673 without taking special precautions.
13674
13675 For instance, if the stack starts at absolute address 0x80000000
13676 and grows downwards, you can use the flags
13677 -fstack-limit-symbol=__stack_limit and
13678 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
13679 128KB. Note that this may only work with the GNU linker.
13680
13681 You can locally override stack limit checking by using the
13682 "no_stack_limit" function attribute.
13683
13684 -fsplit-stack
13685 Generate code to automatically split the stack before it overflows.
13686 The resulting program has a discontiguous stack which can only
13687 overflow if the program is unable to allocate any more memory.
13688 This is most useful when running threaded programs, as it is no
13689 longer necessary to calculate a good stack size to use for each
13690 thread. This is currently only implemented for the x86 targets
13691 running GNU/Linux.
13692
13693 When code compiled with -fsplit-stack calls code compiled without
13694 -fsplit-stack, there may not be much stack space available for the
13695 latter code to run. If compiling all code, including library code,
13696 with -fsplit-stack is not an option, then the linker can fix up
13697 these calls so that the code compiled without -fsplit-stack always
13698 has a large stack. Support for this is implemented in the gold
13699 linker in GNU binutils release 2.21 and later.
13700
13701 -fvtable-verify=[std|preinit|none]
13702 This option is only available when compiling C++ code. It turns on
13703 (or off, if using -fvtable-verify=none) the security feature that
13704 verifies at run time, for every virtual call, that the vtable
13705 pointer through which the call is made is valid for the type of the
13706 object, and has not been corrupted or overwritten. If an invalid
13707 vtable pointer is detected at run time, an error is reported and
13708 execution of the program is immediately halted.
13709
13710 This option causes run-time data structures to be built at program
13711 startup, which are used for verifying the vtable pointers. The
13712 options std and preinit control the timing of when these data
13713 structures are built. In both cases the data structures are built
13714 before execution reaches "main". Using -fvtable-verify=std causes
13715 the data structures to be built after shared libraries have been
13716 loaded and initialized. -fvtable-verify=preinit causes them to be
13717 built before shared libraries have been loaded and initialized.
13718
13719 If this option appears multiple times in the command line with
13720 different values specified, none takes highest priority over both
13721 std and preinit; preinit takes priority over std.
13722
13723 -fvtv-debug
13724 When used in conjunction with -fvtable-verify=std or
13725 -fvtable-verify=preinit, causes debug versions of the runtime
13726 functions for the vtable verification feature to be called. This
13727 flag also causes the compiler to log information about which vtable
13728 pointers it finds for each class. This information is written to a
13729 file named vtv_set_ptr_data.log in the directory named by the
13730 environment variable VTV_LOGS_DIR if that is defined or the current
13731 working directory otherwise.
13732
13733 Note: This feature appends data to the log file. If you want a
13734 fresh log file, be sure to delete any existing one.
13735
13736 -fvtv-counts
13737 This is a debugging flag. When used in conjunction with
13738 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
13739 compiler to keep track of the total number of virtual calls it
13740 encounters and the number of verifications it inserts. It also
13741 counts the number of calls to certain run-time library functions
13742 that it inserts and logs this information for each compilation
13743 unit. The compiler writes this information to a file named
13744 vtv_count_data.log in the directory named by the environment
13745 variable VTV_LOGS_DIR if that is defined or the current working
13746 directory otherwise. It also counts the size of the vtable pointer
13747 sets for each class, and writes this information to
13748 vtv_class_set_sizes.log in the same directory.
13749
13750 Note: This feature appends data to the log files. To get fresh
13751 log files, be sure to delete any existing ones.
13752
13753 -finstrument-functions
13754 Generate instrumentation calls for entry and exit to functions.
13755 Just after function entry and just before function exit, the
13756 following profiling functions are called with the address of the
13757 current function and its call site. (On some platforms,
13758 "__builtin_return_address" does not work beyond the current
13759 function, so the call site information may not be available to the
13760 profiling functions otherwise.)
13761
13762 void __cyg_profile_func_enter (void *this_fn,
13763 void *call_site);
13764 void __cyg_profile_func_exit (void *this_fn,
13765 void *call_site);
13766
13767 The first argument is the address of the start of the current
13768 function, which may be looked up exactly in the symbol table.
13769
13770 This instrumentation is also done for functions expanded inline in
13771 other functions. The profiling calls indicate where, conceptually,
13772 the inline function is entered and exited. This means that
13773 addressable versions of such functions must be available. If all
13774 your uses of a function are expanded inline, this may mean an
13775 additional expansion of code size. If you use "extern inline" in
13776 your C code, an addressable version of such functions must be
13777 provided. (This is normally the case anyway, but if you get lucky
13778 and the optimizer always expands the functions inline, you might
13779 have gotten away without providing static copies.)
13780
13781 A function may be given the attribute "no_instrument_function", in
13782 which case this instrumentation is not done. This can be used, for
13783 example, for the profiling functions listed above, high-priority
13784 interrupt routines, and any functions from which the profiling
13785 functions cannot safely be called (perhaps signal handlers, if the
13786 profiling routines generate output or allocate memory).
13787
13788 -finstrument-functions-exclude-file-list=file,file,...
13789 Set the list of functions that are excluded from instrumentation
13790 (see the description of -finstrument-functions). If the file that
13791 contains a function definition matches with one of file, then that
13792 function is not instrumented. The match is done on substrings: if
13793 the file parameter is a substring of the file name, it is
13794 considered to be a match.
13795
13796 For example:
13797
13798 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13799
13800 excludes any inline function defined in files whose pathnames
13801 contain /bits/stl or include/sys.
13802
13803 If, for some reason, you want to include letter , in one of sym,
13804 write ,. For example,
13805 -finstrument-functions-exclude-file-list=',,tmp' (note the single
13806 quote surrounding the option).
13807
13808 -finstrument-functions-exclude-function-list=sym,sym,...
13809 This is similar to -finstrument-functions-exclude-file-list, but
13810 this option sets the list of function names to be excluded from
13811 instrumentation. The function name to be matched is its user-
13812 visible name, such as "vector<int> blah(const vector<int> &)", not
13813 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
13814 match is done on substrings: if the sym parameter is a substring of
13815 the function name, it is considered to be a match. For C99 and C++
13816 extended identifiers, the function name must be given in UTF-8, not
13817 using universal character names.
13818
13819 -fpatchable-function-entry=N[,M]
13820 Generate N NOPs right at the beginning of each function, with the
13821 function entry point before the Mth NOP. If M is omitted, it
13822 defaults to 0 so the function entry points to the address just at
13823 the first NOP. The NOP instructions reserve extra space which can
13824 be used to patch in any desired instrumentation at run time,
13825 provided that the code segment is writable. The amount of space is
13826 controllable indirectly via the number of NOPs; the NOP instruction
13827 used corresponds to the instruction emitted by the internal GCC
13828 back-end interface "gen_nop". This behavior is target-specific and
13829 may also depend on the architecture variant and/or other
13830 compilation options.
13831
13832 For run-time identification, the starting addresses of these areas,
13833 which correspond to their respective function entries minus M, are
13834 additionally collected in the "__patchable_function_entries"
13835 section of the resulting binary.
13836
13837 Note that the value of "__attribute__ ((patchable_function_entry
13838 (N,M)))" takes precedence over command-line option
13839 -fpatchable-function-entry=N,M. This can be used to increase the
13840 area size or to remove it completely on a single function. If
13841 "N=0", no pad location is recorded.
13842
13843 The NOP instructions are inserted at---and maybe before, depending
13844 on M---the function entry address, even before the prologue.
13845
13846 The maximum value of N and M is 65535.
13847
13848 Options Controlling the Preprocessor
13849 These options control the C preprocessor, which is run on each C source
13850 file before actual compilation.
13851
13852 If you use the -E option, nothing is done except preprocessing. Some
13853 of these options make sense only together with -E because they cause
13854 the preprocessor output to be unsuitable for actual compilation.
13855
13856 In addition to the options listed here, there are a number of options
13857 to control search paths for include files documented in Directory
13858 Options. Options to control preprocessor diagnostics are listed in
13859 Warning Options.
13860
13861 -D name
13862 Predefine name as a macro, with definition 1.
13863
13864 -D name=definition
13865 The contents of definition are tokenized and processed as if they
13866 appeared during translation phase three in a #define directive. In
13867 particular, the definition is truncated by embedded newline
13868 characters.
13869
13870 If you are invoking the preprocessor from a shell or shell-like
13871 program you may need to use the shell's quoting syntax to protect
13872 characters such as spaces that have a meaning in the shell syntax.
13873
13874 If you wish to define a function-like macro on the command line,
13875 write its argument list with surrounding parentheses before the
13876 equals sign (if any). Parentheses are meaningful to most shells,
13877 so you should quote the option. With sh and csh,
13878 -D'name(args...)=definition' works.
13879
13880 -D and -U options are processed in the order they are given on the
13881 command line. All -imacros file and -include file options are
13882 processed after all -D and -U options.
13883
13884 -U name
13885 Cancel any previous definition of name, either built in or provided
13886 with a -D option.
13887
13888 -include file
13889 Process file as if "#include "file"" appeared as the first line of
13890 the primary source file. However, the first directory searched for
13891 file is the preprocessor's working directory instead of the
13892 directory containing the main source file. If not found there, it
13893 is searched for in the remainder of the "#include "..."" search
13894 chain as normal.
13895
13896 If multiple -include options are given, the files are included in
13897 the order they appear on the command line.
13898
13899 -imacros file
13900 Exactly like -include, except that any output produced by scanning
13901 file is thrown away. Macros it defines remain defined. This
13902 allows you to acquire all the macros from a header without also
13903 processing its declarations.
13904
13905 All files specified by -imacros are processed before all files
13906 specified by -include.
13907
13908 -undef
13909 Do not predefine any system-specific or GCC-specific macros. The
13910 standard predefined macros remain defined.
13911
13912 -pthread
13913 Define additional macros required for using the POSIX threads
13914 library. You should use this option consistently for both
13915 compilation and linking. This option is supported on GNU/Linux
13916 targets, most other Unix derivatives, and also on x86 Cygwin and
13917 MinGW targets.
13918
13919 -M Instead of outputting the result of preprocessing, output a rule
13920 suitable for make describing the dependencies of the main source
13921 file. The preprocessor outputs one make rule containing the object
13922 file name for that source file, a colon, and the names of all the
13923 included files, including those coming from -include or -imacros
13924 command-line options.
13925
13926 Unless specified explicitly (with -MT or -MQ), the object file name
13927 consists of the name of the source file with any suffix replaced
13928 with object file suffix and with any leading directory parts
13929 removed. If there are many included files then the rule is split
13930 into several lines using \-newline. The rule has no commands.
13931
13932 This option does not suppress the preprocessor's debug output, such
13933 as -dM. To avoid mixing such debug output with the dependency
13934 rules you should explicitly specify the dependency output file with
13935 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13936 Debug output is still sent to the regular output stream as normal.
13937
13938 Passing -M to the driver implies -E, and suppresses warnings with
13939 an implicit -w.
13940
13941 -MM Like -M but do not mention header files that are found in system
13942 header directories, nor header files that are included, directly or
13943 indirectly, from such a header.
13944
13945 This implies that the choice of angle brackets or double quotes in
13946 an #include directive does not in itself determine whether that
13947 header appears in -MM dependency output.
13948
13949 -MF file
13950 When used with -M or -MM, specifies a file to write the
13951 dependencies to. If no -MF switch is given the preprocessor sends
13952 the rules to the same place it would send preprocessed output.
13953
13954 When used with the driver options -MD or -MMD, -MF overrides the
13955 default dependency output file.
13956
13957 If file is -, then the dependencies are written to stdout.
13958
13959 -MG In conjunction with an option such as -M requesting dependency
13960 generation, -MG assumes missing header files are generated files
13961 and adds them to the dependency list without raising an error. The
13962 dependency filename is taken directly from the "#include" directive
13963 without prepending any path. -MG also suppresses preprocessed
13964 output, as a missing header file renders this useless.
13965
13966 This feature is used in automatic updating of makefiles.
13967
13968 -Mno-modules
13969 Disable dependency generation for compiled module interfaces.
13970
13971 -MP This option instructs CPP to add a phony target for each dependency
13972 other than the main file, causing each to depend on nothing. These
13973 dummy rules work around errors make gives if you remove header
13974 files without updating the Makefile to match.
13975
13976 This is typical output:
13977
13978 test.o: test.c test.h
13979
13980 test.h:
13981
13982 -MT target
13983 Change the target of the rule emitted by dependency generation. By
13984 default CPP takes the name of the main input file, deletes any
13985 directory components and any file suffix such as .c, and appends
13986 the platform's usual object suffix. The result is the target.
13987
13988 An -MT option sets the target to be exactly the string you specify.
13989 If you want multiple targets, you can specify them as a single
13990 argument to -MT, or use multiple -MT options.
13991
13992 For example, -MT '$(objpfx)foo.o' might give
13993
13994 $(objpfx)foo.o: foo.c
13995
13996 -MQ target
13997 Same as -MT, but it quotes any characters which are special to
13998 Make. -MQ '$(objpfx)foo.o' gives
13999
14000 $$(objpfx)foo.o: foo.c
14001
14002 The default target is automatically quoted, as if it were given
14003 with -MQ.
14004
14005 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14006 The driver determines file based on whether an -o option is given.
14007 If it is, the driver uses its argument but with a suffix of .d,
14008 otherwise it takes the name of the input file, removes any
14009 directory components and suffix, and applies a .d suffix.
14010
14011 If -MD is used in conjunction with -E, any -o switch is understood
14012 to specify the dependency output file, but if used without -E, each
14013 -o is understood to specify a target object file.
14014
14015 Since -E is not implied, -MD can be used to generate a dependency
14016 output file as a side effect of the compilation process.
14017
14018 -MMD
14019 Like -MD except mention only user header files, not system header
14020 files.
14021
14022 -fpreprocessed
14023 Indicate to the preprocessor that the input file has already been
14024 preprocessed. This suppresses things like macro expansion,
14025 trigraph conversion, escaped newline splicing, and processing of
14026 most directives. The preprocessor still recognizes and removes
14027 comments, so that you can pass a file preprocessed with -C to the
14028 compiler without problems. In this mode the integrated
14029 preprocessor is little more than a tokenizer for the front ends.
14030
14031 -fpreprocessed is implicit if the input file has one of the
14032 extensions .i, .ii or .mi. These are the extensions that GCC uses
14033 for preprocessed files created by -save-temps.
14034
14035 -fdirectives-only
14036 When preprocessing, handle directives, but do not expand macros.
14037
14038 The option's behavior depends on the -E and -fpreprocessed options.
14039
14040 With -E, preprocessing is limited to the handling of directives
14041 such as "#define", "#ifdef", and "#error". Other preprocessor
14042 operations, such as macro expansion and trigraph conversion are not
14043 performed. In addition, the -dD option is implicitly enabled.
14044
14045 With -fpreprocessed, predefinition of command line and most builtin
14046 macros is disabled. Macros such as "__LINE__", which are
14047 contextually dependent, are handled normally. This enables
14048 compilation of files previously preprocessed with "-E
14049 -fdirectives-only".
14050
14051 With both -E and -fpreprocessed, the rules for -fpreprocessed take
14052 precedence. This enables full preprocessing of files previously
14053 preprocessed with "-E -fdirectives-only".
14054
14055 -fdollars-in-identifiers
14056 Accept $ in identifiers.
14057
14058 -fextended-identifiers
14059 Accept universal character names and extended characters in
14060 identifiers. This option is enabled by default for C99 (and later
14061 C standard versions) and C++.
14062
14063 -fno-canonical-system-headers
14064 When preprocessing, do not shorten system header paths with
14065 canonicalization.
14066
14067 -fmax-include-depth=depth
14068 Set the maximum depth of the nested #include. The default is 200.
14069
14070 -ftabstop=width
14071 Set the distance between tab stops. This helps the preprocessor
14072 report correct column numbers in warnings or errors, even if tabs
14073 appear on the line. If the value is less than 1 or greater than
14074 100, the option is ignored. The default is 8.
14075
14076 -ftrack-macro-expansion[=level]
14077 Track locations of tokens across macro expansions. This allows the
14078 compiler to emit diagnostic about the current macro expansion stack
14079 when a compilation error occurs in a macro expansion. Using this
14080 option makes the preprocessor and the compiler consume more memory.
14081 The level parameter can be used to choose the level of precision of
14082 token location tracking thus decreasing the memory consumption if
14083 necessary. Value 0 of level de-activates this option. Value 1
14084 tracks tokens locations in a degraded mode for the sake of minimal
14085 memory overhead. In this mode all tokens resulting from the
14086 expansion of an argument of a function-like macro have the same
14087 location. Value 2 tracks tokens locations completely. This value is
14088 the most memory hungry. When this option is given no argument, the
14089 default parameter value is 2.
14090
14091 Note that "-ftrack-macro-expansion=2" is activated by default.
14092
14093 -fmacro-prefix-map=old=new
14094 When preprocessing files residing in directory old, expand the
14095 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
14096 directory new instead. This can be used to change an absolute path
14097 to a relative path by using . for new which can result in more
14098 reproducible builds that are location independent. This option
14099 also affects "__builtin_FILE()" during compilation. See also
14100 -ffile-prefix-map.
14101
14102 -fexec-charset=charset
14103 Set the execution character set, used for string and character
14104 constants. The default is UTF-8. charset can be any encoding
14105 supported by the system's "iconv" library routine.
14106
14107 -fwide-exec-charset=charset
14108 Set the wide execution character set, used for wide string and
14109 character constants. The default is UTF-32 or UTF-16, whichever
14110 corresponds to the width of "wchar_t". As with -fexec-charset,
14111 charset can be any encoding supported by the system's "iconv"
14112 library routine; however, you will have problems with encodings
14113 that do not fit exactly in "wchar_t".
14114
14115 -finput-charset=charset
14116 Set the input character set, used for translation from the
14117 character set of the input file to the source character set used by
14118 GCC. If the locale does not specify, or GCC cannot get this
14119 information from the locale, the default is UTF-8. This can be
14120 overridden by either the locale or this command-line option.
14121 Currently the command-line option takes precedence if there's a
14122 conflict. charset can be any encoding supported by the system's
14123 "iconv" library routine.
14124
14125 -fpch-deps
14126 When using precompiled headers, this flag causes the dependency-
14127 output flags to also list the files from the precompiled header's
14128 dependencies. If not specified, only the precompiled header are
14129 listed and not the files that were used to create it, because those
14130 files are not consulted when a precompiled header is used.
14131
14132 -fpch-preprocess
14133 This option allows use of a precompiled header together with -E.
14134 It inserts a special "#pragma", "#pragma GCC pch_preprocess
14135 "filename"" in the output to mark the place where the precompiled
14136 header was found, and its filename. When -fpreprocessed is in use,
14137 GCC recognizes this "#pragma" and loads the PCH.
14138
14139 This option is off by default, because the resulting preprocessed
14140 output is only really suitable as input to GCC. It is switched on
14141 by -save-temps.
14142
14143 You should not write this "#pragma" in your own code, but it is
14144 safe to edit the filename if the PCH file is available in a
14145 different location. The filename may be absolute or it may be
14146 relative to GCC's current directory.
14147
14148 -fworking-directory
14149 Enable generation of linemarkers in the preprocessor output that
14150 let the compiler know the current working directory at the time of
14151 preprocessing. When this option is enabled, the preprocessor
14152 emits, after the initial linemarker, a second linemarker with the
14153 current working directory followed by two slashes. GCC uses this
14154 directory, when it's present in the preprocessed input, as the
14155 directory emitted as the current working directory in some
14156 debugging information formats. This option is implicitly enabled
14157 if debugging information is enabled, but this can be inhibited with
14158 the negated form -fno-working-directory. If the -P flag is present
14159 in the command line, this option has no effect, since no "#line"
14160 directives are emitted whatsoever.
14161
14162 -A predicate=answer
14163 Make an assertion with the predicate predicate and answer answer.
14164 This form is preferred to the older form -A predicate(answer),
14165 which is still supported, because it does not use shell special
14166 characters.
14167
14168 -A -predicate=answer
14169 Cancel an assertion with the predicate predicate and answer answer.
14170
14171 -C Do not discard comments. All comments are passed through to the
14172 output file, except for comments in processed directives, which are
14173 deleted along with the directive.
14174
14175 You should be prepared for side effects when using -C; it causes
14176 the preprocessor to treat comments as tokens in their own right.
14177 For example, comments appearing at the start of what would be a
14178 directive line have the effect of turning that line into an
14179 ordinary source line, since the first token on the line is no
14180 longer a #.
14181
14182 -CC Do not discard comments, including during macro expansion. This is
14183 like -C, except that comments contained within macros are also
14184 passed through to the output file where the macro is expanded.
14185
14186 In addition to the side effects of the -C option, the -CC option
14187 causes all C++-style comments inside a macro to be converted to
14188 C-style comments. This is to prevent later use of that macro from
14189 inadvertently commenting out the remainder of the source line.
14190
14191 The -CC option is generally used to support lint comments.
14192
14193 -P Inhibit generation of linemarkers in the output from the
14194 preprocessor. This might be useful when running the preprocessor
14195 on something that is not C code, and will be sent to a program
14196 which might be confused by the linemarkers.
14197
14198 -traditional
14199 -traditional-cpp
14200 Try to imitate the behavior of pre-standard C preprocessors, as
14201 opposed to ISO C preprocessors. See the GNU CPP manual for
14202 details.
14203
14204 Note that GCC does not otherwise attempt to emulate a pre-standard
14205 C compiler, and these options are only supported with the -E
14206 switch, or when invoking CPP explicitly.
14207
14208 -trigraphs
14209 Support ISO C trigraphs. These are three-character sequences, all
14210 starting with ??, that are defined by ISO C to stand for single
14211 characters. For example, ??/ stands for \, so '??/n' is a
14212 character constant for a newline.
14213
14214 The nine trigraphs and their replacements are
14215
14216 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
14217 Replacement: [ ] { } # \ ^ | ~
14218
14219 By default, GCC ignores trigraphs, but in standard-conforming modes
14220 it converts them. See the -std and -ansi options.
14221
14222 -remap
14223 Enable special code to work around file systems which only permit
14224 very short file names, such as MS-DOS.
14225
14226 -H Print the name of each header file used, in addition to other
14227 normal activities. Each name is indented to show how deep in the
14228 #include stack it is. Precompiled header files are also printed,
14229 even if they are found to be invalid; an invalid precompiled header
14230 file is printed with ...x and a valid one with ...! .
14231
14232 -dletters
14233 Says to make debugging dumps during compilation as specified by
14234 letters. The flags documented here are those relevant to the
14235 preprocessor. Other letters are interpreted by the compiler
14236 proper, or reserved for future versions of GCC, and so are silently
14237 ignored. If you specify letters whose behavior conflicts, the
14238 result is undefined.
14239
14240 -dM Instead of the normal output, generate a list of #define
14241 directives for all the macros defined during the execution of
14242 the preprocessor, including predefined macros. This gives you
14243 a way of finding out what is predefined in your version of the
14244 preprocessor. Assuming you have no file foo.h, the command
14245
14246 touch foo.h; cpp -dM foo.h
14247
14248 shows all the predefined macros.
14249
14250 If you use -dM without the -E option, -dM is interpreted as a
14251 synonym for -fdump-rtl-mach.
14252
14253 -dD Like -dM except in two respects: it does not include the
14254 predefined macros, and it outputs both the #define directives
14255 and the result of preprocessing. Both kinds of output go to
14256 the standard output file.
14257
14258 -dN Like -dD, but emit only the macro names, not their expansions.
14259
14260 -dI Output #include directives in addition to the result of
14261 preprocessing.
14262
14263 -dU Like -dD except that only macros that are expanded, or whose
14264 definedness is tested in preprocessor directives, are output;
14265 the output is delayed until the use or test of the macro; and
14266 #undef directives are also output for macros tested but
14267 undefined at the time.
14268
14269 -fdebug-cpp
14270 This option is only useful for debugging GCC. When used from CPP
14271 or with -E, it dumps debugging information about location maps.
14272 Every token in the output is preceded by the dump of the map its
14273 location belongs to.
14274
14275 When used from GCC without -E, this option has no effect.
14276
14277 -Wp,option
14278 You can use -Wp,option to bypass the compiler driver and pass
14279 option directly through to the preprocessor. If option contains
14280 commas, it is split into multiple options at the commas. However,
14281 many options are modified, translated or interpreted by the
14282 compiler driver before being passed to the preprocessor, and -Wp
14283 forcibly bypasses this phase. The preprocessor's direct interface
14284 is undocumented and subject to change, so whenever possible you
14285 should avoid using -Wp and let the driver handle the options
14286 instead.
14287
14288 -Xpreprocessor option
14289 Pass option as an option to the preprocessor. You can use this to
14290 supply system-specific preprocessor options that GCC does not
14291 recognize.
14292
14293 If you want to pass an option that takes an argument, you must use
14294 -Xpreprocessor twice, once for the option and once for the
14295 argument.
14296
14297 -no-integrated-cpp
14298 Perform preprocessing as a separate pass before compilation. By
14299 default, GCC performs preprocessing as an integrated part of input
14300 tokenization and parsing. If this option is provided, the
14301 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
14302 and Objective-C, respectively) is instead invoked twice, once for
14303 preprocessing only and once for actual compilation of the
14304 preprocessed input. This option may be useful in conjunction with
14305 the -B or -wrapper options to specify an alternate preprocessor or
14306 perform additional processing of the program source between normal
14307 preprocessing and compilation.
14308
14309 -flarge-source-files
14310 Adjust GCC to expect large source files, at the expense of slower
14311 compilation and higher memory usage.
14312
14313 Specifically, GCC normally tracks both column numbers and line
14314 numbers within source files and it normally prints both of these
14315 numbers in diagnostics. However, once it has processed a certain
14316 number of source lines, it stops tracking column numbers and only
14317 tracks line numbers. This means that diagnostics for later lines
14318 do not include column numbers. It also means that options like
14319 -Wmisleading-indentation cease to work at that point, although the
14320 compiler prints a note if this happens. Passing
14321 -flarge-source-files significantly increases the number of source
14322 lines that GCC can process before it stops tracking columns.
14323
14324 Passing Options to the Assembler
14325 You can pass options to the assembler.
14326
14327 -Wa,option
14328 Pass option as an option to the assembler. If option contains
14329 commas, it is split into multiple options at the commas.
14330
14331 -Xassembler option
14332 Pass option as an option to the assembler. You can use this to
14333 supply system-specific assembler options that GCC does not
14334 recognize.
14335
14336 If you want to pass an option that takes an argument, you must use
14337 -Xassembler twice, once for the option and once for the argument.
14338
14339 Options for Linking
14340 These options come into play when the compiler links object files into
14341 an executable output file. They are meaningless if the compiler is not
14342 doing a link step.
14343
14344 object-file-name
14345 A file name that does not end in a special recognized suffix is
14346 considered to name an object file or library. (Object files are
14347 distinguished from libraries by the linker according to the file
14348 contents.) If linking is done, these object files are used as
14349 input to the linker.
14350
14351 -c
14352 -S
14353 -E If any of these options is used, then the linker is not run, and
14354 object file names should not be used as arguments.
14355
14356 -flinker-output=type
14357 This option controls code generation of the link-time optimizer.
14358 By default the linker output is automatically determined by the
14359 linker plugin. For debugging the compiler and if incremental
14360 linking with a non-LTO object file is desired, it may be useful to
14361 control the type manually.
14362
14363 If type is exec, code generation produces a static binary. In this
14364 case -fpic and -fpie are both disabled.
14365
14366 If type is dyn, code generation produces a shared library. In this
14367 case -fpic or -fPIC is preserved, but not enabled automatically.
14368 This allows to build shared libraries without position-independent
14369 code on architectures where this is possible, i.e. on x86.
14370
14371 If type is pie, code generation produces an -fpie executable. This
14372 results in similar optimizations as exec except that -fpie is not
14373 disabled if specified at compilation time.
14374
14375 If type is rel, the compiler assumes that incremental linking is
14376 done. The sections containing intermediate code for link-time
14377 optimization are merged, pre-optimized, and output to the resulting
14378 object file. In addition, if -ffat-lto-objects is specified, binary
14379 code is produced for future non-LTO linking. The object file
14380 produced by incremental linking is smaller than a static library
14381 produced from the same object files. At link time the result of
14382 incremental linking also loads faster than a static library
14383 assuming that the majority of objects in the library are used.
14384
14385 Finally nolto-rel configures the compiler for incremental linking
14386 where code generation is forced, a final binary is produced, and
14387 the intermediate code for later link-time optimization is stripped.
14388 When multiple object files are linked together the resulting code
14389 is better optimized than with link-time optimizations disabled (for
14390 example, cross-module inlining happens), but most of benefits of
14391 whole program optimizations are lost.
14392
14393 During the incremental link (by -r) the linker plugin defaults to
14394 rel. With current interfaces to GNU Binutils it is however not
14395 possible to incrementally link LTO objects and non-LTO objects into
14396 a single mixed object file. If any of object files in incremental
14397 link cannot be used for link-time optimization, the linker plugin
14398 issues a warning and uses nolto-rel. To maintain whole program
14399 optimization, it is recommended to link such objects into static
14400 library instead. Alternatively it is possible to use H.J. Lu's
14401 binutils with support for mixed objects.
14402
14403 -fuse-ld=bfd
14404 Use the bfd linker instead of the default linker.
14405
14406 -fuse-ld=gold
14407 Use the gold linker instead of the default linker.
14408
14409 -fuse-ld=lld
14410 Use the LLVM lld linker instead of the default linker.
14411
14412 -fuse-ld=mold
14413 Use the Modern Linker (mold) instead of the default linker.
14414
14415 -llibrary
14416 -l library
14417 Search the library named library when linking. (The second
14418 alternative with the library as a separate argument is only for
14419 POSIX compliance and is not recommended.)
14420
14421 The -l option is passed directly to the linker by GCC. Refer to
14422 your linker documentation for exact details. The general
14423 description below applies to the GNU linker.
14424
14425 The linker searches a standard list of directories for the library.
14426 The directories searched include several standard system
14427 directories plus any that you specify with -L.
14428
14429 Static libraries are archives of object files, and have file names
14430 like liblibrary.a. Some targets also support shared libraries,
14431 which typically have names like liblibrary.so. If both static and
14432 shared libraries are found, the linker gives preference to linking
14433 with the shared library unless the -static option is used.
14434
14435 It makes a difference where in the command you write this option;
14436 the linker searches and processes libraries and object files in the
14437 order they are specified. Thus, foo.o -lz bar.o searches library z
14438 after file foo.o but before bar.o. If bar.o refers to functions in
14439 z, those functions may not be loaded.
14440
14441 -lobjc
14442 You need this special case of the -l option in order to link an
14443 Objective-C or Objective-C++ program.
14444
14445 -nostartfiles
14446 Do not use the standard system startup files when linking. The
14447 standard system libraries are used normally, unless -nostdlib,
14448 -nolibc, or -nodefaultlibs is used.
14449
14450 -nodefaultlibs
14451 Do not use the standard system libraries when linking. Only the
14452 libraries you specify are passed to the linker, and options
14453 specifying linkage of the system libraries, such as -static-libgcc
14454 or -shared-libgcc, are ignored. The standard startup files are
14455 used normally, unless -nostartfiles is used.
14456
14457 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14458 "memmove". These entries are usually resolved by entries in libc.
14459 These entry points should be supplied through some other mechanism
14460 when this option is specified.
14461
14462 -nolibc
14463 Do not use the C library or system libraries tightly coupled with
14464 it when linking. Still link with the startup files, libgcc or
14465 toolchain provided language support libraries such as libgnat,
14466 libgfortran or libstdc++ unless options preventing their inclusion
14467 are used as well. This typically removes -lc from the link command
14468 line, as well as system libraries that normally go with it and
14469 become meaningless when absence of a C library is assumed, for
14470 example -lpthread or -lm in some configurations. This is intended
14471 for bare-board targets when there is indeed no C library available.
14472
14473 -nostdlib
14474 Do not use the standard system startup files or libraries when
14475 linking. No startup files and only the libraries you specify are
14476 passed to the linker, and options specifying linkage of the system
14477 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
14478
14479 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14480 "memmove". These entries are usually resolved by entries in libc.
14481 These entry points should be supplied through some other mechanism
14482 when this option is specified.
14483
14484 One of the standard libraries bypassed by -nostdlib and
14485 -nodefaultlibs is libgcc.a, a library of internal subroutines which
14486 GCC uses to overcome shortcomings of particular machines, or
14487 special needs for some languages.
14488
14489 In most cases, you need libgcc.a even when you want to avoid other
14490 standard libraries. In other words, when you specify -nostdlib or
14491 -nodefaultlibs you should usually specify -lgcc as well. This
14492 ensures that you have no unresolved references to internal GCC
14493 library subroutines. (An example of such an internal subroutine is
14494 "__main", used to ensure C++ constructors are called.)
14495
14496 -e entry
14497 --entry=entry
14498 Specify that the program entry point is entry. The argument is
14499 interpreted by the linker; the GNU linker accepts either a symbol
14500 name or an address.
14501
14502 -pie
14503 Produce a dynamically linked position independent executable on
14504 targets that support it. For predictable results, you must also
14505 specify the same set of options used for compilation (-fpie, -fPIE,
14506 or model suboptions) when you specify this linker option.
14507
14508 -no-pie
14509 Don't produce a dynamically linked position independent executable.
14510
14511 -static-pie
14512 Produce a static position independent executable on targets that
14513 support it. A static position independent executable is similar to
14514 a static executable, but can be loaded at any address without a
14515 dynamic linker. For predictable results, you must also specify the
14516 same set of options used for compilation (-fpie, -fPIE, or model
14517 suboptions) when you specify this linker option.
14518
14519 -pthread
14520 Link with the POSIX threads library. This option is supported on
14521 GNU/Linux targets, most other Unix derivatives, and also on x86
14522 Cygwin and MinGW targets. On some targets this option also sets
14523 flags for the preprocessor, so it should be used consistently for
14524 both compilation and linking.
14525
14526 -r Produce a relocatable object as output. This is also known as
14527 partial linking.
14528
14529 -rdynamic
14530 Pass the flag -export-dynamic to the ELF linker, on targets that
14531 support it. This instructs the linker to add all symbols, not only
14532 used ones, to the dynamic symbol table. This option is needed for
14533 some uses of "dlopen" or to allow obtaining backtraces from within
14534 a program.
14535
14536 -s Remove all symbol table and relocation information from the
14537 executable.
14538
14539 -static
14540 On systems that support dynamic linking, this overrides -pie and
14541 prevents linking with the shared libraries. On other systems, this
14542 option has no effect.
14543
14544 -shared
14545 Produce a shared object which can then be linked with other objects
14546 to form an executable. Not all systems support this option. For
14547 predictable results, you must also specify the same set of options
14548 used for compilation (-fpic, -fPIC, or model suboptions) when you
14549 specify this linker option.[1]
14550
14551 -shared-libgcc
14552 -static-libgcc
14553 On systems that provide libgcc as a shared library, these options
14554 force the use of either the shared or static version, respectively.
14555 If no shared version of libgcc was built when the compiler was
14556 configured, these options have no effect.
14557
14558 There are several situations in which an application should use the
14559 shared libgcc instead of the static version. The most common of
14560 these is when the application wishes to throw and catch exceptions
14561 across different shared libraries. In that case, each of the
14562 libraries as well as the application itself should use the shared
14563 libgcc.
14564
14565 Therefore, the G++ driver automatically adds -shared-libgcc
14566 whenever you build a shared library or a main executable, because
14567 C++ programs typically use exceptions, so this is the right thing
14568 to do.
14569
14570 If, instead, you use the GCC driver to create shared libraries, you
14571 may find that they are not always linked with the shared libgcc.
14572 If GCC finds, at its configuration time, that you have a non-GNU
14573 linker or a GNU linker that does not support option --eh-frame-hdr,
14574 it links the shared version of libgcc into shared libraries by
14575 default. Otherwise, it takes advantage of the linker and optimizes
14576 away the linking with the shared version of libgcc, linking with
14577 the static version of libgcc by default. This allows exceptions to
14578 propagate through such shared libraries, without incurring
14579 relocation costs at library load time.
14580
14581 However, if a library or main executable is supposed to throw or
14582 catch exceptions, you must link it using the G++ driver, or using
14583 the option -shared-libgcc, such that it is linked with the shared
14584 libgcc.
14585
14586 -static-libasan
14587 When the -fsanitize=address option is used to link a program, the
14588 GCC driver automatically links against libasan. If libasan is
14589 available as a shared library, and the -static option is not used,
14590 then this links against the shared version of libasan. The
14591 -static-libasan option directs the GCC driver to link libasan
14592 statically, without necessarily linking other libraries statically.
14593
14594 -static-libtsan
14595 When the -fsanitize=thread option is used to link a program, the
14596 GCC driver automatically links against libtsan. If libtsan is
14597 available as a shared library, and the -static option is not used,
14598 then this links against the shared version of libtsan. The
14599 -static-libtsan option directs the GCC driver to link libtsan
14600 statically, without necessarily linking other libraries statically.
14601
14602 -static-liblsan
14603 When the -fsanitize=leak option is used to link a program, the GCC
14604 driver automatically links against liblsan. If liblsan is
14605 available as a shared library, and the -static option is not used,
14606 then this links against the shared version of liblsan. The
14607 -static-liblsan option directs the GCC driver to link liblsan
14608 statically, without necessarily linking other libraries statically.
14609
14610 -static-libubsan
14611 When the -fsanitize=undefined option is used to link a program, the
14612 GCC driver automatically links against libubsan. If libubsan is
14613 available as a shared library, and the -static option is not used,
14614 then this links against the shared version of libubsan. The
14615 -static-libubsan option directs the GCC driver to link libubsan
14616 statically, without necessarily linking other libraries statically.
14617
14618 -static-libstdc++
14619 When the g++ program is used to link a C++ program, it normally
14620 automatically links against libstdc++. If libstdc++ is available
14621 as a shared library, and the -static option is not used, then this
14622 links against the shared version of libstdc++. That is normally
14623 fine. However, it is sometimes useful to freeze the version of
14624 libstdc++ used by the program without going all the way to a fully
14625 static link. The -static-libstdc++ option directs the g++ driver
14626 to link libstdc++ statically, without necessarily linking other
14627 libraries statically.
14628
14629 -symbolic
14630 Bind references to global symbols when building a shared object.
14631 Warn about any unresolved references (unless overridden by the link
14632 editor option -Xlinker -z -Xlinker defs). Only a few systems
14633 support this option.
14634
14635 -T script
14636 Use script as the linker script. This option is supported by most
14637 systems using the GNU linker. On some targets, such as bare-board
14638 targets without an operating system, the -T option may be required
14639 when linking to avoid references to undefined symbols.
14640
14641 -Xlinker option
14642 Pass option as an option to the linker. You can use this to supply
14643 system-specific linker options that GCC does not recognize.
14644
14645 If you want to pass an option that takes a separate argument, you
14646 must use -Xlinker twice, once for the option and once for the
14647 argument. For example, to pass -assert definitions, you must write
14648 -Xlinker -assert -Xlinker definitions. It does not work to write
14649 -Xlinker "-assert definitions", because this passes the entire
14650 string as a single argument, which is not what the linker expects.
14651
14652 When using the GNU linker, it is usually more convenient to pass
14653 arguments to linker options using the option=value syntax than as
14654 separate arguments. For example, you can specify -Xlinker
14655 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
14656 Other linkers may not support this syntax for command-line options.
14657
14658 -Wl,option
14659 Pass option as an option to the linker. If option contains commas,
14660 it is split into multiple options at the commas. You can use this
14661 syntax to pass an argument to the option. For example,
14662 -Wl,-Map,output.map passes -Map output.map to the linker. When
14663 using the GNU linker, you can also get the same effect with
14664 -Wl,-Map=output.map.
14665
14666 -u symbol
14667 Pretend the symbol symbol is undefined, to force linking of library
14668 modules to define it. You can use -u multiple times with different
14669 symbols to force loading of additional library modules.
14670
14671 -z keyword
14672 -z is passed directly on to the linker along with the keyword
14673 keyword. See the section in the documentation of your linker for
14674 permitted values and their meanings.
14675
14676 Options for Directory Search
14677 These options specify directories to search for header files, for
14678 libraries and for parts of the compiler:
14679
14680 -I dir
14681 -iquote dir
14682 -isystem dir
14683 -idirafter dir
14684 Add the directory dir to the list of directories to be searched for
14685 header files during preprocessing. If dir begins with = or
14686 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
14687 see --sysroot and -isysroot.
14688
14689 Directories specified with -iquote apply only to the quote form of
14690 the directive, "#include "file"". Directories specified with -I,
14691 -isystem, or -idirafter apply to lookup for both the
14692 "#include "file"" and "#include <file>" directives.
14693
14694 You can specify any number or combination of these options on the
14695 command line to search for header files in several directories.
14696 The lookup order is as follows:
14697
14698 1. For the quote form of the include directive, the directory of
14699 the current file is searched first.
14700
14701 2. For the quote form of the include directive, the directories
14702 specified by -iquote options are searched in left-to-right
14703 order, as they appear on the command line.
14704
14705 3. Directories specified with -I options are scanned in left-to-
14706 right order.
14707
14708 4. Directories specified with -isystem options are scanned in
14709 left-to-right order.
14710
14711 5. Standard system directories are scanned.
14712
14713 6. Directories specified with -idirafter options are scanned in
14714 left-to-right order.
14715
14716 You can use -I to override a system header file, substituting your
14717 own version, since these directories are searched before the
14718 standard system header file directories. However, you should not
14719 use this option to add directories that contain vendor-supplied
14720 system header files; use -isystem for that.
14721
14722 The -isystem and -idirafter options also mark the directory as a
14723 system directory, so that it gets the same special treatment that
14724 is applied to the standard system directories.
14725
14726 If a standard system include directory, or a directory specified
14727 with -isystem, is also specified with -I, the -I option is ignored.
14728 The directory is still searched but as a system directory at its
14729 normal position in the system include chain. This is to ensure
14730 that GCC's procedure to fix buggy system headers and the ordering
14731 for the "#include_next" directive are not inadvertently changed.
14732 If you really need to change the search order for system
14733 directories, use the -nostdinc and/or -isystem options.
14734
14735 -I- Split the include path. This option has been deprecated. Please
14736 use -iquote instead for -I directories before the -I- and remove
14737 the -I- option.
14738
14739 Any directories specified with -I options before -I- are searched
14740 only for headers requested with "#include "file""; they are not
14741 searched for "#include <file>". If additional directories are
14742 specified with -I options after the -I-, those directories are
14743 searched for all #include directives.
14744
14745 In addition, -I- inhibits the use of the directory of the current
14746 file directory as the first search directory for "#include "file"".
14747 There is no way to override this effect of -I-.
14748
14749 -iprefix prefix
14750 Specify prefix as the prefix for subsequent -iwithprefix options.
14751 If the prefix represents a directory, you should include the final
14752 /.
14753
14754 -iwithprefix dir
14755 -iwithprefixbefore dir
14756 Append dir to the prefix specified previously with -iprefix, and
14757 add the resulting directory to the include search path.
14758 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
14759 puts it where -idirafter would.
14760
14761 -isysroot dir
14762 This option is like the --sysroot option, but applies only to
14763 header files (except for Darwin targets, where it applies to both
14764 header files and libraries). See the --sysroot option for more
14765 information.
14766
14767 -imultilib dir
14768 Use dir as a subdirectory of the directory containing target-
14769 specific C++ headers.
14770
14771 -nostdinc
14772 Do not search the standard system directories for header files.
14773 Only the directories explicitly specified with -I, -iquote,
14774 -isystem, and/or -idirafter options (and the directory of the
14775 current file, if appropriate) are searched.
14776
14777 -nostdinc++
14778 Do not search for header files in the C++-specific standard
14779 directories, but do still search the other standard directories.
14780 (This option is used when building the C++ library.)
14781
14782 -iplugindir=dir
14783 Set the directory to search for plugins that are passed by
14784 -fplugin=name instead of -fplugin=path/name.so. This option is not
14785 meant to be used by the user, but only passed by the driver.
14786
14787 -Ldir
14788 Add directory dir to the list of directories to be searched for -l.
14789
14790 -Bprefix
14791 This option specifies where to find the executables, libraries,
14792 include files, and data files of the compiler itself.
14793
14794 The compiler driver program runs one or more of the subprograms
14795 cpp, cc1, as and ld. It tries prefix as a prefix for each program
14796 it tries to run, both with and without machine/version/ for the
14797 corresponding target machine and compiler version.
14798
14799 For each subprogram to be run, the compiler driver first tries the
14800 -B prefix, if any. If that name is not found, or if -B is not
14801 specified, the driver tries two standard prefixes, /usr/lib/gcc/
14802 and /usr/local/lib/gcc/. If neither of those results in a file
14803 name that is found, the unmodified program name is searched for
14804 using the directories specified in your PATH environment variable.
14805
14806 The compiler checks to see if the path provided by -B refers to a
14807 directory, and if necessary it adds a directory separator character
14808 at the end of the path.
14809
14810 -B prefixes that effectively specify directory names also apply to
14811 libraries in the linker, because the compiler translates these
14812 options into -L options for the linker. They also apply to include
14813 files in the preprocessor, because the compiler translates these
14814 options into -isystem options for the preprocessor. In this case,
14815 the compiler appends include to the prefix.
14816
14817 The runtime support file libgcc.a can also be searched for using
14818 the -B prefix, if needed. If it is not found there, the two
14819 standard prefixes above are tried, and that is all. The file is
14820 left out of the link if it is not found by those means.
14821
14822 Another way to specify a prefix much like the -B prefix is to use
14823 the environment variable GCC_EXEC_PREFIX.
14824
14825 As a special kludge, if the path provided by -B is [dir/]stageN/,
14826 where N is a number in the range 0 to 9, then it is replaced by
14827 [dir/]include. This is to help with boot-strapping the compiler.
14828
14829 -no-canonical-prefixes
14830 Do not expand any symbolic links, resolve references to /../ or
14831 /./, or make the path absolute when generating a relative prefix.
14832
14833 --sysroot=dir
14834 Use dir as the logical root directory for headers and libraries.
14835 For example, if the compiler normally searches for headers in
14836 /usr/include and libraries in /usr/lib, it instead searches
14837 dir/usr/include and dir/usr/lib.
14838
14839 If you use both this option and the -isysroot option, then the
14840 --sysroot option applies to libraries, but the -isysroot option
14841 applies to header files.
14842
14843 The GNU linker (beginning with version 2.16) has the necessary
14844 support for this option. If your linker does not support this
14845 option, the header file aspect of --sysroot still works, but the
14846 library aspect does not.
14847
14848 --no-sysroot-suffix
14849 For some targets, a suffix is added to the root directory specified
14850 with --sysroot, depending on the other options used, so that
14851 headers may for example be found in dir/suffix/usr/include instead
14852 of dir/usr/include. This option disables the addition of such a
14853 suffix.
14854
14855 Options for Code Generation Conventions
14856 These machine-independent options control the interface conventions
14857 used in code generation.
14858
14859 Most of them have both positive and negative forms; the negative form
14860 of -ffoo is -fno-foo. In the table below, only one of the forms is
14861 listed---the one that is not the default. You can figure out the other
14862 form by either removing no- or adding it.
14863
14864 -fstack-reuse=reuse-level
14865 This option controls stack space reuse for user declared local/auto
14866 variables and compiler generated temporaries. reuse_level can be
14867 all, named_vars, or none. all enables stack reuse for all local
14868 variables and temporaries, named_vars enables the reuse only for
14869 user defined local variables with names, and none disables stack
14870 reuse completely. The default value is all. The option is needed
14871 when the program extends the lifetime of a scoped local variable or
14872 a compiler generated temporary beyond the end point defined by the
14873 language. When a lifetime of a variable ends, and if the variable
14874 lives in memory, the optimizing compiler has the freedom to reuse
14875 its stack space with other temporaries or scoped local variables
14876 whose live range does not overlap with it. Legacy code extending
14877 local lifetime is likely to break with the stack reuse
14878 optimization.
14879
14880 For example,
14881
14882 int *p;
14883 {
14884 int local1;
14885
14886 p = &local1;
14887 local1 = 10;
14888 ....
14889 }
14890 {
14891 int local2;
14892 local2 = 20;
14893 ...
14894 }
14895
14896 if (*p == 10) // out of scope use of local1
14897 {
14898
14899 }
14900
14901 Another example:
14902
14903 struct A
14904 {
14905 A(int k) : i(k), j(k) { }
14906 int i;
14907 int j;
14908 };
14909
14910 A *ap;
14911
14912 void foo(const A& ar)
14913 {
14914 ap = &ar;
14915 }
14916
14917 void bar()
14918 {
14919 foo(A(10)); // temp object's lifetime ends when foo returns
14920
14921 {
14922 A a(20);
14923 ....
14924 }
14925 ap->i+= 10; // ap references out of scope temp whose space
14926 // is reused with a. What is the value of ap->i?
14927 }
14928
14929 The lifetime of a compiler generated temporary is well defined by
14930 the C++ standard. When a lifetime of a temporary ends, and if the
14931 temporary lives in memory, the optimizing compiler has the freedom
14932 to reuse its stack space with other temporaries or scoped local
14933 variables whose live range does not overlap with it. However some
14934 of the legacy code relies on the behavior of older compilers in
14935 which temporaries' stack space is not reused, the aggressive stack
14936 reuse can lead to runtime errors. This option is used to control
14937 the temporary stack reuse optimization.
14938
14939 -ftrapv
14940 This option generates traps for signed overflow on addition,
14941 subtraction, multiplication operations. The options -ftrapv and
14942 -fwrapv override each other, so using -ftrapv -fwrapv on the
14943 command-line results in -fwrapv being effective. Note that only
14944 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14945 command-line results in -ftrapv being effective.
14946
14947 -fwrapv
14948 This option instructs the compiler to assume that signed arithmetic
14949 overflow of addition, subtraction and multiplication wraps around
14950 using twos-complement representation. This flag enables some
14951 optimizations and disables others. The options -ftrapv and -fwrapv
14952 override each other, so using -ftrapv -fwrapv on the command-line
14953 results in -fwrapv being effective. Note that only active options
14954 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14955 results in -ftrapv being effective.
14956
14957 -fwrapv-pointer
14958 This option instructs the compiler to assume that pointer
14959 arithmetic overflow on addition and subtraction wraps around using
14960 twos-complement representation. This flag disables some
14961 optimizations which assume pointer overflow is invalid.
14962
14963 -fstrict-overflow
14964 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14965 implies -fwrapv -fwrapv-pointer.
14966
14967 -fexceptions
14968 Enable exception handling. Generates extra code needed to
14969 propagate exceptions. For some targets, this implies GCC generates
14970 frame unwind information for all functions, which can produce
14971 significant data size overhead, although it does not affect
14972 execution. If you do not specify this option, GCC enables it by
14973 default for languages like C++ that normally require exception
14974 handling, and disables it for languages like C that do not normally
14975 require it. However, you may need to enable this option when
14976 compiling C code that needs to interoperate properly with exception
14977 handlers written in C++. You may also wish to disable this option
14978 if you are compiling older C++ programs that don't use exception
14979 handling.
14980
14981 -fnon-call-exceptions
14982 Generate code that allows trapping instructions to throw
14983 exceptions. Note that this requires platform-specific runtime
14984 support that does not exist everywhere. Moreover, it only allows
14985 trapping instructions to throw exceptions, i.e. memory references
14986 or floating-point instructions. It does not allow exceptions to be
14987 thrown from arbitrary signal handlers such as "SIGALRM". This
14988 enables -fexceptions.
14989
14990 -fdelete-dead-exceptions
14991 Consider that instructions that may throw exceptions but don't
14992 otherwise contribute to the execution of the program can be
14993 optimized away. This does not affect calls to functions except
14994 those with the "pure" or "const" attributes. This option is
14995 enabled by default for the Ada and C++ compilers, as permitted by
14996 the language specifications. Optimization passes that cause dead
14997 exceptions to be removed are enabled independently at different
14998 optimization levels.
14999
15000 -funwind-tables
15001 Similar to -fexceptions, except that it just generates any needed
15002 static data, but does not affect the generated code in any other
15003 way. You normally do not need to enable this option; instead, a
15004 language processor that needs this handling enables it on your
15005 behalf.
15006
15007 -fasynchronous-unwind-tables
15008 Generate unwind table in DWARF format, if supported by target
15009 machine. The table is exact at each instruction boundary, so it
15010 can be used for stack unwinding from asynchronous events (such as
15011 debugger or garbage collector).
15012
15013 -fno-gnu-unique
15014 On systems with recent GNU assembler and C library, the C++
15015 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15016 definitions of template static data members and static local
15017 variables in inline functions are unique even in the presence of
15018 "RTLD_LOCAL"; this is necessary to avoid problems with a library
15019 used by two different "RTLD_LOCAL" plugins depending on a
15020 definition in one of them and therefore disagreeing with the other
15021 one about the binding of the symbol. But this causes "dlclose" to
15022 be ignored for affected DSOs; if your program relies on
15023 reinitialization of a DSO via "dlclose" and "dlopen", you can use
15024 -fno-gnu-unique.
15025
15026 -fpcc-struct-return
15027 Return "short" "struct" and "union" values in memory like longer
15028 ones, rather than in registers. This convention is less efficient,
15029 but it has the advantage of allowing intercallability between GCC-
15030 compiled files and files compiled with other compilers,
15031 particularly the Portable C Compiler (pcc).
15032
15033 The precise convention for returning structures in memory depends
15034 on the target configuration macros.
15035
15036 Short structures and unions are those whose size and alignment
15037 match that of some integer type.
15038
15039 Warning: code compiled with the -fpcc-struct-return switch is not
15040 binary compatible with code compiled with the -freg-struct-return
15041 switch. Use it to conform to a non-default application binary
15042 interface.
15043
15044 -freg-struct-return
15045 Return "struct" and "union" values in registers when possible.
15046 This is more efficient for small structures than
15047 -fpcc-struct-return.
15048
15049 If you specify neither -fpcc-struct-return nor -freg-struct-return,
15050 GCC defaults to whichever convention is standard for the target.
15051 If there is no standard convention, GCC defaults to
15052 -fpcc-struct-return, except on targets where GCC is the principal
15053 compiler. In those cases, we can choose the standard, and we chose
15054 the more efficient register return alternative.
15055
15056 Warning: code compiled with the -freg-struct-return switch is not
15057 binary compatible with code compiled with the -fpcc-struct-return
15058 switch. Use it to conform to a non-default application binary
15059 interface.
15060
15061 -fshort-enums
15062 Allocate to an "enum" type only as many bytes as it needs for the
15063 declared range of possible values. Specifically, the "enum" type
15064 is equivalent to the smallest integer type that has enough room.
15065
15066 Warning: the -fshort-enums switch causes GCC to generate code that
15067 is not binary compatible with code generated without that switch.
15068 Use it to conform to a non-default application binary interface.
15069
15070 -fshort-wchar
15071 Override the underlying type for "wchar_t" to be "short unsigned
15072 int" instead of the default for the target. This option is useful
15073 for building programs to run under WINE.
15074
15075 Warning: the -fshort-wchar switch causes GCC to generate code that
15076 is not binary compatible with code generated without that switch.
15077 Use it to conform to a non-default application binary interface.
15078
15079 -fcommon
15080 In C code, this option controls the placement of global variables
15081 defined without an initializer, known as tentative definitions in
15082 the C standard. Tentative definitions are distinct from
15083 declarations of a variable with the "extern" keyword, which do not
15084 allocate storage.
15085
15086 The default is -fno-common, which specifies that the compiler
15087 places uninitialized global variables in the BSS section of the
15088 object file. This inhibits the merging of tentative definitions by
15089 the linker so you get a multiple-definition error if the same
15090 variable is accidentally defined in more than one compilation unit.
15091
15092 The -fcommon places uninitialized global variables in a common
15093 block. This allows the linker to resolve all tentative definitions
15094 of the same variable in different compilation units to the same
15095 object, or to a non-tentative definition. This behavior is
15096 inconsistent with C++, and on many targets implies a speed and code
15097 size penalty on global variable references. It is mainly useful to
15098 enable legacy code to link without errors.
15099
15100 -fno-ident
15101 Ignore the "#ident" directive.
15102
15103 -finhibit-size-directive
15104 Don't output a ".size" assembler directive, or anything else that
15105 would cause trouble if the function is split in the middle, and the
15106 two halves are placed at locations far apart in memory. This
15107 option is used when compiling crtstuff.c; you should not need to
15108 use it for anything else.
15109
15110 -fverbose-asm
15111 Put extra commentary information in the generated assembly code to
15112 make it more readable. This option is generally only of use to
15113 those who actually need to read the generated assembly code
15114 (perhaps while debugging the compiler itself).
15115
15116 -fno-verbose-asm, the default, causes the extra information to be
15117 omitted and is useful when comparing two assembler files.
15118
15119 The added comments include:
15120
15121 * information on the compiler version and command-line options,
15122
15123 * the source code lines associated with the assembly
15124 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15125
15126 * hints on which high-level expressions correspond to the various
15127 assembly instruction operands.
15128
15129 For example, given this C source file:
15130
15131 int test (int n)
15132 {
15133 int i;
15134 int total = 0;
15135
15136 for (i = 0; i < n; i++)
15137 total += i * i;
15138
15139 return total;
15140 }
15141
15142 compiling to (x86_64) assembly via -S and emitting the result
15143 direct to stdout via -o -
15144
15145 gcc -S test.c -fverbose-asm -Os -o -
15146
15147 gives output similar to this:
15148
15149 .file "test.c"
15150 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15151 [...snip...]
15152 # options passed:
15153 [...snip...]
15154
15155 .text
15156 .globl test
15157 .type test, @function
15158 test:
15159 .LFB0:
15160 .cfi_startproc
15161 # test.c:4: int total = 0;
15162 xorl %eax, %eax # <retval>
15163 # test.c:6: for (i = 0; i < n; i++)
15164 xorl %edx, %edx # i
15165 .L2:
15166 # test.c:6: for (i = 0; i < n; i++)
15167 cmpl %edi, %edx # n, i
15168 jge .L5 #,
15169 # test.c:7: total += i * i;
15170 movl %edx, %ecx # i, tmp92
15171 imull %edx, %ecx # i, tmp92
15172 # test.c:6: for (i = 0; i < n; i++)
15173 incl %edx # i
15174 # test.c:7: total += i * i;
15175 addl %ecx, %eax # tmp92, <retval>
15176 jmp .L2 #
15177 .L5:
15178 # test.c:10: }
15179 ret
15180 .cfi_endproc
15181 .LFE0:
15182 .size test, .-test
15183 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15184 .section .note.GNU-stack,"",@progbits
15185
15186 The comments are intended for humans rather than machines and hence
15187 the precise format of the comments is subject to change.
15188
15189 -frecord-gcc-switches
15190 This switch causes the command line used to invoke the compiler to
15191 be recorded into the object file that is being created. This
15192 switch is only implemented on some targets and the exact format of
15193 the recording is target and binary file format dependent, but it
15194 usually takes the form of a section containing ASCII text. This
15195 switch is related to the -fverbose-asm switch, but that switch only
15196 records information in the assembler output file as comments, so it
15197 never reaches the object file. See also -grecord-gcc-switches for
15198 another way of storing compiler options into the object file.
15199
15200 -fpic
15201 Generate position-independent code (PIC) suitable for use in a
15202 shared library, if supported for the target machine. Such code
15203 accesses all constant addresses through a global offset table
15204 (GOT). The dynamic loader resolves the GOT entries when the
15205 program starts (the dynamic loader is not part of GCC; it is part
15206 of the operating system). If the GOT size for the linked
15207 executable exceeds a machine-specific maximum size, you get an
15208 error message from the linker indicating that -fpic does not work;
15209 in that case, recompile with -fPIC instead. (These maximums are 8k
15210 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
15211 x86 has no such limit.)
15212
15213 Position-independent code requires special support, and therefore
15214 works only on certain machines. For the x86, GCC supports PIC for
15215 System V but not for the Sun 386i. Code generated for the IBM
15216 RS/6000 is always position-independent.
15217
15218 When this flag is set, the macros "__pic__" and "__PIC__" are
15219 defined to 1.
15220
15221 -fPIC
15222 If supported for the target machine, emit position-independent
15223 code, suitable for dynamic linking and avoiding any limit on the
15224 size of the global offset table. This option makes a difference on
15225 AArch64, m68k, PowerPC and SPARC.
15226
15227 Position-independent code requires special support, and therefore
15228 works only on certain machines.
15229
15230 When this flag is set, the macros "__pic__" and "__PIC__" are
15231 defined to 2.
15232
15233 -fpie
15234 -fPIE
15235 These options are similar to -fpic and -fPIC, but the generated
15236 position-independent code can be only linked into executables.
15237 Usually these options are used to compile code that will be linked
15238 using the -pie GCC option.
15239
15240 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
15241 The macros have the value 1 for -fpie and 2 for -fPIE.
15242
15243 -fno-plt
15244 Do not use the PLT for external function calls in position-
15245 independent code. Instead, load the callee address at call sites
15246 from the GOT and branch to it. This leads to more efficient code
15247 by eliminating PLT stubs and exposing GOT loads to optimizations.
15248 On architectures such as 32-bit x86 where PLT stubs expect the GOT
15249 pointer in a specific register, this gives more register allocation
15250 freedom to the compiler. Lazy binding requires use of the PLT;
15251 with -fno-plt all external symbols are resolved at load time.
15252
15253 Alternatively, the function attribute "noplt" can be used to avoid
15254 calls through the PLT for specific external functions.
15255
15256 In position-dependent code, a few targets also convert calls to
15257 functions that are marked to not use the PLT to use the GOT
15258 instead.
15259
15260 -fno-jump-tables
15261 Do not use jump tables for switch statements even where it would be
15262 more efficient than other code generation strategies. This option
15263 is of use in conjunction with -fpic or -fPIC for building code that
15264 forms part of a dynamic linker and cannot reference the address of
15265 a jump table. On some targets, jump tables do not require a GOT
15266 and this option is not needed.
15267
15268 -fno-bit-tests
15269 Do not use bit tests for switch statements even where it would be
15270 more efficient than other code generation strategies.
15271
15272 -ffixed-reg
15273 Treat the register named reg as a fixed register; generated code
15274 should never refer to it (except perhaps as a stack pointer, frame
15275 pointer or in some other fixed role).
15276
15277 reg must be the name of a register. The register names accepted
15278 are machine-specific and are defined in the "REGISTER_NAMES" macro
15279 in the machine description macro file.
15280
15281 This flag does not have a negative form, because it specifies a
15282 three-way choice.
15283
15284 -fcall-used-reg
15285 Treat the register named reg as an allocable register that is
15286 clobbered by function calls. It may be allocated for temporaries
15287 or variables that do not live across a call. Functions compiled
15288 this way do not save and restore the register reg.
15289
15290 It is an error to use this flag with the frame pointer or stack
15291 pointer. Use of this flag for other registers that have fixed
15292 pervasive roles in the machine's execution model produces
15293 disastrous results.
15294
15295 This flag does not have a negative form, because it specifies a
15296 three-way choice.
15297
15298 -fcall-saved-reg
15299 Treat the register named reg as an allocable register saved by
15300 functions. It may be allocated even for temporaries or variables
15301 that live across a call. Functions compiled this way save and
15302 restore the register reg if they use it.
15303
15304 It is an error to use this flag with the frame pointer or stack
15305 pointer. Use of this flag for other registers that have fixed
15306 pervasive roles in the machine's execution model produces
15307 disastrous results.
15308
15309 A different sort of disaster results from the use of this flag for
15310 a register in which function values may be returned.
15311
15312 This flag does not have a negative form, because it specifies a
15313 three-way choice.
15314
15315 -fpack-struct[=n]
15316 Without a value specified, pack all structure members together
15317 without holes. When a value is specified (which must be a small
15318 power of two), pack structure members according to this value,
15319 representing the maximum alignment (that is, objects with default
15320 alignment requirements larger than this are output potentially
15321 unaligned at the next fitting location.
15322
15323 Warning: the -fpack-struct switch causes GCC to generate code that
15324 is not binary compatible with code generated without that switch.
15325 Additionally, it makes the code suboptimal. Use it to conform to a
15326 non-default application binary interface.
15327
15328 -fleading-underscore
15329 This option and its counterpart, -fno-leading-underscore, forcibly
15330 change the way C symbols are represented in the object file. One
15331 use is to help link with legacy assembly code.
15332
15333 Warning: the -fleading-underscore switch causes GCC to generate
15334 code that is not binary compatible with code generated without that
15335 switch. Use it to conform to a non-default application binary
15336 interface. Not all targets provide complete support for this
15337 switch.
15338
15339 -ftls-model=model
15340 Alter the thread-local storage model to be used. The model
15341 argument should be one of global-dynamic, local-dynamic, initial-
15342 exec or local-exec. Note that the choice is subject to
15343 optimization: the compiler may use a more efficient model for
15344 symbols not visible outside of the translation unit, or if -fpic is
15345 not given on the command line.
15346
15347 The default without -fpic is initial-exec; with -fpic the default
15348 is global-dynamic.
15349
15350 -ftrampolines
15351 For targets that normally need trampolines for nested functions,
15352 always generate them instead of using descriptors. Otherwise, for
15353 targets that do not need them, like for example HP-PA or IA-64, do
15354 nothing.
15355
15356 A trampoline is a small piece of code that is created at run time
15357 on the stack when the address of a nested function is taken, and is
15358 used to call the nested function indirectly. Therefore, it
15359 requires the stack to be made executable in order for the program
15360 to work properly.
15361
15362 -fno-trampolines is enabled by default on a language by language
15363 basis to let the compiler avoid generating them, if it computes
15364 that this is safe, and replace them with descriptors. Descriptors
15365 are made up of data only, but the generated code must be prepared
15366 to deal with them. As of this writing, -fno-trampolines is enabled
15367 by default only for Ada.
15368
15369 Moreover, code compiled with -ftrampolines and code compiled with
15370 -fno-trampolines are not binary compatible if nested functions are
15371 present. This option must therefore be used on a program-wide
15372 basis and be manipulated with extreme care.
15373
15374 For languages other than Ada, the "-ftrampolines" and
15375 "-fno-trampolines" options currently have no effect, and
15376 trampolines are always generated on platforms that need them for
15377 nested functions.
15378
15379 -fvisibility=[default|internal|hidden|protected]
15380 Set the default ELF image symbol visibility to the specified
15381 option---all symbols are marked with this unless overridden within
15382 the code. Using this feature can very substantially improve
15383 linking and load times of shared object libraries, produce more
15384 optimized code, provide near-perfect API export and prevent symbol
15385 clashes. It is strongly recommended that you use this in any
15386 shared objects you distribute.
15387
15388 Despite the nomenclature, default always means public; i.e.,
15389 available to be linked against from outside the shared object.
15390 protected and internal are pretty useless in real-world usage so
15391 the only other commonly used option is hidden. The default if
15392 -fvisibility isn't specified is default, i.e., make every symbol
15393 public.
15394
15395 A good explanation of the benefits offered by ensuring ELF symbols
15396 have the correct visibility is given by "How To Write Shared
15397 Libraries" by Ulrich Drepper (which can be found at
15398 <https://www.akkadia.org/drepper/>)---however a superior solution
15399 made possible by this option to marking things hidden when the
15400 default is public is to make the default hidden and mark things
15401 public. This is the norm with DLLs on Windows and with
15402 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
15403 instead of "__declspec(dllexport)" you get almost identical
15404 semantics with identical syntax. This is a great boon to those
15405 working with cross-platform projects.
15406
15407 For those adding visibility support to existing code, you may find
15408 "#pragma GCC visibility" of use. This works by you enclosing the
15409 declarations you wish to set visibility for with (for example)
15410 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
15411 pop". Bear in mind that symbol visibility should be viewed as part
15412 of the API interface contract and thus all new code should always
15413 specify visibility when it is not the default; i.e., declarations
15414 only for use within the local DSO should always be marked
15415 explicitly as hidden as so to avoid PLT indirection
15416 overheads---making this abundantly clear also aids readability and
15417 self-documentation of the code. Note that due to ISO C++
15418 specification requirements, "operator new" and "operator delete"
15419 must always be of default visibility.
15420
15421 Be aware that headers from outside your project, in particular
15422 system headers and headers from any other library you use, may not
15423 be expecting to be compiled with visibility other than the default.
15424 You may need to explicitly say "#pragma GCC visibility
15425 push(default)" before including any such headers.
15426
15427 "extern" declarations are not affected by -fvisibility, so a lot of
15428 code can be recompiled with -fvisibility=hidden with no
15429 modifications. However, this means that calls to "extern"
15430 functions with no explicit visibility use the PLT, so it is more
15431 effective to use "__attribute ((visibility))" and/or "#pragma GCC
15432 visibility" to tell the compiler which "extern" declarations should
15433 be treated as hidden.
15434
15435 Note that -fvisibility does affect C++ vague linkage entities. This
15436 means that, for instance, an exception class that is be thrown
15437 between DSOs must be explicitly marked with default visibility so
15438 that the type_info nodes are unified between the DSOs.
15439
15440 An overview of these techniques, their benefits and how to use them
15441 is at <https://gcc.gnu.org/wiki/Visibility>.
15442
15443 -fstrict-volatile-bitfields
15444 This option should be used if accesses to volatile bit-fields (or
15445 other structure fields, although the compiler usually honors those
15446 types anyway) should use a single access of the width of the
15447 field's type, aligned to a natural alignment if possible. For
15448 example, targets with memory-mapped peripheral registers might
15449 require all such accesses to be 16 bits wide; with this flag you
15450 can declare all peripheral bit-fields as "unsigned short" (assuming
15451 short is 16 bits on these targets) to force GCC to use 16-bit
15452 accesses instead of, perhaps, a more efficient 32-bit access.
15453
15454 If this option is disabled, the compiler uses the most efficient
15455 instruction. In the previous example, that might be a 32-bit load
15456 instruction, even though that accesses bytes that do not contain
15457 any portion of the bit-field, or memory-mapped registers unrelated
15458 to the one being updated.
15459
15460 In some cases, such as when the "packed" attribute is applied to a
15461 structure field, it may not be possible to access the field with a
15462 single read or write that is correctly aligned for the target
15463 machine. In this case GCC falls back to generating multiple
15464 accesses rather than code that will fault or truncate the result at
15465 run time.
15466
15467 Note: Due to restrictions of the C/C++11 memory model, write
15468 accesses are not allowed to touch non bit-field members. It is
15469 therefore recommended to define all bits of the field's type as
15470 bit-field members.
15471
15472 The default value of this option is determined by the application
15473 binary interface for the target processor.
15474
15475 -fsync-libcalls
15476 This option controls whether any out-of-line instance of the
15477 "__sync" family of functions may be used to implement the C++11
15478 "__atomic" family of functions.
15479
15480 The default value of this option is enabled, thus the only useful
15481 form of the option is -fno-sync-libcalls. This option is used in
15482 the implementation of the libatomic runtime library.
15483
15484 GCC Developer Options
15485 This section describes command-line options that are primarily of
15486 interest to GCC developers, including options to support compiler
15487 testing and investigation of compiler bugs and compile-time performance
15488 problems. This includes options that produce debug dumps at various
15489 points in the compilation; that print statistics such as memory use and
15490 execution time; and that print information about GCC's configuration,
15491 such as where it searches for libraries. You should rarely need to use
15492 any of these options for ordinary compilation and linking tasks.
15493
15494 Many developer options that cause GCC to dump output to a file take an
15495 optional =filename suffix. You can specify stdout or - to dump to
15496 standard output, and stderr for standard error.
15497
15498 If =filename is omitted, a default dump file name is constructed by
15499 concatenating the base dump file name, a pass number, phase letter, and
15500 pass name. The base dump file name is the name of output file produced
15501 by the compiler if explicitly specified and not an executable;
15502 otherwise it is the source file name. The pass number is determined by
15503 the order passes are registered with the compiler's pass manager. This
15504 is generally the same as the order of execution, but passes registered
15505 by plugins, target-specific passes, or passes that are otherwise
15506 registered late are numbered higher than the pass named final, even if
15507 they are executed earlier. The phase letter is one of i (inter-
15508 procedural analysis), l (language-specific), r (RTL), or t (tree). The
15509 files are created in the directory of the output file.
15510
15511 -fcallgraph-info
15512 -fcallgraph-info=MARKERS
15513 Makes the compiler output callgraph information for the program, on
15514 a per-object-file basis. The information is generated in the
15515 common VCG format. It can be decorated with additional, per-node
15516 and/or per-edge information, if a list of comma-separated markers
15517 is additionally specified. When the "su" marker is specified, the
15518 callgraph is decorated with stack usage information; it is
15519 equivalent to -fstack-usage. When the "da" marker is specified,
15520 the callgraph is decorated with information about dynamically
15521 allocated objects.
15522
15523 When compiling with -flto, no callgraph information is output along
15524 with the object file. At LTO link time, -fcallgraph-info may
15525 generate multiple callgraph information files next to intermediate
15526 LTO output files.
15527
15528 -dletters
15529 -fdump-rtl-pass
15530 -fdump-rtl-pass=filename
15531 Says to make debugging dumps during compilation at times specified
15532 by letters. This is used for debugging the RTL-based passes of the
15533 compiler.
15534
15535 Some -dletters switches have different meaning when -E is used for
15536 preprocessing.
15537
15538 Debug dumps can be enabled with a -fdump-rtl switch or some -d
15539 option letters. Here are the possible letters for use in pass and
15540 letters, and their meanings:
15541
15542 -fdump-rtl-alignments
15543 Dump after branch alignments have been computed.
15544
15545 -fdump-rtl-asmcons
15546 Dump after fixing rtl statements that have unsatisfied in/out
15547 constraints.
15548
15549 -fdump-rtl-auto_inc_dec
15550 Dump after auto-inc-dec discovery. This pass is only run on
15551 architectures that have auto inc or auto dec instructions.
15552
15553 -fdump-rtl-barriers
15554 Dump after cleaning up the barrier instructions.
15555
15556 -fdump-rtl-bbpart
15557 Dump after partitioning hot and cold basic blocks.
15558
15559 -fdump-rtl-bbro
15560 Dump after block reordering.
15561
15562 -fdump-rtl-btl1
15563 -fdump-rtl-btl2
15564 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
15565 two branch target load optimization passes.
15566
15567 -fdump-rtl-bypass
15568 Dump after jump bypassing and control flow optimizations.
15569
15570 -fdump-rtl-combine
15571 Dump after the RTL instruction combination pass.
15572
15573 -fdump-rtl-compgotos
15574 Dump after duplicating the computed gotos.
15575
15576 -fdump-rtl-ce1
15577 -fdump-rtl-ce2
15578 -fdump-rtl-ce3
15579 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
15580 dumping after the three if conversion passes.
15581
15582 -fdump-rtl-cprop_hardreg
15583 Dump after hard register copy propagation.
15584
15585 -fdump-rtl-csa
15586 Dump after combining stack adjustments.
15587
15588 -fdump-rtl-cse1
15589 -fdump-rtl-cse2
15590 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
15591 two common subexpression elimination passes.
15592
15593 -fdump-rtl-dce
15594 Dump after the standalone dead code elimination passes.
15595
15596 -fdump-rtl-dbr
15597 Dump after delayed branch scheduling.
15598
15599 -fdump-rtl-dce1
15600 -fdump-rtl-dce2
15601 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
15602 two dead store elimination passes.
15603
15604 -fdump-rtl-eh
15605 Dump after finalization of EH handling code.
15606
15607 -fdump-rtl-eh_ranges
15608 Dump after conversion of EH handling range regions.
15609
15610 -fdump-rtl-expand
15611 Dump after RTL generation.
15612
15613 -fdump-rtl-fwprop1
15614 -fdump-rtl-fwprop2
15615 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
15616 the two forward propagation passes.
15617
15618 -fdump-rtl-gcse1
15619 -fdump-rtl-gcse2
15620 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
15621 global common subexpression elimination.
15622
15623 -fdump-rtl-init-regs
15624 Dump after the initialization of the registers.
15625
15626 -fdump-rtl-initvals
15627 Dump after the computation of the initial value sets.
15628
15629 -fdump-rtl-into_cfglayout
15630 Dump after converting to cfglayout mode.
15631
15632 -fdump-rtl-ira
15633 Dump after iterated register allocation.
15634
15635 -fdump-rtl-jump
15636 Dump after the second jump optimization.
15637
15638 -fdump-rtl-loop2
15639 -fdump-rtl-loop2 enables dumping after the rtl loop
15640 optimization passes.
15641
15642 -fdump-rtl-mach
15643 Dump after performing the machine dependent reorganization
15644 pass, if that pass exists.
15645
15646 -fdump-rtl-mode_sw
15647 Dump after removing redundant mode switches.
15648
15649 -fdump-rtl-rnreg
15650 Dump after register renumbering.
15651
15652 -fdump-rtl-outof_cfglayout
15653 Dump after converting from cfglayout mode.
15654
15655 -fdump-rtl-peephole2
15656 Dump after the peephole pass.
15657
15658 -fdump-rtl-postreload
15659 Dump after post-reload optimizations.
15660
15661 -fdump-rtl-pro_and_epilogue
15662 Dump after generating the function prologues and epilogues.
15663
15664 -fdump-rtl-sched1
15665 -fdump-rtl-sched2
15666 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
15667 the basic block scheduling passes.
15668
15669 -fdump-rtl-ree
15670 Dump after sign/zero extension elimination.
15671
15672 -fdump-rtl-seqabstr
15673 Dump after common sequence discovery.
15674
15675 -fdump-rtl-shorten
15676 Dump after shortening branches.
15677
15678 -fdump-rtl-sibling
15679 Dump after sibling call optimizations.
15680
15681 -fdump-rtl-split1
15682 -fdump-rtl-split2
15683 -fdump-rtl-split3
15684 -fdump-rtl-split4
15685 -fdump-rtl-split5
15686 These options enable dumping after five rounds of instruction
15687 splitting.
15688
15689 -fdump-rtl-sms
15690 Dump after modulo scheduling. This pass is only run on some
15691 architectures.
15692
15693 -fdump-rtl-stack
15694 Dump after conversion from GCC's "flat register file" registers
15695 to the x87's stack-like registers. This pass is only run on
15696 x86 variants.
15697
15698 -fdump-rtl-subreg1
15699 -fdump-rtl-subreg2
15700 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
15701 the two subreg expansion passes.
15702
15703 -fdump-rtl-unshare
15704 Dump after all rtl has been unshared.
15705
15706 -fdump-rtl-vartrack
15707 Dump after variable tracking.
15708
15709 -fdump-rtl-vregs
15710 Dump after converting virtual registers to hard registers.
15711
15712 -fdump-rtl-web
15713 Dump after live range splitting.
15714
15715 -fdump-rtl-regclass
15716 -fdump-rtl-subregs_of_mode_init
15717 -fdump-rtl-subregs_of_mode_finish
15718 -fdump-rtl-dfinit
15719 -fdump-rtl-dfinish
15720 These dumps are defined but always produce empty files.
15721
15722 -da
15723 -fdump-rtl-all
15724 Produce all the dumps listed above.
15725
15726 -dA Annotate the assembler output with miscellaneous debugging
15727 information.
15728
15729 -dD Dump all macro definitions, at the end of preprocessing, in
15730 addition to normal output.
15731
15732 -dH Produce a core dump whenever an error occurs.
15733
15734 -dp Annotate the assembler output with a comment indicating which
15735 pattern and alternative is used. The length and cost of each
15736 instruction are also printed.
15737
15738 -dP Dump the RTL in the assembler output as a comment before each
15739 instruction. Also turns on -dp annotation.
15740
15741 -dx Just generate RTL for a function instead of compiling it.
15742 Usually used with -fdump-rtl-expand.
15743
15744 -fdump-debug
15745 Dump debugging information generated during the debug generation
15746 phase.
15747
15748 -fdump-earlydebug
15749 Dump debugging information generated during the early debug
15750 generation phase.
15751
15752 -fdump-noaddr
15753 When doing debugging dumps, suppress address output. This makes it
15754 more feasible to use diff on debugging dumps for compiler
15755 invocations with different compiler binaries and/or different text
15756 / bss / data / heap / stack / dso start locations.
15757
15758 -freport-bug
15759 Collect and dump debug information into a temporary file if an
15760 internal compiler error (ICE) occurs.
15761
15762 -fdump-unnumbered
15763 When doing debugging dumps, suppress instruction numbers and
15764 address output. This makes it more feasible to use diff on
15765 debugging dumps for compiler invocations with different options, in
15766 particular with and without -g.
15767
15768 -fdump-unnumbered-links
15769 When doing debugging dumps (see -d option above), suppress
15770 instruction numbers for the links to the previous and next
15771 instructions in a sequence.
15772
15773 -fdump-ipa-switch
15774 -fdump-ipa-switch-options
15775 Control the dumping at various stages of inter-procedural analysis
15776 language tree to a file. The file name is generated by appending a
15777 switch specific suffix to the source file name, and the file is
15778 created in the same directory as the output file. The following
15779 dumps are possible:
15780
15781 all Enables all inter-procedural analysis dumps.
15782
15783 cgraph
15784 Dumps information about call-graph optimization, unused
15785 function removal, and inlining decisions.
15786
15787 inline
15788 Dump after function inlining.
15789
15790 Additionally, the options -optimized, -missed, -note, and -all can
15791 be provided, with the same meaning as for -fopt-info, defaulting to
15792 -optimized.
15793
15794 For example, -fdump-ipa-inline-optimized-missed will emit
15795 information on callsites that were inlined, along with callsites
15796 that were not inlined.
15797
15798 By default, the dump will contain messages about successful
15799 optimizations (equivalent to -optimized) together with low-level
15800 details about the analysis.
15801
15802 -fdump-lang
15803 Dump language-specific information. The file name is made by
15804 appending .lang to the source file name.
15805
15806 -fdump-lang-all
15807 -fdump-lang-switch
15808 -fdump-lang-switch-options
15809 -fdump-lang-switch-options=filename
15810 Control the dumping of language-specific information. The options
15811 and filename portions behave as described in the -fdump-tree
15812 option. The following switch values are accepted:
15813
15814 all Enable all language-specific dumps.
15815
15816 class
15817 Dump class hierarchy information. Virtual table information is
15818 emitted unless 'slim' is specified. This option is applicable
15819 to C++ only.
15820
15821 module
15822 Dump module information. Options lineno (locations), graph
15823 (reachability), blocks (clusters), uid (serialization), alias
15824 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
15825 provide additional information. This option is applicable to
15826 C++ only.
15827
15828 raw Dump the raw internal tree data. This option is applicable to
15829 C++ only.
15830
15831 -fdump-passes
15832 Print on stderr the list of optimization passes that are turned on
15833 and off by the current command-line options.
15834
15835 -fdump-statistics-option
15836 Enable and control dumping of pass statistics in a separate file.
15837 The file name is generated by appending a suffix ending in
15838 .statistics to the source file name, and the file is created in the
15839 same directory as the output file. If the -option form is used,
15840 -stats causes counters to be summed over the whole compilation unit
15841 while -details dumps every event as the passes generate them. The
15842 default with no option is to sum counters for each function
15843 compiled.
15844
15845 -fdump-tree-all
15846 -fdump-tree-switch
15847 -fdump-tree-switch-options
15848 -fdump-tree-switch-options=filename
15849 Control the dumping at various stages of processing the
15850 intermediate language tree to a file. If the -options form is
15851 used, options is a list of - separated options which control the
15852 details of the dump. Not all options are applicable to all dumps;
15853 those that are not meaningful are ignored. The following options
15854 are available
15855
15856 address
15857 Print the address of each node. Usually this is not meaningful
15858 as it changes according to the environment and source file.
15859 Its primary use is for tying up a dump file with a debug
15860 environment.
15861
15862 asmname
15863 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15864 that in the dump instead of "DECL_NAME". Its primary use is
15865 ease of use working backward from mangled names in the assembly
15866 file.
15867
15868 slim
15869 When dumping front-end intermediate representations, inhibit
15870 dumping of members of a scope or body of a function merely
15871 because that scope has been reached. Only dump such items when
15872 they are directly reachable by some other path.
15873
15874 When dumping pretty-printed trees, this option inhibits dumping
15875 the bodies of control structures.
15876
15877 When dumping RTL, print the RTL in slim (condensed) form
15878 instead of the default LISP-like representation.
15879
15880 raw Print a raw representation of the tree. By default, trees are
15881 pretty-printed into a C-like representation.
15882
15883 details
15884 Enable more detailed dumps (not honored by every dump option).
15885 Also include information from the optimization passes.
15886
15887 stats
15888 Enable dumping various statistics about the pass (not honored
15889 by every dump option).
15890
15891 blocks
15892 Enable showing basic block boundaries (disabled in raw dumps).
15893
15894 graph
15895 For each of the other indicated dump files (-fdump-rtl-pass),
15896 dump a representation of the control flow graph suitable for
15897 viewing with GraphViz to file.passid.pass.dot. Each function
15898 in the file is pretty-printed as a subgraph, so that GraphViz
15899 can render them all in a single plot.
15900
15901 This option currently only works for RTL dumps, and the RTL is
15902 always dumped in slim form.
15903
15904 vops
15905 Enable showing virtual operands for every statement.
15906
15907 lineno
15908 Enable showing line numbers for statements.
15909
15910 uid Enable showing the unique ID ("DECL_UID") for each variable.
15911
15912 verbose
15913 Enable showing the tree dump for each statement.
15914
15915 eh Enable showing the EH region number holding each statement.
15916
15917 scev
15918 Enable showing scalar evolution analysis details.
15919
15920 optimized
15921 Enable showing optimization information (only available in
15922 certain passes).
15923
15924 missed
15925 Enable showing missed optimization information (only available
15926 in certain passes).
15927
15928 note
15929 Enable other detailed optimization information (only available
15930 in certain passes).
15931
15932 all Turn on all options, except raw, slim, verbose and lineno.
15933
15934 optall
15935 Turn on all optimization options, i.e., optimized, missed, and
15936 note.
15937
15938 To determine what tree dumps are available or find the dump for a
15939 pass of interest follow the steps below.
15940
15941 1. Invoke GCC with -fdump-passes and in the stderr output look for
15942 a code that corresponds to the pass you are interested in. For
15943 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15944 correspond to the three Value Range Propagation passes. The
15945 number at the end distinguishes distinct invocations of the
15946 same pass.
15947
15948 2. To enable the creation of the dump file, append the pass code
15949 to the -fdump- option prefix and invoke GCC with it. For
15950 example, to enable the dump from the Early Value Range
15951 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15952 Optionally, you may specify the name of the dump file. If you
15953 don't specify one, GCC creates as described below.
15954
15955 3. Find the pass dump in a file whose name is composed of three
15956 components separated by a period: the name of the source file
15957 GCC was invoked to compile, a numeric suffix indicating the
15958 pass number followed by the letter t for tree passes (and the
15959 letter r for RTL passes), and finally the pass code. For
15960 example, the Early VRP pass dump might be in a file named
15961 myfile.c.038t.evrp in the current working directory. Note that
15962 the numeric codes are not stable and may change from one
15963 version of GCC to another.
15964
15965 -fopt-info
15966 -fopt-info-options
15967 -fopt-info-options=filename
15968 Controls optimization dumps from various optimization passes. If
15969 the -options form is used, options is a list of - separated option
15970 keywords to select the dump details and optimizations.
15971
15972 The options can be divided into three groups:
15973
15974 1. options describing what kinds of messages should be emitted,
15975
15976 2. options describing the verbosity of the dump, and
15977
15978 3. options describing which optimizations should be included.
15979
15980 The options from each group can be freely mixed as they are non-
15981 overlapping. However, in case of any conflicts, the later options
15982 override the earlier options on the command line.
15983
15984 The following options control which kinds of messages should be
15985 emitted:
15986
15987 optimized
15988 Print information when an optimization is successfully applied.
15989 It is up to a pass to decide which information is relevant. For
15990 example, the vectorizer passes print the source location of
15991 loops which are successfully vectorized.
15992
15993 missed
15994 Print information about missed optimizations. Individual passes
15995 control which information to include in the output.
15996
15997 note
15998 Print verbose information about optimizations, such as certain
15999 transformations, more detailed messages about decisions etc.
16000
16001 all Print detailed optimization information. This includes
16002 optimized, missed, and note.
16003
16004 The following option controls the dump verbosity:
16005
16006 internals
16007 By default, only "high-level" messages are emitted. This option
16008 enables additional, more detailed, messages, which are likely
16009 to only be of interest to GCC developers.
16010
16011 One or more of the following option keywords can be used to
16012 describe a group of optimizations:
16013
16014 ipa Enable dumps from all interprocedural optimizations.
16015
16016 loop
16017 Enable dumps from all loop optimizations.
16018
16019 inline
16020 Enable dumps from all inlining optimizations.
16021
16022 omp Enable dumps from all OMP (Offloading and Multi Processing)
16023 optimizations.
16024
16025 vec Enable dumps from all vectorization optimizations.
16026
16027 optall
16028 Enable dumps from all optimizations. This is a superset of the
16029 optimization groups listed above.
16030
16031 If options is omitted, it defaults to optimized-optall, which means
16032 to dump messages about successful optimizations from all the
16033 passes, omitting messages that are treated as "internals".
16034
16035 If the filename is provided, then the dumps from all the applicable
16036 optimizations are concatenated into the filename. Otherwise the
16037 dump is output onto stderr. Though multiple -fopt-info options are
16038 accepted, only one of them can include a filename. If other
16039 filenames are provided then all but the first such option are
16040 ignored.
16041
16042 Note that the output filename is overwritten in case of multiple
16043 translation units. If a combined output from multiple translation
16044 units is desired, stderr should be used instead.
16045
16046 In the following example, the optimization info is output to
16047 stderr:
16048
16049 gcc -O3 -fopt-info
16050
16051 This example:
16052
16053 gcc -O3 -fopt-info-missed=missed.all
16054
16055 outputs missed optimization report from all the passes into
16056 missed.all, and this one:
16057
16058 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16059
16060 prints information about missed optimization opportunities from
16061 vectorization passes on stderr. Note that -fopt-info-vec-missed is
16062 equivalent to -fopt-info-missed-vec. The order of the optimization
16063 group names and message types listed after -fopt-info does not
16064 matter.
16065
16066 As another example,
16067
16068 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16069
16070 outputs information about missed optimizations as well as optimized
16071 locations from all the inlining passes into inline.txt.
16072
16073 Finally, consider:
16074
16075 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16076
16077 Here the two output filenames vec.miss and loop.opt are in conflict
16078 since only one output file is allowed. In this case, only the first
16079 option takes effect and the subsequent options are ignored. Thus
16080 only vec.miss is produced which contains dumps from the vectorizer
16081 about missed opportunities.
16082
16083 -fsave-optimization-record
16084 Write a SRCFILE.opt-record.json.gz file detailing what
16085 optimizations were performed, for those optimizations that support
16086 -fopt-info.
16087
16088 This option is experimental and the format of the data within the
16089 compressed JSON file is subject to change.
16090
16091 It is roughly equivalent to a machine-readable version of
16092 -fopt-info-all, as a collection of messages with source file, line
16093 number and column number, with the following additional data for
16094 each message:
16095
16096 * the execution count of the code being optimized, along with
16097 metadata about whether this was from actual profile data, or
16098 just an estimate, allowing consumers to prioritize messages by
16099 code hotness,
16100
16101 * the function name of the code being optimized, where
16102 applicable,
16103
16104 * the "inlining chain" for the code being optimized, so that when
16105 a function is inlined into several different places (which
16106 might themselves be inlined), the reader can distinguish
16107 between the copies,
16108
16109 * objects identifying those parts of the message that refer to
16110 expressions, statements or symbol-table nodes, which of these
16111 categories they are, and, when available, their source code
16112 location,
16113
16114 * the GCC pass that emitted the message, and
16115
16116 * the location in GCC's own code from which the message was
16117 emitted
16118
16119 Additionally, some messages are logically nested within other
16120 messages, reflecting implementation details of the optimization
16121 passes.
16122
16123 -fsched-verbose=n
16124 On targets that use instruction scheduling, this option controls
16125 the amount of debugging output the scheduler prints to the dump
16126 files.
16127
16128 For n greater than zero, -fsched-verbose outputs the same
16129 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
16130 greater than one, it also output basic block probabilities,
16131 detailed ready list information and unit/insn info. For n greater
16132 than two, it includes RTL at abort point, control-flow and regions
16133 info. And for n over four, -fsched-verbose also includes
16134 dependence info.
16135
16136 -fenable-kind-pass
16137 -fdisable-kind-pass=range-list
16138 This is a set of options that are used to explicitly disable/enable
16139 optimization passes. These options are intended for use for
16140 debugging GCC. Compiler users should use regular options for
16141 enabling/disabling passes instead.
16142
16143 -fdisable-ipa-pass
16144 Disable IPA pass pass. pass is the pass name. If the same pass
16145 is statically invoked in the compiler multiple times, the pass
16146 name should be appended with a sequential number starting from
16147 1.
16148
16149 -fdisable-rtl-pass
16150 -fdisable-rtl-pass=range-list
16151 Disable RTL pass pass. pass is the pass name. If the same
16152 pass is statically invoked in the compiler multiple times, the
16153 pass name should be appended with a sequential number starting
16154 from 1. range-list is a comma-separated list of function
16155 ranges or assembler names. Each range is a number pair
16156 separated by a colon. The range is inclusive in both ends. If
16157 the range is trivial, the number pair can be simplified as a
16158 single number. If the function's call graph node's uid falls
16159 within one of the specified ranges, the pass is disabled for
16160 that function. The uid is shown in the function header of a
16161 dump file, and the pass names can be dumped by using option
16162 -fdump-passes.
16163
16164 -fdisable-tree-pass
16165 -fdisable-tree-pass=range-list
16166 Disable tree pass pass. See -fdisable-rtl for the description
16167 of option arguments.
16168
16169 -fenable-ipa-pass
16170 Enable IPA pass pass. pass is the pass name. If the same pass
16171 is statically invoked in the compiler multiple times, the pass
16172 name should be appended with a sequential number starting from
16173 1.
16174
16175 -fenable-rtl-pass
16176 -fenable-rtl-pass=range-list
16177 Enable RTL pass pass. See -fdisable-rtl for option argument
16178 description and examples.
16179
16180 -fenable-tree-pass
16181 -fenable-tree-pass=range-list
16182 Enable tree pass pass. See -fdisable-rtl for the description
16183 of option arguments.
16184
16185 Here are some examples showing uses of these options.
16186
16187 # disable ccp1 for all functions
16188 -fdisable-tree-ccp1
16189 # disable complete unroll for function whose cgraph node uid is 1
16190 -fenable-tree-cunroll=1
16191 # disable gcse2 for functions at the following ranges [1,1],
16192 # [300,400], and [400,1000]
16193 # disable gcse2 for functions foo and foo2
16194 -fdisable-rtl-gcse2=foo,foo2
16195 # disable early inlining
16196 -fdisable-tree-einline
16197 # disable ipa inlining
16198 -fdisable-ipa-inline
16199 # enable tree full unroll
16200 -fenable-tree-unroll
16201
16202 -fchecking
16203 -fchecking=n
16204 Enable internal consistency checking. The default depends on the
16205 compiler configuration. -fchecking=2 enables further internal
16206 consistency checking that might affect code generation.
16207
16208 -frandom-seed=string
16209 This option provides a seed that GCC uses in place of random
16210 numbers in generating certain symbol names that have to be
16211 different in every compiled file. It is also used to place unique
16212 stamps in coverage data files and the object files that produce
16213 them. You can use the -frandom-seed option to produce reproducibly
16214 identical object files.
16215
16216 The string can either be a number (decimal, octal or hex) or an
16217 arbitrary string (in which case it's converted to a number by
16218 computing CRC32).
16219
16220 The string should be different for every file you compile.
16221
16222 -save-temps
16223 Store the usual "temporary" intermediate files permanently; name
16224 them as auxiliary output files, as specified described under
16225 -dumpbase and -dumpdir.
16226
16227 When used in combination with the -x command-line option,
16228 -save-temps is sensible enough to avoid overwriting an input source
16229 file with the same extension as an intermediate file. The
16230 corresponding intermediate file may be obtained by renaming the
16231 source file before using -save-temps.
16232
16233 -save-temps=cwd
16234 Equivalent to -save-temps -dumpdir ./.
16235
16236 -save-temps=obj
16237 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
16238 directory of the output file specified after the -o option,
16239 including any directory separators. If the -o option is not used,
16240 the -save-temps=obj switch behaves like -save-temps=cwd.
16241
16242 -time[=file]
16243 Report the CPU time taken by each subprocess in the compilation
16244 sequence. For C source files, this is the compiler proper and
16245 assembler (plus the linker if linking is done).
16246
16247 Without the specification of an output file, the output looks like
16248 this:
16249
16250 # cc1 0.12 0.01
16251 # as 0.00 0.01
16252
16253 The first number on each line is the "user time", that is time
16254 spent executing the program itself. The second number is "system
16255 time", time spent executing operating system routines on behalf of
16256 the program. Both numbers are in seconds.
16257
16258 With the specification of an output file, the output is appended to
16259 the named file, and it looks like this:
16260
16261 0.12 0.01 cc1 <options>
16262 0.00 0.01 as <options>
16263
16264 The "user time" and the "system time" are moved before the program
16265 name, and the options passed to the program are displayed, so that
16266 one can later tell what file was being compiled, and with which
16267 options.
16268
16269 -fdump-final-insns[=file]
16270 Dump the final internal representation (RTL) to file. If the
16271 optional argument is omitted (or if file is "."), the name of the
16272 dump file is determined by appending ".gkd" to the dump base name,
16273 see -dumpbase.
16274
16275 -fcompare-debug[=opts]
16276 If no error occurs during compilation, run the compiler a second
16277 time, adding opts and -fcompare-debug-second to the arguments
16278 passed to the second compilation. Dump the final internal
16279 representation in both compilations, and print an error if they
16280 differ.
16281
16282 If the equal sign is omitted, the default -gtoggle is used.
16283
16284 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
16285 and nonzero, implicitly enables -fcompare-debug. If
16286 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
16287 it is used for opts, otherwise the default -gtoggle is used.
16288
16289 -fcompare-debug=, with the equal sign but without opts, is
16290 equivalent to -fno-compare-debug, which disables the dumping of the
16291 final representation and the second compilation, preventing even
16292 GCC_COMPARE_DEBUG from taking effect.
16293
16294 To verify full coverage during -fcompare-debug testing, set
16295 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
16296 rejects as an invalid option in any actual compilation (rather than
16297 preprocessing, assembly or linking). To get just a warning,
16298 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
16299 will do.
16300
16301 -fcompare-debug-second
16302 This option is implicitly passed to the compiler for the second
16303 compilation requested by -fcompare-debug, along with options to
16304 silence warnings, and omitting other options that would cause the
16305 compiler to produce output to files or to standard output as a side
16306 effect. Dump files and preserved temporary files are renamed so as
16307 to contain the ".gk" additional extension during the second
16308 compilation, to avoid overwriting those generated by the first.
16309
16310 When this option is passed to the compiler driver, it causes the
16311 first compilation to be skipped, which makes it useful for little
16312 other than debugging the compiler proper.
16313
16314 -gtoggle
16315 Turn off generation of debug info, if leaving out this option
16316 generates it, or turn it on at level 2 otherwise. The position of
16317 this argument in the command line does not matter; it takes effect
16318 after all other options are processed, and it does so only once, no
16319 matter how many times it is given. This is mainly intended to be
16320 used with -fcompare-debug.
16321
16322 -fvar-tracking-assignments-toggle
16323 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
16324 toggles -g.
16325
16326 -Q Makes the compiler print out each function name as it is compiled,
16327 and print some statistics about each pass when it finishes.
16328
16329 -ftime-report
16330 Makes the compiler print some statistics about the time consumed by
16331 each pass when it finishes.
16332
16333 -ftime-report-details
16334 Record the time consumed by infrastructure parts separately for
16335 each pass.
16336
16337 -fira-verbose=n
16338 Control the verbosity of the dump file for the integrated register
16339 allocator. The default value is 5. If the value n is greater or
16340 equal to 10, the dump output is sent to stderr using the same
16341 format as n minus 10.
16342
16343 -flto-report
16344 Prints a report with internal details on the workings of the link-
16345 time optimizer. The contents of this report vary from version to
16346 version. It is meant to be useful to GCC developers when
16347 processing object files in LTO mode (via -flto).
16348
16349 Disabled by default.
16350
16351 -flto-report-wpa
16352 Like -flto-report, but only print for the WPA phase of link-time
16353 optimization.
16354
16355 -fmem-report
16356 Makes the compiler print some statistics about permanent memory
16357 allocation when it finishes.
16358
16359 -fmem-report-wpa
16360 Makes the compiler print some statistics about permanent memory
16361 allocation for the WPA phase only.
16362
16363 -fpre-ipa-mem-report
16364 -fpost-ipa-mem-report
16365 Makes the compiler print some statistics about permanent memory
16366 allocation before or after interprocedural optimization.
16367
16368 -fprofile-report
16369 Makes the compiler print some statistics about consistency of the
16370 (estimated) profile and effect of individual passes.
16371
16372 -fstack-usage
16373 Makes the compiler output stack usage information for the program,
16374 on a per-function basis. The filename for the dump is made by
16375 appending .su to the auxname. auxname is generated from the name
16376 of the output file, if explicitly specified and it is not an
16377 executable, otherwise it is the basename of the source file. An
16378 entry is made up of three fields:
16379
16380 * The name of the function.
16381
16382 * A number of bytes.
16383
16384 * One or more qualifiers: "static", "dynamic", "bounded".
16385
16386 The qualifier "static" means that the function manipulates the
16387 stack statically: a fixed number of bytes are allocated for the
16388 frame on function entry and released on function exit; no stack
16389 adjustments are otherwise made in the function. The second field
16390 is this fixed number of bytes.
16391
16392 The qualifier "dynamic" means that the function manipulates the
16393 stack dynamically: in addition to the static allocation described
16394 above, stack adjustments are made in the body of the function, for
16395 example to push/pop arguments around function calls. If the
16396 qualifier "bounded" is also present, the amount of these
16397 adjustments is bounded at compile time and the second field is an
16398 upper bound of the total amount of stack used by the function. If
16399 it is not present, the amount of these adjustments is not bounded
16400 at compile time and the second field only represents the bounded
16401 part.
16402
16403 -fstats
16404 Emit statistics about front-end processing at the end of the
16405 compilation. This option is supported only by the C++ front end,
16406 and the information is generally only useful to the G++ development
16407 team.
16408
16409 -fdbg-cnt-list
16410 Print the name and the counter upper bound for all debug counters.
16411
16412 -fdbg-cnt=counter-value-list
16413 Set the internal debug counter lower and upper bound. counter-
16414 value-list is a comma-separated list of
16415 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
16416 tuples which sets the name of the counter and list of closed
16417 intervals. The lower_bound is optional and is zero initialized if
16418 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
16419 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
16420 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
16421 for first 10 invocations.
16422
16423 -print-file-name=library
16424 Print the full absolute name of the library file library that would
16425 be used when linking---and don't do anything else. With this
16426 option, GCC does not compile or link anything; it just prints the
16427 file name.
16428
16429 -print-multi-directory
16430 Print the directory name corresponding to the multilib selected by
16431 any other switches present in the command line. This directory is
16432 supposed to exist in GCC_EXEC_PREFIX.
16433
16434 -print-multi-lib
16435 Print the mapping from multilib directory names to compiler
16436 switches that enable them. The directory name is separated from
16437 the switches by ;, and each switch starts with an @ instead of the
16438 -, without spaces between multiple switches. This is supposed to
16439 ease shell processing.
16440
16441 -print-multi-os-directory
16442 Print the path to OS libraries for the selected multilib, relative
16443 to some lib subdirectory. If OS libraries are present in the lib
16444 subdirectory and no multilibs are used, this is usually just ., if
16445 OS libraries are present in libsuffix sibling directories this
16446 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
16447 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
16448 or ev6.
16449
16450 -print-multiarch
16451 Print the path to OS libraries for the selected multiarch, relative
16452 to some lib subdirectory.
16453
16454 -print-prog-name=program
16455 Like -print-file-name, but searches for a program such as cpp.
16456
16457 -print-libgcc-file-name
16458 Same as -print-file-name=libgcc.a.
16459
16460 This is useful when you use -nostdlib or -nodefaultlibs but you do
16461 want to link with libgcc.a. You can do:
16462
16463 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
16464
16465 -print-search-dirs
16466 Print the name of the configured installation directory and a list
16467 of program and library directories gcc searches---and don't do
16468 anything else.
16469
16470 This is useful when gcc prints the error message installation
16471 problem, cannot exec cpp0: No such file or directory. To resolve
16472 this you either need to put cpp0 and the other compiler components
16473 where gcc expects to find them, or you can set the environment
16474 variable GCC_EXEC_PREFIX to the directory where you installed them.
16475 Don't forget the trailing /.
16476
16477 -print-sysroot
16478 Print the target sysroot directory that is used during compilation.
16479 This is the target sysroot specified either at configure time or
16480 using the --sysroot option, possibly with an extra suffix that
16481 depends on compilation options. If no target sysroot is specified,
16482 the option prints nothing.
16483
16484 -print-sysroot-headers-suffix
16485 Print the suffix added to the target sysroot when searching for
16486 headers, or give an error if the compiler is not configured with
16487 such a suffix---and don't do anything else.
16488
16489 -dumpmachine
16490 Print the compiler's target machine (for example,
16491 i686-pc-linux-gnu)---and don't do anything else.
16492
16493 -dumpversion
16494 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
16495 don't do anything else. This is the compiler version used in
16496 filesystem paths and specs. Depending on how the compiler has been
16497 configured it can be just a single number (major version), two
16498 numbers separated by a dot (major and minor version) or three
16499 numbers separated by dots (major, minor and patchlevel version).
16500
16501 -dumpfullversion
16502 Print the full compiler version---and don't do anything else. The
16503 output is always three numbers separated by dots, major, minor and
16504 patchlevel version.
16505
16506 -dumpspecs
16507 Print the compiler's built-in specs---and don't do anything else.
16508 (This is used when GCC itself is being built.)
16509
16510 Machine-Dependent Options
16511 Each target machine supported by GCC can have its own options---for
16512 example, to allow you to compile for a particular processor variant or
16513 ABI, or to control optimizations specific to that machine. By
16514 convention, the names of machine-specific options start with -m.
16515
16516 Some configurations of the compiler also support additional target-
16517 specific options, usually for compatibility with other compilers on the
16518 same platform.
16519
16520 AArch64 Options
16521
16522 These options are defined for AArch64 implementations:
16523
16524 -mabi=name
16525 Generate code for the specified data model. Permissible values are
16526 ilp32 for SysV-like data model where int, long int and pointers are
16527 32 bits, and lp64 for SysV-like data model where int is 32 bits,
16528 but long int and pointers are 64 bits.
16529
16530 The default depends on the specific target configuration. Note
16531 that the LP64 and ILP32 ABIs are not link-compatible; you must
16532 compile your entire program with the same ABI, and link with a
16533 compatible set of libraries.
16534
16535 -mbig-endian
16536 Generate big-endian code. This is the default when GCC is
16537 configured for an aarch64_be-*-* target.
16538
16539 -mgeneral-regs-only
16540 Generate code which uses only the general-purpose registers. This
16541 will prevent the compiler from using floating-point and Advanced
16542 SIMD registers but will not impose any restrictions on the
16543 assembler.
16544
16545 -mlittle-endian
16546 Generate little-endian code. This is the default when GCC is
16547 configured for an aarch64-*-* but not an aarch64_be-*-* target.
16548
16549 -mcmodel=tiny
16550 Generate code for the tiny code model. The program and its
16551 statically defined symbols must be within 1MB of each other.
16552 Programs can be statically or dynamically linked.
16553
16554 -mcmodel=small
16555 Generate code for the small code model. The program and its
16556 statically defined symbols must be within 4GB of each other.
16557 Programs can be statically or dynamically linked. This is the
16558 default code model.
16559
16560 -mcmodel=large
16561 Generate code for the large code model. This makes no assumptions
16562 about addresses and sizes of sections. Programs can be statically
16563 linked only. The -mcmodel=large option is incompatible with
16564 -mabi=ilp32, -fpic and -fPIC.
16565
16566 -mstrict-align
16567 -mno-strict-align
16568 Avoid or allow generating memory accesses that may not be aligned
16569 on a natural object boundary as described in the architecture
16570 specification.
16571
16572 -momit-leaf-frame-pointer
16573 -mno-omit-leaf-frame-pointer
16574 Omit or keep the frame pointer in leaf functions. The former
16575 behavior is the default.
16576
16577 -mstack-protector-guard=guard
16578 -mstack-protector-guard-reg=reg
16579 -mstack-protector-guard-offset=offset
16580 Generate stack protection code using canary at guard. Supported
16581 locations are global for a global canary or sysreg for a canary in
16582 an appropriate system register.
16583
16584 With the latter choice the options -mstack-protector-guard-reg=reg
16585 and -mstack-protector-guard-offset=offset furthermore specify which
16586 system register to use as base register for reading the canary, and
16587 from what offset from that base register. There is no default
16588 register or offset as this is entirely for use within the Linux
16589 kernel.
16590
16591 -mtls-dialect=desc
16592 Use TLS descriptors as the thread-local storage mechanism for
16593 dynamic accesses of TLS variables. This is the default.
16594
16595 -mtls-dialect=traditional
16596 Use traditional TLS as the thread-local storage mechanism for
16597 dynamic accesses of TLS variables.
16598
16599 -mtls-size=size
16600 Specify bit size of immediate TLS offsets. Valid values are 12,
16601 24, 32, 48. This option requires binutils 2.26 or newer.
16602
16603 -mfix-cortex-a53-835769
16604 -mno-fix-cortex-a53-835769
16605 Enable or disable the workaround for the ARM Cortex-A53 erratum
16606 number 835769. This involves inserting a NOP instruction between
16607 memory instructions and 64-bit integer multiply-accumulate
16608 instructions.
16609
16610 -mfix-cortex-a53-843419
16611 -mno-fix-cortex-a53-843419
16612 Enable or disable the workaround for the ARM Cortex-A53 erratum
16613 number 843419. This erratum workaround is made at link time and
16614 this will only pass the corresponding flag to the linker.
16615
16616 -mlow-precision-recip-sqrt
16617 -mno-low-precision-recip-sqrt
16618 Enable or disable the reciprocal square root approximation. This
16619 option only has an effect if -ffast-math or
16620 -funsafe-math-optimizations is used as well. Enabling this reduces
16621 precision of reciprocal square root results to about 16 bits for
16622 single precision and to 32 bits for double precision.
16623
16624 -mlow-precision-sqrt
16625 -mno-low-precision-sqrt
16626 Enable or disable the square root approximation. This option only
16627 has an effect if -ffast-math or -funsafe-math-optimizations is used
16628 as well. Enabling this reduces precision of square root results to
16629 about 16 bits for single precision and to 32 bits for double
16630 precision. If enabled, it implies -mlow-precision-recip-sqrt.
16631
16632 -mlow-precision-div
16633 -mno-low-precision-div
16634 Enable or disable the division approximation. This option only has
16635 an effect if -ffast-math or -funsafe-math-optimizations is used as
16636 well. Enabling this reduces precision of division results to about
16637 16 bits for single precision and to 32 bits for double precision.
16638
16639 -mtrack-speculation
16640 -mno-track-speculation
16641 Enable or disable generation of additional code to track
16642 speculative execution through conditional branches. The tracking
16643 state can then be used by the compiler when expanding calls to
16644 "__builtin_speculation_safe_copy" to permit a more efficient code
16645 sequence to be generated.
16646
16647 -moutline-atomics
16648 -mno-outline-atomics
16649 Enable or disable calls to out-of-line helpers to implement atomic
16650 operations. These helpers will, at runtime, determine if the LSE
16651 instructions from ARMv8.1-A can be used; if not, they will use the
16652 load/store-exclusive instructions that are present in the base
16653 ARMv8.0 ISA.
16654
16655 This option is only applicable when compiling for the base ARMv8.0
16656 instruction set. If using a later revision, e.g. -march=armv8.1-a
16657 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
16658 used directly. The same applies when using -mcpu= when the
16659 selected cpu supports the lse feature. This option is on by
16660 default.
16661
16662 -march=name
16663 Specify the name of the target architecture and, optionally, one or
16664 more feature modifiers. This option has the form
16665 -march=arch{+[no]feature}*.
16666
16667 The table below summarizes the permissible values for arch and the
16668 features that they enable by default:
16669
16670 arch value : Architecture : Includes by default
16671 armv8-a : Armv8-A : +fp, +simd
16672 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
16673 armv8.2-a : Armv8.2-A : armv8.1-a
16674 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
16675 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
16676 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
16677 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
16678 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
16679 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
16680 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
16681 armv8-r : Armv8-R : armv8-r
16682
16683 The value native is available on native AArch64 GNU/Linux and
16684 causes the compiler to pick the architecture of the host system.
16685 This option has no effect if the compiler is unable to recognize
16686 the architecture of the host system,
16687
16688 The permissible values for feature are listed in the sub-section on
16689 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16690 Where conflicting feature modifiers are specified, the right-most
16691 feature is used.
16692
16693 GCC uses name to determine what kind of instructions it can emit
16694 when generating assembly code. If -march is specified without
16695 either of -mtune or -mcpu also being specified, the code is tuned
16696 to perform well across a range of target processors implementing
16697 the target architecture.
16698
16699 -mtune=name
16700 Specify the name of the target processor for which GCC should tune
16701 the performance of the code. Permissible values for this option
16702 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
16703 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
16704 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
16705 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
16706 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
16707 neoverse-v1, qdf24xx, saphira, phecda, xgene1, vulcan, octeontx,
16708 octeontx81, octeontx83, octeontx2, octeontx2t98, octeontx2t96
16709 octeontx2t93, octeontx2f95, octeontx2f95n, octeontx2f95mm, a64fx,
16710 thunderx, thunderxt88, thunderxt88p1, thunderxt81, tsv110,
16711 thunderxt83, thunderx2t99, thunderx3t110, zeus,
16712 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16713 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16714 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
16715 cortex-x1, cortex-x2, cortex-a510, cortex-a710, ampere1, native.
16716
16717 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16718 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16719 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
16720 should tune for a big.LITTLE system.
16721
16722 The value neoverse-512tvb specifies that GCC should tune for
16723 Neoverse cores that (a) implement SVE and (b) have a total vector
16724 bandwidth of 512 bits per cycle. In other words, the option tells
16725 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
16726 SIMD arithmetic instructions a cycle and that can execute an
16727 equivalent number of SVE arithmetic instructions per cycle (2 for
16728 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
16729 for a specific core like Neoverse V1 but is more specific than the
16730 default tuning described below.
16731
16732 Additionally on native AArch64 GNU/Linux systems the value native
16733 tunes performance to the host system. This option has no effect if
16734 the compiler is unable to recognize the processor of the host
16735 system.
16736
16737 Where none of -mtune=, -mcpu= or -march= are specified, the code is
16738 tuned to perform well across a range of target processors.
16739
16740 This option cannot be suffixed by feature modifiers.
16741
16742 -mcpu=name
16743 Specify the name of the target processor, optionally suffixed by
16744 one or more feature modifiers. This option has the form
16745 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
16746 the same as those available for -mtune. The permissible values for
16747 feature are documented in the sub-section on
16748 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16749 Where conflicting feature modifiers are specified, the right-most
16750 feature is used.
16751
16752 GCC uses name to determine what kind of instructions it can emit
16753 when generating assembly code (as if by -march) and to determine
16754 the target processor for which to tune for performance (as if by
16755 -mtune). Where this option is used in conjunction with -march or
16756 -mtune, those options take precedence over the appropriate part of
16757 this option.
16758
16759 -mcpu=neoverse-512tvb is special in that it does not refer to a
16760 specific core, but instead refers to all Neoverse cores that (a)
16761 implement SVE and (b) have a total vector bandwidth of 512 bits a
16762 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
16763 generates code that can run on a Neoverse V1 core, since Neoverse
16764 V1 is the first Neoverse core with these properties. Unless
16765 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
16766 way as for -mtune=neoverse-512tvb.
16767
16768 -moverride=string
16769 Override tuning decisions made by the back-end in response to a
16770 -mtune= switch. The syntax, semantics, and accepted values for
16771 string in this option are not guaranteed to be consistent across
16772 releases.
16773
16774 This option is only intended to be useful when developing GCC.
16775
16776 -mverbose-cost-dump
16777 Enable verbose cost model dumping in the debug dump files. This
16778 option is provided for use in debugging the compiler.
16779
16780 -mpc-relative-literal-loads
16781 -mno-pc-relative-literal-loads
16782 Enable or disable PC-relative literal loads. With this option
16783 literal pools are accessed using a single instruction and emitted
16784 after each function. This limits the maximum size of functions to
16785 1MB. This is enabled by default for -mcmodel=tiny.
16786
16787 -msign-return-address=scope
16788 Select the function scope on which return address signing will be
16789 applied. Permissible values are none, which disables return
16790 address signing, non-leaf, which enables pointer signing for
16791 functions which are not leaf functions, and all, which enables
16792 pointer signing for all functions. The default value is none. This
16793 option has been deprecated by -mbranch-protection.
16794
16795 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
16796 Select the branch protection features to use. none is the default
16797 and turns off all types of branch protection. standard turns on
16798 all types of branch protection features. If a feature has
16799 additional tuning options, then standard sets it to its standard
16800 level. pac-ret[+leaf] turns on return address signing to its
16801 standard level: signing functions that save the return address to
16802 memory (non-leaf functions will practically always do this) using
16803 the a-key. The optional argument leaf can be used to extend the
16804 signing to include leaf functions. The optional argument b-key can
16805 be used to sign the functions with the B-key instead of the A-key.
16806 bti turns on branch target identification mechanism.
16807
16808 -mharden-sls=opts
16809 Enable compiler hardening against straight line speculation (SLS).
16810 opts is a comma-separated list of the following options:
16811
16812 retbr
16813 blr
16814
16815 In addition, -mharden-sls=all enables all SLS hardening while
16816 -mharden-sls=none disables all SLS hardening.
16817
16818 -msve-vector-bits=bits
16819 Specify the number of bits in an SVE vector register. This option
16820 only has an effect when SVE is enabled.
16821
16822 GCC supports two forms of SVE code generation: "vector-length
16823 agnostic" output that works with any size of vector register and
16824 "vector-length specific" output that allows GCC to make assumptions
16825 about the vector length when it is useful for optimization reasons.
16826 The possible values of bits are: scalable, 128, 256, 512, 1024 and
16827 2048. Specifying scalable selects vector-length agnostic output.
16828 At present -msve-vector-bits=128 also generates vector-length
16829 agnostic output for big-endian targets. All other values generate
16830 vector-length specific code. The behavior of these values may
16831 change in future releases and no value except scalable should be
16832 relied on for producing code that is portable across different
16833 hardware SVE vector lengths.
16834
16835 The default is -msve-vector-bits=scalable, which produces vector-
16836 length agnostic code.
16837
16838 -march and -mcpu Feature Modifiers
16839
16840 Feature modifiers used with -march and -mcpu can be any of the
16841 following and their inverses nofeature:
16842
16843 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
16844
16845 crypto
16846 Enable Crypto extension. This also enables Advanced SIMD and
16847 floating-point instructions.
16848
16849 fp Enable floating-point instructions. This is on by default for all
16850 possible values for options -march and -mcpu.
16851
16852 simd
16853 Enable Advanced SIMD instructions. This also enables floating-
16854 point instructions. This is on by default for all possible values
16855 for options -march and -mcpu.
16856
16857 sve Enable Scalable Vector Extension instructions. This also enables
16858 Advanced SIMD and floating-point instructions.
16859
16860 lse Enable Large System Extension instructions. This is on by default
16861 for -march=armv8.1-a.
16862
16863 rdma
16864 Enable Round Double Multiply Accumulate instructions. This is on
16865 by default for -march=armv8.1-a.
16866
16867 fp16
16868 Enable FP16 extension. This also enables floating-point
16869 instructions.
16870
16871 fp16fml
16872 Enable FP16 fmla extension. This also enables FP16 extensions and
16873 floating-point instructions. This option is enabled by default for
16874 -march=armv8.4-a. Use of this option with architectures prior to
16875 Armv8.2-A is not supported.
16876
16877 rcpc
16878 Enable the RcPc extension. This does not change code generation
16879 from GCC, but is passed on to the assembler, enabling inline asm
16880 statements to use instructions from the RcPc extension.
16881
16882 dotprod
16883 Enable the Dot Product extension. This also enables Advanced SIMD
16884 instructions.
16885
16886 aes Enable the Armv8-a aes and pmull crypto extension. This also
16887 enables Advanced SIMD instructions.
16888
16889 sha2
16890 Enable the Armv8-a sha2 crypto extension. This also enables
16891 Advanced SIMD instructions.
16892
16893 sha3
16894 Enable the sha512 and sha3 crypto extension. This also enables
16895 Advanced SIMD instructions. Use of this option with architectures
16896 prior to Armv8.2-A is not supported.
16897
16898 sm4 Enable the sm3 and sm4 crypto extension. This also enables
16899 Advanced SIMD instructions. Use of this option with architectures
16900 prior to Armv8.2-A is not supported.
16901
16902 profile
16903 Enable the Statistical Profiling extension. This option is only to
16904 enable the extension at the assembler level and does not affect
16905 code generation.
16906
16907 rng Enable the Armv8.5-a Random Number instructions. This option is
16908 only to enable the extension at the assembler level and does not
16909 affect code generation.
16910
16911 memtag
16912 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16913 with architectures prior to Armv8.5-A is not supported.
16914
16915 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16916 only to enable the extension at the assembler level and does not
16917 affect code generation. This option is enabled by default for
16918 -march=armv8.5-a.
16919
16920 ssbs
16921 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16922 option is only to enable the extension at the assembler level and
16923 does not affect code generation. This option is enabled by default
16924 for -march=armv8.5-a.
16925
16926 predres
16927 Enable the Armv8-a Execution and Data Prediction Restriction
16928 instructions. This option is only to enable the extension at the
16929 assembler level and does not affect code generation. This option
16930 is enabled by default for -march=armv8.5-a.
16931
16932 sve2
16933 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16934 SVE instructions.
16935
16936 sve2-bitperm
16937 Enable SVE2 bitperm instructions. This also enables SVE2
16938 instructions.
16939
16940 sve2-sm4
16941 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16942
16943 sve2-aes
16944 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16945
16946 sve2-sha3
16947 Enable SVE2 sha3 instructions. This also enables SVE2
16948 instructions.
16949
16950 tme Enable the Transactional Memory Extension.
16951
16952 i8mm
16953 Enable 8-bit Integer Matrix Multiply instructions. This also
16954 enables Advanced SIMD and floating-point instructions. This option
16955 is enabled by default for -march=armv8.6-a. Use of this option
16956 with architectures prior to Armv8.2-A is not supported.
16957
16958 f32mm
16959 Enable 32-bit Floating point Matrix Multiply instructions. This
16960 also enables SVE instructions. Use of this option with
16961 architectures prior to Armv8.2-A is not supported.
16962
16963 f64mm
16964 Enable 64-bit Floating point Matrix Multiply instructions. This
16965 also enables SVE instructions. Use of this option with
16966 architectures prior to Armv8.2-A is not supported.
16967
16968 bf16
16969 Enable brain half-precision floating-point instructions. This also
16970 enables Advanced SIMD and floating-point instructions. This option
16971 is enabled by default for -march=armv8.6-a. Use of this option
16972 with architectures prior to Armv8.2-A is not supported.
16973
16974 ls64
16975 Enable the 64-byte atomic load and store instructions for
16976 accelerators. This option is enabled by default for
16977 -march=armv8.7-a.
16978
16979 mops
16980 Enable the instructions to accelerate memory operations like
16981 "memcpy", "memmove", "memset". This option is enabled by default
16982 for -march=armv8.8-a
16983
16984 flagm
16985 Enable the Flag Manipulation instructions Extension.
16986
16987 pauth
16988 Enable the Pointer Authentication Extension.
16989
16990 Feature crypto implies aes, sha2, and simd, which implies fp.
16991 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16992 nosha2.
16993
16994 Adapteva Epiphany Options
16995
16996 These -m options are defined for Adapteva Epiphany:
16997
16998 -mhalf-reg-file
16999 Don't allocate any register in the range "r32"..."r63". That
17000 allows code to run on hardware variants that lack these registers.
17001
17002 -mprefer-short-insn-regs
17003 Preferentially allocate registers that allow short instruction
17004 generation. This can result in increased instruction count, so
17005 this may either reduce or increase overall code size.
17006
17007 -mbranch-cost=num
17008 Set the cost of branches to roughly num "simple" instructions.
17009 This cost is only a heuristic and is not guaranteed to produce
17010 consistent results across releases.
17011
17012 -mcmove
17013 Enable the generation of conditional moves.
17014
17015 -mnops=num
17016 Emit num NOPs before every other generated instruction.
17017
17018 -mno-soft-cmpsf
17019 For single-precision floating-point comparisons, emit an "fsub"
17020 instruction and test the flags. This is faster than a software
17021 comparison, but can get incorrect results in the presence of NaNs,
17022 or when two different small numbers are compared such that their
17023 difference is calculated as zero. The default is -msoft-cmpsf,
17024 which uses slower, but IEEE-compliant, software comparisons.
17025
17026 -mstack-offset=num
17027 Set the offset between the top of the stack and the stack pointer.
17028 E.g., a value of 8 means that the eight bytes in the range
17029 "sp+0...sp+7" can be used by leaf functions without stack
17030 allocation. Values other than 8 or 16 are untested and unlikely to
17031 work. Note also that this option changes the ABI; compiling a
17032 program with a different stack offset than the libraries have been
17033 compiled with generally does not work. This option can be useful
17034 if you want to evaluate if a different stack offset would give you
17035 better code, but to actually use a different stack offset to build
17036 working programs, it is recommended to configure the toolchain with
17037 the appropriate --with-stack-offset=num option.
17038
17039 -mno-round-nearest
17040 Make the scheduler assume that the rounding mode has been set to
17041 truncating. The default is -mround-nearest.
17042
17043 -mlong-calls
17044 If not otherwise specified by an attribute, assume all calls might
17045 be beyond the offset range of the "b" / "bl" instructions, and
17046 therefore load the function address into a register before
17047 performing a (otherwise direct) call. This is the default.
17048
17049 -mshort-calls
17050 If not otherwise specified by an attribute, assume all direct calls
17051 are in the range of the "b" / "bl" instructions, so use these
17052 instructions for direct calls. The default is -mlong-calls.
17053
17054 -msmall16
17055 Assume addresses can be loaded as 16-bit unsigned values. This
17056 does not apply to function addresses for which -mlong-calls
17057 semantics are in effect.
17058
17059 -mfp-mode=mode
17060 Set the prevailing mode of the floating-point unit. This
17061 determines the floating-point mode that is provided and expected at
17062 function call and return time. Making this mode match the mode you
17063 predominantly need at function start can make your programs smaller
17064 and faster by avoiding unnecessary mode switches.
17065
17066 mode can be set to one the following values:
17067
17068 caller
17069 Any mode at function entry is valid, and retained or restored
17070 when the function returns, and when it calls other functions.
17071 This mode is useful for compiling libraries or other
17072 compilation units you might want to incorporate into different
17073 programs with different prevailing FPU modes, and the
17074 convenience of being able to use a single object file outweighs
17075 the size and speed overhead for any extra mode switching that
17076 might be needed, compared with what would be needed with a more
17077 specific choice of prevailing FPU mode.
17078
17079 truncate
17080 This is the mode used for floating-point calculations with
17081 truncating (i.e. round towards zero) rounding mode. That
17082 includes conversion from floating point to integer.
17083
17084 round-nearest
17085 This is the mode used for floating-point calculations with
17086 round-to-nearest-or-even rounding mode.
17087
17088 int This is the mode used to perform integer calculations in the
17089 FPU, e.g. integer multiply, or integer multiply-and-
17090 accumulate.
17091
17092 The default is -mfp-mode=caller
17093
17094 -mno-split-lohi
17095 -mno-postinc
17096 -mno-postmodify
17097 Code generation tweaks that disable, respectively, splitting of
17098 32-bit loads, generation of post-increment addresses, and
17099 generation of post-modify addresses. The defaults are msplit-lohi,
17100 -mpost-inc, and -mpost-modify.
17101
17102 -mnovect-double
17103 Change the preferred SIMD mode to SImode. The default is
17104 -mvect-double, which uses DImode as preferred SIMD mode.
17105
17106 -max-vect-align=num
17107 The maximum alignment for SIMD vector mode types. num may be 4 or
17108 8. The default is 8. Note that this is an ABI change, even though
17109 many library function interfaces are unaffected if they don't use
17110 SIMD vector modes in places that affect size and/or alignment of
17111 relevant types.
17112
17113 -msplit-vecmove-early
17114 Split vector moves into single word moves before reload. In theory
17115 this can give better register allocation, but so far the reverse
17116 seems to be generally the case.
17117
17118 -m1reg-reg
17119 Specify a register to hold the constant -1, which makes loading
17120 small negative constants and certain bitmasks faster. Allowable
17121 values for reg are r43 and r63, which specify use of that register
17122 as a fixed register, and none, which means that no register is used
17123 for this purpose. The default is -m1reg-none.
17124
17125 AMD GCN Options
17126
17127 These options are defined specifically for the AMD GCN port.
17128
17129 -march=gpu
17130 -mtune=gpu
17131 Set architecture type or tuning for gpu. Supported values for gpu
17132 are
17133
17134 fiji
17135 Compile for GCN3 Fiji devices (gfx803).
17136
17137 gfx900
17138 Compile for GCN5 Vega 10 devices (gfx900).
17139
17140 gfx906
17141 Compile for GCN5 Vega 20 devices (gfx906).
17142
17143 -msram-ecc=on
17144 -msram-ecc=off
17145 -msram-ecc=any
17146 Compile binaries suitable for devices with the SRAM-ECC feature
17147 enabled, disabled, or either mode. This feature can be enabled
17148 per-process on some devices. The compiled code must match the
17149 device mode. The default is any, for devices that support it.
17150
17151 -mstack-size=bytes
17152 Specify how many bytes of stack space will be requested for each
17153 GPU thread (wave-front). Beware that there may be many threads and
17154 limited memory available. The size of the stack allocation may
17155 also have an impact on run-time performance. The default is 32KB
17156 when using OpenACC or OpenMP, and 1MB otherwise.
17157
17158 -mxnack
17159 Compile binaries suitable for devices with the XNACK feature
17160 enabled. Some devices always require XNACK and some allow the user
17161 to configure XNACK. The compiled code must match the device mode.
17162 The default is -mno-xnack. At present this option is a placeholder
17163 for support that is not yet implemented.
17164
17165 ARC Options
17166
17167 The following options control the architecture variant for which code
17168 is being compiled:
17169
17170 -mbarrel-shifter
17171 Generate instructions supported by barrel shifter. This is the
17172 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
17173
17174 -mjli-always
17175 Force to call a function using jli_s instruction. This option is
17176 valid only for ARCv2 architecture.
17177
17178 -mcpu=cpu
17179 Set architecture type, register usage, and instruction scheduling
17180 parameters for cpu. There are also shortcut alias options
17181 available for backward compatibility and convenience. Supported
17182 values for cpu are
17183
17184 arc600
17185 Compile for ARC600. Aliases: -mA6, -mARC600.
17186
17187 arc601
17188 Compile for ARC601. Alias: -mARC601.
17189
17190 arc700
17191 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
17192 default when configured with --with-cpu=arc700.
17193
17194 arcem
17195 Compile for ARC EM.
17196
17197 archs
17198 Compile for ARC HS.
17199
17200 em Compile for ARC EM CPU with no hardware extensions.
17201
17202 em4 Compile for ARC EM4 CPU.
17203
17204 em4_dmips
17205 Compile for ARC EM4 DMIPS CPU.
17206
17207 em4_fpus
17208 Compile for ARC EM4 DMIPS CPU with the single-precision
17209 floating-point extension.
17210
17211 em4_fpuda
17212 Compile for ARC EM4 DMIPS CPU with single-precision floating-
17213 point and double assist instructions.
17214
17215 hs Compile for ARC HS CPU with no hardware extensions except the
17216 atomic instructions.
17217
17218 hs34
17219 Compile for ARC HS34 CPU.
17220
17221 hs38
17222 Compile for ARC HS38 CPU.
17223
17224 hs38_linux
17225 Compile for ARC HS38 CPU with all hardware extensions on.
17226
17227 arc600_norm
17228 Compile for ARC 600 CPU with "norm" instructions enabled.
17229
17230 arc600_mul32x16
17231 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
17232 instructions enabled.
17233
17234 arc600_mul64
17235 Compile for ARC 600 CPU with "norm" and "mul64"-family
17236 instructions enabled.
17237
17238 arc601_norm
17239 Compile for ARC 601 CPU with "norm" instructions enabled.
17240
17241 arc601_mul32x16
17242 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
17243 instructions enabled.
17244
17245 arc601_mul64
17246 Compile for ARC 601 CPU with "norm" and "mul64"-family
17247 instructions enabled.
17248
17249 nps400
17250 Compile for ARC 700 on NPS400 chip.
17251
17252 em_mini
17253 Compile for ARC EM minimalist configuration featuring reduced
17254 register set.
17255
17256 -mdpfp
17257 -mdpfp-compact
17258 Generate double-precision FPX instructions, tuned for the compact
17259 implementation.
17260
17261 -mdpfp-fast
17262 Generate double-precision FPX instructions, tuned for the fast
17263 implementation.
17264
17265 -mno-dpfp-lrsr
17266 Disable "lr" and "sr" instructions from using FPX extension aux
17267 registers.
17268
17269 -mea
17270 Generate extended arithmetic instructions. Currently only "divaw",
17271 "adds", "subs", and "sat16" are supported. Only valid for
17272 -mcpu=ARC700.
17273
17274 -mno-mpy
17275 Do not generate "mpy"-family instructions for ARC700. This option
17276 is deprecated.
17277
17278 -mmul32x16
17279 Generate 32x16-bit multiply and multiply-accumulate instructions.
17280
17281 -mmul64
17282 Generate "mul64" and "mulu64" instructions. Only valid for
17283 -mcpu=ARC600.
17284
17285 -mnorm
17286 Generate "norm" instructions. This is the default if -mcpu=ARC700
17287 is in effect.
17288
17289 -mspfp
17290 -mspfp-compact
17291 Generate single-precision FPX instructions, tuned for the compact
17292 implementation.
17293
17294 -mspfp-fast
17295 Generate single-precision FPX instructions, tuned for the fast
17296 implementation.
17297
17298 -msimd
17299 Enable generation of ARC SIMD instructions via target-specific
17300 builtins. Only valid for -mcpu=ARC700.
17301
17302 -msoft-float
17303 This option ignored; it is provided for compatibility purposes
17304 only. Software floating-point code is emitted by default, and this
17305 default can overridden by FPX options; -mspfp, -mspfp-compact, or
17306 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
17307 -mdpfp-fast for double precision.
17308
17309 -mswap
17310 Generate "swap" instructions.
17311
17312 -matomic
17313 This enables use of the locked load/store conditional extension to
17314 implement atomic memory built-in functions. Not available for ARC
17315 6xx or ARC EM cores.
17316
17317 -mdiv-rem
17318 Enable "div" and "rem" instructions for ARCv2 cores.
17319
17320 -mcode-density
17321 Enable code density instructions for ARC EM. This option is on by
17322 default for ARC HS.
17323
17324 -mll64
17325 Enable double load/store operations for ARC HS cores.
17326
17327 -mtp-regno=regno
17328 Specify thread pointer register number.
17329
17330 -mmpy-option=multo
17331 Compile ARCv2 code with a multiplier design option. You can
17332 specify the option using either a string or numeric value for
17333 multo. wlh1 is the default value. The recognized values are:
17334
17335 0
17336 none
17337 No multiplier available.
17338
17339 1
17340 w 16x16 multiplier, fully pipelined. The following instructions
17341 are enabled: "mpyw" and "mpyuw".
17342
17343 2
17344 wlh1
17345 32x32 multiplier, fully pipelined (1 stage). The following
17346 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17347 "mpymu", and "mpy_s".
17348
17349 3
17350 wlh2
17351 32x32 multiplier, fully pipelined (2 stages). The following
17352 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17353 "mpymu", and "mpy_s".
17354
17355 4
17356 wlh3
17357 Two 16x16 multipliers, blocking, sequential. The following
17358 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17359 "mpymu", and "mpy_s".
17360
17361 5
17362 wlh4
17363 One 16x16 multiplier, blocking, sequential. The following
17364 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17365 "mpymu", and "mpy_s".
17366
17367 6
17368 wlh5
17369 One 32x4 multiplier, blocking, sequential. The following
17370 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17371 "mpymu", and "mpy_s".
17372
17373 7
17374 plus_dmpy
17375 ARC HS SIMD support.
17376
17377 8
17378 plus_macd
17379 ARC HS SIMD support.
17380
17381 9
17382 plus_qmacw
17383 ARC HS SIMD support.
17384
17385 This option is only available for ARCv2 cores.
17386
17387 -mfpu=fpu
17388 Enables support for specific floating-point hardware extensions for
17389 ARCv2 cores. Supported values for fpu are:
17390
17391 fpus
17392 Enables support for single-precision floating-point hardware
17393 extensions.
17394
17395 fpud
17396 Enables support for double-precision floating-point hardware
17397 extensions. The single-precision floating-point extension is
17398 also enabled. Not available for ARC EM.
17399
17400 fpuda
17401 Enables support for double-precision floating-point hardware
17402 extensions using double-precision assist instructions. The
17403 single-precision floating-point extension is also enabled.
17404 This option is only available for ARC EM.
17405
17406 fpuda_div
17407 Enables support for double-precision floating-point hardware
17408 extensions using double-precision assist instructions. The
17409 single-precision floating-point, square-root, and divide
17410 extensions are also enabled. This option is only available for
17411 ARC EM.
17412
17413 fpuda_fma
17414 Enables support for double-precision floating-point hardware
17415 extensions using double-precision assist instructions. The
17416 single-precision floating-point and fused multiply and add
17417 hardware extensions are also enabled. This option is only
17418 available for ARC EM.
17419
17420 fpuda_all
17421 Enables support for double-precision floating-point hardware
17422 extensions using double-precision assist instructions. All
17423 single-precision floating-point hardware extensions are also
17424 enabled. This option is only available for ARC EM.
17425
17426 fpus_div
17427 Enables support for single-precision floating-point, square-
17428 root and divide hardware extensions.
17429
17430 fpud_div
17431 Enables support for double-precision floating-point, square-
17432 root and divide hardware extensions. This option includes
17433 option fpus_div. Not available for ARC EM.
17434
17435 fpus_fma
17436 Enables support for single-precision floating-point and fused
17437 multiply and add hardware extensions.
17438
17439 fpud_fma
17440 Enables support for double-precision floating-point and fused
17441 multiply and add hardware extensions. This option includes
17442 option fpus_fma. Not available for ARC EM.
17443
17444 fpus_all
17445 Enables support for all single-precision floating-point
17446 hardware extensions.
17447
17448 fpud_all
17449 Enables support for all single- and double-precision floating-
17450 point hardware extensions. Not available for ARC EM.
17451
17452 -mirq-ctrl-saved=register-range, blink, lp_count
17453 Specifies general-purposes registers that the processor
17454 automatically saves/restores on interrupt entry and exit.
17455 register-range is specified as two registers separated by a dash.
17456 The register range always starts with "r0", the upper limit is "fp"
17457 register. blink and lp_count are optional. This option is only
17458 valid for ARC EM and ARC HS cores.
17459
17460 -mrgf-banked-regs=number
17461 Specifies the number of registers replicated in second register
17462 bank on entry to fast interrupt. Fast interrupts are interrupts
17463 with the highest priority level P0. These interrupts save only PC
17464 and STATUS32 registers to avoid memory transactions during
17465 interrupt entry and exit sequences. Use this option when you are
17466 using fast interrupts in an ARC V2 family processor. Permitted
17467 values are 4, 8, 16, and 32.
17468
17469 -mlpc-width=width
17470 Specify the width of the "lp_count" register. Valid values for
17471 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
17472 fixed to 32 bits. If the width is less than 32, the compiler does
17473 not attempt to transform loops in your program to use the zero-
17474 delay loop mechanism unless it is known that the "lp_count"
17475 register can hold the required loop-counter value. Depending on
17476 the width specified, the compiler and run-time library might
17477 continue to use the loop mechanism for various needs. This option
17478 defines macro "__ARC_LPC_WIDTH__" with the value of width.
17479
17480 -mrf16
17481 This option instructs the compiler to generate code for a 16-entry
17482 register file. This option defines the "__ARC_RF16__" preprocessor
17483 macro.
17484
17485 -mbranch-index
17486 Enable use of "bi" or "bih" instructions to implement jump tables.
17487
17488 The following options are passed through to the assembler, and also
17489 define preprocessor macro symbols.
17490
17491 -mdsp-packa
17492 Passed down to the assembler to enable the DSP Pack A extensions.
17493 Also sets the preprocessor symbol "__Xdsp_packa". This option is
17494 deprecated.
17495
17496 -mdvbf
17497 Passed down to the assembler to enable the dual Viterbi butterfly
17498 extension. Also sets the preprocessor symbol "__Xdvbf". This
17499 option is deprecated.
17500
17501 -mlock
17502 Passed down to the assembler to enable the locked load/store
17503 conditional extension. Also sets the preprocessor symbol
17504 "__Xlock".
17505
17506 -mmac-d16
17507 Passed down to the assembler. Also sets the preprocessor symbol
17508 "__Xxmac_d16". This option is deprecated.
17509
17510 -mmac-24
17511 Passed down to the assembler. Also sets the preprocessor symbol
17512 "__Xxmac_24". This option is deprecated.
17513
17514 -mrtsc
17515 Passed down to the assembler to enable the 64-bit time-stamp
17516 counter extension instruction. Also sets the preprocessor symbol
17517 "__Xrtsc". This option is deprecated.
17518
17519 -mswape
17520 Passed down to the assembler to enable the swap byte ordering
17521 extension instruction. Also sets the preprocessor symbol
17522 "__Xswape".
17523
17524 -mtelephony
17525 Passed down to the assembler to enable dual- and single-operand
17526 instructions for telephony. Also sets the preprocessor symbol
17527 "__Xtelephony". This option is deprecated.
17528
17529 -mxy
17530 Passed down to the assembler to enable the XY memory extension.
17531 Also sets the preprocessor symbol "__Xxy".
17532
17533 The following options control how the assembly code is annotated:
17534
17535 -misize
17536 Annotate assembler instructions with estimated addresses.
17537
17538 -mannotate-align
17539 Explain what alignment considerations lead to the decision to make
17540 an instruction short or long.
17541
17542 The following options are passed through to the linker:
17543
17544 -marclinux
17545 Passed through to the linker, to specify use of the "arclinux"
17546 emulation. This option is enabled by default in tool chains built
17547 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17548 profiling is not requested.
17549
17550 -marclinux_prof
17551 Passed through to the linker, to specify use of the "arclinux_prof"
17552 emulation. This option is enabled by default in tool chains built
17553 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17554 profiling is requested.
17555
17556 The following options control the semantics of generated code:
17557
17558 -mlong-calls
17559 Generate calls as register indirect calls, thus providing access to
17560 the full 32-bit address range.
17561
17562 -mmedium-calls
17563 Don't use less than 25-bit addressing range for calls, which is the
17564 offset available for an unconditional branch-and-link instruction.
17565 Conditional execution of function calls is suppressed, to allow use
17566 of the 25-bit range, rather than the 21-bit range with conditional
17567 branch-and-link. This is the default for tool chains built for
17568 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
17569
17570 -G num
17571 Put definitions of externally-visible data in a small data section
17572 if that data is no bigger than num bytes. The default value of num
17573 is 4 for any ARC configuration, or 8 when we have double load/store
17574 operations.
17575
17576 -mno-sdata
17577 Do not generate sdata references. This is the default for tool
17578 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
17579 targets.
17580
17581 -mvolatile-cache
17582 Use ordinarily cached memory accesses for volatile references.
17583 This is the default.
17584
17585 -mno-volatile-cache
17586 Enable cache bypass for volatile references.
17587
17588 The following options fine tune code generation:
17589
17590 -malign-call
17591 Does nothing. Preserved for backward compatibility.
17592
17593 -mauto-modify-reg
17594 Enable the use of pre/post modify with register displacement.
17595
17596 -mbbit-peephole
17597 Enable bbit peephole2.
17598
17599 -mno-brcc
17600 This option disables a target-specific pass in arc_reorg to
17601 generate compare-and-branch ("brcc") instructions. It has no
17602 effect on generation of these instructions driven by the combiner
17603 pass.
17604
17605 -mcase-vector-pcrel
17606 Use PC-relative switch case tables to enable case table shortening.
17607 This is the default for -Os.
17608
17609 -mcompact-casesi
17610 Enable compact "casesi" pattern. This is the default for -Os, and
17611 only available for ARCv1 cores. This option is deprecated.
17612
17613 -mno-cond-exec
17614 Disable the ARCompact-specific pass to generate conditional
17615 execution instructions.
17616
17617 Due to delay slot scheduling and interactions between operand
17618 numbers, literal sizes, instruction lengths, and the support for
17619 conditional execution, the target-independent pass to generate
17620 conditional execution is often lacking, so the ARC port has kept a
17621 special pass around that tries to find more conditional execution
17622 generation opportunities after register allocation, branch
17623 shortening, and delay slot scheduling have been done. This pass
17624 generally, but not always, improves performance and code size, at
17625 the cost of extra compilation time, which is why there is an option
17626 to switch it off. If you have a problem with call instructions
17627 exceeding their allowable offset range because they are
17628 conditionalized, you should consider using -mmedium-calls instead.
17629
17630 -mearly-cbranchsi
17631 Enable pre-reload use of the "cbranchsi" pattern.
17632
17633 -mexpand-adddi
17634 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
17635 "adc" etc. This option is deprecated.
17636
17637 -mindexed-loads
17638 Enable the use of indexed loads. This can be problematic because
17639 some optimizers then assume that indexed stores exist, which is not
17640 the case.
17641
17642 -mlra
17643 Enable Local Register Allocation. This is still experimental for
17644 ARC, so by default the compiler uses standard reload (i.e.
17645 -mno-lra).
17646
17647 -mlra-priority-none
17648 Don't indicate any priority for target registers.
17649
17650 -mlra-priority-compact
17651 Indicate target register priority for r0..r3 / r12..r15.
17652
17653 -mlra-priority-noncompact
17654 Reduce target register priority for r0..r3 / r12..r15.
17655
17656 -mmillicode
17657 When optimizing for size (using -Os), prologues and epilogues that
17658 have to save or restore a large number of registers are often
17659 shortened by using call to a special function in libgcc; this is
17660 referred to as a millicode call. As these calls can pose
17661 performance issues, and/or cause linking issues when linking in a
17662 nonstandard way, this option is provided to turn on or off
17663 millicode call generation.
17664
17665 -mcode-density-frame
17666 This option enable the compiler to emit "enter" and "leave"
17667 instructions. These instructions are only valid for CPUs with
17668 code-density feature.
17669
17670 -mmixed-code
17671 Does nothing. Preserved for backward compatibility.
17672
17673 -mq-class
17674 Ths option is deprecated. Enable q instruction alternatives. This
17675 is the default for -Os.
17676
17677 -mRcq
17678 Enable Rcq constraint handling. Most short code generation depends
17679 on this. This is the default.
17680
17681 -mRcw
17682 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
17683 on this. This is the default.
17684
17685 -msize-level=level
17686 Fine-tune size optimization with regards to instruction lengths and
17687 alignment. The recognized values for level are:
17688
17689 0 No size optimization. This level is deprecated and treated
17690 like 1.
17691
17692 1 Short instructions are used opportunistically.
17693
17694 2 In addition, alignment of loops and of code after barriers are
17695 dropped.
17696
17697 3 In addition, optional data alignment is dropped, and the option
17698 Os is enabled.
17699
17700 This defaults to 3 when -Os is in effect. Otherwise, the behavior
17701 when this is not set is equivalent to level 1.
17702
17703 -mtune=cpu
17704 Set instruction scheduling parameters for cpu, overriding any
17705 implied by -mcpu=.
17706
17707 Supported values for cpu are
17708
17709 ARC600
17710 Tune for ARC600 CPU.
17711
17712 ARC601
17713 Tune for ARC601 CPU.
17714
17715 ARC700
17716 Tune for ARC700 CPU with standard multiplier block.
17717
17718 ARC700-xmac
17719 Tune for ARC700 CPU with XMAC block.
17720
17721 ARC725D
17722 Tune for ARC725D CPU.
17723
17724 ARC750D
17725 Tune for ARC750D CPU.
17726
17727 -mmultcost=num
17728 Cost to assume for a multiply instruction, with 4 being equal to a
17729 normal instruction.
17730
17731 -munalign-prob-threshold=probability
17732 Does nothing. Preserved for backward compatibility.
17733
17734 The following options are maintained for backward compatibility, but
17735 are now deprecated and will be removed in a future release:
17736
17737 -margonaut
17738 Obsolete FPX.
17739
17740 -mbig-endian
17741 -EB Compile code for big-endian targets. Use of these options is now
17742 deprecated. Big-endian code is supported by configuring GCC to
17743 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
17744 endian is the default.
17745
17746 -mlittle-endian
17747 -EL Compile code for little-endian targets. Use of these options is
17748 now deprecated. Little-endian code is supported by configuring GCC
17749 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
17750 little endian is the default.
17751
17752 -mbarrel_shifter
17753 Replaced by -mbarrel-shifter.
17754
17755 -mdpfp_compact
17756 Replaced by -mdpfp-compact.
17757
17758 -mdpfp_fast
17759 Replaced by -mdpfp-fast.
17760
17761 -mdsp_packa
17762 Replaced by -mdsp-packa.
17763
17764 -mEA
17765 Replaced by -mea.
17766
17767 -mmac_24
17768 Replaced by -mmac-24.
17769
17770 -mmac_d16
17771 Replaced by -mmac-d16.
17772
17773 -mspfp_compact
17774 Replaced by -mspfp-compact.
17775
17776 -mspfp_fast
17777 Replaced by -mspfp-fast.
17778
17779 -mtune=cpu
17780 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
17781 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
17782
17783 -multcost=num
17784 Replaced by -mmultcost.
17785
17786 ARM Options
17787
17788 These -m options are defined for the ARM port:
17789
17790 -mabi=name
17791 Generate code for the specified ABI. Permissible values are: apcs-
17792 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
17793
17794 -mapcs-frame
17795 Generate a stack frame that is compliant with the ARM Procedure
17796 Call Standard for all functions, even if this is not strictly
17797 necessary for correct execution of the code. Specifying
17798 -fomit-frame-pointer with this option causes the stack frames not
17799 to be generated for leaf functions. The default is
17800 -mno-apcs-frame. This option is deprecated.
17801
17802 -mapcs
17803 This is a synonym for -mapcs-frame and is deprecated.
17804
17805 -mthumb-interwork
17806 Generate code that supports calling between the ARM and Thumb
17807 instruction sets. Without this option, on pre-v5 architectures,
17808 the two instruction sets cannot be reliably used inside one
17809 program. The default is -mno-thumb-interwork, since slightly
17810 larger code is generated when -mthumb-interwork is specified. In
17811 AAPCS configurations this option is meaningless.
17812
17813 -mno-sched-prolog
17814 Prevent the reordering of instructions in the function prologue, or
17815 the merging of those instruction with the instructions in the
17816 function's body. This means that all functions start with a
17817 recognizable set of instructions (or in fact one of a choice from a
17818 small set of different function prologues), and this information
17819 can be used to locate the start of functions inside an executable
17820 piece of code. The default is -msched-prolog.
17821
17822 -mfloat-abi=name
17823 Specifies which floating-point ABI to use. Permissible values are:
17824 soft, softfp and hard.
17825
17826 Specifying soft causes GCC to generate output containing library
17827 calls for floating-point operations. softfp allows the generation
17828 of code using hardware floating-point instructions, but still uses
17829 the soft-float calling conventions. hard allows generation of
17830 floating-point instructions and uses FPU-specific calling
17831 conventions.
17832
17833 The default depends on the specific target configuration. Note
17834 that the hard-float and soft-float ABIs are not link-compatible;
17835 you must compile your entire program with the same ABI, and link
17836 with a compatible set of libraries.
17837
17838 -mgeneral-regs-only
17839 Generate code which uses only the general-purpose registers. This
17840 will prevent the compiler from using floating-point and Advanced
17841 SIMD registers but will not impose any restrictions on the
17842 assembler.
17843
17844 -mlittle-endian
17845 Generate code for a processor running in little-endian mode. This
17846 is the default for all standard configurations.
17847
17848 -mbig-endian
17849 Generate code for a processor running in big-endian mode; the
17850 default is to compile code for a little-endian processor.
17851
17852 -mbe8
17853 -mbe32
17854 When linking a big-endian image select between BE8 and BE32
17855 formats. The option has no effect for little-endian images and is
17856 ignored. The default is dependent on the selected target
17857 architecture. For ARMv6 and later architectures the default is
17858 BE8, for older architectures the default is BE32. BE32 format has
17859 been deprecated by ARM.
17860
17861 -march=name[+extension...]
17862 This specifies the name of the target ARM architecture. GCC uses
17863 this name to determine what kind of instructions it can emit when
17864 generating assembly code. This option can be used in conjunction
17865 with or instead of the -mcpu= option.
17866
17867 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
17868 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
17869 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
17870 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
17871 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
17872 iwmmxt and iwmmxt2.
17873
17874 Additionally, the following architectures, which lack support for
17875 the Thumb execution state, are recognized but support is
17876 deprecated: armv4.
17877
17878 Many of the architectures support extensions. These can be added
17879 by appending +extension to the architecture name. Extension
17880 options are processed in order and capabilities accumulate. An
17881 extension will also enable any necessary base extensions upon which
17882 it depends. For example, the +crypto extension will always enable
17883 the +simd extension. The exception to the additive construction is
17884 for extensions that are prefixed with +no...: these extensions
17885 disable the specified option and any other extensions that may
17886 depend on the presence of that extension.
17887
17888 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
17889 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17890 disabled by the +nofp option that follows it.
17891
17892 Most extension names are generically named, but have an effect that
17893 is dependent upon the architecture to which it is applied. For
17894 example, the +simd option can be applied to both armv7-a and
17895 armv8-a architectures, but will enable the original ARMv7-A
17896 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17897 for armv8-a.
17898
17899 The table below lists the supported extensions for each
17900 architecture. Architectures not mentioned do not support any
17901 extensions.
17902
17903 armv5te
17904 armv6
17905 armv6j
17906 armv6k
17907 armv6kz
17908 armv6t2
17909 armv6z
17910 armv6zk
17911 +fp The VFPv2 floating-point instructions. The extension
17912 +vfpv2 can be used as an alias for this extension.
17913
17914 +nofp
17915 Disable the floating-point instructions.
17916
17917 armv7
17918 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17919 architectures.
17920
17921 +fp The VFPv3 floating-point instructions, with 16 double-
17922 precision registers. The extension +vfpv3-d16 can be used
17923 as an alias for this extension. Note that floating-point
17924 is not supported by the base ARMv7-M architecture, but is
17925 compatible with both the ARMv7-A and ARMv7-R architectures.
17926
17927 +nofp
17928 Disable the floating-point instructions.
17929
17930 armv7-a
17931 +mp The multiprocessing extension.
17932
17933 +sec
17934 The security extension.
17935
17936 +fp The VFPv3 floating-point instructions, with 16 double-
17937 precision registers. The extension +vfpv3-d16 can be used
17938 as an alias for this extension.
17939
17940 +simd
17941 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17942 instructions. The extensions +neon and +neon-vfpv3 can be
17943 used as aliases for this extension.
17944
17945 +vfpv3
17946 The VFPv3 floating-point instructions, with 32 double-
17947 precision registers.
17948
17949 +vfpv3-d16-fp16
17950 The VFPv3 floating-point instructions, with 16 double-
17951 precision registers and the half-precision floating-point
17952 conversion operations.
17953
17954 +vfpv3-fp16
17955 The VFPv3 floating-point instructions, with 32 double-
17956 precision registers and the half-precision floating-point
17957 conversion operations.
17958
17959 +vfpv4-d16
17960 The VFPv4 floating-point instructions, with 16 double-
17961 precision registers.
17962
17963 +vfpv4
17964 The VFPv4 floating-point instructions, with 32 double-
17965 precision registers.
17966
17967 +neon-fp16
17968 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17969 instructions, with the half-precision floating-point
17970 conversion operations.
17971
17972 +neon-vfpv4
17973 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17974 instructions.
17975
17976 +nosimd
17977 Disable the Advanced SIMD instructions (does not disable
17978 floating point).
17979
17980 +nofp
17981 Disable the floating-point and Advanced SIMD instructions.
17982
17983 armv7ve
17984 The extended version of the ARMv7-A architecture with support
17985 for virtualization.
17986
17987 +fp The VFPv4 floating-point instructions, with 16 double-
17988 precision registers. The extension +vfpv4-d16 can be used
17989 as an alias for this extension.
17990
17991 +simd
17992 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17993 instructions. The extension +neon-vfpv4 can be used as an
17994 alias for this extension.
17995
17996 +vfpv3-d16
17997 The VFPv3 floating-point instructions, with 16 double-
17998 precision registers.
17999
18000 +vfpv3
18001 The VFPv3 floating-point instructions, with 32 double-
18002 precision registers.
18003
18004 +vfpv3-d16-fp16
18005 The VFPv3 floating-point instructions, with 16 double-
18006 precision registers and the half-precision floating-point
18007 conversion operations.
18008
18009 +vfpv3-fp16
18010 The VFPv3 floating-point instructions, with 32 double-
18011 precision registers and the half-precision floating-point
18012 conversion operations.
18013
18014 +vfpv4-d16
18015 The VFPv4 floating-point instructions, with 16 double-
18016 precision registers.
18017
18018 +vfpv4
18019 The VFPv4 floating-point instructions, with 32 double-
18020 precision registers.
18021
18022 +neon
18023 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18024 instructions. The extension +neon-vfpv3 can be used as an
18025 alias for this extension.
18026
18027 +neon-fp16
18028 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18029 instructions, with the half-precision floating-point
18030 conversion operations.
18031
18032 +nosimd
18033 Disable the Advanced SIMD instructions (does not disable
18034 floating point).
18035
18036 +nofp
18037 Disable the floating-point and Advanced SIMD instructions.
18038
18039 armv8-a
18040 +crc
18041 The Cyclic Redundancy Check (CRC) instructions.
18042
18043 +simd
18044 The ARMv8-A Advanced SIMD and floating-point instructions.
18045
18046 +crypto
18047 The cryptographic instructions.
18048
18049 +nocrypto
18050 Disable the cryptographic instructions.
18051
18052 +nofp
18053 Disable the floating-point, Advanced SIMD and cryptographic
18054 instructions.
18055
18056 +sb Speculation Barrier Instruction.
18057
18058 +predres
18059 Execution and Data Prediction Restriction Instructions.
18060
18061 armv8.1-a
18062 +simd
18063 The ARMv8.1-A Advanced SIMD and floating-point
18064 instructions.
18065
18066 +crypto
18067 The cryptographic instructions. This also enables the
18068 Advanced SIMD and floating-point instructions.
18069
18070 +nocrypto
18071 Disable the cryptographic instructions.
18072
18073 +nofp
18074 Disable the floating-point, Advanced SIMD and cryptographic
18075 instructions.
18076
18077 +sb Speculation Barrier Instruction.
18078
18079 +predres
18080 Execution and Data Prediction Restriction Instructions.
18081
18082 armv8.2-a
18083 armv8.3-a
18084 +fp16
18085 The half-precision floating-point data processing
18086 instructions. This also enables the Advanced SIMD and
18087 floating-point instructions.
18088
18089 +fp16fml
18090 The half-precision floating-point fmla extension. This
18091 also enables the half-precision floating-point extension
18092 and Advanced SIMD and floating-point instructions.
18093
18094 +simd
18095 The ARMv8.1-A Advanced SIMD and floating-point
18096 instructions.
18097
18098 +crypto
18099 The cryptographic instructions. This also enables the
18100 Advanced SIMD and floating-point instructions.
18101
18102 +dotprod
18103 Enable the Dot Product extension. This also enables
18104 Advanced SIMD instructions.
18105
18106 +nocrypto
18107 Disable the cryptographic extension.
18108
18109 +nofp
18110 Disable the floating-point, Advanced SIMD and cryptographic
18111 instructions.
18112
18113 +sb Speculation Barrier Instruction.
18114
18115 +predres
18116 Execution and Data Prediction Restriction Instructions.
18117
18118 +i8mm
18119 8-bit Integer Matrix Multiply instructions. This also
18120 enables Advanced SIMD and floating-point instructions.
18121
18122 +bf16
18123 Brain half-precision floating-point instructions. This
18124 also enables Advanced SIMD and floating-point instructions.
18125
18126 armv8.4-a
18127 +fp16
18128 The half-precision floating-point data processing
18129 instructions. This also enables the Advanced SIMD and
18130 floating-point instructions as well as the Dot Product
18131 extension and the half-precision floating-point fmla
18132 extension.
18133
18134 +simd
18135 The ARMv8.3-A Advanced SIMD and floating-point instructions
18136 as well as the Dot Product extension.
18137
18138 +crypto
18139 The cryptographic instructions. This also enables the
18140 Advanced SIMD and floating-point instructions as well as
18141 the Dot Product extension.
18142
18143 +nocrypto
18144 Disable the cryptographic extension.
18145
18146 +nofp
18147 Disable the floating-point, Advanced SIMD and cryptographic
18148 instructions.
18149
18150 +sb Speculation Barrier Instruction.
18151
18152 +predres
18153 Execution and Data Prediction Restriction Instructions.
18154
18155 +i8mm
18156 8-bit Integer Matrix Multiply instructions. This also
18157 enables Advanced SIMD and floating-point instructions.
18158
18159 +bf16
18160 Brain half-precision floating-point instructions. This
18161 also enables Advanced SIMD and floating-point instructions.
18162
18163 armv8.5-a
18164 +fp16
18165 The half-precision floating-point data processing
18166 instructions. This also enables the Advanced SIMD and
18167 floating-point instructions as well as the Dot Product
18168 extension and the half-precision floating-point fmla
18169 extension.
18170
18171 +simd
18172 The ARMv8.3-A Advanced SIMD and floating-point instructions
18173 as well as the Dot Product extension.
18174
18175 +crypto
18176 The cryptographic instructions. This also enables the
18177 Advanced SIMD and floating-point instructions as well as
18178 the Dot Product extension.
18179
18180 +nocrypto
18181 Disable the cryptographic extension.
18182
18183 +nofp
18184 Disable the floating-point, Advanced SIMD and cryptographic
18185 instructions.
18186
18187 +i8mm
18188 8-bit Integer Matrix Multiply instructions. This also
18189 enables Advanced SIMD and floating-point instructions.
18190
18191 +bf16
18192 Brain half-precision floating-point instructions. This
18193 also enables Advanced SIMD and floating-point instructions.
18194
18195 armv8.6-a
18196 +fp16
18197 The half-precision floating-point data processing
18198 instructions. This also enables the Advanced SIMD and
18199 floating-point instructions as well as the Dot Product
18200 extension and the half-precision floating-point fmla
18201 extension.
18202
18203 +simd
18204 The ARMv8.3-A Advanced SIMD and floating-point instructions
18205 as well as the Dot Product extension.
18206
18207 +crypto
18208 The cryptographic instructions. This also enables the
18209 Advanced SIMD and floating-point instructions as well as
18210 the Dot Product extension.
18211
18212 +nocrypto
18213 Disable the cryptographic extension.
18214
18215 +nofp
18216 Disable the floating-point, Advanced SIMD and cryptographic
18217 instructions.
18218
18219 +i8mm
18220 8-bit Integer Matrix Multiply instructions. This also
18221 enables Advanced SIMD and floating-point instructions.
18222
18223 +bf16
18224 Brain half-precision floating-point instructions. This
18225 also enables Advanced SIMD and floating-point instructions.
18226
18227 armv7-r
18228 +fp.sp
18229 The single-precision VFPv3 floating-point instructions.
18230 The extension +vfpv3xd can be used as an alias for this
18231 extension.
18232
18233 +fp The VFPv3 floating-point instructions with 16 double-
18234 precision registers. The extension +vfpv3-d16 can be used
18235 as an alias for this extension.
18236
18237 +vfpv3xd-d16-fp16
18238 The single-precision VFPv3 floating-point instructions with
18239 16 double-precision registers and the half-precision
18240 floating-point conversion operations.
18241
18242 +vfpv3-d16-fp16
18243 The VFPv3 floating-point instructions with 16 double-
18244 precision registers and the half-precision floating-point
18245 conversion operations.
18246
18247 +nofp
18248 Disable the floating-point extension.
18249
18250 +idiv
18251 The ARM-state integer division instructions.
18252
18253 +noidiv
18254 Disable the ARM-state integer division extension.
18255
18256 armv7e-m
18257 +fp The single-precision VFPv4 floating-point instructions.
18258
18259 +fpv5
18260 The single-precision FPv5 floating-point instructions.
18261
18262 +fp.dp
18263 The single- and double-precision FPv5 floating-point
18264 instructions.
18265
18266 +nofp
18267 Disable the floating-point extensions.
18268
18269 armv8.1-m.main
18270 +dsp
18271 The DSP instructions.
18272
18273 +mve
18274 The M-Profile Vector Extension (MVE) integer instructions.
18275
18276 +mve.fp
18277 The M-Profile Vector Extension (MVE) integer and single
18278 precision floating-point instructions.
18279
18280 +fp The single-precision floating-point instructions.
18281
18282 +fp.dp
18283 The single- and double-precision floating-point
18284 instructions.
18285
18286 +nofp
18287 Disable the floating-point extension.
18288
18289 +cdecp0, +cdecp1, ... , +cdecp7
18290 Enable the Custom Datapath Extension (CDE) on selected
18291 coprocessors according to the numbers given in the options
18292 in the range 0 to 7.
18293
18294 armv8-m.main
18295 +dsp
18296 The DSP instructions.
18297
18298 +nodsp
18299 Disable the DSP extension.
18300
18301 +fp The single-precision floating-point instructions.
18302
18303 +fp.dp
18304 The single- and double-precision floating-point
18305 instructions.
18306
18307 +nofp
18308 Disable the floating-point extension.
18309
18310 +cdecp0, +cdecp1, ... , +cdecp7
18311 Enable the Custom Datapath Extension (CDE) on selected
18312 coprocessors according to the numbers given in the options
18313 in the range 0 to 7.
18314
18315 armv8-r
18316 +crc
18317 The Cyclic Redundancy Check (CRC) instructions.
18318
18319 +fp.sp
18320 The single-precision FPv5 floating-point instructions.
18321
18322 +simd
18323 The ARMv8-A Advanced SIMD and floating-point instructions.
18324
18325 +crypto
18326 The cryptographic instructions.
18327
18328 +nocrypto
18329 Disable the cryptographic instructions.
18330
18331 +nofp
18332 Disable the floating-point, Advanced SIMD and cryptographic
18333 instructions.
18334
18335 -march=native causes the compiler to auto-detect the architecture
18336 of the build computer. At present, this feature is only supported
18337 on GNU/Linux, and not all architectures are recognized. If the
18338 auto-detect is unsuccessful the option has no effect.
18339
18340 -mtune=name
18341 This option specifies the name of the target ARM processor for
18342 which GCC should tune the performance of the code. For some ARM
18343 implementations better performance can be obtained by using this
18344 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
18345 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
18346 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
18347 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
18348 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
18349 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
18350 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
18351 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18352 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
18353 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
18354 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
18355 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
18356 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
18357 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
18358 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
18359 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
18360 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
18361 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
18362 xgene1.
18363
18364 Additionally, this option can specify that GCC should tune the
18365 performance of the code for a big.LITTLE system. Permissible names
18366 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18367 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18368 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
18369 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
18370
18371 -mtune=generic-arch specifies that GCC should tune the performance
18372 for a blend of processors within architecture arch. The aim is to
18373 generate code that run well on the current most popular processors,
18374 balancing between optimizations that benefit some CPUs in the
18375 range, and avoiding performance pitfalls of other CPUs. The
18376 effects of this option may change in future GCC versions as CPU
18377 models come and go.
18378
18379 -mtune permits the same extension options as -mcpu, but the
18380 extension options do not affect the tuning of the generated code.
18381
18382 -mtune=native causes the compiler to auto-detect the CPU of the
18383 build computer. At present, this feature is only supported on
18384 GNU/Linux, and not all architectures are recognized. If the auto-
18385 detect is unsuccessful the option has no effect.
18386
18387 -mcpu=name[+extension...]
18388 This specifies the name of the target ARM processor. GCC uses this
18389 name to derive the name of the target ARM architecture (as if
18390 specified by -march) and the ARM processor type for which to tune
18391 for performance (as if specified by -mtune). Where this option is
18392 used in conjunction with -march or -mtune, those options take
18393 precedence over the appropriate part of this option.
18394
18395 Many of the supported CPUs implement optional architectural
18396 extensions. Where this is so the architectural extensions are
18397 normally enabled by default. If implementations that lack the
18398 extension exist, then the extension syntax can be used to disable
18399 those extensions that have been omitted. For floating-point and
18400 Advanced SIMD (Neon) instructions, the settings of the options
18401 -mfloat-abi and -mfpu must also be considered: floating-point and
18402 Advanced SIMD instructions will only be used if -mfloat-abi is not
18403 set to soft; and any setting of -mfpu other than auto will override
18404 the available floating-point and SIMD extension instructions.
18405
18406 For example, cortex-a9 can be found in three major configurations:
18407 integer only, with just a floating-point unit or with floating-
18408 point and Advanced SIMD. The default is to enable all the
18409 instructions, but the extensions +nosimd and +nofp can be used to
18410 disable just the SIMD or both the SIMD and floating-point
18411 instructions respectively.
18412
18413 Permissible names for this option are the same as those for -mtune.
18414
18415 The following extension options are common to the listed CPUs:
18416
18417 +nodsp
18418 Disable the DSP instructions on cortex-m33, cortex-m35p.
18419
18420 +nofp
18421 Disables the floating-point instructions on arm9e, arm946e-s,
18422 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
18423 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
18424 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
18425 point and SIMD instructions on generic-armv7-a, cortex-a5,
18426 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18427 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18428 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
18429
18430 +nofp.dp
18431 Disables the double-precision component of the floating-point
18432 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
18433 cortex-r52plus and cortex-m7.
18434
18435 +nosimd
18436 Disables the SIMD (but not floating-point) instructions on
18437 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
18438
18439 +crypto
18440 Enables the cryptographic instructions on cortex-a32,
18441 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
18442 cortex-a73, cortex-a75, exynos-m1, xgene1,
18443 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18444 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
18445 cortex-a75.cortex-a55.
18446
18447 Additionally the generic-armv7-a pseudo target defaults to VFPv3
18448 with 16 double-precision registers. It supports the following
18449 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
18450 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
18451 neon-vfpv4. The meanings are the same as for the extensions to
18452 -march=armv7-a.
18453
18454 -mcpu=generic-arch is also permissible, and is equivalent to
18455 -march=arch -mtune=generic-arch. See -mtune for more information.
18456
18457 -mcpu=native causes the compiler to auto-detect the CPU of the
18458 build computer. At present, this feature is only supported on
18459 GNU/Linux, and not all architectures are recognized. If the auto-
18460 detect is unsuccessful the option has no effect.
18461
18462 -mfpu=name
18463 This specifies what floating-point hardware (or hardware emulation)
18464 is available on the target. Permissible names are: auto, vfpv2,
18465 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
18466 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
18467 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
18468 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
18469 and vfp is an alias for vfpv2.
18470
18471 The setting auto is the default and is special. It causes the
18472 compiler to select the floating-point and Advanced SIMD
18473 instructions based on the settings of -mcpu and -march.
18474
18475 If the selected floating-point hardware includes the NEON extension
18476 (e.g. -mfpu=neon), note that floating-point operations are not
18477 generated by GCC's auto-vectorization pass unless
18478 -funsafe-math-optimizations is also specified. This is because
18479 NEON hardware does not fully implement the IEEE 754 standard for
18480 floating-point arithmetic (in particular denormal values are
18481 treated as zero), so the use of NEON instructions may lead to a
18482 loss of precision.
18483
18484 You can also set the fpu name at function level by using the
18485 "target("fpu=")" function attributes or pragmas.
18486
18487 -mfp16-format=name
18488 Specify the format of the "__fp16" half-precision floating-point
18489 type. Permissible names are none, ieee, and alternative; the
18490 default is none, in which case the "__fp16" type is not defined.
18491
18492 -mstructure-size-boundary=n
18493 The sizes of all structures and unions are rounded up to a multiple
18494 of the number of bits set by this option. Permissible values are
18495 8, 32 and 64. The default value varies for different toolchains.
18496 For the COFF targeted toolchain the default value is 8. A value of
18497 64 is only allowed if the underlying ABI supports it.
18498
18499 Specifying a larger number can produce faster, more efficient code,
18500 but can also increase the size of the program. Different values
18501 are potentially incompatible. Code compiled with one value cannot
18502 necessarily expect to work with code or libraries compiled with
18503 another value, if they exchange information using structures or
18504 unions.
18505
18506 This option is deprecated.
18507
18508 -mabort-on-noreturn
18509 Generate a call to the function "abort" at the end of a "noreturn"
18510 function. It is executed if the function tries to return.
18511
18512 -mlong-calls
18513 -mno-long-calls
18514 Tells the compiler to perform function calls by first loading the
18515 address of the function into a register and then performing a
18516 subroutine call on this register. This switch is needed if the
18517 target function lies outside of the 64-megabyte addressing range of
18518 the offset-based version of subroutine call instruction.
18519
18520 Even if this switch is enabled, not all function calls are turned
18521 into long calls. The heuristic is that static functions, functions
18522 that have the "short_call" attribute, functions that are inside the
18523 scope of a "#pragma no_long_calls" directive, and functions whose
18524 definitions have already been compiled within the current
18525 compilation unit are not turned into long calls. The exceptions to
18526 this rule are that weak function definitions, functions with the
18527 "long_call" attribute or the "section" attribute, and functions
18528 that are within the scope of a "#pragma long_calls" directive are
18529 always turned into long calls.
18530
18531 This feature is not enabled by default. Specifying -mno-long-calls
18532 restores the default behavior, as does placing the function calls
18533 within the scope of a "#pragma long_calls_off" directive. Note
18534 these switches have no effect on how the compiler generates code to
18535 handle function calls via function pointers.
18536
18537 -msingle-pic-base
18538 Treat the register used for PIC addressing as read-only, rather
18539 than loading it in the prologue for each function. The runtime
18540 system is responsible for initializing this register with an
18541 appropriate value before execution begins.
18542
18543 -mpic-register=reg
18544 Specify the register to be used for PIC addressing. For standard
18545 PIC base case, the default is any suitable register determined by
18546 compiler. For single PIC base case, the default is R9 if target is
18547 EABI based or stack-checking is enabled, otherwise the default is
18548 R10.
18549
18550 -mpic-data-is-text-relative
18551 Assume that the displacement between the text and data segments is
18552 fixed at static link time. This permits using PC-relative
18553 addressing operations to access data known to be in the data
18554 segment. For non-VxWorks RTP targets, this option is enabled by
18555 default. When disabled on such targets, it will enable
18556 -msingle-pic-base by default.
18557
18558 -mpoke-function-name
18559 Write the name of each function into the text section, directly
18560 preceding the function prologue. The generated code is similar to
18561 this:
18562
18563 t0
18564 .ascii "arm_poke_function_name", 0
18565 .align
18566 t1
18567 .word 0xff000000 + (t1 - t0)
18568 arm_poke_function_name
18569 mov ip, sp
18570 stmfd sp!, {fp, ip, lr, pc}
18571 sub fp, ip, #4
18572
18573 When performing a stack backtrace, code can inspect the value of
18574 "pc" stored at "fp + 0". If the trace function then looks at
18575 location "pc - 12" and the top 8 bits are set, then we know that
18576 there is a function name embedded immediately preceding this
18577 location and has length "((pc[-3]) & 0xff000000)".
18578
18579 -mthumb
18580 -marm
18581 Select between generating code that executes in ARM and Thumb
18582 states. The default for most configurations is to generate code
18583 that executes in ARM state, but the default can be changed by
18584 configuring GCC with the --with-mode=state configure option.
18585
18586 You can also override the ARM and Thumb mode for each function by
18587 using the "target("thumb")" and "target("arm")" function attributes
18588 or pragmas.
18589
18590 -mflip-thumb
18591 Switch ARM/Thumb modes on alternating functions. This option is
18592 provided for regression testing of mixed Thumb/ARM code generation,
18593 and is not intended for ordinary use in compiling code.
18594
18595 -mtpcs-frame
18596 Generate a stack frame that is compliant with the Thumb Procedure
18597 Call Standard for all non-leaf functions. (A leaf function is one
18598 that does not call any other functions.) The default is
18599 -mno-tpcs-frame.
18600
18601 -mtpcs-leaf-frame
18602 Generate a stack frame that is compliant with the Thumb Procedure
18603 Call Standard for all leaf functions. (A leaf function is one that
18604 does not call any other functions.) The default is
18605 -mno-apcs-leaf-frame.
18606
18607 -mcallee-super-interworking
18608 Gives all externally visible functions in the file being compiled
18609 an ARM instruction set header which switches to Thumb mode before
18610 executing the rest of the function. This allows these functions to
18611 be called from non-interworking code. This option is not valid in
18612 AAPCS configurations because interworking is enabled by default.
18613
18614 -mcaller-super-interworking
18615 Allows calls via function pointers (including virtual functions) to
18616 execute correctly regardless of whether the target code has been
18617 compiled for interworking or not. There is a small overhead in the
18618 cost of executing a function pointer if this option is enabled.
18619 This option is not valid in AAPCS configurations because
18620 interworking is enabled by default.
18621
18622 -mtp=name
18623 Specify the access model for the thread local storage pointer. The
18624 valid models are soft, which generates calls to "__aeabi_read_tp",
18625 cp15, which fetches the thread pointer from "cp15" directly
18626 (supported in the arm6k architecture), and auto, which uses the
18627 best available method for the selected processor. The default
18628 setting is auto.
18629
18630 -mtls-dialect=dialect
18631 Specify the dialect to use for accessing thread local storage. Two
18632 dialects are supported---gnu and gnu2. The gnu dialect selects the
18633 original GNU scheme for supporting local and global dynamic TLS
18634 models. The gnu2 dialect selects the GNU descriptor scheme, which
18635 provides better performance for shared libraries. The GNU
18636 descriptor scheme is compatible with the original scheme, but does
18637 require new assembler, linker and library support. Initial and
18638 local exec TLS models are unaffected by this option and always use
18639 the original scheme.
18640
18641 -mword-relocations
18642 Only generate absolute relocations on word-sized values (i.e.
18643 R_ARM_ABS32). This is enabled by default on targets (uClinux,
18644 SymbianOS) where the runtime loader imposes this restriction, and
18645 when -fpic or -fPIC is specified. This option conflicts with
18646 -mslow-flash-data.
18647
18648 -mfix-cortex-m3-ldrd
18649 Some Cortex-M3 cores can cause data corruption when "ldrd"
18650 instructions with overlapping destination and base registers are
18651 used. This option avoids generating these instructions. This
18652 option is enabled by default when -mcpu=cortex-m3 is specified.
18653
18654 -mfix-cortex-a57-aes-1742098
18655 -mno-fix-cortex-a57-aes-1742098
18656 -mfix-cortex-a72-aes-1655431
18657 -mno-fix-cortex-a72-aes-1655431
18658 Enable (disable) mitigation for an erratum on Cortex-A57 and
18659 Cortex-A72 that affects the AES cryptographic instructions. This
18660 option is enabled by default when either -mcpu=cortex-a57 or
18661 -mcpu=cortex-a72 is specified.
18662
18663 -munaligned-access
18664 -mno-unaligned-access
18665 Enables (or disables) reading and writing of 16- and 32- bit values
18666 from addresses that are not 16- or 32- bit aligned. By default
18667 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18668 ARMv8-M Baseline architectures, and enabled for all other
18669 architectures. If unaligned access is not enabled then words in
18670 packed data structures are accessed a byte at a time.
18671
18672 The ARM attribute "Tag_CPU_unaligned_access" is set in the
18673 generated object file to either true or false, depending upon the
18674 setting of this option. If unaligned access is enabled then the
18675 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
18676
18677 -mneon-for-64bits
18678 This option is deprecated and has no effect.
18679
18680 -mslow-flash-data
18681 Assume loading data from flash is slower than fetching instruction.
18682 Therefore literal load is minimized for better performance. This
18683 option is only supported when compiling for ARMv7 M-profile and off
18684 by default. It conflicts with -mword-relocations.
18685
18686 -masm-syntax-unified
18687 Assume inline assembler is using unified asm syntax. The default
18688 is currently off which implies divided syntax. This option has no
18689 impact on Thumb2. However, this may change in future releases of
18690 GCC. Divided syntax should be considered deprecated.
18691
18692 -mrestrict-it
18693 Restricts generation of IT blocks to conform to the rules of
18694 ARMv8-A. IT blocks can only contain a single 16-bit instruction
18695 from a select set of instructions. This option is on by default for
18696 ARMv8-A Thumb mode.
18697
18698 -mprint-tune-info
18699 Print CPU tuning information as comment in assembler file. This is
18700 an option used only for regression testing of the compiler and not
18701 intended for ordinary use in compiling code. This option is
18702 disabled by default.
18703
18704 -mverbose-cost-dump
18705 Enable verbose cost model dumping in the debug dump files. This
18706 option is provided for use in debugging the compiler.
18707
18708 -mpure-code
18709 Do not allow constant data to be placed in code sections.
18710 Additionally, when compiling for ELF object format give all text
18711 sections the ELF processor-specific section attribute
18712 "SHF_ARM_PURECODE". This option is only available when generating
18713 non-pic code for M-profile targets.
18714
18715 -mcmse
18716 Generate secure code as per the "ARMv8-M Security Extensions:
18717 Requirements on Development Tools Engineering Specification", which
18718 can be found on
18719 <https://developer.arm.com/documentation/ecm0359818/latest/>.
18720
18721 -mfix-cmse-cve-2021-35465
18722 Mitigate against a potential security issue with the "VLLDM"
18723 instruction in some M-profile devices when using CMSE
18724 (CVE-2021-365465). This option is enabled by default when the
18725 option -mcpu= is used with "cortex-m33", "cortex-m35p" or
18726 "cortex-m55". The option -mno-fix-cmse-cve-2021-35465 can be used
18727 to disable the mitigation.
18728
18729 -mstack-protector-guard=guard
18730 -mstack-protector-guard-offset=offset
18731 Generate stack protection code using canary at guard. Supported
18732 locations are global for a global canary or tls for a canary
18733 accessible via the TLS register. The option
18734 -mstack-protector-guard-offset= is for use with
18735 -fstack-protector-guard=tls and not for use in user-land code.
18736
18737 -mfdpic
18738 -mno-fdpic
18739 Select the FDPIC ABI, which uses 64-bit function descriptors to
18740 represent pointers to functions. When the compiler is configured
18741 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
18742 and implies -fPIE if none of the PIC/PIE-related options is
18743 provided. On other targets, it only enables the FDPIC-specific
18744 code generation features, and the user should explicitly provide
18745 the PIC/PIE-related options as needed.
18746
18747 Note that static linking is not supported because it would still
18748 involve the dynamic linker when the program self-relocates. If
18749 such behavior is acceptable, use -static and -Wl,-dynamic-linker
18750 options.
18751
18752 The opposite -mno-fdpic option is useful (and required) to build
18753 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
18754 toolchain as the one used to build the userland programs.
18755
18756 AVR Options
18757
18758 These options are defined for AVR implementations:
18759
18760 -mmcu=mcu
18761 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18762
18763 The default for this option is avr2.
18764
18765 GCC supports the following AVR devices and ISAs:
18766
18767 "avr2"
18768 "Classic" devices with up to 8 KiB of program memory. mcu =
18769 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
18770 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
18771 "at90c8534", "at90s8515", "at90s8535".
18772
18773 "avr25"
18774 "Classic" devices with up to 8 KiB of program memory and with
18775 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
18776 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
18777 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
18778 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
18779 "attiny461a", "attiny4313", "attiny84", "attiny84a",
18780 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
18781 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
18782
18783 "avr3"
18784 "Classic" devices with 16 KiB up to 64 KiB of program memory.
18785 mcu = "at76c711", "at43usb355".
18786
18787 "avr31"
18788 "Classic" devices with 128 KiB of program memory. mcu =
18789 "atmega103", "at43usb320".
18790
18791 "avr35"
18792 "Classic" devices with 16 KiB up to 64 KiB of program memory
18793 and with the "MOVW" instruction. mcu = "attiny167",
18794 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
18795 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
18796
18797 "avr4"
18798 "Enhanced" devices with up to 8 KiB of program memory. mcu =
18799 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
18800 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
18801 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
18802 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
18803 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
18804 "at90pwm3b", "at90pwm81".
18805
18806 "avr5"
18807 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
18808 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
18809 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
18810 "atmega161", "atmega162", "atmega163", "atmega164a",
18811 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
18812 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
18813 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
18814 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
18815 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
18816 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
18817 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
18818 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
18819 "atmega328", "atmega328p", "atmega328pb", "atmega329",
18820 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
18821 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
18822 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
18823 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
18824 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
18825 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
18826 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
18827 "atmega649", "atmega649a", "atmega649p", "atmega6450",
18828 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
18829 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
18830 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
18831 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
18832 "at90pwm316", "at90can32", "at90can64", "at90scr100",
18833 "at90usb646", "at90usb647", "at94k", "m3000".
18834
18835 "avr51"
18836 "Enhanced" devices with 128 KiB of program memory. mcu =
18837 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
18838 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
18839 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
18840
18841 "avr6"
18842 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
18843 of program memory. mcu = "atmega256rfr2", "atmega2560",
18844 "atmega2561", "atmega2564rfr2".
18845
18846 "avrxmega2"
18847 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
18848 program memory. mcu = "atxmega8e5", "atxmega16a4",
18849 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
18850 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
18851 "atxmega32d3", "atxmega32d4", "atxmega32e5".
18852
18853 "avrxmega3"
18854 "XMEGA" devices with up to 64 KiB of combined program memory
18855 and RAM, and with program memory visible in the RAM address
18856 space. mcu = "attiny202", "attiny204", "attiny212",
18857 "attiny214", "attiny402", "attiny404", "attiny406",
18858 "attiny412", "attiny414", "attiny416", "attiny417",
18859 "attiny804", "attiny806", "attiny807", "attiny814",
18860 "attiny816", "attiny817", "attiny1604", "attiny1606",
18861 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
18862 "attiny3214", "attiny3216", "attiny3217", "atmega808",
18863 "atmega809", "atmega1608", "atmega1609", "atmega3208",
18864 "atmega3209", "atmega4808", "atmega4809".
18865
18866 "avrxmega4"
18867 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18868 program memory. mcu = "atxmega64a3", "atxmega64a3u",
18869 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
18870 "atxmega64d3", "atxmega64d4".
18871
18872 "avrxmega5"
18873 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18874 program memory and more than 64 KiB of RAM. mcu =
18875 "atxmega64a1", "atxmega64a1u".
18876
18877 "avrxmega6"
18878 "XMEGA" devices with more than 128 KiB of program memory. mcu
18879 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
18880 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
18881 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
18882 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
18883 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
18884 "atxmega256d3", "atxmega384c3", "atxmega384d3".
18885
18886 "avrxmega7"
18887 "XMEGA" devices with more than 128 KiB of program memory and
18888 more than 64 KiB of RAM. mcu = "atxmega128a1",
18889 "atxmega128a1u", "atxmega128a4u".
18890
18891 "avrtiny"
18892 "TINY" Tiny core devices with 512 B up to 4 KiB of program
18893 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
18894 "attiny20", "attiny40".
18895
18896 "avr1"
18897 This ISA is implemented by the minimal AVR core and supported
18898 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
18899 "attiny28", "at90s1200".
18900
18901 -mabsdata
18902 Assume that all data in static storage can be accessed by LDS / STS
18903 instructions. This option has only an effect on reduced Tiny
18904 devices like ATtiny40. See also the "absdata" AVR Variable
18905 Attributes,variable attribute.
18906
18907 -maccumulate-args
18908 Accumulate outgoing function arguments and acquire/release the
18909 needed stack space for outgoing function arguments once in function
18910 prologue/epilogue. Without this option, outgoing arguments are
18911 pushed before calling a function and popped afterwards.
18912
18913 Popping the arguments after the function call can be expensive on
18914 AVR so that accumulating the stack space might lead to smaller
18915 executables because arguments need not be removed from the stack
18916 after such a function call.
18917
18918 This option can lead to reduced code size for functions that
18919 perform several calls to functions that get their arguments on the
18920 stack like calls to printf-like functions.
18921
18922 -mbranch-cost=cost
18923 Set the branch costs for conditional branch instructions to cost.
18924 Reasonable values for cost are small, non-negative integers. The
18925 default branch cost is 0.
18926
18927 -mcall-prologues
18928 Functions prologues/epilogues are expanded as calls to appropriate
18929 subroutines. Code size is smaller.
18930
18931 -mdouble=bits
18932 -mlong-double=bits
18933 Set the size (in bits) of the "double" or "long double" type,
18934 respectively. Possible values for bits are 32 and 64. Whether or
18935 not a specific value for bits is allowed depends on the
18936 "--with-double=" and "--with-long-double=" configure options
18937 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18938 applies for the default values of the options.
18939
18940 -mgas-isr-prologues
18941 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18942 instruction supported by GNU Binutils. If this option is on, the
18943 feature can still be disabled for individual ISRs by means of the
18944 AVR Function Attributes,,"no_gccisr" function attribute. This
18945 feature is activated per default if optimization is on (but not
18946 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18947 PR21683 ("https://sourceware.org/PR21683").
18948
18949 -mint8
18950 Assume "int" to be 8-bit integer. This affects the sizes of all
18951 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18952 and "long long" is 4 bytes. Please note that this option does not
18953 conform to the C standards, but it results in smaller code size.
18954
18955 -mmain-is-OS_task
18956 Do not save registers in "main". The effect is the same like
18957 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18958 It is activated per default if optimization is on.
18959
18960 -mn-flash=num
18961 Assume that the flash memory has a size of num times 64 KiB.
18962
18963 -mno-interrupts
18964 Generated code is not compatible with hardware interrupts. Code
18965 size is smaller.
18966
18967 -mrelax
18968 Try to replace "CALL" resp. "JMP" instruction by the shorter
18969 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18970 just adds the --mlink-relax option to the assembler's command line
18971 and the --relax option to the linker's command line.
18972
18973 Jump relaxing is performed by the linker because jump offsets are
18974 not known before code is located. Therefore, the assembler code
18975 generated by the compiler is the same, but the instructions in the
18976 executable may differ from instructions in the assembler code.
18977
18978 Relaxing must be turned on if linker stubs are needed, see the
18979 section on "EIND" and linker stubs below.
18980
18981 -mrmw
18982 Assume that the device supports the Read-Modify-Write instructions
18983 "XCH", "LAC", "LAS" and "LAT".
18984
18985 -mshort-calls
18986 Assume that "RJMP" and "RCALL" can target the whole program memory.
18987
18988 This option is used internally for multilib selection. It is not
18989 an optimization option, and you don't need to set it by hand.
18990
18991 -msp8
18992 Treat the stack pointer register as an 8-bit register, i.e. assume
18993 the high byte of the stack pointer is zero. In general, you don't
18994 need to set this option by hand.
18995
18996 This option is used internally by the compiler to select and build
18997 multilibs for architectures "avr2" and "avr25". These
18998 architectures mix devices with and without "SPH". For any setting
18999 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
19000 removes this option from the compiler proper's command line,
19001 because the compiler then knows if the device or architecture has
19002 an 8-bit stack pointer and thus no "SPH" register or not.
19003
19004 -mstrict-X
19005 Use address register "X" in a way proposed by the hardware. This
19006 means that "X" is only used in indirect, post-increment or pre-
19007 decrement addressing.
19008
19009 Without this option, the "X" register may be used in the same way
19010 as "Y" or "Z" which then is emulated by additional instructions.
19011 For example, loading a value with "X+const" addressing with a small
19012 non-negative "const < 64" to a register Rn is performed as
19013
19014 adiw r26, const ; X += const
19015 ld <Rn>, X ; <Rn> = *X
19016 sbiw r26, const ; X -= const
19017
19018 -mtiny-stack
19019 Only change the lower 8 bits of the stack pointer.
19020
19021 -mfract-convert-truncate
19022 Allow to use truncation instead of rounding towards zero for
19023 fractional fixed-point types.
19024
19025 -nodevicelib
19026 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
19027
19028 -nodevicespecs
19029 Don't add -specs=device-specs/specs-mcu to the compiler driver's
19030 command line. The user takes responsibility for supplying the sub-
19031 processes like compiler proper, assembler and linker with
19032 appropriate command line options. This means that the user has to
19033 supply her private device specs file by means of -specs=path-to-
19034 specs-file. There is no more need for option -mmcu=mcu.
19035
19036 This option can also serve as a replacement for the older way of
19037 specifying custom device-specs files that needed -B some-path to
19038 point to a directory which contains a folder named "device-specs"
19039 which contains a specs file named "specs-mcu", where mcu was
19040 specified by -mmcu=mcu.
19041
19042 -Waddr-space-convert
19043 Warn about conversions between address spaces in the case where the
19044 resulting address space is not contained in the incoming address
19045 space.
19046
19047 -Wmisspelled-isr
19048 Warn if the ISR is misspelled, i.e. without __vector prefix.
19049 Enabled by default.
19050
19051 "EIND" and Devices with More Than 128 Ki Bytes of Flash
19052
19053 Pointers in the implementation are 16 bits wide. The address of a
19054 function or label is represented as word address so that indirect jumps
19055 and calls can target any code address in the range of 64 Ki words.
19056
19057 In order to facilitate indirect jump on devices with more than 128 Ki
19058 bytes of program memory space, there is a special function register
19059 called "EIND" that serves as most significant part of the target
19060 address when "EICALL" or "EIJMP" instructions are used.
19061
19062 Indirect jumps and calls on these devices are handled as follows by the
19063 compiler and are subject to some limitations:
19064
19065 * The compiler never sets "EIND".
19066
19067 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
19068 instructions or might read "EIND" directly in order to emulate an
19069 indirect call/jump by means of a "RET" instruction.
19070
19071 * The compiler assumes that "EIND" never changes during the startup
19072 code or during the application. In particular, "EIND" is not
19073 saved/restored in function or interrupt service routine
19074 prologue/epilogue.
19075
19076 * For indirect calls to functions and computed goto, the linker
19077 generates stubs. Stubs are jump pads sometimes also called
19078 trampolines. Thus, the indirect call/jump jumps to such a stub.
19079 The stub contains a direct jump to the desired address.
19080
19081 * Linker relaxation must be turned on so that the linker generates
19082 the stubs correctly in all situations. See the compiler option
19083 -mrelax and the linker option --relax. There are corner cases
19084 where the linker is supposed to generate stubs but aborts without
19085 relaxation and without a helpful error message.
19086
19087 * The default linker script is arranged for code with "EIND = 0". If
19088 code is supposed to work for a setup with "EIND != 0", a custom
19089 linker script has to be used in order to place the sections whose
19090 name start with ".trampolines" into the segment where "EIND" points
19091 to.
19092
19093 * The startup code from libgcc never sets "EIND". Notice that
19094 startup code is a blend of code from libgcc and AVR-LibC. For the
19095 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
19096 ("http://nongnu.org/avr-libc/user-manual/").
19097
19098 * It is legitimate for user-specific startup code to set up "EIND"
19099 early, for example by means of initialization code located in
19100 section ".init3". Such code runs prior to general startup code that
19101 initializes RAM and calls constructors, but after the bit of
19102 startup code from AVR-LibC that sets "EIND" to the segment where
19103 the vector table is located.
19104
19105 #include <avr/io.h>
19106
19107 static void
19108 __attribute__((section(".init3"),naked,used,no_instrument_function))
19109 init3_set_eind (void)
19110 {
19111 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19112 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19113 }
19114
19115 The "__trampolines_start" symbol is defined in the linker script.
19116
19117 * Stubs are generated automatically by the linker if the following
19118 two conditions are met:
19119
19120 -<The address of a label is taken by means of the "gs" modifier>
19121 (short for generate stubs) like so:
19122
19123 LDI r24, lo8(gs(<func>))
19124 LDI r25, hi8(gs(<func>))
19125
19126 -<The final location of that label is in a code segment>
19127 outside the segment where the stubs are located.
19128
19129 * The compiler emits such "gs" modifiers for code labels in the
19130 following situations:
19131
19132 -<Taking address of a function or code label.>
19133 -<Computed goto.>
19134 -<If prologue-save function is used, see -mcall-prologues>
19135 command-line option.
19136
19137 -<Switch/case dispatch tables. If you do not want such dispatch>
19138 tables you can specify the -fno-jump-tables command-line
19139 option.
19140
19141 -<C and C++ constructors/destructors called during
19142 startup/shutdown.>
19143 -<If the tools hit a "gs()" modifier explained above.>
19144 * Jumping to non-symbolic addresses like so is not supported:
19145
19146 int main (void)
19147 {
19148 /* Call function at word address 0x2 */
19149 return ((int(*)(void)) 0x2)();
19150 }
19151
19152 Instead, a stub has to be set up, i.e. the function has to be
19153 called through a symbol ("func_4" in the example):
19154
19155 int main (void)
19156 {
19157 extern int func_4 (void);
19158
19159 /* Call function at byte address 0x4 */
19160 return func_4();
19161 }
19162
19163 and the application be linked with -Wl,--defsym,func_4=0x4.
19164 Alternatively, "func_4" can be defined in the linker script.
19165
19166 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
19167 Registers
19168
19169 Some AVR devices support memories larger than the 64 KiB range that can
19170 be accessed with 16-bit pointers. To access memory locations outside
19171 this 64 KiB range, the content of a "RAMP" register is used as high
19172 part of the address: The "X", "Y", "Z" address register is concatenated
19173 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
19174 respectively, to get a wide address. Similarly, "RAMPD" is used
19175 together with direct addressing.
19176
19177 * The startup code initializes the "RAMP" special function registers
19178 with zero.
19179
19180 * If a AVR Named Address Spaces,named address space other than
19181 generic or "__flash" is used, then "RAMPZ" is set as needed before
19182 the operation.
19183
19184 * If the device supports RAM larger than 64 KiB and the compiler
19185 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
19186 reset to zero after the operation.
19187
19188 * If the device comes with a specific "RAMP" register, the ISR
19189 prologue/epilogue saves/restores that SFR and initializes it with
19190 zero in case the ISR code might (implicitly) use it.
19191
19192 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
19193 you use inline assembler to read from locations outside the 16-bit
19194 address range and change one of the "RAMP" registers, you must
19195 reset it to zero after the access.
19196
19197 AVR Built-in Macros
19198
19199 GCC defines several built-in macros so that the user code can test for
19200 the presence or absence of features. Almost any of the following
19201 built-in macros are deduced from device capabilities and thus triggered
19202 by the -mmcu= command-line option.
19203
19204 For even more AVR-specific built-in macros see AVR Named Address Spaces
19205 and AVR Built-in Functions.
19206
19207 "__AVR_ARCH__"
19208 Build-in macro that resolves to a decimal number that identifies
19209 the architecture and depends on the -mmcu=mcu option. Possible
19210 values are:
19211
19212 2, 25, 3, 31, 35, 4, 5, 51, 6
19213
19214 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
19215 "avr51", "avr6",
19216
19217 respectively and
19218
19219 100, 102, 103, 104, 105, 106, 107
19220
19221 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
19222 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
19223 specifies a device, this built-in macro is set accordingly. For
19224 example, with -mmcu=atmega8 the macro is defined to 4.
19225
19226 "__AVR_Device__"
19227 Setting -mmcu=device defines this built-in macro which reflects the
19228 device's name. For example, -mmcu=atmega8 defines the built-in
19229 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
19230 "__AVR_ATtiny261A__", etc.
19231
19232 The built-in macros' names follow the scheme "__AVR_Device__" where
19233 Device is the device name as from the AVR user manual. The
19234 difference between Device in the built-in macro and device in
19235 -mmcu=device is that the latter is always lowercase.
19236
19237 If device is not a device but only a core architecture like avr51,
19238 this macro is not defined.
19239
19240 "__AVR_DEVICE_NAME__"
19241 Setting -mmcu=device defines this built-in macro to the device's
19242 name. For example, with -mmcu=atmega8 the macro is defined to
19243 "atmega8".
19244
19245 If device is not a device but only a core architecture like avr51,
19246 this macro is not defined.
19247
19248 "__AVR_XMEGA__"
19249 The device / architecture belongs to the XMEGA family of devices.
19250
19251 "__AVR_HAVE_ELPM__"
19252 The device has the "ELPM" instruction.
19253
19254 "__AVR_HAVE_ELPMX__"
19255 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
19256
19257 "__AVR_HAVE_MOVW__"
19258 The device has the "MOVW" instruction to perform 16-bit register-
19259 register moves.
19260
19261 "__AVR_HAVE_LPMX__"
19262 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
19263
19264 "__AVR_HAVE_MUL__"
19265 The device has a hardware multiplier.
19266
19267 "__AVR_HAVE_JMP_CALL__"
19268 The device has the "JMP" and "CALL" instructions. This is the case
19269 for devices with more than 8 KiB of program memory.
19270
19271 "__AVR_HAVE_EIJMP_EICALL__"
19272 "__AVR_3_BYTE_PC__"
19273 The device has the "EIJMP" and "EICALL" instructions. This is the
19274 case for devices with more than 128 KiB of program memory. This
19275 also means that the program counter (PC) is 3 bytes wide.
19276
19277 "__AVR_2_BYTE_PC__"
19278 The program counter (PC) is 2 bytes wide. This is the case for
19279 devices with up to 128 KiB of program memory.
19280
19281 "__AVR_HAVE_8BIT_SP__"
19282 "__AVR_HAVE_16BIT_SP__"
19283 The stack pointer (SP) register is treated as 8-bit respectively
19284 16-bit register by the compiler. The definition of these macros is
19285 affected by -mtiny-stack.
19286
19287 "__AVR_HAVE_SPH__"
19288 "__AVR_SP8__"
19289 The device has the SPH (high part of stack pointer) special
19290 function register or has an 8-bit stack pointer, respectively. The
19291 definition of these macros is affected by -mmcu= and in the cases
19292 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
19293
19294 "__AVR_HAVE_RAMPD__"
19295 "__AVR_HAVE_RAMPX__"
19296 "__AVR_HAVE_RAMPY__"
19297 "__AVR_HAVE_RAMPZ__"
19298 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
19299 function register, respectively.
19300
19301 "__NO_INTERRUPTS__"
19302 This macro reflects the -mno-interrupts command-line option.
19303
19304 "__AVR_ERRATA_SKIP__"
19305 "__AVR_ERRATA_SKIP_JMP_CALL__"
19306 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19307 instructions because of a hardware erratum. Skip instructions are
19308 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
19309 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
19310
19311 "__AVR_ISA_RMW__"
19312 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
19313 LAT).
19314
19315 "__AVR_SFR_OFFSET__=offset"
19316 Instructions that can address I/O special function registers
19317 directly like "IN", "OUT", "SBI", etc. may use a different address
19318 as if addressed by an instruction to access RAM like "LD" or "STS".
19319 This offset depends on the device architecture and has to be
19320 subtracted from the RAM address in order to get the respective I/O
19321 address.
19322
19323 "__AVR_SHORT_CALLS__"
19324 The -mshort-calls command line option is set.
19325
19326 "__AVR_PM_BASE_ADDRESS__=addr"
19327 Some devices support reading from flash memory by means of "LD*"
19328 instructions. The flash memory is seen in the data address space
19329 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
19330 defined, this feature is not available. If defined, the address
19331 space is linear and there is no need to put ".rodata" into RAM.
19332 This is handled by the default linker description file, and is
19333 currently available for "avrtiny" and "avrxmega3". Even more
19334 convenient, there is no need to use address spaces like "__flash"
19335 or features like attribute "progmem" and "pgm_read_*".
19336
19337 "__WITH_AVRLIBC__"
19338 The compiler is configured to be used together with AVR-Libc. See
19339 the --with-avrlibc configure option.
19340
19341 "__HAVE_DOUBLE_MULTILIB__"
19342 Defined if -mdouble= acts as a multilib option.
19343
19344 "__HAVE_DOUBLE32__"
19345 "__HAVE_DOUBLE64__"
19346 Defined if the compiler supports 32-bit double resp. 64-bit double.
19347 The actual layout is specified by option -mdouble=.
19348
19349 "__DEFAULT_DOUBLE__"
19350 The size in bits of "double" if -mdouble= is not set. To test the
19351 layout of "double" in a program, use the built-in macro
19352 "__SIZEOF_DOUBLE__".
19353
19354 "__HAVE_LONG_DOUBLE32__"
19355 "__HAVE_LONG_DOUBLE64__"
19356 "__HAVE_LONG_DOUBLE_MULTILIB__"
19357 "__DEFAULT_LONG_DOUBLE__"
19358 Same as above, but for "long double" instead of "double".
19359
19360 "__WITH_DOUBLE_COMPARISON__"
19361 Reflects the "--with-double-comparison={tristate|bool|libf7}"
19362 configure option ("https://gcc.gnu.org/install/configure.html#avr")
19363 and is defined to 2 or 3.
19364
19365 "__WITH_LIBF7_LIBGCC__"
19366 "__WITH_LIBF7_MATH__"
19367 "__WITH_LIBF7_MATH_SYMBOLS__"
19368 Reflects the "--with-libf7={libgcc|math|math-symbols}"
19369 configure option
19370 ("https://gcc.gnu.org/install/configure.html#avr").
19371
19372 Blackfin Options
19373
19374 -mcpu=cpu[-sirevision]
19375 Specifies the name of the target Blackfin processor. Currently,
19376 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
19377 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
19378 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
19379 bf547m, bf548m, bf549m, bf561, bf592.
19380
19381 The optional sirevision specifies the silicon revision of the
19382 target Blackfin processor. Any workarounds available for the
19383 targeted silicon revision are enabled. If sirevision is none, no
19384 workarounds are enabled. If sirevision is any, all workarounds for
19385 the targeted processor are enabled. The "__SILICON_REVISION__"
19386 macro is defined to two hexadecimal digits representing the major
19387 and minor numbers in the silicon revision. If sirevision is none,
19388 the "__SILICON_REVISION__" is not defined. If sirevision is any,
19389 the "__SILICON_REVISION__" is defined to be 0xffff. If this
19390 optional sirevision is not used, GCC assumes the latest known
19391 silicon revision of the targeted Blackfin processor.
19392
19393 GCC defines a preprocessor macro for the specified cpu. For the
19394 bfin-elf toolchain, this option causes the hardware BSP provided by
19395 libgloss to be linked in if -msim is not given.
19396
19397 Without this option, bf532 is used as the processor by default.
19398
19399 Note that support for bf561 is incomplete. For bf561, only the
19400 preprocessor macro is defined.
19401
19402 -msim
19403 Specifies that the program will be run on the simulator. This
19404 causes the simulator BSP provided by libgloss to be linked in.
19405 This option has effect only for bfin-elf toolchain. Certain other
19406 options, such as -mid-shared-library and -mfdpic, imply -msim.
19407
19408 -momit-leaf-frame-pointer
19409 Don't keep the frame pointer in a register for leaf functions.
19410 This avoids the instructions to save, set up and restore frame
19411 pointers and makes an extra register available in leaf functions.
19412
19413 -mspecld-anomaly
19414 When enabled, the compiler ensures that the generated code does not
19415 contain speculative loads after jump instructions. If this option
19416 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
19417
19418 -mno-specld-anomaly
19419 Don't generate extra code to prevent speculative loads from
19420 occurring.
19421
19422 -mcsync-anomaly
19423 When enabled, the compiler ensures that the generated code does not
19424 contain CSYNC or SSYNC instructions too soon after conditional
19425 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
19426 is defined.
19427
19428 -mno-csync-anomaly
19429 Don't generate extra code to prevent CSYNC or SSYNC instructions
19430 from occurring too soon after a conditional branch.
19431
19432 -mlow64k
19433 When enabled, the compiler is free to take advantage of the
19434 knowledge that the entire program fits into the low 64k of memory.
19435
19436 -mno-low64k
19437 Assume that the program is arbitrarily large. This is the default.
19438
19439 -mstack-check-l1
19440 Do stack checking using information placed into L1 scratchpad
19441 memory by the uClinux kernel.
19442
19443 -mid-shared-library
19444 Generate code that supports shared libraries via the library ID
19445 method. This allows for execute in place and shared libraries in
19446 an environment without virtual memory management. This option
19447 implies -fPIC. With a bfin-elf target, this option implies -msim.
19448
19449 -mno-id-shared-library
19450 Generate code that doesn't assume ID-based shared libraries are
19451 being used. This is the default.
19452
19453 -mleaf-id-shared-library
19454 Generate code that supports shared libraries via the library ID
19455 method, but assumes that this library or executable won't link
19456 against any other ID shared libraries. That allows the compiler to
19457 use faster code for jumps and calls.
19458
19459 -mno-leaf-id-shared-library
19460 Do not assume that the code being compiled won't link against any
19461 ID shared libraries. Slower code is generated for jump and call
19462 insns.
19463
19464 -mshared-library-id=n
19465 Specifies the identification number of the ID-based shared library
19466 being compiled. Specifying a value of 0 generates more compact
19467 code; specifying other values forces the allocation of that number
19468 to the current library but is no more space- or time-efficient than
19469 omitting this option.
19470
19471 -msep-data
19472 Generate code that allows the data segment to be located in a
19473 different area of memory from the text segment. This allows for
19474 execute in place in an environment without virtual memory
19475 management by eliminating relocations against the text section.
19476
19477 -mno-sep-data
19478 Generate code that assumes that the data segment follows the text
19479 segment. This is the default.
19480
19481 -mlong-calls
19482 -mno-long-calls
19483 Tells the compiler to perform function calls by first loading the
19484 address of the function into a register and then performing a
19485 subroutine call on this register. This switch is needed if the
19486 target function lies outside of the 24-bit addressing range of the
19487 offset-based version of subroutine call instruction.
19488
19489 This feature is not enabled by default. Specifying -mno-long-calls
19490 restores the default behavior. Note these switches have no effect
19491 on how the compiler generates code to handle function calls via
19492 function pointers.
19493
19494 -mfast-fp
19495 Link with the fast floating-point library. This library relaxes
19496 some of the IEEE floating-point standard's rules for checking
19497 inputs against Not-a-Number (NAN), in the interest of performance.
19498
19499 -minline-plt
19500 Enable inlining of PLT entries in function calls to functions that
19501 are not known to bind locally. It has no effect without -mfdpic.
19502
19503 -mmulticore
19504 Build a standalone application for multicore Blackfin processors.
19505 This option causes proper start files and link scripts supporting
19506 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
19507 can only be used with -mcpu=bf561[-sirevision].
19508
19509 This option can be used with -mcorea or -mcoreb, which selects the
19510 one-application-per-core programming model. Without -mcorea or
19511 -mcoreb, the single-application/dual-core programming model is
19512 used. In this model, the main function of Core B should be named as
19513 "coreb_main".
19514
19515 If this option is not used, the single-core application programming
19516 model is used.
19517
19518 -mcorea
19519 Build a standalone application for Core A of BF561 when using the
19520 one-application-per-core programming model. Proper start files and
19521 link scripts are used to support Core A, and the macro
19522 "__BFIN_COREA" is defined. This option can only be used in
19523 conjunction with -mmulticore.
19524
19525 -mcoreb
19526 Build a standalone application for Core B of BF561 when using the
19527 one-application-per-core programming model. Proper start files and
19528 link scripts are used to support Core B, and the macro
19529 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
19530 should be used instead of "main". This option can only be used in
19531 conjunction with -mmulticore.
19532
19533 -msdram
19534 Build a standalone application for SDRAM. Proper start files and
19535 link scripts are used to put the application into SDRAM, and the
19536 macro "__BFIN_SDRAM" is defined. The loader should initialize
19537 SDRAM before loading the application.
19538
19539 -micplb
19540 Assume that ICPLBs are enabled at run time. This has an effect on
19541 certain anomaly workarounds. For Linux targets, the default is to
19542 assume ICPLBs are enabled; for standalone applications the default
19543 is off.
19544
19545 C6X Options
19546
19547 -march=name
19548 This specifies the name of the target architecture. GCC uses this
19549 name to determine what kind of instructions it can emit when
19550 generating assembly code. Permissible names are: c62x, c64x,
19551 c64x+, c67x, c67x+, c674x.
19552
19553 -mbig-endian
19554 Generate code for a big-endian target.
19555
19556 -mlittle-endian
19557 Generate code for a little-endian target. This is the default.
19558
19559 -msim
19560 Choose startup files and linker script suitable for the simulator.
19561
19562 -msdata=default
19563 Put small global and static data in the ".neardata" section, which
19564 is pointed to by register "B14". Put small uninitialized global
19565 and static data in the ".bss" section, which is adjacent to the
19566 ".neardata" section. Put small read-only data into the ".rodata"
19567 section. The corresponding sections used for large pieces of data
19568 are ".fardata", ".far" and ".const".
19569
19570 -msdata=all
19571 Put all data, not just small objects, into the sections reserved
19572 for small data, and use addressing relative to the "B14" register
19573 to access them.
19574
19575 -msdata=none
19576 Make no use of the sections reserved for small data, and use
19577 absolute addresses to access all data. Put all initialized global
19578 and static data in the ".fardata" section, and all uninitialized
19579 data in the ".far" section. Put all constant data into the
19580 ".const" section.
19581
19582 CRIS Options
19583
19584 These options are defined specifically for the CRIS ports.
19585
19586 -march=architecture-type
19587 -mcpu=architecture-type
19588 Generate code for the specified architecture. The choices for
19589 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
19590 ETRAX 100, and ETRAX 100 LX. Default is v0.
19591
19592 -mtune=architecture-type
19593 Tune to architecture-type everything applicable about the generated
19594 code, except for the ABI and the set of available instructions.
19595 The choices for architecture-type are the same as for
19596 -march=architecture-type.
19597
19598 -mmax-stack-frame=n
19599 Warn when the stack frame of a function exceeds n bytes.
19600
19601 -metrax4
19602 -metrax100
19603 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
19604 -march=v8 respectively.
19605
19606 -mmul-bug-workaround
19607 -mno-mul-bug-workaround
19608 Work around a bug in the "muls" and "mulu" instructions for CPU
19609 models where it applies. This option is disabled by default.
19610
19611 -mpdebug
19612 Enable CRIS-specific verbose debug-related information in the
19613 assembly code. This option also has the effect of turning off the
19614 #NO_APP formatted-code indicator to the assembler at the beginning
19615 of the assembly file.
19616
19617 -mcc-init
19618 Do not use condition-code results from previous instruction; always
19619 emit compare and test instructions before use of condition codes.
19620
19621 -mno-side-effects
19622 Do not emit instructions with side effects in addressing modes
19623 other than post-increment.
19624
19625 -mstack-align
19626 -mno-stack-align
19627 -mdata-align
19628 -mno-data-align
19629 -mconst-align
19630 -mno-const-align
19631 These options (no- options) arrange (eliminate arrangements) for
19632 the stack frame, individual data and constants to be aligned for
19633 the maximum single data access size for the chosen CPU model. The
19634 default is to arrange for 32-bit alignment. ABI details such as
19635 structure layout are not affected by these options.
19636
19637 -m32-bit
19638 -m16-bit
19639 -m8-bit
19640 Similar to the stack- data- and const-align options above, these
19641 options arrange for stack frame, writable data and constants to all
19642 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
19643 alignment.
19644
19645 -mno-prologue-epilogue
19646 -mprologue-epilogue
19647 With -mno-prologue-epilogue, the normal function prologue and
19648 epilogue which set up the stack frame are omitted and no return
19649 instructions or return sequences are generated in the code. Use
19650 this option only together with visual inspection of the compiled
19651 code: no warnings or errors are generated when call-saved registers
19652 must be saved, or storage for local variables needs to be
19653 allocated.
19654
19655 -melf
19656 Legacy no-op option.
19657
19658 -sim
19659 This option arranges to link with input-output functions from a
19660 simulator library. Code, initialized data and zero-initialized
19661 data are allocated consecutively.
19662
19663 -sim2
19664 Like -sim, but pass linker options to locate initialized data at
19665 0x40000000 and zero-initialized data at 0x80000000.
19666
19667 CR16 Options
19668
19669 These options are defined specifically for the CR16 ports.
19670
19671 -mmac
19672 Enable the use of multiply-accumulate instructions. Disabled by
19673 default.
19674
19675 -mcr16cplus
19676 -mcr16c
19677 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19678 is default.
19679
19680 -msim
19681 Links the library libsim.a which is in compatible with simulator.
19682 Applicable to ELF compiler only.
19683
19684 -mint32
19685 Choose integer type as 32-bit wide.
19686
19687 -mbit-ops
19688 Generates "sbit"/"cbit" instructions for bit manipulations.
19689
19690 -mdata-model=model
19691 Choose a data model. The choices for model are near, far or medium.
19692 medium is default. However, far is not valid with -mcr16c, as the
19693 CR16C architecture does not support the far data model.
19694
19695 C-SKY Options
19696
19697 GCC supports these options when compiling for C-SKY V2 processors.
19698
19699 -march=arch
19700 Specify the C-SKY target architecture. Valid values for arch are:
19701 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
19702
19703 -mcpu=cpu
19704 Specify the C-SKY target processor. Valid values for cpu are:
19705 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
19706 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
19707 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
19708 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
19709 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
19710 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
19711 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
19712 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
19713 ck810tv, ck810ft, and ck810ftv.
19714
19715 -mbig-endian
19716 -EB
19717 -mlittle-endian
19718 -EL Select big- or little-endian code. The default is little-endian.
19719
19720 -mfloat-abi=name
19721 Specifies which floating-point ABI to use. Permissible values are:
19722 soft, softfp and hard.
19723
19724 Specifying soft causes GCC to generate output containing library
19725 calls for floating-point operations. softfp allows the generation
19726 of code using hardware floating-point instructions, but still uses
19727 the soft-float calling conventions. hard allows generation of
19728 floating-point instructions and uses FPU-specific calling
19729 conventions.
19730
19731 The default depends on the specific target configuration. Note
19732 that the hard-float and soft-float ABIs are not link-compatible;
19733 you must compile your entire program with the same ABI, and link
19734 with a compatible set of libraries.
19735
19736 -mhard-float
19737 -msoft-float
19738 Select hardware or software floating-point implementations. The
19739 default is soft float.
19740
19741 -mdouble-float
19742 -mno-double-float
19743 When -mhard-float is in effect, enable generation of double-
19744 precision float instructions. This is the default except when
19745 compiling for CK803.
19746
19747 -mfdivdu
19748 -mno-fdivdu
19749 When -mhard-float is in effect, enable generation of "frecipd",
19750 "fsqrtd", and "fdivd" instructions. This is the default except
19751 when compiling for CK803.
19752
19753 -mfpu=fpu
19754 Select the floating-point processor. This option can only be used
19755 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
19756 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
19757 and fpv2_divd (-mdouble-float -mdivdu).
19758
19759 -melrw
19760 -mno-elrw
19761 Enable the extended "lrw" instruction. This option defaults to on
19762 for CK801 and off otherwise.
19763
19764 -mistack
19765 -mno-istack
19766 Enable interrupt stack instructions; the default is off.
19767
19768 The -mistack option is required to handle the "interrupt" and "isr"
19769 function attributes.
19770
19771 -mmp
19772 Enable multiprocessor instructions; the default is off.
19773
19774 -mcp
19775 Enable coprocessor instructions; the default is off.
19776
19777 -mcache
19778 Enable coprocessor instructions; the default is off.
19779
19780 -msecurity
19781 Enable C-SKY security instructions; the default is off.
19782
19783 -mtrust
19784 Enable C-SKY trust instructions; the default is off.
19785
19786 -mdsp
19787 -medsp
19788 -mvdsp
19789 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
19790 respectively. All of these options default to off.
19791
19792 -mdiv
19793 -mno-div
19794 Generate divide instructions. Default is off.
19795
19796 -msmart
19797 -mno-smart
19798 Generate code for Smart Mode, using only registers numbered 0-7 to
19799 allow use of 16-bit instructions. This option is ignored for CK801
19800 where this is the required behavior, and it defaults to on for
19801 CK802. For other targets, the default is off.
19802
19803 -mhigh-registers
19804 -mno-high-registers
19805 Generate code using the high registers numbered 16-31. This option
19806 is not supported on CK801, CK802, or CK803, and is enabled by
19807 default for other processors.
19808
19809 -manchor
19810 -mno-anchor
19811 Generate code using global anchor symbol addresses.
19812
19813 -mpushpop
19814 -mno-pushpop
19815 Generate code using "push" and "pop" instructions. This option
19816 defaults to on.
19817
19818 -mmultiple-stld
19819 -mstm
19820 -mno-multiple-stld
19821 -mno-stm
19822 Generate code using "stm" and "ldm" instructions. This option
19823 isn't supported on CK801 but is enabled by default on other
19824 processors.
19825
19826 -mconstpool
19827 -mno-constpool
19828 Create constant pools in the compiler instead of deferring it to
19829 the assembler. This option is the default and required for correct
19830 code generation on CK801 and CK802, and is optional on other
19831 processors.
19832
19833 -mstack-size
19834 -mno-stack-size
19835 Emit ".stack_size" directives for each function in the assembly
19836 output. This option defaults to off.
19837
19838 -mccrt
19839 -mno-ccrt
19840 Generate code for the C-SKY compiler runtime instead of libgcc.
19841 This option defaults to off.
19842
19843 -mbranch-cost=n
19844 Set the branch costs to roughly "n" instructions. The default is
19845 1.
19846
19847 -msched-prolog
19848 -mno-sched-prolog
19849 Permit scheduling of function prologue and epilogue sequences.
19850 Using this option can result in code that is not compliant with the
19851 C-SKY V2 ABI prologue requirements and that cannot be debugged or
19852 backtraced. It is disabled by default.
19853
19854 -msim
19855 Links the library libsemi.a which is in compatible with simulator.
19856 Applicable to ELF compiler only.
19857
19858 Darwin Options
19859
19860 These options are defined for all architectures running the Darwin
19861 operating system.
19862
19863 FSF GCC on Darwin does not create "fat" object files; it creates an
19864 object file for the single architecture that GCC was built to target.
19865 Apple's GCC on Darwin does create "fat" files if multiple -arch options
19866 are used; it does so by running the compiler or linker multiple times
19867 and joining the results together with lipo.
19868
19869 The subtype of the file created (like ppc7400 or ppc970 or i686) is
19870 determined by the flags that specify the ISA that GCC is targeting,
19871 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
19872 override this.
19873
19874 The Darwin tools vary in their behavior when presented with an ISA
19875 mismatch. The assembler, as, only permits instructions to be used that
19876 are valid for the subtype of the file it is generating, so you cannot
19877 put 64-bit instructions in a ppc750 object file. The linker for shared
19878 libraries, /usr/bin/libtool, fails and prints an error if asked to
19879 create a shared library with a less restrictive subtype than its input
19880 files (for instance, trying to put a ppc970 object file in a ppc7400
19881 library). The linker for executables, ld, quietly gives the executable
19882 the most restrictive subtype of any of its input files.
19883
19884 -Fdir
19885 Add the framework directory dir to the head of the list of
19886 directories to be searched for header files. These directories are
19887 interleaved with those specified by -I options and are scanned in a
19888 left-to-right order.
19889
19890 A framework directory is a directory with frameworks in it. A
19891 framework is a directory with a Headers and/or PrivateHeaders
19892 directory contained directly in it that ends in .framework. The
19893 name of a framework is the name of this directory excluding the
19894 .framework. Headers associated with the framework are found in one
19895 of those two directories, with Headers being searched first. A
19896 subframework is a framework directory that is in a framework's
19897 Frameworks directory. Includes of subframework headers can only
19898 appear in a header of a framework that contains the subframework,
19899 or in a sibling subframework header. Two subframeworks are
19900 siblings if they occur in the same framework. A subframework
19901 should not have the same name as a framework; a warning is issued
19902 if this is violated. Currently a subframework cannot have
19903 subframeworks; in the future, the mechanism may be extended to
19904 support this. The standard frameworks can be found in
19905 /System/Library/Frameworks and /Library/Frameworks. An example
19906 include looks like "#include <Framework/header.h>", where Framework
19907 denotes the name of the framework and header.h is found in the
19908 PrivateHeaders or Headers directory.
19909
19910 -iframeworkdir
19911 Like -F except the directory is a treated as a system directory.
19912 The main difference between this -iframework and -F is that with
19913 -iframework the compiler does not warn about constructs contained
19914 within header files found via dir. This option is valid only for
19915 the C family of languages.
19916
19917 -gused
19918 Emit debugging information for symbols that are used. For stabs
19919 debugging format, this enables -feliminate-unused-debug-symbols.
19920 This is by default ON.
19921
19922 -gfull
19923 Emit debugging information for all symbols and types.
19924
19925 -mmacosx-version-min=version
19926 The earliest version of MacOS X that this executable will run on is
19927 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19928
19929 If the compiler was built to use the system's headers by default,
19930 then the default for this option is the system version on which the
19931 compiler is running, otherwise the default is to make choices that
19932 are compatible with as many systems and code bases as possible.
19933
19934 -mkernel
19935 Enable kernel development mode. The -mkernel option sets -static,
19936 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19937 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19938 where applicable. This mode also sets -mno-altivec, -msoft-float,
19939 -fno-builtin and -mlong-branch for PowerPC targets.
19940
19941 -mone-byte-bool
19942 Override the defaults for "bool" so that "sizeof(bool)==1". By
19943 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19944 when compiling for Darwin/x86, so this option has no effect on x86.
19945
19946 Warning: The -mone-byte-bool switch causes GCC to generate code
19947 that is not binary compatible with code generated without that
19948 switch. Using this switch may require recompiling all other
19949 modules in a program, including system libraries. Use this switch
19950 to conform to a non-default data model.
19951
19952 -mfix-and-continue
19953 -ffix-and-continue
19954 -findirect-data
19955 Generate code suitable for fast turnaround development, such as to
19956 allow GDB to dynamically load .o files into already-running
19957 programs. -findirect-data and -ffix-and-continue are provided for
19958 backwards compatibility.
19959
19960 -all_load
19961 Loads all members of static archive libraries. See man ld(1) for
19962 more information.
19963
19964 -arch_errors_fatal
19965 Cause the errors having to do with files that have the wrong
19966 architecture to be fatal.
19967
19968 -bind_at_load
19969 Causes the output file to be marked such that the dynamic linker
19970 will bind all undefined references when the file is loaded or
19971 launched.
19972
19973 -bundle
19974 Produce a Mach-o bundle format file. See man ld(1) for more
19975 information.
19976
19977 -bundle_loader executable
19978 This option specifies the executable that will load the build
19979 output file being linked. See man ld(1) for more information.
19980
19981 -dynamiclib
19982 When passed this option, GCC produces a dynamic library instead of
19983 an executable when linking, using the Darwin libtool command.
19984
19985 -force_cpusubtype_ALL
19986 This causes GCC's output file to have the ALL subtype, instead of
19987 one controlled by the -mcpu or -march option.
19988
19989 -allowable_client client_name
19990 -client_name
19991 -compatibility_version
19992 -current_version
19993 -dead_strip
19994 -dependency-file
19995 -dylib_file
19996 -dylinker_install_name
19997 -dynamic
19998 -exported_symbols_list
19999 -filelist
20000 -flat_namespace
20001 -force_flat_namespace
20002 -headerpad_max_install_names
20003 -image_base
20004 -init
20005 -install_name
20006 -keep_private_externs
20007 -multi_module
20008 -multiply_defined
20009 -multiply_defined_unused
20010 -noall_load
20011 -no_dead_strip_inits_and_terms
20012 -nofixprebinding
20013 -nomultidefs
20014 -noprebind
20015 -noseglinkedit
20016 -pagezero_size
20017 -prebind
20018 -prebind_all_twolevel_modules
20019 -private_bundle
20020 -read_only_relocs
20021 -sectalign
20022 -sectobjectsymbols
20023 -whyload
20024 -seg1addr
20025 -sectcreate
20026 -sectobjectsymbols
20027 -sectorder
20028 -segaddr
20029 -segs_read_only_addr
20030 -segs_read_write_addr
20031 -seg_addr_table
20032 -seg_addr_table_filename
20033 -seglinkedit
20034 -segprot
20035 -segs_read_only_addr
20036 -segs_read_write_addr
20037 -single_module
20038 -static
20039 -sub_library
20040 -sub_umbrella
20041 -twolevel_namespace
20042 -umbrella
20043 -undefined
20044 -unexported_symbols_list
20045 -weak_reference_mismatches
20046 -whatsloaded
20047 These options are passed to the Darwin linker. The Darwin linker
20048 man page describes them in detail.
20049
20050 DEC Alpha Options
20051
20052 These -m options are defined for the DEC Alpha implementations:
20053
20054 -mno-soft-float
20055 -msoft-float
20056 Use (do not use) the hardware floating-point instructions for
20057 floating-point operations. When -msoft-float is specified,
20058 functions in libgcc.a are used to perform floating-point
20059 operations. Unless they are replaced by routines that emulate the
20060 floating-point operations, or compiled in such a way as to call
20061 such emulations routines, these routines issue floating-point
20062 operations. If you are compiling for an Alpha without floating-
20063 point operations, you must ensure that the library is built so as
20064 not to call them.
20065
20066 Note that Alpha implementations without floating-point operations
20067 are required to have floating-point registers.
20068
20069 -mfp-reg
20070 -mno-fp-regs
20071 Generate code that uses (does not use) the floating-point register
20072 set. -mno-fp-regs implies -msoft-float. If the floating-point
20073 register set is not used, floating-point operands are passed in
20074 integer registers as if they were integers and floating-point
20075 results are passed in $0 instead of $f0. This is a non-standard
20076 calling sequence, so any function with a floating-point argument or
20077 return value called by code compiled with -mno-fp-regs must also be
20078 compiled with that option.
20079
20080 A typical use of this option is building a kernel that does not
20081 use, and hence need not save and restore, any floating-point
20082 registers.
20083
20084 -mieee
20085 The Alpha architecture implements floating-point hardware optimized
20086 for maximum performance. It is mostly compliant with the IEEE
20087 floating-point standard. However, for full compliance, software
20088 assistance is required. This option generates code fully IEEE-
20089 compliant code except that the inexact-flag is not maintained (see
20090 below). If this option is turned on, the preprocessor macro
20091 "_IEEE_FP" is defined during compilation. The resulting code is
20092 less efficient but is able to correctly support denormalized
20093 numbers and exceptional IEEE values such as not-a-number and
20094 plus/minus infinity. Other Alpha compilers call this option
20095 -ieee_with_no_inexact.
20096
20097 -mieee-with-inexact
20098 This is like -mieee except the generated code also maintains the
20099 IEEE inexact-flag. Turning on this option causes the generated
20100 code to implement fully-compliant IEEE math. In addition to
20101 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
20102 On some Alpha implementations the resulting code may execute
20103 significantly slower than the code generated by default. Since
20104 there is very little code that depends on the inexact-flag, you
20105 should normally not specify this option. Other Alpha compilers
20106 call this option -ieee_with_inexact.
20107
20108 -mfp-trap-mode=trap-mode
20109 This option controls what floating-point related traps are enabled.
20110 Other Alpha compilers call this option -fptm trap-mode. The trap
20111 mode can be set to one of four values:
20112
20113 n This is the default (normal) setting. The only traps that are
20114 enabled are the ones that cannot be disabled in software (e.g.,
20115 division by zero trap).
20116
20117 u In addition to the traps enabled by n, underflow traps are
20118 enabled as well.
20119
20120 su Like u, but the instructions are marked to be safe for software
20121 completion (see Alpha architecture manual for details).
20122
20123 sui Like su, but inexact traps are enabled as well.
20124
20125 -mfp-rounding-mode=rounding-mode
20126 Selects the IEEE rounding mode. Other Alpha compilers call this
20127 option -fprm rounding-mode. The rounding-mode can be one of:
20128
20129 n Normal IEEE rounding mode. Floating-point numbers are rounded
20130 towards the nearest machine number or towards the even machine
20131 number in case of a tie.
20132
20133 m Round towards minus infinity.
20134
20135 c Chopped rounding mode. Floating-point numbers are rounded
20136 towards zero.
20137
20138 d Dynamic rounding mode. A field in the floating-point control
20139 register (fpcr, see Alpha architecture reference manual)
20140 controls the rounding mode in effect. The C library
20141 initializes this register for rounding towards plus infinity.
20142 Thus, unless your program modifies the fpcr, d corresponds to
20143 round towards plus infinity.
20144
20145 -mtrap-precision=trap-precision
20146 In the Alpha architecture, floating-point traps are imprecise.
20147 This means without software assistance it is impossible to recover
20148 from a floating trap and program execution normally needs to be
20149 terminated. GCC can generate code that can assist operating system
20150 trap handlers in determining the exact location that caused a
20151 floating-point trap. Depending on the requirements of an
20152 application, different levels of precisions can be selected:
20153
20154 p Program precision. This option is the default and means a trap
20155 handler can only identify which program caused a floating-point
20156 exception.
20157
20158 f Function precision. The trap handler can determine the
20159 function that caused a floating-point exception.
20160
20161 i Instruction precision. The trap handler can determine the
20162 exact instruction that caused a floating-point exception.
20163
20164 Other Alpha compilers provide the equivalent options called
20165 -scope_safe and -resumption_safe.
20166
20167 -mieee-conformant
20168 This option marks the generated code as IEEE conformant. You must
20169 not use this option unless you also specify -mtrap-precision=i and
20170 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
20171 to emit the line .eflag 48 in the function prologue of the
20172 generated assembly file.
20173
20174 -mbuild-constants
20175 Normally GCC examines a 32- or 64-bit integer constant to see if it
20176 can construct it from smaller constants in two or three
20177 instructions. If it cannot, it outputs the constant as a literal
20178 and generates code to load it from the data segment at run time.
20179
20180 Use this option to require GCC to construct all integer constants
20181 using code, even if it takes more instructions (the maximum is
20182 six).
20183
20184 You typically use this option to build a shared library dynamic
20185 loader. Itself a shared library, it must relocate itself in memory
20186 before it can find the variables and constants in its own data
20187 segment.
20188
20189 -mbwx
20190 -mno-bwx
20191 -mcix
20192 -mno-cix
20193 -mfix
20194 -mno-fix
20195 -mmax
20196 -mno-max
20197 Indicate whether GCC should generate code to use the optional BWX,
20198 CIX, FIX and MAX instruction sets. The default is to use the
20199 instruction sets supported by the CPU type specified via -mcpu=
20200 option or that of the CPU on which GCC was built if none is
20201 specified.
20202
20203 -mfloat-vax
20204 -mfloat-ieee
20205 Generate code that uses (does not use) VAX F and G floating-point
20206 arithmetic instead of IEEE single and double precision.
20207
20208 -mexplicit-relocs
20209 -mno-explicit-relocs
20210 Older Alpha assemblers provided no way to generate symbol
20211 relocations except via assembler macros. Use of these macros does
20212 not allow optimal instruction scheduling. GNU binutils as of
20213 version 2.12 supports a new syntax that allows the compiler to
20214 explicitly mark which relocations should apply to which
20215 instructions. This option is mostly useful for debugging, as GCC
20216 detects the capabilities of the assembler when it is built and sets
20217 the default accordingly.
20218
20219 -msmall-data
20220 -mlarge-data
20221 When -mexplicit-relocs is in effect, static data is accessed via
20222 gp-relative relocations. When -msmall-data is used, objects 8
20223 bytes long or smaller are placed in a small data area (the ".sdata"
20224 and ".sbss" sections) and are accessed via 16-bit relocations off
20225 of the $gp register. This limits the size of the small data area
20226 to 64KB, but allows the variables to be directly accessed via a
20227 single instruction.
20228
20229 The default is -mlarge-data. With this option the data area is
20230 limited to just below 2GB. Programs that require more than 2GB of
20231 data must use "malloc" or "mmap" to allocate the data in the heap
20232 instead of in the program's data segment.
20233
20234 When generating code for shared libraries, -fpic implies
20235 -msmall-data and -fPIC implies -mlarge-data.
20236
20237 -msmall-text
20238 -mlarge-text
20239 When -msmall-text is used, the compiler assumes that the code of
20240 the entire program (or shared library) fits in 4MB, and is thus
20241 reachable with a branch instruction. When -msmall-data is used,
20242 the compiler can assume that all local symbols share the same $gp
20243 value, and thus reduce the number of instructions required for a
20244 function call from 4 to 1.
20245
20246 The default is -mlarge-text.
20247
20248 -mcpu=cpu_type
20249 Set the instruction set and instruction scheduling parameters for
20250 machine type cpu_type. You can specify either the EV style name or
20251 the corresponding chip number. GCC supports scheduling parameters
20252 for the EV4, EV5 and EV6 family of processors and chooses the
20253 default values for the instruction set from the processor you
20254 specify. If you do not specify a processor type, GCC defaults to
20255 the processor on which the compiler was built.
20256
20257 Supported values for cpu_type are
20258
20259 ev4
20260 ev45
20261 21064
20262 Schedules as an EV4 and has no instruction set extensions.
20263
20264 ev5
20265 21164
20266 Schedules as an EV5 and has no instruction set extensions.
20267
20268 ev56
20269 21164a
20270 Schedules as an EV5 and supports the BWX extension.
20271
20272 pca56
20273 21164pc
20274 21164PC
20275 Schedules as an EV5 and supports the BWX and MAX extensions.
20276
20277 ev6
20278 21264
20279 Schedules as an EV6 and supports the BWX, FIX, and MAX
20280 extensions.
20281
20282 ev67
20283 21264a
20284 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
20285 extensions.
20286
20287 Native toolchains also support the value native, which selects the
20288 best architecture option for the host processor. -mcpu=native has
20289 no effect if GCC does not recognize the processor.
20290
20291 -mtune=cpu_type
20292 Set only the instruction scheduling parameters for machine type
20293 cpu_type. The instruction set is not changed.
20294
20295 Native toolchains also support the value native, which selects the
20296 best architecture option for the host processor. -mtune=native has
20297 no effect if GCC does not recognize the processor.
20298
20299 -mmemory-latency=time
20300 Sets the latency the scheduler should assume for typical memory
20301 references as seen by the application. This number is highly
20302 dependent on the memory access patterns used by the application and
20303 the size of the external cache on the machine.
20304
20305 Valid options for time are
20306
20307 number
20308 A decimal number representing clock cycles.
20309
20310 L1
20311 L2
20312 L3
20313 main
20314 The compiler contains estimates of the number of clock cycles
20315 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20316 (also called Dcache, Scache, and Bcache), as well as to main
20317 memory. Note that L3 is only valid for EV5.
20318
20319 eBPF Options
20320
20321 -mframe-limit=bytes
20322 This specifies the hard limit for frame sizes, in bytes.
20323 Currently, the value that can be specified should be less than or
20324 equal to 32767. Defaults to whatever limit is imposed by the
20325 version of the Linux kernel targeted.
20326
20327 -mkernel=version
20328 This specifies the minimum version of the kernel that will run the
20329 compiled program. GCC uses this version to determine which
20330 instructions to use, what kernel helpers to allow, etc. Currently,
20331 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
20332 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
20333 4.20, 5.0, 5.1, 5.2, latest and native.
20334
20335 -mbig-endian
20336 Generate code for a big-endian target.
20337
20338 -mlittle-endian
20339 Generate code for a little-endian target. This is the default.
20340
20341 -mjmpext
20342 Enable generation of extra conditional-branch instructions.
20343 Enabled for CPU v2 and above.
20344
20345 -mjmp32
20346 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
20347
20348 -malu32
20349 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
20350
20351 -mcpu=version
20352 This specifies which version of the eBPF ISA to target. Newer
20353 versions may not be supported by all kernels. The default is v3.
20354
20355 Supported values for version are:
20356
20357 v1 The first stable eBPF ISA with no special features or
20358 extensions.
20359
20360 v2 Supports the jump extensions, as in -mjmpext.
20361
20362 v3 All features of v2, plus:
20363
20364 -<32-bit jump operations, as in -mjmp32>
20365 -<32-bit ALU operations, as in -malu32>
20366 -mco-re
20367 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
20368 and is implied by -gbtf.
20369
20370 -mno-co-re
20371 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
20372 RE support is enabled by default when generating BTF debug
20373 information for the BPF target.
20374
20375 -mxbpf
20376 Generate code for an expanded version of BPF, which relaxes some of
20377 the restrictions imposed by the BPF architecture:
20378
20379 -<Save and restore callee-saved registers at function entry and>
20380 exit, respectively.
20381
20382 FR30 Options
20383
20384 These options are defined specifically for the FR30 port.
20385
20386 -msmall-model
20387 Use the small address space model. This can produce smaller code,
20388 but it does assume that all symbolic values and addresses fit into
20389 a 20-bit range.
20390
20391 -mno-lsim
20392 Assume that runtime support has been provided and so there is no
20393 need to include the simulator library (libsim.a) on the linker
20394 command line.
20395
20396 FT32 Options
20397
20398 These options are defined specifically for the FT32 port.
20399
20400 -msim
20401 Specifies that the program will be run on the simulator. This
20402 causes an alternate runtime startup and library to be linked. You
20403 must not use this option when generating programs that will run on
20404 real hardware; you must provide your own runtime library for
20405 whatever I/O functions are needed.
20406
20407 -mlra
20408 Enable Local Register Allocation. This is still experimental for
20409 FT32, so by default the compiler uses standard reload.
20410
20411 -mnodiv
20412 Do not use div and mod instructions.
20413
20414 -mft32b
20415 Enable use of the extended instructions of the FT32B processor.
20416
20417 -mcompress
20418 Compress all code using the Ft32B code compression scheme.
20419
20420 -mnopm
20421 Do not generate code that reads program memory.
20422
20423 FRV Options
20424
20425 -mgpr-32
20426 Only use the first 32 general-purpose registers.
20427
20428 -mgpr-64
20429 Use all 64 general-purpose registers.
20430
20431 -mfpr-32
20432 Use only the first 32 floating-point registers.
20433
20434 -mfpr-64
20435 Use all 64 floating-point registers.
20436
20437 -mhard-float
20438 Use hardware instructions for floating-point operations.
20439
20440 -msoft-float
20441 Use library routines for floating-point operations.
20442
20443 -malloc-cc
20444 Dynamically allocate condition code registers.
20445
20446 -mfixed-cc
20447 Do not try to dynamically allocate condition code registers, only
20448 use "icc0" and "fcc0".
20449
20450 -mdword
20451 Change ABI to use double word insns.
20452
20453 -mno-dword
20454 Do not use double word instructions.
20455
20456 -mdouble
20457 Use floating-point double instructions.
20458
20459 -mno-double
20460 Do not use floating-point double instructions.
20461
20462 -mmedia
20463 Use media instructions.
20464
20465 -mno-media
20466 Do not use media instructions.
20467
20468 -mmuladd
20469 Use multiply and add/subtract instructions.
20470
20471 -mno-muladd
20472 Do not use multiply and add/subtract instructions.
20473
20474 -mfdpic
20475 Select the FDPIC ABI, which uses function descriptors to represent
20476 pointers to functions. Without any PIC/PIE-related options, it
20477 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
20478 small data are within a 12-bit range from the GOT base address;
20479 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
20480 bfin-elf target, this option implies -msim.
20481
20482 -minline-plt
20483 Enable inlining of PLT entries in function calls to functions that
20484 are not known to bind locally. It has no effect without -mfdpic.
20485 It's enabled by default if optimizing for speed and compiling for
20486 shared libraries (i.e., -fPIC or -fpic), or when an optimization
20487 option such as -O3 or above is present in the command line.
20488
20489 -mTLS
20490 Assume a large TLS segment when generating thread-local code.
20491
20492 -mtls
20493 Do not assume a large TLS segment when generating thread-local
20494 code.
20495
20496 -mgprel-ro
20497 Enable the use of "GPREL" relocations in the FDPIC ABI for data
20498 that is known to be in read-only sections. It's enabled by
20499 default, except for -fpic or -fpie: even though it may help make
20500 the global offset table smaller, it trades 1 instruction for 4.
20501 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
20502 may be shared by multiple symbols, and it avoids the need for a GOT
20503 entry for the referenced symbol, so it's more likely to be a win.
20504 If it is not, -mno-gprel-ro can be used to disable it.
20505
20506 -multilib-library-pic
20507 Link with the (library, not FD) pic libraries. It's implied by
20508 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
20509 should never have to use it explicitly.
20510
20511 -mlinked-fp
20512 Follow the EABI requirement of always creating a frame pointer
20513 whenever a stack frame is allocated. This option is enabled by
20514 default and can be disabled with -mno-linked-fp.
20515
20516 -mlong-calls
20517 Use indirect addressing to call functions outside the current
20518 compilation unit. This allows the functions to be placed anywhere
20519 within the 32-bit address space.
20520
20521 -malign-labels
20522 Try to align labels to an 8-byte boundary by inserting NOPs into
20523 the previous packet. This option only has an effect when VLIW
20524 packing is enabled. It doesn't create new packets; it merely adds
20525 NOPs to existing ones.
20526
20527 -mlibrary-pic
20528 Generate position-independent EABI code.
20529
20530 -macc-4
20531 Use only the first four media accumulator registers.
20532
20533 -macc-8
20534 Use all eight media accumulator registers.
20535
20536 -mpack
20537 Pack VLIW instructions.
20538
20539 -mno-pack
20540 Do not pack VLIW instructions.
20541
20542 -mno-eflags
20543 Do not mark ABI switches in e_flags.
20544
20545 -mcond-move
20546 Enable the use of conditional-move instructions (default).
20547
20548 This switch is mainly for debugging the compiler and will likely be
20549 removed in a future version.
20550
20551 -mno-cond-move
20552 Disable the use of conditional-move instructions.
20553
20554 This switch is mainly for debugging the compiler and will likely be
20555 removed in a future version.
20556
20557 -mscc
20558 Enable the use of conditional set instructions (default).
20559
20560 This switch is mainly for debugging the compiler and will likely be
20561 removed in a future version.
20562
20563 -mno-scc
20564 Disable the use of conditional set instructions.
20565
20566 This switch is mainly for debugging the compiler and will likely be
20567 removed in a future version.
20568
20569 -mcond-exec
20570 Enable the use of conditional execution (default).
20571
20572 This switch is mainly for debugging the compiler and will likely be
20573 removed in a future version.
20574
20575 -mno-cond-exec
20576 Disable the use of conditional execution.
20577
20578 This switch is mainly for debugging the compiler and will likely be
20579 removed in a future version.
20580
20581 -mvliw-branch
20582 Run a pass to pack branches into VLIW instructions (default).
20583
20584 This switch is mainly for debugging the compiler and will likely be
20585 removed in a future version.
20586
20587 -mno-vliw-branch
20588 Do not run a pass to pack branches into VLIW instructions.
20589
20590 This switch is mainly for debugging the compiler and will likely be
20591 removed in a future version.
20592
20593 -mmulti-cond-exec
20594 Enable optimization of "&&" and "||" in conditional execution
20595 (default).
20596
20597 This switch is mainly for debugging the compiler and will likely be
20598 removed in a future version.
20599
20600 -mno-multi-cond-exec
20601 Disable optimization of "&&" and "||" in conditional execution.
20602
20603 This switch is mainly for debugging the compiler and will likely be
20604 removed in a future version.
20605
20606 -mnested-cond-exec
20607 Enable nested conditional execution optimizations (default).
20608
20609 This switch is mainly for debugging the compiler and will likely be
20610 removed in a future version.
20611
20612 -mno-nested-cond-exec
20613 Disable nested conditional execution optimizations.
20614
20615 This switch is mainly for debugging the compiler and will likely be
20616 removed in a future version.
20617
20618 -moptimize-membar
20619 This switch removes redundant "membar" instructions from the
20620 compiler-generated code. It is enabled by default.
20621
20622 -mno-optimize-membar
20623 This switch disables the automatic removal of redundant "membar"
20624 instructions from the generated code.
20625
20626 -mtomcat-stats
20627 Cause gas to print out tomcat statistics.
20628
20629 -mcpu=cpu
20630 Select the processor type for which to generate code. Possible
20631 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
20632 and simple.
20633
20634 GNU/Linux Options
20635
20636 These -m options are defined for GNU/Linux targets:
20637
20638 -mglibc
20639 Use the GNU C library. This is the default except on
20640 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
20641 targets.
20642
20643 -muclibc
20644 Use uClibc C library. This is the default on *-*-linux-*uclibc*
20645 targets.
20646
20647 -mmusl
20648 Use the musl C library. This is the default on *-*-linux-*musl*
20649 targets.
20650
20651 -mbionic
20652 Use Bionic C library. This is the default on *-*-linux-*android*
20653 targets.
20654
20655 -mandroid
20656 Compile code compatible with Android platform. This is the default
20657 on *-*-linux-*android* targets.
20658
20659 When compiling, this option enables -mbionic, -fPIC,
20660 -fno-exceptions and -fno-rtti by default. When linking, this
20661 option makes the GCC driver pass Android-specific options to the
20662 linker. Finally, this option causes the preprocessor macro
20663 "__ANDROID__" to be defined.
20664
20665 -tno-android-cc
20666 Disable compilation effects of -mandroid, i.e., do not enable
20667 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
20668
20669 -tno-android-ld
20670 Disable linking effects of -mandroid, i.e., pass standard Linux
20671 linking options to the linker.
20672
20673 H8/300 Options
20674
20675 These -m options are defined for the H8/300 implementations:
20676
20677 -mrelax
20678 Shorten some address references at link time, when possible; uses
20679 the linker option -relax.
20680
20681 -mh Generate code for the H8/300H.
20682
20683 -ms Generate code for the H8S.
20684
20685 -mn Generate code for the H8S and H8/300H in the normal mode. This
20686 switch must be used either with -mh or -ms.
20687
20688 -ms2600
20689 Generate code for the H8S/2600. This switch must be used with -ms.
20690
20691 -mexr
20692 Extended registers are stored on stack before execution of function
20693 with monitor attribute. Default option is -mexr. This option is
20694 valid only for H8S targets.
20695
20696 -mno-exr
20697 Extended registers are not stored on stack before execution of
20698 function with monitor attribute. Default option is -mno-exr. This
20699 option is valid only for H8S targets.
20700
20701 -mint32
20702 Make "int" data 32 bits by default.
20703
20704 -malign-300
20705 On the H8/300H and H8S, use the same alignment rules as for the
20706 H8/300. The default for the H8/300H and H8S is to align longs and
20707 floats on 4-byte boundaries. -malign-300 causes them to be aligned
20708 on 2-byte boundaries. This option has no effect on the H8/300.
20709
20710 HPPA Options
20711
20712 These -m options are defined for the HPPA family of computers:
20713
20714 -march=architecture-type
20715 Generate code for the specified architecture. The choices for
20716 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
20717 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
20718 system to determine the proper architecture option for your
20719 machine. Code compiled for lower numbered architectures runs on
20720 higher numbered architectures, but not the other way around.
20721
20722 -mpa-risc-1-0
20723 -mpa-risc-1-1
20724 -mpa-risc-2-0
20725 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
20726
20727 -mcaller-copies
20728 The caller copies function arguments passed by hidden reference.
20729 This option should be used with care as it is not compatible with
20730 the default 32-bit runtime. However, only aggregates larger than
20731 eight bytes are passed by hidden reference and the option provides
20732 better compatibility with OpenMP.
20733
20734 -mjump-in-delay
20735 This option is ignored and provided for compatibility purposes
20736 only.
20737
20738 -mdisable-fpregs
20739 Prevent floating-point registers from being used in any manner.
20740 This is necessary for compiling kernels that perform lazy context
20741 switching of floating-point registers. If you use this option and
20742 attempt to perform floating-point operations, the compiler aborts.
20743
20744 -mdisable-indexing
20745 Prevent the compiler from using indexing address modes. This
20746 avoids some rather obscure problems when compiling MIG generated
20747 code under MACH.
20748
20749 -mno-space-regs
20750 Generate code that assumes the target has no space registers. This
20751 allows GCC to generate faster indirect calls and use unscaled index
20752 address modes.
20753
20754 Such code is suitable for level 0 PA systems and kernels.
20755
20756 -mfast-indirect-calls
20757 Generate code that assumes calls never cross space boundaries.
20758 This allows GCC to emit code that performs faster indirect calls.
20759
20760 This option does not work in the presence of shared libraries or
20761 nested functions.
20762
20763 -mfixed-range=register-range
20764 Generate code treating the given register range as fixed registers.
20765 A fixed register is one that the register allocator cannot use.
20766 This is useful when compiling kernel code. A register range is
20767 specified as two registers separated by a dash. Multiple register
20768 ranges can be specified separated by a comma.
20769
20770 -mlong-load-store
20771 Generate 3-instruction load and store sequences as sometimes
20772 required by the HP-UX 10 linker. This is equivalent to the +k
20773 option to the HP compilers.
20774
20775 -mportable-runtime
20776 Use the portable calling conventions proposed by HP for ELF
20777 systems.
20778
20779 -mgas
20780 Enable the use of assembler directives only GAS understands.
20781
20782 -mschedule=cpu-type
20783 Schedule code according to the constraints for the machine type
20784 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
20785 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
20786 to determine the proper scheduling option for your machine. The
20787 default scheduling is 8000.
20788
20789 -mlinker-opt
20790 Enable the optimization pass in the HP-UX linker. Note this makes
20791 symbolic debugging impossible. It also triggers a bug in the HP-UX
20792 8 and HP-UX 9 linkers in which they give bogus error messages when
20793 linking some programs.
20794
20795 -msoft-float
20796 Generate output containing library calls for floating point.
20797 Warning: the requisite libraries are not available for all HPPA
20798 targets. Normally the facilities of the machine's usual C compiler
20799 are used, but this cannot be done directly in cross-compilation.
20800 You must make your own arrangements to provide suitable library
20801 functions for cross-compilation.
20802
20803 -msoft-float changes the calling convention in the output file;
20804 therefore, it is only useful if you compile all of a program with
20805 this option. In particular, you need to compile libgcc.a, the
20806 library that comes with GCC, with -msoft-float in order for this to
20807 work.
20808
20809 -msio
20810 Generate the predefine, "_SIO", for server IO. The default is
20811 -mwsio. This generates the predefines, "__hp9000s700",
20812 "__hp9000s700__" and "_WSIO", for workstation IO. These options
20813 are available under HP-UX and HI-UX.
20814
20815 -mgnu-ld
20816 Use options specific to GNU ld. This passes -shared to ld when
20817 building a shared library. It is the default when GCC is
20818 configured, explicitly or implicitly, with the GNU linker. This
20819 option does not affect which ld is called; it only changes what
20820 parameters are passed to that ld. The ld that is called is
20821 determined by the --with-ld configure option, GCC's program search
20822 path, and finally by the user's PATH. The linker used by GCC can
20823 be printed using which `gcc -print-prog-name=ld`. This option is
20824 only available on the 64-bit HP-UX GCC, i.e. configured with
20825 hppa*64*-*-hpux*.
20826
20827 -mhp-ld
20828 Use options specific to HP ld. This passes -b to ld when building
20829 a shared library and passes +Accept TypeMismatch to ld on all
20830 links. It is the default when GCC is configured, explicitly or
20831 implicitly, with the HP linker. This option does not affect which
20832 ld is called; it only changes what parameters are passed to that
20833 ld. The ld that is called is determined by the --with-ld configure
20834 option, GCC's program search path, and finally by the user's PATH.
20835 The linker used by GCC can be printed using which `gcc
20836 -print-prog-name=ld`. This option is only available on the 64-bit
20837 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
20838
20839 -mlong-calls
20840 Generate code that uses long call sequences. This ensures that a
20841 call is always able to reach linker generated stubs. The default
20842 is to generate long calls only when the distance from the call site
20843 to the beginning of the function or translation unit, as the case
20844 may be, exceeds a predefined limit set by the branch type being
20845 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
20846 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
20847 always limited at 240,000 bytes.
20848
20849 Distances are measured from the beginning of functions when using
20850 the -ffunction-sections option, or when using the -mgas and
20851 -mno-portable-runtime options together under HP-UX with the SOM
20852 linker.
20853
20854 It is normally not desirable to use this option as it degrades
20855 performance. However, it may be useful in large applications,
20856 particularly when partial linking is used to build the application.
20857
20858 The types of long calls used depends on the capabilities of the
20859 assembler and linker, and the type of code being generated. The
20860 impact on systems that support long absolute calls, and long pic
20861 symbol-difference or pc-relative calls should be relatively small.
20862 However, an indirect call is used on 32-bit ELF systems in pic code
20863 and it is quite long.
20864
20865 -munix=unix-std
20866 Generate compiler predefines and select a startfile for the
20867 specified UNIX standard. The choices for unix-std are 93, 95 and
20868 98. 93 is supported on all HP-UX versions. 95 is available on HP-
20869 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
20870 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
20871 11.00, and 98 for HP-UX 11.11 and later.
20872
20873 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
20874 -munix=95 provides additional predefines for "XOPEN_UNIX" and
20875 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
20876 provides additional predefines for "_XOPEN_UNIX",
20877 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
20878 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
20879
20880 It is important to note that this option changes the interfaces for
20881 various library routines. It also affects the operational behavior
20882 of the C library. Thus, extreme care is needed in using this
20883 option.
20884
20885 Library code that is intended to operate with more than one UNIX
20886 standard must test, set and restore the variable
20887 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
20888 provide this capability.
20889
20890 -nolibdld
20891 Suppress the generation of link options to search libdld.sl when
20892 the -static option is specified on HP-UX 10 and later.
20893
20894 -static
20895 The HP-UX implementation of setlocale in libc has a dependency on
20896 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20897 when the -static option is specified, special link options are
20898 needed to resolve this dependency.
20899
20900 On HP-UX 10 and later, the GCC driver adds the necessary options to
20901 link with libdld.sl when the -static option is specified. This
20902 causes the resulting binary to be dynamic. On the 64-bit port, the
20903 linkers generate dynamic binaries by default in any case. The
20904 -nolibdld option can be used to prevent the GCC driver from adding
20905 these link options.
20906
20907 -threads
20908 Add support for multithreading with the dce thread library under
20909 HP-UX. This option sets flags for both the preprocessor and
20910 linker.
20911
20912 IA-64 Options
20913
20914 These are the -m options defined for the Intel IA-64 architecture.
20915
20916 -mbig-endian
20917 Generate code for a big-endian target. This is the default for HP-
20918 UX.
20919
20920 -mlittle-endian
20921 Generate code for a little-endian target. This is the default for
20922 AIX5 and GNU/Linux.
20923
20924 -mgnu-as
20925 -mno-gnu-as
20926 Generate (or don't) code for the GNU assembler. This is the
20927 default.
20928
20929 -mgnu-ld
20930 -mno-gnu-ld
20931 Generate (or don't) code for the GNU linker. This is the default.
20932
20933 -mno-pic
20934 Generate code that does not use a global pointer register. The
20935 result is not position independent code, and violates the IA-64
20936 ABI.
20937
20938 -mvolatile-asm-stop
20939 -mno-volatile-asm-stop
20940 Generate (or don't) a stop bit immediately before and after
20941 volatile asm statements.
20942
20943 -mregister-names
20944 -mno-register-names
20945 Generate (or don't) in, loc, and out register names for the stacked
20946 registers. This may make assembler output more readable.
20947
20948 -mno-sdata
20949 -msdata
20950 Disable (or enable) optimizations that use the small data section.
20951 This may be useful for working around optimizer bugs.
20952
20953 -mconstant-gp
20954 Generate code that uses a single constant global pointer value.
20955 This is useful when compiling kernel code.
20956
20957 -mauto-pic
20958 Generate code that is self-relocatable. This implies
20959 -mconstant-gp. This is useful when compiling firmware code.
20960
20961 -minline-float-divide-min-latency
20962 Generate code for inline divides of floating-point values using the
20963 minimum latency algorithm.
20964
20965 -minline-float-divide-max-throughput
20966 Generate code for inline divides of floating-point values using the
20967 maximum throughput algorithm.
20968
20969 -mno-inline-float-divide
20970 Do not generate inline code for divides of floating-point values.
20971
20972 -minline-int-divide-min-latency
20973 Generate code for inline divides of integer values using the
20974 minimum latency algorithm.
20975
20976 -minline-int-divide-max-throughput
20977 Generate code for inline divides of integer values using the
20978 maximum throughput algorithm.
20979
20980 -mno-inline-int-divide
20981 Do not generate inline code for divides of integer values.
20982
20983 -minline-sqrt-min-latency
20984 Generate code for inline square roots using the minimum latency
20985 algorithm.
20986
20987 -minline-sqrt-max-throughput
20988 Generate code for inline square roots using the maximum throughput
20989 algorithm.
20990
20991 -mno-inline-sqrt
20992 Do not generate inline code for "sqrt".
20993
20994 -mfused-madd
20995 -mno-fused-madd
20996 Do (don't) generate code that uses the fused multiply/add or
20997 multiply/subtract instructions. The default is to use these
20998 instructions.
20999
21000 -mno-dwarf2-asm
21001 -mdwarf2-asm
21002 Don't (or do) generate assembler code for the DWARF line number
21003 debugging info. This may be useful when not using the GNU
21004 assembler.
21005
21006 -mearly-stop-bits
21007 -mno-early-stop-bits
21008 Allow stop bits to be placed earlier than immediately preceding the
21009 instruction that triggered the stop bit. This can improve
21010 instruction scheduling, but does not always do so.
21011
21012 -mfixed-range=register-range
21013 Generate code treating the given register range as fixed registers.
21014 A fixed register is one that the register allocator cannot use.
21015 This is useful when compiling kernel code. A register range is
21016 specified as two registers separated by a dash. Multiple register
21017 ranges can be specified separated by a comma.
21018
21019 -mtls-size=tls-size
21020 Specify bit size of immediate TLS offsets. Valid values are 14,
21021 22, and 64.
21022
21023 -mtune=cpu-type
21024 Tune the instruction scheduling for a particular CPU, Valid values
21025 are itanium, itanium1, merced, itanium2, and mckinley.
21026
21027 -milp32
21028 -mlp64
21029 Generate code for a 32-bit or 64-bit environment. The 32-bit
21030 environment sets int, long and pointer to 32 bits. The 64-bit
21031 environment sets int to 32 bits and long and pointer to 64 bits.
21032 These are HP-UX specific flags.
21033
21034 -mno-sched-br-data-spec
21035 -msched-br-data-spec
21036 (Dis/En)able data speculative scheduling before reload. This
21037 results in generation of "ld.a" instructions and the corresponding
21038 check instructions ("ld.c" / "chk.a"). The default setting is
21039 disabled.
21040
21041 -msched-ar-data-spec
21042 -mno-sched-ar-data-spec
21043 (En/Dis)able data speculative scheduling after reload. This
21044 results in generation of "ld.a" instructions and the corresponding
21045 check instructions ("ld.c" / "chk.a"). The default setting is
21046 enabled.
21047
21048 -mno-sched-control-spec
21049 -msched-control-spec
21050 (Dis/En)able control speculative scheduling. This feature is
21051 available only during region scheduling (i.e. before reload). This
21052 results in generation of the "ld.s" instructions and the
21053 corresponding check instructions "chk.s". The default setting is
21054 disabled.
21055
21056 -msched-br-in-data-spec
21057 -mno-sched-br-in-data-spec
21058 (En/Dis)able speculative scheduling of the instructions that are
21059 dependent on the data speculative loads before reload. This is
21060 effective only with -msched-br-data-spec enabled. The default
21061 setting is enabled.
21062
21063 -msched-ar-in-data-spec
21064 -mno-sched-ar-in-data-spec
21065 (En/Dis)able speculative scheduling of the instructions that are
21066 dependent on the data speculative loads after reload. This is
21067 effective only with -msched-ar-data-spec enabled. The default
21068 setting is enabled.
21069
21070 -msched-in-control-spec
21071 -mno-sched-in-control-spec
21072 (En/Dis)able speculative scheduling of the instructions that are
21073 dependent on the control speculative loads. This is effective only
21074 with -msched-control-spec enabled. The default setting is enabled.
21075
21076 -mno-sched-prefer-non-data-spec-insns
21077 -msched-prefer-non-data-spec-insns
21078 If enabled, data-speculative instructions are chosen for schedule
21079 only if there are no other choices at the moment. This makes the
21080 use of the data speculation much more conservative. The default
21081 setting is disabled.
21082
21083 -mno-sched-prefer-non-control-spec-insns
21084 -msched-prefer-non-control-spec-insns
21085 If enabled, control-speculative instructions are chosen for
21086 schedule only if there are no other choices at the moment. This
21087 makes the use of the control speculation much more conservative.
21088 The default setting is disabled.
21089
21090 -mno-sched-count-spec-in-critical-path
21091 -msched-count-spec-in-critical-path
21092 If enabled, speculative dependencies are considered during
21093 computation of the instructions priorities. This makes the use of
21094 the speculation a bit more conservative. The default setting is
21095 disabled.
21096
21097 -msched-spec-ldc
21098 Use a simple data speculation check. This option is on by default.
21099
21100 -msched-control-spec-ldc
21101 Use a simple check for control speculation. This option is on by
21102 default.
21103
21104 -msched-stop-bits-after-every-cycle
21105 Place a stop bit after every cycle when scheduling. This option is
21106 on by default.
21107
21108 -msched-fp-mem-deps-zero-cost
21109 Assume that floating-point stores and loads are not likely to cause
21110 a conflict when placed into the same instruction group. This
21111 option is disabled by default.
21112
21113 -msel-sched-dont-check-control-spec
21114 Generate checks for control speculation in selective scheduling.
21115 This flag is disabled by default.
21116
21117 -msched-max-memory-insns=max-insns
21118 Limit on the number of memory insns per instruction group, giving
21119 lower priority to subsequent memory insns attempting to schedule in
21120 the same instruction group. Frequently useful to prevent cache bank
21121 conflicts. The default value is 1.
21122
21123 -msched-max-memory-insns-hard-limit
21124 Makes the limit specified by msched-max-memory-insns a hard limit,
21125 disallowing more than that number in an instruction group.
21126 Otherwise, the limit is "soft", meaning that non-memory operations
21127 are preferred when the limit is reached, but memory operations may
21128 still be scheduled.
21129
21130 LM32 Options
21131
21132 These -m options are defined for the LatticeMico32 architecture:
21133
21134 -mbarrel-shift-enabled
21135 Enable barrel-shift instructions.
21136
21137 -mdivide-enabled
21138 Enable divide and modulus instructions.
21139
21140 -mmultiply-enabled
21141 Enable multiply instructions.
21142
21143 -msign-extend-enabled
21144 Enable sign extend instructions.
21145
21146 -muser-enabled
21147 Enable user-defined instructions.
21148
21149 LoongArch Options
21150
21151 These command-line options are defined for LoongArch targets:
21152
21153 -march=cpu-type
21154 Generate instructions for the machine type cpu-type. In contrast
21155 to -mtune=cpu-type, which merely tunes the generated code for the
21156 specified cpu-type, -march=cpu-type allows GCC to generate code
21157 that may not run at all on processors other than the one indicated.
21158 Specifying -march=cpu-type implies -mtune=cpu-type, except where
21159 noted otherwise.
21160
21161 The choices for cpu-type are:
21162
21163 native
21164 This selects the CPU to generate code for at compilation time
21165 by determining the processor type of the compiling machine.
21166 Using -march=native enables all instruction subsets supported
21167 by the local machine (hence the result might not run on
21168 different machines). Using -mtune=native produces code
21169 optimized for the local machine under the constraints of the
21170 selected instruction set.
21171
21172 loongarch64
21173 A generic CPU with 64-bit extensions.
21174
21175 la464
21176 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
21177
21178 -mtune=cpu-type
21179 Optimize the output for the given processor, specified by
21180 microarchitecture name.
21181
21182 -mabi=base-abi-type
21183 Generate code for the specified calling convention. base-abi-type
21184 can be one of:
21185
21186 lp64d
21187 Uses 64-bit general purpose registers and 32/64-bit floating-
21188 point registers for parameter passing. Data model is LP64,
21189 where int is 32 bits, while long int and pointers are 64 bits.
21190
21191 lp64f
21192 Uses 64-bit general purpose registers and 32-bit floating-point
21193 registers for parameter passing. Data model is LP64, where int
21194 is 32 bits, while long int and pointers are 64 bits.
21195
21196 lp64s
21197 Uses 64-bit general purpose registers and no floating-point
21198 registers for parameter passing. Data model is LP64, where int
21199 is 32 bits, while long int and pointers are 64 bits.
21200
21201 -mfpu=fpu-type
21202 Generate code for the specified FPU type, which can be one of:
21203
21204 64 Allow the use of hardware floating-point instructions for
21205 32-bit and 64-bit operations.
21206
21207 32 Allow the use of hardware floating-point instructions for
21208 32-bit operations.
21209
21210 none
21211 0 Prevent the use of hardware floating-point instructions.
21212
21213 -msoft-float
21214 Force -mfpu=none and prevents the use of floating-point registers
21215 for parameter passing. This option may change the target ABI.
21216
21217 -msingle-float
21218 Force -mfpu=32 and allow the use of 32-bit floating-point registers
21219 for parameter passing. This option may change the target ABI.
21220
21221 -mdouble-float
21222 Force -mfpu=64 and allow the use of 32/64-bit floating-point
21223 registers for parameter passing. This option may change the target
21224 ABI.
21225
21226 -mbranch-cost=n
21227 Set the cost of branches to roughly n instructions.
21228
21229 -mcheck-zero-division
21230 -mno-check-zero-divison
21231 Trap (do not trap) on integer division by zero. The default is
21232 -mcheck-zero-division for -O0 or -Og, and -mno-check-zero-division
21233 for other optimization levels.
21234
21235 -mcond-move-int
21236 -mno-cond-move-int
21237 Conditional moves for integral data in general-purpose registers
21238 are enabled (disabled). The default is -mcond-move-int.
21239
21240 -mcond-move-float
21241 -mno-cond-move-float
21242 Conditional moves for floating-point registers are enabled
21243 (disabled). The default is -mcond-move-float.
21244
21245 -mmemcpy
21246 -mno-memcpy
21247 Force (do not force) the use of "memcpy" for non-trivial block
21248 moves. The default is -mno-memcpy, which allows GCC to inline most
21249 constant-sized copies. Setting optimization level to -Os also
21250 forces the use of "memcpy", but -mno-memcpy may override this
21251 behavior if explicitly specified, regardless of the order these
21252 options on the command line.
21253
21254 -mstrict-align
21255 -mno-strict-align
21256 Avoid or allow generating memory accesses that may not be aligned
21257 on a natural object boundary as described in the architecture
21258 specification. The default is -mno-strict-align.
21259
21260 -msmall-data-limit=number
21261 Put global and static data smaller than number bytes into a special
21262 section (on some targets). The default value is 0.
21263
21264 -mmax-inline-memcpy-size=n
21265 Inline all block moves (such as calls to "memcpy" or structure
21266 copies) less than or equal to n bytes. The default value of n is
21267 1024.
21268
21269 -mcmodel=code-model
21270 Set the code model to one of:
21271
21272 tiny-static
21273 * local symbol and global strong symbol: The data section
21274 must be within +/-2MiB addressing space. The text section
21275 must be within +/-128MiB addressing space.
21276
21277 * global weak symbol: The got table must be within +/-2GiB
21278 addressing space.
21279
21280 tiny
21281 * local symbol: The data section must be within +/-2MiB
21282 addressing space. The text section must be within
21283 +/-128MiB addressing space.
21284
21285 * global symbol: The got table must be within +/-2GiB
21286 addressing space.
21287
21288 normal
21289 * local symbol: The data section must be within +/-2GiB
21290 addressing space. The text section must be within
21291 +/-128MiB addressing space.
21292
21293 * global symbol: The got table must be within +/-2GiB
21294 addressing space.
21295
21296 large
21297 * local symbol: The data section must be within +/-2GiB
21298 addressing space. The text section must be within
21299 +/-128GiB addressing space.
21300
21301 * global symbol: The got table must be within +/-2GiB
21302 addressing space.
21303
21304 extreme(Not implemented yet)
21305 * local symbol: The data and text section must be within
21306 +/-8EiB addressing space.
21307
21308 * global symbol: The data got table must be within +/-8EiB
21309 addressing space.
21310
21311 The default code model is "normal".
21312
21313 M32C Options
21314
21315 -mcpu=name
21316 Select the CPU for which code is generated. name may be one of r8c
21317 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
21318 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
21319
21320 -msim
21321 Specifies that the program will be run on the simulator. This
21322 causes an alternate runtime library to be linked in which supports,
21323 for example, file I/O. You must not use this option when
21324 generating programs that will run on real hardware; you must
21325 provide your own runtime library for whatever I/O functions are
21326 needed.
21327
21328 -memregs=number
21329 Specifies the number of memory-based pseudo-registers GCC uses
21330 during code generation. These pseudo-registers are used like real
21331 registers, so there is a tradeoff between GCC's ability to fit the
21332 code into available registers, and the performance penalty of using
21333 memory instead of registers. Note that all modules in a program
21334 must be compiled with the same value for this option. Because of
21335 that, you must not use this option with GCC's default runtime
21336 libraries.
21337
21338 M32R/D Options
21339
21340 These -m options are defined for Renesas M32R/D architectures:
21341
21342 -m32r2
21343 Generate code for the M32R/2.
21344
21345 -m32rx
21346 Generate code for the M32R/X.
21347
21348 -m32r
21349 Generate code for the M32R. This is the default.
21350
21351 -mmodel=small
21352 Assume all objects live in the lower 16MB of memory (so that their
21353 addresses can be loaded with the "ld24" instruction), and assume
21354 all subroutines are reachable with the "bl" instruction. This is
21355 the default.
21356
21357 The addressability of a particular object can be set with the
21358 "model" attribute.
21359
21360 -mmodel=medium
21361 Assume objects may be anywhere in the 32-bit address space (the
21362 compiler generates "seth/add3" instructions to load their
21363 addresses), and assume all subroutines are reachable with the "bl"
21364 instruction.
21365
21366 -mmodel=large
21367 Assume objects may be anywhere in the 32-bit address space (the
21368 compiler generates "seth/add3" instructions to load their
21369 addresses), and assume subroutines may not be reachable with the
21370 "bl" instruction (the compiler generates the much slower
21371 "seth/add3/jl" instruction sequence).
21372
21373 -msdata=none
21374 Disable use of the small data area. Variables are put into one of
21375 ".data", ".bss", or ".rodata" (unless the "section" attribute has
21376 been specified). This is the default.
21377
21378 The small data area consists of sections ".sdata" and ".sbss".
21379 Objects may be explicitly put in the small data area with the
21380 "section" attribute using one of these sections.
21381
21382 -msdata=sdata
21383 Put small global and static data in the small data area, but do not
21384 generate special code to reference them.
21385
21386 -msdata=use
21387 Put small global and static data in the small data area, and
21388 generate special instructions to reference them.
21389
21390 -G num
21391 Put global and static objects less than or equal to num bytes into
21392 the small data or BSS sections instead of the normal data or BSS
21393 sections. The default value of num is 8. The -msdata option must
21394 be set to one of sdata or use for this option to have any effect.
21395
21396 All modules should be compiled with the same -G num value.
21397 Compiling with different values of num may or may not work; if it
21398 doesn't the linker gives an error message---incorrect code is not
21399 generated.
21400
21401 -mdebug
21402 Makes the M32R-specific code in the compiler display some
21403 statistics that might help in debugging programs.
21404
21405 -malign-loops
21406 Align all loops to a 32-byte boundary.
21407
21408 -mno-align-loops
21409 Do not enforce a 32-byte alignment for loops. This is the default.
21410
21411 -missue-rate=number
21412 Issue number instructions per cycle. number can only be 1 or 2.
21413
21414 -mbranch-cost=number
21415 number can only be 1 or 2. If it is 1 then branches are preferred
21416 over conditional code, if it is 2, then the opposite applies.
21417
21418 -mflush-trap=number
21419 Specifies the trap number to use to flush the cache. The default
21420 is 12. Valid numbers are between 0 and 15 inclusive.
21421
21422 -mno-flush-trap
21423 Specifies that the cache cannot be flushed by using a trap.
21424
21425 -mflush-func=name
21426 Specifies the name of the operating system function to call to
21427 flush the cache. The default is _flush_cache, but a function call
21428 is only used if a trap is not available.
21429
21430 -mno-flush-func
21431 Indicates that there is no OS function for flushing the cache.
21432
21433 M680x0 Options
21434
21435 These are the -m options defined for M680x0 and ColdFire processors.
21436 The default settings depend on which architecture was selected when the
21437 compiler was configured; the defaults for the most common choices are
21438 given below.
21439
21440 -march=arch
21441 Generate code for a specific M680x0 or ColdFire instruction set
21442 architecture. Permissible values of arch for M680x0 architectures
21443 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
21444 architectures are selected according to Freescale's ISA
21445 classification and the permissible values are: isaa, isaaplus, isab
21446 and isac.
21447
21448 GCC defines a macro "__mcfarch__" whenever it is generating code
21449 for a ColdFire target. The arch in this macro is one of the -march
21450 arguments given above.
21451
21452 When used together, -march and -mtune select code that runs on a
21453 family of similar processors but that is optimized for a particular
21454 microarchitecture.
21455
21456 -mcpu=cpu
21457 Generate code for a specific M680x0 or ColdFire processor. The
21458 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
21459 68332 and cpu32. The ColdFire cpus are given by the table below,
21460 which also classifies the CPUs into families:
21461
21462 Family : -mcpu arguments
21463 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
21464 5206 : 5202 5204 5206
21465 5206e : 5206e
21466 5208 : 5207 5208
21467 5211a : 5210a 5211a
21468 5213 : 5211 5212 5213
21469 5216 : 5214 5216
21470 52235 : 52230 52231 52232 52233 52234 52235
21471 5225 : 5224 5225
21472 52259 : 52252 52254 52255 52256 52258 52259
21473 5235 : 5232 5233 5234 5235 523x
21474 5249 : 5249
21475 5250 : 5250
21476 5271 : 5270 5271
21477 5272 : 5272
21478 5275 : 5274 5275
21479 5282 : 5280 5281 5282 528x
21480 53017 : 53011 53012 53013 53014 53015 53016 53017
21481 5307 : 5307
21482 5329 : 5327 5328 5329 532x
21483 5373 : 5372 5373 537x
21484 5407 : 5407
21485 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
21486 5485
21487
21488 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
21489 Other combinations of -mcpu and -march are rejected.
21490
21491 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
21492 selected. It also defines "__mcf_family_family", where the value
21493 of family is given by the table above.
21494
21495 -mtune=tune
21496 Tune the code for a particular microarchitecture within the
21497 constraints set by -march and -mcpu. The M680x0 microarchitectures
21498 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
21499 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
21500
21501 You can also use -mtune=68020-40 for code that needs to run
21502 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
21503 is similar but includes 68060 targets as well. These two options
21504 select the same tuning decisions as -m68020-40 and -m68020-60
21505 respectively.
21506
21507 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
21508 680x0 architecture arch. It also defines "mcarch" unless either
21509 -ansi or a non-GNU -std option is used. If GCC is tuning for a
21510 range of architectures, as selected by -mtune=68020-40 or
21511 -mtune=68020-60, it defines the macros for every architecture in
21512 the range.
21513
21514 GCC also defines the macro "__muarch__" when tuning for ColdFire
21515 microarchitecture uarch, where uarch is one of the arguments given
21516 above.
21517
21518 -m68000
21519 -mc68000
21520 Generate output for a 68000. This is the default when the compiler
21521 is configured for 68000-based systems. It is equivalent to
21522 -march=68000.
21523
21524 Use this option for microcontrollers with a 68000 or EC000 core,
21525 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21526
21527 -m68010
21528 Generate output for a 68010. This is the default when the compiler
21529 is configured for 68010-based systems. It is equivalent to
21530 -march=68010.
21531
21532 -m68020
21533 -mc68020
21534 Generate output for a 68020. This is the default when the compiler
21535 is configured for 68020-based systems. It is equivalent to
21536 -march=68020.
21537
21538 -m68030
21539 Generate output for a 68030. This is the default when the compiler
21540 is configured for 68030-based systems. It is equivalent to
21541 -march=68030.
21542
21543 -m68040
21544 Generate output for a 68040. This is the default when the compiler
21545 is configured for 68040-based systems. It is equivalent to
21546 -march=68040.
21547
21548 This option inhibits the use of 68881/68882 instructions that have
21549 to be emulated by software on the 68040. Use this option if your
21550 68040 does not have code to emulate those instructions.
21551
21552 -m68060
21553 Generate output for a 68060. This is the default when the compiler
21554 is configured for 68060-based systems. It is equivalent to
21555 -march=68060.
21556
21557 This option inhibits the use of 68020 and 68881/68882 instructions
21558 that have to be emulated by software on the 68060. Use this option
21559 if your 68060 does not have code to emulate those instructions.
21560
21561 -mcpu32
21562 Generate output for a CPU32. This is the default when the compiler
21563 is configured for CPU32-based systems. It is equivalent to
21564 -march=cpu32.
21565
21566 Use this option for microcontrollers with a CPU32 or CPU32+ core,
21567 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
21568 68341, 68349 and 68360.
21569
21570 -m5200
21571 Generate output for a 520X ColdFire CPU. This is the default when
21572 the compiler is configured for 520X-based systems. It is
21573 equivalent to -mcpu=5206, and is now deprecated in favor of that
21574 option.
21575
21576 Use this option for microcontroller with a 5200 core, including the
21577 MCF5202, MCF5203, MCF5204 and MCF5206.
21578
21579 -m5206e
21580 Generate output for a 5206e ColdFire CPU. The option is now
21581 deprecated in favor of the equivalent -mcpu=5206e.
21582
21583 -m528x
21584 Generate output for a member of the ColdFire 528X family. The
21585 option is now deprecated in favor of the equivalent -mcpu=528x.
21586
21587 -m5307
21588 Generate output for a ColdFire 5307 CPU. The option is now
21589 deprecated in favor of the equivalent -mcpu=5307.
21590
21591 -m5407
21592 Generate output for a ColdFire 5407 CPU. The option is now
21593 deprecated in favor of the equivalent -mcpu=5407.
21594
21595 -mcfv4e
21596 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
21597 This includes use of hardware floating-point instructions. The
21598 option is equivalent to -mcpu=547x, and is now deprecated in favor
21599 of that option.
21600
21601 -m68020-40
21602 Generate output for a 68040, without using any of the new
21603 instructions. This results in code that can run relatively
21604 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21605 generated code does use the 68881 instructions that are emulated on
21606 the 68040.
21607
21608 The option is equivalent to -march=68020 -mtune=68020-40.
21609
21610 -m68020-60
21611 Generate output for a 68060, without using any of the new
21612 instructions. This results in code that can run relatively
21613 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21614 generated code does use the 68881 instructions that are emulated on
21615 the 68060.
21616
21617 The option is equivalent to -march=68020 -mtune=68020-60.
21618
21619 -mhard-float
21620 -m68881
21621 Generate floating-point instructions. This is the default for
21622 68020 and above, and for ColdFire devices that have an FPU. It
21623 defines the macro "__HAVE_68881__" on M680x0 targets and
21624 "__mcffpu__" on ColdFire targets.
21625
21626 -msoft-float
21627 Do not generate floating-point instructions; use library calls
21628 instead. This is the default for 68000, 68010, and 68832 targets.
21629 It is also the default for ColdFire devices that have no FPU.
21630
21631 -mdiv
21632 -mno-div
21633 Generate (do not generate) ColdFire hardware divide and remainder
21634 instructions. If -march is used without -mcpu, the default is "on"
21635 for ColdFire architectures and "off" for M680x0 architectures.
21636 Otherwise, the default is taken from the target CPU (either the
21637 default CPU, or the one specified by -mcpu). For example, the
21638 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
21639
21640 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
21641
21642 -mshort
21643 Consider type "int" to be 16 bits wide, like "short int".
21644 Additionally, parameters passed on the stack are also aligned to a
21645 16-bit boundary even on targets whose API mandates promotion to
21646 32-bit.
21647
21648 -mno-short
21649 Do not consider type "int" to be 16 bits wide. This is the
21650 default.
21651
21652 -mnobitfield
21653 -mno-bitfield
21654 Do not use the bit-field instructions. The -m68000, -mcpu32 and
21655 -m5200 options imply -mnobitfield.
21656
21657 -mbitfield
21658 Do use the bit-field instructions. The -m68020 option implies
21659 -mbitfield. This is the default if you use a configuration
21660 designed for a 68020.
21661
21662 -mrtd
21663 Use a different function-calling convention, in which functions
21664 that take a fixed number of arguments return with the "rtd"
21665 instruction, which pops their arguments while returning. This
21666 saves one instruction in the caller since there is no need to pop
21667 the arguments there.
21668
21669 This calling convention is incompatible with the one normally used
21670 on Unix, so you cannot use it if you need to call libraries
21671 compiled with the Unix compiler.
21672
21673 Also, you must provide function prototypes for all functions that
21674 take variable numbers of arguments (including "printf"); otherwise
21675 incorrect code is generated for calls to those functions.
21676
21677 In addition, seriously incorrect code results if you call a
21678 function with too many arguments. (Normally, extra arguments are
21679 harmlessly ignored.)
21680
21681 The "rtd" instruction is supported by the 68010, 68020, 68030,
21682 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21683
21684 The default is -mno-rtd.
21685
21686 -malign-int
21687 -mno-align-int
21688 Control whether GCC aligns "int", "long", "long long", "float",
21689 "double", and "long double" variables on a 32-bit boundary
21690 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
21691 variables on 32-bit boundaries produces code that runs somewhat
21692 faster on processors with 32-bit busses at the expense of more
21693 memory.
21694
21695 Warning: if you use the -malign-int switch, GCC aligns structures
21696 containing the above types differently than most published
21697 application binary interface specifications for the m68k.
21698
21699 Use the pc-relative addressing mode of the 68000 directly, instead
21700 of using a global offset table. At present, this option implies
21701 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
21702 -fPIC is not presently supported with -mpcrel, though this could be
21703 supported for 68020 and higher processors.
21704
21705 -mno-strict-align
21706 -mstrict-align
21707 Do not (do) assume that unaligned memory references are handled by
21708 the system.
21709
21710 -msep-data
21711 Generate code that allows the data segment to be located in a
21712 different area of memory from the text segment. This allows for
21713 execute-in-place in an environment without virtual memory
21714 management. This option implies -fPIC.
21715
21716 -mno-sep-data
21717 Generate code that assumes that the data segment follows the text
21718 segment. This is the default.
21719
21720 -mid-shared-library
21721 Generate code that supports shared libraries via the library ID
21722 method. This allows for execute-in-place and shared libraries in
21723 an environment without virtual memory management. This option
21724 implies -fPIC.
21725
21726 -mno-id-shared-library
21727 Generate code that doesn't assume ID-based shared libraries are
21728 being used. This is the default.
21729
21730 -mshared-library-id=n
21731 Specifies the identification number of the ID-based shared library
21732 being compiled. Specifying a value of 0 generates more compact
21733 code; specifying other values forces the allocation of that number
21734 to the current library, but is no more space- or time-efficient
21735 than omitting this option.
21736
21737 -mxgot
21738 -mno-xgot
21739 When generating position-independent code for ColdFire, generate
21740 code that works if the GOT has more than 8192 entries. This code
21741 is larger and slower than code generated without this option. On
21742 M680x0 processors, this option is not needed; -fPIC suffices.
21743
21744 GCC normally uses a single instruction to load values from the GOT.
21745 While this is relatively efficient, it only works if the GOT is
21746 smaller than about 64k. Anything larger causes the linker to
21747 report an error such as:
21748
21749 relocation truncated to fit: R_68K_GOT16O foobar
21750
21751 If this happens, you should recompile your code with -mxgot. It
21752 should then work with very large GOTs. However, code generated
21753 with -mxgot is less efficient, since it takes 4 instructions to
21754 fetch the value of a global symbol.
21755
21756 Note that some linkers, including newer versions of the GNU linker,
21757 can create multiple GOTs and sort GOT entries. If you have such a
21758 linker, you should only need to use -mxgot when compiling a single
21759 object file that accesses more than 8192 GOT entries. Very few do.
21760
21761 These options have no effect unless GCC is generating position-
21762 independent code.
21763
21764 -mlong-jump-table-offsets
21765 Use 32-bit offsets in "switch" tables. The default is to use
21766 16-bit offsets.
21767
21768 MCore Options
21769
21770 These are the -m options defined for the Motorola M*Core processors.
21771
21772 -mhardlit
21773 -mno-hardlit
21774 Inline constants into the code stream if it can be done in two
21775 instructions or less.
21776
21777 -mdiv
21778 -mno-div
21779 Use the divide instruction. (Enabled by default).
21780
21781 -mrelax-immediate
21782 -mno-relax-immediate
21783 Allow arbitrary-sized immediates in bit operations.
21784
21785 -mwide-bitfields
21786 -mno-wide-bitfields
21787 Always treat bit-fields as "int"-sized.
21788
21789 -m4byte-functions
21790 -mno-4byte-functions
21791 Force all functions to be aligned to a 4-byte boundary.
21792
21793 -mcallgraph-data
21794 -mno-callgraph-data
21795 Emit callgraph information.
21796
21797 -mslow-bytes
21798 -mno-slow-bytes
21799 Prefer word access when reading byte quantities.
21800
21801 -mlittle-endian
21802 -mbig-endian
21803 Generate code for a little-endian target.
21804
21805 -m210
21806 -m340
21807 Generate code for the 210 processor.
21808
21809 -mno-lsim
21810 Assume that runtime support has been provided and so omit the
21811 simulator library (libsim.a) from the linker command line.
21812
21813 -mstack-increment=size
21814 Set the maximum amount for a single stack increment operation.
21815 Large values can increase the speed of programs that contain
21816 functions that need a large amount of stack space, but they can
21817 also trigger a segmentation fault if the stack is extended too
21818 much. The default value is 0x1000.
21819
21820 MeP Options
21821
21822 -mabsdiff
21823 Enables the "abs" instruction, which is the absolute difference
21824 between two registers.
21825
21826 -mall-opts
21827 Enables all the optional instructions---average, multiply, divide,
21828 bit operations, leading zero, absolute difference, min/max, clip,
21829 and saturation.
21830
21831 -maverage
21832 Enables the "ave" instruction, which computes the average of two
21833 registers.
21834
21835 -mbased=n
21836 Variables of size n bytes or smaller are placed in the ".based"
21837 section by default. Based variables use the $tp register as a base
21838 register, and there is a 128-byte limit to the ".based" section.
21839
21840 -mbitops
21841 Enables the bit operation instructions---bit test ("btstm"), set
21842 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
21843 ("tas").
21844
21845 -mc=name
21846 Selects which section constant data is placed in. name may be
21847 tiny, near, or far.
21848
21849 -mclip
21850 Enables the "clip" instruction. Note that -mclip is not useful
21851 unless you also provide -mminmax.
21852
21853 -mconfig=name
21854 Selects one of the built-in core configurations. Each MeP chip has
21855 one or more modules in it; each module has a core CPU and a variety
21856 of coprocessors, optional instructions, and peripherals. The
21857 "MeP-Integrator" tool, not part of GCC, provides these
21858 configurations through this option; using this option is the same
21859 as using all the corresponding command-line options. The default
21860 configuration is default.
21861
21862 -mcop
21863 Enables the coprocessor instructions. By default, this is a 32-bit
21864 coprocessor. Note that the coprocessor is normally enabled via the
21865 -mconfig= option.
21866
21867 -mcop32
21868 Enables the 32-bit coprocessor's instructions.
21869
21870 -mcop64
21871 Enables the 64-bit coprocessor's instructions.
21872
21873 -mivc2
21874 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21875
21876 -mdc
21877 Causes constant variables to be placed in the ".near" section.
21878
21879 -mdiv
21880 Enables the "div" and "divu" instructions.
21881
21882 -meb
21883 Generate big-endian code.
21884
21885 -mel
21886 Generate little-endian code.
21887
21888 -mio-volatile
21889 Tells the compiler that any variable marked with the "io" attribute
21890 is to be considered volatile.
21891
21892 -ml Causes variables to be assigned to the ".far" section by default.
21893
21894 -mleadz
21895 Enables the "leadz" (leading zero) instruction.
21896
21897 -mm Causes variables to be assigned to the ".near" section by default.
21898
21899 -mminmax
21900 Enables the "min" and "max" instructions.
21901
21902 -mmult
21903 Enables the multiplication and multiply-accumulate instructions.
21904
21905 -mno-opts
21906 Disables all the optional instructions enabled by -mall-opts.
21907
21908 -mrepeat
21909 Enables the "repeat" and "erepeat" instructions, used for low-
21910 overhead looping.
21911
21912 -ms Causes all variables to default to the ".tiny" section. Note that
21913 there is a 65536-byte limit to this section. Accesses to these
21914 variables use the %gp base register.
21915
21916 -msatur
21917 Enables the saturation instructions. Note that the compiler does
21918 not currently generate these itself, but this option is included
21919 for compatibility with other tools, like "as".
21920
21921 -msdram
21922 Link the SDRAM-based runtime instead of the default ROM-based
21923 runtime.
21924
21925 -msim
21926 Link the simulator run-time libraries.
21927
21928 -msimnovec
21929 Link the simulator runtime libraries, excluding built-in support
21930 for reset and exception vectors and tables.
21931
21932 -mtf
21933 Causes all functions to default to the ".far" section. Without
21934 this option, functions default to the ".near" section.
21935
21936 -mtiny=n
21937 Variables that are n bytes or smaller are allocated to the ".tiny"
21938 section. These variables use the $gp base register. The default
21939 for this option is 4, but note that there's a 65536-byte limit to
21940 the ".tiny" section.
21941
21942 MicroBlaze Options
21943
21944 -msoft-float
21945 Use software emulation for floating point (default).
21946
21947 -mhard-float
21948 Use hardware floating-point instructions.
21949
21950 -mmemcpy
21951 Do not optimize block moves, use "memcpy".
21952
21953 -mno-clearbss
21954 This option is deprecated. Use -fno-zero-initialized-in-bss
21955 instead.
21956
21957 -mcpu=cpu-type
21958 Use features of, and schedule code for, the given CPU. Supported
21959 values are in the format vX.YY.Z, where X is a major version, YY is
21960 the minor version, and Z is compatibility code. Example values are
21961 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
21962
21963 -mxl-soft-mul
21964 Use software multiply emulation (default).
21965
21966 -mxl-soft-div
21967 Use software emulation for divides (default).
21968
21969 -mxl-barrel-shift
21970 Use the hardware barrel shifter.
21971
21972 -mxl-pattern-compare
21973 Use pattern compare instructions.
21974
21975 -msmall-divides
21976 Use table lookup optimization for small signed integer divisions.
21977
21978 -mxl-stack-check
21979 This option is deprecated. Use -fstack-check instead.
21980
21981 -mxl-gp-opt
21982 Use GP-relative ".sdata"/".sbss" sections.
21983
21984 -mxl-multiply-high
21985 Use multiply high instructions for high part of 32x32 multiply.
21986
21987 -mxl-float-convert
21988 Use hardware floating-point conversion instructions.
21989
21990 -mxl-float-sqrt
21991 Use hardware floating-point square root instruction.
21992
21993 -mbig-endian
21994 Generate code for a big-endian target.
21995
21996 -mlittle-endian
21997 Generate code for a little-endian target.
21998
21999 -mxl-reorder
22000 Use reorder instructions (swap and byte reversed load/store).
22001
22002 -mxl-mode-app-model
22003 Select application model app-model. Valid models are
22004
22005 executable
22006 normal executable (default), uses startup code crt0.o.
22007
22008 xmdstub
22009 for use with Xilinx Microprocessor Debugger (XMD) based
22010 software intrusive debug agent called xmdstub. This uses
22011 startup file crt1.o and sets the start address of the program
22012 to 0x800.
22013
22014 bootstrap
22015 for applications that are loaded using a bootloader. This
22016 model uses startup file crt2.o which does not contain a
22017 processor reset vector handler. This is suitable for
22018 transferring control on a processor reset to the bootloader
22019 rather than the application.
22020
22021 novectors
22022 for applications that do not require any of the MicroBlaze
22023 vectors. This option may be useful for applications running
22024 within a monitoring application. This model uses crt3.o as a
22025 startup file.
22026
22027 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
22028 model.
22029
22030 -mpic-data-is-text-relative
22031 Assume that the displacement between the text and data segments is
22032 fixed at static link time. This allows data to be referenced by
22033 offset from start of text address instead of GOT since PC-relative
22034 addressing is not supported.
22035
22036 MIPS Options
22037
22038 -EB Generate big-endian code.
22039
22040 -EL Generate little-endian code. This is the default for mips*el-*-*
22041 configurations.
22042
22043 -march=arch
22044 Generate code that runs on arch, which can be the name of a generic
22045 MIPS ISA, or the name of a particular processor. The ISA names
22046 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
22047 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
22048 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
22049 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
22050 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
22051 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
22052 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
22053 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
22054 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
22055 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
22056 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
22057 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
22058 and xlp. The special value from-abi selects the most compatible
22059 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
22060 and mips3 for 64-bit ABIs).
22061
22062 The native Linux/GNU toolchain also supports the value native,
22063 which selects the best architecture option for the host processor.
22064 -march=native has no effect if GCC does not recognize the
22065 processor.
22066
22067 In processor names, a final 000 can be abbreviated as k (for
22068 example, -march=r2k). Prefixes are optional, and vr may be written
22069 r.
22070
22071 Names of the form nf2_1 refer to processors with FPUs clocked at
22072 half the rate of the core, names of the form nf1_1 refer to
22073 processors with FPUs clocked at the same rate as the core, and
22074 names of the form nf3_2 refer to processors with FPUs clocked a
22075 ratio of 3:2 with respect to the core. For compatibility reasons,
22076 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
22077 as synonyms for nf1_1.
22078
22079 GCC defines two macros based on the value of this option. The
22080 first is "_MIPS_ARCH", which gives the name of target architecture,
22081 as a string. The second has the form "_MIPS_ARCH_foo", where foo
22082 is the capitalized value of "_MIPS_ARCH". For example,
22083 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
22084 "_MIPS_ARCH_R2000".
22085
22086 Note that the "_MIPS_ARCH" macro uses the processor names given
22087 above. In other words, it has the full prefix and does not
22088 abbreviate 000 as k. In the case of from-abi, the macro names the
22089 resolved architecture (either "mips1" or "mips3"). It names the
22090 default architecture when no -march option is given.
22091
22092 -mtune=arch
22093 Optimize for arch. Among other things, this option controls the
22094 way instructions are scheduled, and the perceived cost of
22095 arithmetic operations. The list of arch values is the same as for
22096 -march.
22097
22098 When this option is not used, GCC optimizes for the processor
22099 specified by -march. By using -march and -mtune together, it is
22100 possible to generate code that runs on a family of processors, but
22101 optimize the code for one particular member of that family.
22102
22103 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
22104 work in the same way as the -march ones described above.
22105
22106 -mips1
22107 Equivalent to -march=mips1.
22108
22109 -mips2
22110 Equivalent to -march=mips2.
22111
22112 -mips3
22113 Equivalent to -march=mips3.
22114
22115 -mips4
22116 Equivalent to -march=mips4.
22117
22118 -mips32
22119 Equivalent to -march=mips32.
22120
22121 -mips32r3
22122 Equivalent to -march=mips32r3.
22123
22124 -mips32r5
22125 Equivalent to -march=mips32r5.
22126
22127 -mips32r6
22128 Equivalent to -march=mips32r6.
22129
22130 -mips64
22131 Equivalent to -march=mips64.
22132
22133 -mips64r2
22134 Equivalent to -march=mips64r2.
22135
22136 -mips64r3
22137 Equivalent to -march=mips64r3.
22138
22139 -mips64r5
22140 Equivalent to -march=mips64r5.
22141
22142 -mips64r6
22143 Equivalent to -march=mips64r6.
22144
22145 -mips16
22146 -mno-mips16
22147 Generate (do not generate) MIPS16 code. If GCC is targeting a
22148 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
22149
22150 MIPS16 code generation can also be controlled on a per-function
22151 basis by means of "mips16" and "nomips16" attributes.
22152
22153 -mflip-mips16
22154 Generate MIPS16 code on alternating functions. This option is
22155 provided for regression testing of mixed MIPS16/non-MIPS16 code
22156 generation, and is not intended for ordinary use in compiling user
22157 code.
22158
22159 -minterlink-compressed
22160 -mno-interlink-compressed
22161 Require (do not require) that code using the standard
22162 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
22163 microMIPS code, and vice versa.
22164
22165 For example, code using the standard ISA encoding cannot jump
22166 directly to MIPS16 or microMIPS code; it must either use a call or
22167 an indirect jump. -minterlink-compressed therefore disables direct
22168 jumps unless GCC knows that the target of the jump is not
22169 compressed.
22170
22171 -minterlink-mips16
22172 -mno-interlink-mips16
22173 Aliases of -minterlink-compressed and -mno-interlink-compressed.
22174 These options predate the microMIPS ASE and are retained for
22175 backwards compatibility.
22176
22177 -mabi=32
22178 -mabi=o64
22179 -mabi=n32
22180 -mabi=64
22181 -mabi=eabi
22182 Generate code for the given ABI.
22183
22184 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22185 generates 64-bit code when you select a 64-bit architecture, but
22186 you can use -mgp32 to get 32-bit code instead.
22187
22188 For information about the O64 ABI, see
22189 <https://gcc.gnu.org/projects/mipso64-abi.html>.
22190
22191 GCC supports a variant of the o32 ABI in which floating-point
22192 registers are 64 rather than 32 bits wide. You can select this
22193 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
22194 and "mfhc1" instructions and is therefore only supported for
22195 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22196
22197 The register assignments for arguments and return values remain the
22198 same, but each scalar value is passed in a single 64-bit register
22199 rather than a pair of 32-bit registers. For example, scalar
22200 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
22201 The set of call-saved registers also remains the same in that the
22202 even-numbered double-precision registers are saved.
22203
22204 Two additional variants of the o32 ABI are supported to enable a
22205 transition from 32-bit to 64-bit registers. These are FPXX
22206 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
22207 mandates that all code must execute correctly when run using 32-bit
22208 or 64-bit registers. The code can be interlinked with either FP32
22209 or FP64, but not both. The FP64A extension is similar to the FP64
22210 extension but forbids the use of odd-numbered single-precision
22211 registers. This can be used in conjunction with the "FRE" mode of
22212 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
22213 interlink and run in the same process without changing FPU modes.
22214
22215 -mabicalls
22216 -mno-abicalls
22217 Generate (do not generate) code that is suitable for SVR4-style
22218 dynamic objects. -mabicalls is the default for SVR4-based systems.
22219
22220 -mshared
22221 -mno-shared
22222 Generate (do not generate) code that is fully position-independent,
22223 and that can therefore be linked into shared libraries. This
22224 option only affects -mabicalls.
22225
22226 All -mabicalls code has traditionally been position-independent,
22227 regardless of options like -fPIC and -fpic. However, as an
22228 extension, the GNU toolchain allows executables to use absolute
22229 accesses for locally-binding symbols. It can also use shorter GP
22230 initialization sequences and generate direct calls to locally-
22231 defined functions. This mode is selected by -mno-shared.
22232
22233 -mno-shared depends on binutils 2.16 or higher and generates
22234 objects that can only be linked by the GNU linker. However, the
22235 option does not affect the ABI of the final executable; it only
22236 affects the ABI of relocatable objects. Using -mno-shared
22237 generally makes executables both smaller and quicker.
22238
22239 -mshared is the default.
22240
22241 -mplt
22242 -mno-plt
22243 Assume (do not assume) that the static and dynamic linkers support
22244 PLTs and copy relocations. This option only affects -mno-shared
22245 -mabicalls. For the n64 ABI, this option has no effect without
22246 -msym32.
22247
22248 You can make -mplt the default by configuring GCC with
22249 --with-mips-plt. The default is -mno-plt otherwise.
22250
22251 -mxgot
22252 -mno-xgot
22253 Lift (do not lift) the usual restrictions on the size of the global
22254 offset table.
22255
22256 GCC normally uses a single instruction to load values from the GOT.
22257 While this is relatively efficient, it only works if the GOT is
22258 smaller than about 64k. Anything larger causes the linker to
22259 report an error such as:
22260
22261 relocation truncated to fit: R_MIPS_GOT16 foobar
22262
22263 If this happens, you should recompile your code with -mxgot. This
22264 works with very large GOTs, although the code is also less
22265 efficient, since it takes three instructions to fetch the value of
22266 a global symbol.
22267
22268 Note that some linkers can create multiple GOTs. If you have such
22269 a linker, you should only need to use -mxgot when a single object
22270 file accesses more than 64k's worth of GOT entries. Very few do.
22271
22272 These options have no effect unless GCC is generating position
22273 independent code.
22274
22275 -mgp32
22276 Assume that general-purpose registers are 32 bits wide.
22277
22278 -mgp64
22279 Assume that general-purpose registers are 64 bits wide.
22280
22281 -mfp32
22282 Assume that floating-point registers are 32 bits wide.
22283
22284 -mfp64
22285 Assume that floating-point registers are 64 bits wide.
22286
22287 -mfpxx
22288 Do not assume the width of floating-point registers.
22289
22290 -mhard-float
22291 Use floating-point coprocessor instructions.
22292
22293 -msoft-float
22294 Do not use floating-point coprocessor instructions. Implement
22295 floating-point calculations using library calls instead.
22296
22297 -mno-float
22298 Equivalent to -msoft-float, but additionally asserts that the
22299 program being compiled does not perform any floating-point
22300 operations. This option is presently supported only by some bare-
22301 metal MIPS configurations, where it may select a special set of
22302 libraries that lack all floating-point support (including, for
22303 example, the floating-point "printf" formats). If code compiled
22304 with -mno-float accidentally contains floating-point operations, it
22305 is likely to suffer a link-time or run-time failure.
22306
22307 -msingle-float
22308 Assume that the floating-point coprocessor only supports single-
22309 precision operations.
22310
22311 -mdouble-float
22312 Assume that the floating-point coprocessor supports double-
22313 precision operations. This is the default.
22314
22315 -modd-spreg
22316 -mno-odd-spreg
22317 Enable the use of odd-numbered single-precision floating-point
22318 registers for the o32 ABI. This is the default for processors that
22319 are known to support these registers. When using the o32 FPXX ABI,
22320 -mno-odd-spreg is set by default.
22321
22322 -mabs=2008
22323 -mabs=legacy
22324 These options control the treatment of the special not-a-number
22325 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
22326 machine instructions.
22327
22328 By default or when -mabs=legacy is used the legacy treatment is
22329 selected. In this case these instructions are considered
22330 arithmetic and avoided where correct operation is required and the
22331 input operand might be a NaN. A longer sequence of instructions
22332 that manipulate the sign bit of floating-point datum manually is
22333 used instead unless the -ffinite-math-only option has also been
22334 specified.
22335
22336 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
22337 case these instructions are considered non-arithmetic and therefore
22338 operating correctly in all cases, including in particular where the
22339 input operand is a NaN. These instructions are therefore always
22340 used for the respective operations.
22341
22342 -mnan=2008
22343 -mnan=legacy
22344 These options control the encoding of the special not-a-number
22345 (NaN) IEEE 754 floating-point data.
22346
22347 The -mnan=legacy option selects the legacy encoding. In this case
22348 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22349 significand field being 0, whereas signaling NaNs (sNaNs) are
22350 denoted by the first bit of their trailing significand field being
22351 1.
22352
22353 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
22354 case qNaNs are denoted by the first bit of their trailing
22355 significand field being 1, whereas sNaNs are denoted by the first
22356 bit of their trailing significand field being 0.
22357
22358 The default is -mnan=legacy unless GCC has been configured with
22359 --with-nan=2008.
22360
22361 -mllsc
22362 -mno-llsc
22363 Use (do not use) ll, sc, and sync instructions to implement atomic
22364 memory built-in functions. When neither option is specified, GCC
22365 uses the instructions if the target architecture supports them.
22366
22367 -mllsc is useful if the runtime environment can emulate the
22368 instructions and -mno-llsc can be useful when compiling for
22369 nonstandard ISAs. You can make either option the default by
22370 configuring GCC with --with-llsc and --without-llsc respectively.
22371 --with-llsc is the default for some configurations; see the
22372 installation documentation for details.
22373
22374 -mdsp
22375 -mno-dsp
22376 Use (do not use) revision 1 of the MIPS DSP ASE.
22377 This option defines the preprocessor macro "__mips_dsp". It also
22378 defines "__mips_dsp_rev" to 1.
22379
22380 -mdspr2
22381 -mno-dspr2
22382 Use (do not use) revision 2 of the MIPS DSP ASE.
22383 This option defines the preprocessor macros "__mips_dsp" and
22384 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
22385
22386 -msmartmips
22387 -mno-smartmips
22388 Use (do not use) the MIPS SmartMIPS ASE.
22389
22390 -mpaired-single
22391 -mno-paired-single
22392 Use (do not use) paired-single floating-point instructions.
22393 This option requires hardware floating-point support to be
22394 enabled.
22395
22396 -mdmx
22397 -mno-mdmx
22398 Use (do not use) MIPS Digital Media Extension instructions. This
22399 option can only be used when generating 64-bit code and requires
22400 hardware floating-point support to be enabled.
22401
22402 -mips3d
22403 -mno-mips3d
22404 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
22405 -mpaired-single.
22406
22407 -mmicromips
22408 -mno-micromips
22409 Generate (do not generate) microMIPS code.
22410
22411 MicroMIPS code generation can also be controlled on a per-function
22412 basis by means of "micromips" and "nomicromips" attributes.
22413
22414 -mmt
22415 -mno-mt
22416 Use (do not use) MT Multithreading instructions.
22417
22418 -mmcu
22419 -mno-mcu
22420 Use (do not use) the MIPS MCU ASE instructions.
22421
22422 -meva
22423 -mno-eva
22424 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22425
22426 -mvirt
22427 -mno-virt
22428 Use (do not use) the MIPS Virtualization (VZ) instructions.
22429
22430 -mxpa
22431 -mno-xpa
22432 Use (do not use) the MIPS eXtended Physical Address (XPA)
22433 instructions.
22434
22435 -mcrc
22436 -mno-crc
22437 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
22438 instructions.
22439
22440 -mginv
22441 -mno-ginv
22442 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22443
22444 -mloongson-mmi
22445 -mno-loongson-mmi
22446 Use (do not use) the MIPS Loongson MultiMedia extensions
22447 Instructions (MMI).
22448
22449 -mloongson-ext
22450 -mno-loongson-ext
22451 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22452
22453 -mloongson-ext2
22454 -mno-loongson-ext2
22455 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
22456 instructions.
22457
22458 -mlong64
22459 Force "long" types to be 64 bits wide. See -mlong32 for an
22460 explanation of the default and the way that the pointer size is
22461 determined.
22462
22463 -mlong32
22464 Force "long", "int", and pointer types to be 32 bits wide.
22465
22466 The default size of "int"s, "long"s and pointers depends on the
22467 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
22468 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
22469 "long"s. Pointers are the same size as "long"s, or the same size
22470 as integer registers, whichever is smaller.
22471
22472 -msym32
22473 -mno-sym32
22474 Assume (do not assume) that all symbols have 32-bit values,
22475 regardless of the selected ABI. This option is useful in
22476 combination with -mabi=64 and -mno-abicalls because it allows GCC
22477 to generate shorter and faster references to symbolic addresses.
22478
22479 -G num
22480 Put definitions of externally-visible data in a small data section
22481 if that data is no bigger than num bytes. GCC can then generate
22482 more efficient accesses to the data; see -mgpopt for details.
22483
22484 The default -G option depends on the configuration.
22485
22486 -mlocal-sdata
22487 -mno-local-sdata
22488 Extend (do not extend) the -G behavior to local data too, such as
22489 to static variables in C. -mlocal-sdata is the default for all
22490 configurations.
22491
22492 If the linker complains that an application is using too much small
22493 data, you might want to try rebuilding the less performance-
22494 critical parts with -mno-local-sdata. You might also want to build
22495 large libraries with -mno-local-sdata, so that the libraries leave
22496 more room for the main program.
22497
22498 -mextern-sdata
22499 -mno-extern-sdata
22500 Assume (do not assume) that externally-defined data is in a small
22501 data section if the size of that data is within the -G limit.
22502 -mextern-sdata is the default for all configurations.
22503
22504 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
22505 Mod references a variable Var that is no bigger than num bytes, you
22506 must make sure that Var is placed in a small data section. If Var
22507 is defined by another module, you must either compile that module
22508 with a high-enough -G setting or attach a "section" attribute to
22509 Var's definition. If Var is common, you must link the application
22510 with a high-enough -G setting.
22511
22512 The easiest way of satisfying these restrictions is to compile and
22513 link every module with the same -G option. However, you may wish
22514 to build a library that supports several different small data
22515 limits. You can do this by compiling the library with the highest
22516 supported -G setting and additionally using -mno-extern-sdata to
22517 stop the library from making assumptions about externally-defined
22518 data.
22519
22520 -mgpopt
22521 -mno-gpopt
22522 Use (do not use) GP-relative accesses for symbols that are known to
22523 be in a small data section; see -G, -mlocal-sdata and
22524 -mextern-sdata. -mgpopt is the default for all configurations.
22525
22526 -mno-gpopt is useful for cases where the $gp register might not
22527 hold the value of "_gp". For example, if the code is part of a
22528 library that might be used in a boot monitor, programs that call
22529 boot monitor routines pass an unknown value in $gp. (In such
22530 situations, the boot monitor itself is usually compiled with -G0.)
22531
22532 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
22533
22534 -membedded-data
22535 -mno-embedded-data
22536 Allocate variables to the read-only data section first if possible,
22537 then next in the small data section if possible, otherwise in data.
22538 This gives slightly slower code than the default, but reduces the
22539 amount of RAM required when executing, and thus may be preferred
22540 for some embedded systems.
22541
22542 -muninit-const-in-rodata
22543 -mno-uninit-const-in-rodata
22544 Put uninitialized "const" variables in the read-only data section.
22545 This option is only meaningful in conjunction with -membedded-data.
22546
22547 -mcode-readable=setting
22548 Specify whether GCC may generate code that reads from executable
22549 sections. There are three possible settings:
22550
22551 -mcode-readable=yes
22552 Instructions may freely access executable sections. This is
22553 the default setting.
22554
22555 -mcode-readable=pcrel
22556 MIPS16 PC-relative load instructions can access executable
22557 sections, but other instructions must not do so. This option
22558 is useful on 4KSc and 4KSd processors when the code TLBs have
22559 the Read Inhibit bit set. It is also useful on processors that
22560 can be configured to have a dual instruction/data SRAM
22561 interface and that, like the M4K, automatically redirect PC-
22562 relative loads to the instruction RAM.
22563
22564 -mcode-readable=no
22565 Instructions must not access executable sections. This option
22566 can be useful on targets that are configured to have a dual
22567 instruction/data SRAM interface but that (unlike the M4K) do
22568 not automatically redirect PC-relative loads to the instruction
22569 RAM.
22570
22571 -msplit-addresses
22572 -mno-split-addresses
22573 Enable (disable) use of the "%hi()" and "%lo()" assembler
22574 relocation operators. This option has been superseded by
22575 -mexplicit-relocs but is retained for backwards compatibility.
22576
22577 -mexplicit-relocs
22578 -mno-explicit-relocs
22579 Use (do not use) assembler relocation operators when dealing with
22580 symbolic addresses. The alternative, selected by
22581 -mno-explicit-relocs, is to use assembler macros instead.
22582
22583 -mexplicit-relocs is the default if GCC was configured to use an
22584 assembler that supports relocation operators.
22585
22586 -mcheck-zero-division
22587 -mno-check-zero-division
22588 Trap (do not trap) on integer division by zero.
22589
22590 The default is -mcheck-zero-division.
22591
22592 -mdivide-traps
22593 -mdivide-breaks
22594 MIPS systems check for division by zero by generating either a
22595 conditional trap or a break instruction. Using traps results in
22596 smaller code, but is only supported on MIPS II and later. Also,
22597 some versions of the Linux kernel have a bug that prevents trap
22598 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
22599 to allow conditional traps on architectures that support them and
22600 -mdivide-breaks to force the use of breaks.
22601
22602 The default is usually -mdivide-traps, but this can be overridden
22603 at configure time using --with-divide=breaks. Divide-by-zero
22604 checks can be completely disabled using -mno-check-zero-division.
22605
22606 -mload-store-pairs
22607 -mno-load-store-pairs
22608 Enable (disable) an optimization that pairs consecutive load or
22609 store instructions to enable load/store bonding. This option is
22610 enabled by default but only takes effect when the selected
22611 architecture is known to support bonding.
22612
22613 -munaligned-access
22614 -mno-unaligned-access
22615 Enable (disable) direct unaligned access for MIPS Release 6.
22616 MIPSr6 requires load/store unaligned-access support, by hardware or
22617 trap&emulate. So -mno-unaligned-access may be needed by kernel.
22618
22619 -mmemcpy
22620 -mno-memcpy
22621 Force (do not force) the use of "memcpy" for non-trivial block
22622 moves. The default is -mno-memcpy, which allows GCC to inline most
22623 constant-sized copies.
22624
22625 -mlong-calls
22626 -mno-long-calls
22627 Disable (do not disable) use of the "jal" instruction. Calling
22628 functions using "jal" is more efficient but requires the caller and
22629 callee to be in the same 256 megabyte segment.
22630
22631 This option has no effect on abicalls code. The default is
22632 -mno-long-calls.
22633
22634 -mmad
22635 -mno-mad
22636 Enable (disable) use of the "mad", "madu" and "mul" instructions,
22637 as provided by the R4650 ISA.
22638
22639 -mimadd
22640 -mno-imadd
22641 Enable (disable) use of the "madd" and "msub" integer instructions.
22642 The default is -mimadd on architectures that support "madd" and
22643 "msub" except for the 74k architecture where it was found to
22644 generate slower code.
22645
22646 -mfused-madd
22647 -mno-fused-madd
22648 Enable (disable) use of the floating-point multiply-accumulate
22649 instructions, when they are available. The default is
22650 -mfused-madd.
22651
22652 On the R8000 CPU when multiply-accumulate instructions are used,
22653 the intermediate product is calculated to infinite precision and is
22654 not subject to the FCSR Flush to Zero bit. This may be undesirable
22655 in some circumstances. On other processors the result is
22656 numerically identical to the equivalent computation using separate
22657 multiply, add, subtract and negate instructions.
22658
22659 -nocpp
22660 Tell the MIPS assembler to not run its preprocessor over user
22661 assembler files (with a .s suffix) when assembling them.
22662
22663 -mfix-24k
22664 -mno-fix-24k
22665 Work around the 24K E48 (lost data on stores during refill) errata.
22666 The workarounds are implemented by the assembler rather than by
22667 GCC.
22668
22669 -mfix-r4000
22670 -mno-fix-r4000
22671 Work around certain R4000 CPU errata:
22672
22673 - A double-word or a variable shift may give an incorrect result
22674 if executed immediately after starting an integer division.
22675
22676 - A double-word or a variable shift may give an incorrect result
22677 if executed while an integer multiplication is in progress.
22678
22679 - An integer division may give an incorrect result if started in
22680 a delay slot of a taken branch or a jump.
22681
22682 -mfix-r4400
22683 -mno-fix-r4400
22684 Work around certain R4400 CPU errata:
22685
22686 - A double-word or a variable shift may give an incorrect result
22687 if executed immediately after starting an integer division.
22688
22689 -mfix-r10000
22690 -mno-fix-r10000
22691 Work around certain R10000 errata:
22692
22693 - "ll"/"sc" sequences may not behave atomically on revisions
22694 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22695
22696 This option can only be used if the target architecture supports
22697 branch-likely instructions. -mfix-r10000 is the default when
22698 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
22699
22700 -mfix-r5900
22701 -mno-fix-r5900
22702 Do not attempt to schedule the preceding instruction into the delay
22703 slot of a branch instruction placed at the end of a short loop of
22704 six instructions or fewer and always schedule a "nop" instruction
22705 there instead. The short loop bug under certain conditions causes
22706 loops to execute only once or twice, due to a hardware bug in the
22707 R5900 chip. The workaround is implemented by the assembler rather
22708 than by GCC.
22709
22710 -mfix-rm7000
22711 -mno-fix-rm7000
22712 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
22713 are implemented by the assembler rather than by GCC.
22714
22715 -mfix-vr4120
22716 -mno-fix-vr4120
22717 Work around certain VR4120 errata:
22718
22719 - "dmultu" does not always produce the correct result.
22720
22721 - "div" and "ddiv" do not always produce the correct result if
22722 one of the operands is negative.
22723
22724 The workarounds for the division errata rely on special functions
22725 in libgcc.a. At present, these functions are only provided by the
22726 "mips64vr*-elf" configurations.
22727
22728 Other VR4120 errata require a NOP to be inserted between certain
22729 pairs of instructions. These errata are handled by the assembler,
22730 not by GCC itself.
22731
22732 -mfix-vr4130
22733 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
22734 implemented by the assembler rather than by GCC, although GCC
22735 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
22736 "dmacc" and "dmacchi" instructions are available instead.
22737
22738 -mfix-sb1
22739 -mno-fix-sb1
22740 Work around certain SB-1 CPU core errata. (This flag currently
22741 works around the SB-1 revision 2 "F1" and "F2" floating-point
22742 errata.)
22743
22744 -mr10k-cache-barrier=setting
22745 Specify whether GCC should insert cache barriers to avoid the side
22746 effects of speculation on R10K processors.
22747
22748 In common with many processors, the R10K tries to predict the
22749 outcome of a conditional branch and speculatively executes
22750 instructions from the "taken" branch. It later aborts these
22751 instructions if the predicted outcome is wrong. However, on the
22752 R10K, even aborted instructions can have side effects.
22753
22754 This problem only affects kernel stores and, depending on the
22755 system, kernel loads. As an example, a speculatively-executed
22756 store may load the target memory into cache and mark the cache line
22757 as dirty, even if the store itself is later aborted. If a DMA
22758 operation writes to the same area of memory before the "dirty" line
22759 is flushed, the cached data overwrites the DMA-ed data. See the
22760 R10K processor manual for a full description, including other
22761 potential problems.
22762
22763 One workaround is to insert cache barrier instructions before every
22764 memory access that might be speculatively executed and that might
22765 have side effects even if aborted. -mr10k-cache-barrier=setting
22766 controls GCC's implementation of this workaround. It assumes that
22767 aborted accesses to any byte in the following regions does not have
22768 side effects:
22769
22770 1. the memory occupied by the current function's stack frame;
22771
22772 2. the memory occupied by an incoming stack argument;
22773
22774 3. the memory occupied by an object with a link-time-constant
22775 address.
22776
22777 It is the kernel's responsibility to ensure that speculative
22778 accesses to these regions are indeed safe.
22779
22780 If the input program contains a function declaration such as:
22781
22782 void foo (void);
22783
22784 then the implementation of "foo" must allow "j foo" and "jal foo"
22785 to be executed speculatively. GCC honors this restriction for
22786 functions it compiles itself. It expects non-GCC functions (such
22787 as hand-written assembly code) to do the same.
22788
22789 The option has three forms:
22790
22791 -mr10k-cache-barrier=load-store
22792 Insert a cache barrier before a load or store that might be
22793 speculatively executed and that might have side effects even if
22794 aborted.
22795
22796 -mr10k-cache-barrier=store
22797 Insert a cache barrier before a store that might be
22798 speculatively executed and that might have side effects even if
22799 aborted.
22800
22801 -mr10k-cache-barrier=none
22802 Disable the insertion of cache barriers. This is the default
22803 setting.
22804
22805 -mflush-func=func
22806 -mno-flush-func
22807 Specifies the function to call to flush the I and D caches, or to
22808 not call any such function. If called, the function must take the
22809 same arguments as the common "_flush_func", that is, the address of
22810 the memory range for which the cache is being flushed, the size of
22811 the memory range, and the number 3 (to flush both caches). The
22812 default depends on the target GCC was configured for, but commonly
22813 is either "_flush_func" or "__cpu_flush".
22814
22815 mbranch-cost=num
22816 Set the cost of branches to roughly num "simple" instructions.
22817 This cost is only a heuristic and is not guaranteed to produce
22818 consistent results across releases. A zero cost redundantly
22819 selects the default, which is based on the -mtune setting.
22820
22821 -mbranch-likely
22822 -mno-branch-likely
22823 Enable or disable use of Branch Likely instructions, regardless of
22824 the default for the selected architecture. By default, Branch
22825 Likely instructions may be generated if they are supported by the
22826 selected architecture. An exception is for the MIPS32 and MIPS64
22827 architectures and processors that implement those architectures;
22828 for those, Branch Likely instructions are not be generated by
22829 default because the MIPS32 and MIPS64 architectures specifically
22830 deprecate their use.
22831
22832 -mcompact-branches=never
22833 -mcompact-branches=optimal
22834 -mcompact-branches=always
22835 These options control which form of branches will be generated.
22836 The default is -mcompact-branches=optimal.
22837
22838 The -mcompact-branches=never option ensures that compact branch
22839 instructions will never be generated.
22840
22841 The -mcompact-branches=always option ensures that a compact branch
22842 instruction will be generated if available. If a compact branch
22843 instruction is not available, a delay slot form of the branch will
22844 be used instead.
22845
22846 This option is supported from MIPS Release 6 onwards.
22847
22848 The -mcompact-branches=optimal option will cause a delay slot
22849 branch to be used if one is available in the current ISA and the
22850 delay slot is successfully filled. If the delay slot is not
22851 filled, a compact branch will be chosen if one is available.
22852
22853 -mfp-exceptions
22854 -mno-fp-exceptions
22855 Specifies whether FP exceptions are enabled. This affects how FP
22856 instructions are scheduled for some processors. The default is
22857 that FP exceptions are enabled.
22858
22859 For instance, on the SB-1, if FP exceptions are disabled, and we
22860 are emitting 64-bit code, then we can use both FP pipes.
22861 Otherwise, we can only use one FP pipe.
22862
22863 -mvr4130-align
22864 -mno-vr4130-align
22865 The VR4130 pipeline is two-way superscalar, but can only issue two
22866 instructions together if the first one is 8-byte aligned. When
22867 this option is enabled, GCC aligns pairs of instructions that it
22868 thinks should execute in parallel.
22869
22870 This option only has an effect when optimizing for the VR4130. It
22871 normally makes code faster, but at the expense of making it bigger.
22872 It is enabled by default at optimization level -O3.
22873
22874 -msynci
22875 -mno-synci
22876 Enable (disable) generation of "synci" instructions on
22877 architectures that support it. The "synci" instructions (if
22878 enabled) are generated when "__builtin___clear_cache" is compiled.
22879
22880 This option defaults to -mno-synci, but the default can be
22881 overridden by configuring GCC with --with-synci.
22882
22883 When compiling code for single processor systems, it is generally
22884 safe to use "synci". However, on many multi-core (SMP) systems, it
22885 does not invalidate the instruction caches on all cores and may
22886 lead to undefined behavior.
22887
22888 -mrelax-pic-calls
22889 -mno-relax-pic-calls
22890 Try to turn PIC calls that are normally dispatched via register $25
22891 into direct calls. This is only possible if the linker can resolve
22892 the destination at link time and if the destination is within range
22893 for a direct call.
22894
22895 -mrelax-pic-calls is the default if GCC was configured to use an
22896 assembler and a linker that support the ".reloc" assembly directive
22897 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
22898 this optimization can be performed by the assembler and the linker
22899 alone without help from the compiler.
22900
22901 -mmcount-ra-address
22902 -mno-mcount-ra-address
22903 Emit (do not emit) code that allows "_mcount" to modify the calling
22904 function's return address. When enabled, this option extends the
22905 usual "_mcount" interface with a new ra-address parameter, which
22906 has type "intptr_t *" and is passed in register $12. "_mcount" can
22907 then modify the return address by doing both of the following:
22908
22909 * Returning the new address in register $31.
22910
22911 * Storing the new address in "*ra-address", if ra-address is
22912 nonnull.
22913
22914 The default is -mno-mcount-ra-address.
22915
22916 -mframe-header-opt
22917 -mno-frame-header-opt
22918 Enable (disable) frame header optimization in the o32 ABI. When
22919 using the o32 ABI, calling functions will allocate 16 bytes on the
22920 stack for the called function to write out register arguments.
22921 When enabled, this optimization will suppress the allocation of the
22922 frame header if it can be determined that it is unused.
22923
22924 This optimization is off by default at all optimization levels.
22925
22926 -mlxc1-sxc1
22927 -mno-lxc1-sxc1
22928 When applicable, enable (disable) the generation of "lwxc1",
22929 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
22930
22931 -mmadd4
22932 -mno-madd4
22933 When applicable, enable (disable) the generation of 4-operand
22934 "madd.s", "madd.d" and related instructions. Enabled by default.
22935
22936 MMIX Options
22937
22938 These options are defined for the MMIX:
22939
22940 -mlibfuncs
22941 -mno-libfuncs
22942 Specify that intrinsic library functions are being compiled,
22943 passing all values in registers, no matter the size.
22944
22945 -mepsilon
22946 -mno-epsilon
22947 Generate floating-point comparison instructions that compare with
22948 respect to the "rE" epsilon register.
22949
22950 -mabi=mmixware
22951 -mabi=gnu
22952 Generate code that passes function parameters and return values
22953 that (in the called function) are seen as registers $0 and up, as
22954 opposed to the GNU ABI which uses global registers $231 and up.
22955
22956 -mzero-extend
22957 -mno-zero-extend
22958 When reading data from memory in sizes shorter than 64 bits, use
22959 (do not use) zero-extending load instructions by default, rather
22960 than sign-extending ones.
22961
22962 -mknuthdiv
22963 -mno-knuthdiv
22964 Make the result of a division yielding a remainder have the same
22965 sign as the divisor. With the default, -mno-knuthdiv, the sign of
22966 the remainder follows the sign of the dividend. Both methods are
22967 arithmetically valid, the latter being almost exclusively used.
22968
22969 -mtoplevel-symbols
22970 -mno-toplevel-symbols
22971 Prepend (do not prepend) a : to all global symbols, so the assembly
22972 code can be used with the "PREFIX" assembly directive.
22973
22974 -melf
22975 Generate an executable in the ELF format, rather than the default
22976 mmo format used by the mmix simulator.
22977
22978 -mbranch-predict
22979 -mno-branch-predict
22980 Use (do not use) the probable-branch instructions, when static
22981 branch prediction indicates a probable branch.
22982
22983 -mbase-addresses
22984 -mno-base-addresses
22985 Generate (do not generate) code that uses base addresses. Using a
22986 base address automatically generates a request (handled by the
22987 assembler and the linker) for a constant to be set up in a global
22988 register. The register is used for one or more base address
22989 requests within the range 0 to 255 from the value held in the
22990 register. The generally leads to short and fast code, but the
22991 number of different data items that can be addressed is limited.
22992 This means that a program that uses lots of static data may require
22993 -mno-base-addresses.
22994
22995 -msingle-exit
22996 -mno-single-exit
22997 Force (do not force) generated code to have a single exit point in
22998 each function.
22999
23000 MN10300 Options
23001
23002 These -m options are defined for Matsushita MN10300 architectures:
23003
23004 -mmult-bug
23005 Generate code to avoid bugs in the multiply instructions for the
23006 MN10300 processors. This is the default.
23007
23008 -mno-mult-bug
23009 Do not generate code to avoid bugs in the multiply instructions for
23010 the MN10300 processors.
23011
23012 -mam33
23013 Generate code using features specific to the AM33 processor.
23014
23015 -mno-am33
23016 Do not generate code using features specific to the AM33 processor.
23017 This is the default.
23018
23019 -mam33-2
23020 Generate code using features specific to the AM33/2.0 processor.
23021
23022 -mam34
23023 Generate code using features specific to the AM34 processor.
23024
23025 -mtune=cpu-type
23026 Use the timing characteristics of the indicated CPU type when
23027 scheduling instructions. This does not change the targeted
23028 processor type. The CPU type must be one of mn10300, am33, am33-2
23029 or am34.
23030
23031 -mreturn-pointer-on-d0
23032 When generating a function that returns a pointer, return the
23033 pointer in both "a0" and "d0". Otherwise, the pointer is returned
23034 only in "a0", and attempts to call such functions without a
23035 prototype result in errors. Note that this option is on by
23036 default; use -mno-return-pointer-on-d0 to disable it.
23037
23038 -mno-crt0
23039 Do not link in the C run-time initialization object file.
23040
23041 -mrelax
23042 Indicate to the linker that it should perform a relaxation
23043 optimization pass to shorten branches, calls and absolute memory
23044 addresses. This option only has an effect when used on the command
23045 line for the final link step.
23046
23047 This option makes symbolic debugging impossible.
23048
23049 -mliw
23050 Allow the compiler to generate Long Instruction Word instructions
23051 if the target is the AM33 or later. This is the default. This
23052 option defines the preprocessor macro "__LIW__".
23053
23054 -mno-liw
23055 Do not allow the compiler to generate Long Instruction Word
23056 instructions. This option defines the preprocessor macro
23057 "__NO_LIW__".
23058
23059 -msetlb
23060 Allow the compiler to generate the SETLB and Lcc instructions if
23061 the target is the AM33 or later. This is the default. This option
23062 defines the preprocessor macro "__SETLB__".
23063
23064 -mno-setlb
23065 Do not allow the compiler to generate SETLB or Lcc instructions.
23066 This option defines the preprocessor macro "__NO_SETLB__".
23067
23068 Moxie Options
23069
23070 -meb
23071 Generate big-endian code. This is the default for moxie-*-*
23072 configurations.
23073
23074 -mel
23075 Generate little-endian code.
23076
23077 -mmul.x
23078 Generate mul.x and umul.x instructions. This is the default for
23079 moxiebox-*-* configurations.
23080
23081 -mno-crt0
23082 Do not link in the C run-time initialization object file.
23083
23084 MSP430 Options
23085
23086 These options are defined for the MSP430:
23087
23088 -masm-hex
23089 Force assembly output to always use hex constants. Normally such
23090 constants are signed decimals, but this option is available for
23091 testsuite and/or aesthetic purposes.
23092
23093 -mmcu=
23094 Select the MCU to target. This is used to create a C preprocessor
23095 symbol based upon the MCU name, converted to upper case and pre-
23096 and post-fixed with __. This in turn is used by the msp430.h
23097 header file to select an MCU-specific supplementary header file.
23098
23099 The option also sets the ISA to use. If the MCU name is one that
23100 is known to only support the 430 ISA then that is selected,
23101 otherwise the 430X ISA is selected. A generic MCU name of msp430
23102 can also be used to select the 430 ISA. Similarly the generic
23103 msp430x MCU name selects the 430X ISA.
23104
23105 In addition an MCU-specific linker script is added to the linker
23106 command line. The script's name is the name of the MCU with .ld
23107 appended. Thus specifying -mmcu=xxx on the gcc command line
23108 defines the C preprocessor symbol "__XXX__" and cause the linker to
23109 search for a script called xxx.ld.
23110
23111 The ISA and hardware multiply supported for the different MCUs is
23112 hard-coded into GCC. However, an external devices.csv file can be
23113 used to extend device support beyond those that have been hard-
23114 coded.
23115
23116 GCC searches for the devices.csv file using the following methods
23117 in the given precedence order, where the first method takes
23118 precendence over the second which takes precedence over the third.
23119
23120 Include path specified with "-I" and "-L"
23121 devices.csv will be searched for in each of the directories
23122 specified by include paths and linker library search paths.
23123
23124 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
23125 Define the value of the global environment variable
23126 MSP430_GCC_INCLUDE_DIR to the full path to the directory
23127 containing devices.csv, and GCC will search this directory for
23128 devices.csv. If devices.csv is found, this directory will also
23129 be registered as an include path, and linker library path.
23130 Header files and linker scripts in this directory can therefore
23131 be used without manually specifying "-I" and "-L" on the
23132 command line.
23133
23134 The msp430-elf{,bare}/include/devices directory
23135 Finally, GCC will examine msp430-elf{,bare}/include/devices
23136 from the toolchain root directory. This directory does not
23137 exist in a default installation, but if the user has created it
23138 and copied devices.csv there, then the MCU data will be read.
23139 As above, this directory will also be registered as an include
23140 path, and linker library path.
23141
23142 If none of the above search methods find devices.csv, then the
23143 hard-coded MCU data is used.
23144
23145 -mwarn-mcu
23146 -mno-warn-mcu
23147 This option enables or disables warnings about conflicts between
23148 the MCU name specified by the -mmcu option and the ISA set by the
23149 -mcpu option and/or the hardware multiply support set by the
23150 -mhwmult option. It also toggles warnings about unrecognized MCU
23151 names. This option is on by default.
23152
23153 -mcpu=
23154 Specifies the ISA to use. Accepted values are msp430, msp430x and
23155 msp430xv2. This option is deprecated. The -mmcu= option should be
23156 used to select the ISA.
23157
23158 -msim
23159 Link to the simulator runtime libraries and linker script.
23160 Overrides any scripts that would be selected by the -mmcu= option.
23161
23162 -mlarge
23163 Use large-model addressing (20-bit pointers, 20-bit "size_t").
23164
23165 -msmall
23166 Use small-model addressing (16-bit pointers, 16-bit "size_t").
23167
23168 -mrelax
23169 This option is passed to the assembler and linker, and allows the
23170 linker to perform certain optimizations that cannot be done until
23171 the final link.
23172
23173 mhwmult=
23174 Describes the type of hardware multiply supported by the target.
23175 Accepted values are none for no hardware multiply, 16bit for the
23176 original 16-bit-only multiply supported by early MCUs. 32bit for
23177 the 16/32-bit multiply supported by later MCUs and f5series for the
23178 16/32-bit multiply supported by F5-series MCUs. A value of auto
23179 can also be given. This tells GCC to deduce the hardware multiply
23180 support based upon the MCU name provided by the -mmcu option. If
23181 no -mmcu option is specified or if the MCU name is not recognized
23182 then no hardware multiply support is assumed. "auto" is the
23183 default setting.
23184
23185 Hardware multiplies are normally performed by calling a library
23186 routine. This saves space in the generated code. When compiling
23187 at -O3 or higher however the hardware multiplier is invoked inline.
23188 This makes for bigger, but faster code.
23189
23190 The hardware multiply routines disable interrupts whilst running
23191 and restore the previous interrupt state when they finish. This
23192 makes them safe to use inside interrupt handlers as well as in
23193 normal code.
23194
23195 -minrt
23196 Enable the use of a minimum runtime environment - no static
23197 initializers or constructors. This is intended for memory-
23198 constrained devices. The compiler includes special symbols in some
23199 objects that tell the linker and runtime which code fragments are
23200 required.
23201
23202 -mtiny-printf
23203 Enable reduced code size "printf" and "puts" library functions.
23204 The tiny implementations of these functions are not reentrant, so
23205 must be used with caution in multi-threaded applications.
23206
23207 Support for streams has been removed and the string to be printed
23208 will always be sent to stdout via the "write" syscall. The string
23209 is not buffered before it is sent to write.
23210
23211 This option requires Newlib Nano IO, so GCC must be configured with
23212 --enable-newlib-nano-formatted-io.
23213
23214 -mmax-inline-shift=
23215 This option takes an integer between 0 and 64 inclusive, and sets
23216 the maximum number of inline shift instructions which should be
23217 emitted to perform a shift operation by a constant amount. When
23218 this value needs to be exceeded, an mspabi helper function is used
23219 instead. The default value is 4.
23220
23221 This only affects cases where a shift by multiple positions cannot
23222 be completed with a single instruction (e.g. all shifts >1 on the
23223 430 ISA).
23224
23225 Shifts of a 32-bit value are at least twice as costly, so the value
23226 passed for this option is divided by 2 and the resulting value used
23227 instead.
23228
23229 -mcode-region=
23230 -mdata-region=
23231 These options tell the compiler where to place functions and data
23232 that do not have one of the "lower", "upper", "either" or "section"
23233 attributes. Possible values are "lower", "upper", "either" or
23234 "any". The first three behave like the corresponding attribute.
23235 The fourth possible value - "any" - is the default. It leaves
23236 placement entirely up to the linker script and how it assigns the
23237 standard sections (".text", ".data", etc) to the memory regions.
23238
23239 -msilicon-errata=
23240 This option passes on a request to assembler to enable the fixes
23241 for the named silicon errata.
23242
23243 -msilicon-errata-warn=
23244 This option passes on a request to the assembler to enable warning
23245 messages when a silicon errata might need to be applied.
23246
23247 -mwarn-devices-csv
23248 -mno-warn-devices-csv
23249 Warn if devices.csv is not found or there are problem parsing it
23250 (default: on).
23251
23252 NDS32 Options
23253
23254 These options are defined for NDS32 implementations:
23255
23256 -mbig-endian
23257 Generate code in big-endian mode.
23258
23259 -mlittle-endian
23260 Generate code in little-endian mode.
23261
23262 -mreduced-regs
23263 Use reduced-set registers for register allocation.
23264
23265 -mfull-regs
23266 Use full-set registers for register allocation.
23267
23268 -mcmov
23269 Generate conditional move instructions.
23270
23271 -mno-cmov
23272 Do not generate conditional move instructions.
23273
23274 -mext-perf
23275 Generate performance extension instructions.
23276
23277 -mno-ext-perf
23278 Do not generate performance extension instructions.
23279
23280 -mext-perf2
23281 Generate performance extension 2 instructions.
23282
23283 -mno-ext-perf2
23284 Do not generate performance extension 2 instructions.
23285
23286 -mext-string
23287 Generate string extension instructions.
23288
23289 -mno-ext-string
23290 Do not generate string extension instructions.
23291
23292 -mv3push
23293 Generate v3 push25/pop25 instructions.
23294
23295 -mno-v3push
23296 Do not generate v3 push25/pop25 instructions.
23297
23298 -m16-bit
23299 Generate 16-bit instructions.
23300
23301 -mno-16-bit
23302 Do not generate 16-bit instructions.
23303
23304 -misr-vector-size=num
23305 Specify the size of each interrupt vector, which must be 4 or 16.
23306
23307 -mcache-block-size=num
23308 Specify the size of each cache block, which must be a power of 2
23309 between 4 and 512.
23310
23311 -march=arch
23312 Specify the name of the target architecture.
23313
23314 -mcmodel=code-model
23315 Set the code model to one of
23316
23317 small
23318 All the data and read-only data segments must be within 512KB
23319 addressing space. The text segment must be within 16MB
23320 addressing space.
23321
23322 medium
23323 The data segment must be within 512KB while the read-only data
23324 segment can be within 4GB addressing space. The text segment
23325 should be still within 16MB addressing space.
23326
23327 large
23328 All the text and data segments can be within 4GB addressing
23329 space.
23330
23331 -mctor-dtor
23332 Enable constructor/destructor feature.
23333
23334 -mrelax
23335 Guide linker to relax instructions.
23336
23337 Nios II Options
23338
23339 These are the options defined for the Altera Nios II processor.
23340
23341 -G num
23342 Put global and static objects less than or equal to num bytes into
23343 the small data or BSS sections instead of the normal data or BSS
23344 sections. The default value of num is 8.
23345
23346 -mgpopt=option
23347 -mgpopt
23348 -mno-gpopt
23349 Generate (do not generate) GP-relative accesses. The following
23350 option names are recognized:
23351
23352 none
23353 Do not generate GP-relative accesses.
23354
23355 local
23356 Generate GP-relative accesses for small data objects that are
23357 not external, weak, or uninitialized common symbols. Also use
23358 GP-relative addressing for objects that have been explicitly
23359 placed in a small data section via a "section" attribute.
23360
23361 global
23362 As for local, but also generate GP-relative accesses for small
23363 data objects that are external, weak, or common. If you use
23364 this option, you must ensure that all parts of your program
23365 (including libraries) are compiled with the same -G setting.
23366
23367 data
23368 Generate GP-relative accesses for all data objects in the
23369 program. If you use this option, the entire data and BSS
23370 segments of your program must fit in 64K of memory and you must
23371 use an appropriate linker script to allocate them within the
23372 addressable range of the global pointer.
23373
23374 all Generate GP-relative addresses for function pointers as well as
23375 data pointers. If you use this option, the entire text, data,
23376 and BSS segments of your program must fit in 64K of memory and
23377 you must use an appropriate linker script to allocate them
23378 within the addressable range of the global pointer.
23379
23380 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
23381 equivalent to -mgpopt=none.
23382
23383 The default is -mgpopt except when -fpic or -fPIC is specified to
23384 generate position-independent code. Note that the Nios II ABI does
23385 not permit GP-relative accesses from shared libraries.
23386
23387 You may need to specify -mno-gpopt explicitly when building
23388 programs that include large amounts of small data, including large
23389 GOT data sections. In this case, the 16-bit offset for GP-relative
23390 addressing may not be large enough to allow access to the entire
23391 small data section.
23392
23393 -mgprel-sec=regexp
23394 This option specifies additional section names that can be accessed
23395 via GP-relative addressing. It is most useful in conjunction with
23396 "section" attributes on variable declarations and a custom linker
23397 script. The regexp is a POSIX Extended Regular Expression.
23398
23399 This option does not affect the behavior of the -G option, and the
23400 specified sections are in addition to the standard ".sdata" and
23401 ".sbss" small-data sections that are recognized by -mgpopt.
23402
23403 -mr0rel-sec=regexp
23404 This option specifies names of sections that can be accessed via a
23405 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
23406 32-bit address space. It is most useful in conjunction with
23407 "section" attributes on variable declarations and a custom linker
23408 script. The regexp is a POSIX Extended Regular Expression.
23409
23410 In contrast to the use of GP-relative addressing for small data,
23411 zero-based addressing is never generated by default and there are
23412 no conventional section names used in standard linker scripts for
23413 sections in the low or high areas of memory.
23414
23415 -mel
23416 -meb
23417 Generate little-endian (default) or big-endian (experimental) code,
23418 respectively.
23419
23420 -march=arch
23421 This specifies the name of the target Nios II architecture. GCC
23422 uses this name to determine what kind of instructions it can emit
23423 when generating assembly code. Permissible names are: r1, r2.
23424
23425 The preprocessor macro "__nios2_arch__" is available to programs,
23426 with value 1 or 2, indicating the targeted ISA level.
23427
23428 -mbypass-cache
23429 -mno-bypass-cache
23430 Force all load and store instructions to always bypass cache by
23431 using I/O variants of the instructions. The default is not to
23432 bypass the cache.
23433
23434 -mno-cache-volatile
23435 -mcache-volatile
23436 Volatile memory access bypass the cache using the I/O variants of
23437 the load and store instructions. The default is not to bypass the
23438 cache.
23439
23440 -mno-fast-sw-div
23441 -mfast-sw-div
23442 Do not use table-based fast divide for small numbers. The default
23443 is to use the fast divide at -O3 and above.
23444
23445 -mno-hw-mul
23446 -mhw-mul
23447 -mno-hw-mulx
23448 -mhw-mulx
23449 -mno-hw-div
23450 -mhw-div
23451 Enable or disable emitting "mul", "mulx" and "div" family of
23452 instructions by the compiler. The default is to emit "mul" and not
23453 emit "div" and "mulx".
23454
23455 -mbmx
23456 -mno-bmx
23457 -mcdx
23458 -mno-cdx
23459 Enable or disable generation of Nios II R2 BMX (bit manipulation)
23460 and CDX (code density) instructions. Enabling these instructions
23461 also requires -march=r2. Since these instructions are optional
23462 extensions to the R2 architecture, the default is not to emit them.
23463
23464 -mcustom-insn=N
23465 -mno-custom-insn
23466 Each -mcustom-insn=N option enables use of a custom instruction
23467 with encoding N when generating code that uses insn. For example,
23468 -mcustom-fadds=253 generates custom instruction 253 for single-
23469 precision floating-point add operations instead of the default
23470 behavior of using a library call.
23471
23472 The following values of insn are supported. Except as otherwise
23473 noted, floating-point operations are expected to be implemented
23474 with normal IEEE 754 semantics and correspond directly to the C
23475 operators or the equivalent GCC built-in functions.
23476
23477 Single-precision floating point:
23478
23479 fadds, fsubs, fdivs, fmuls
23480 Binary arithmetic operations.
23481
23482 fnegs
23483 Unary negation.
23484
23485 fabss
23486 Unary absolute value.
23487
23488 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
23489 Comparison operations.
23490
23491 fmins, fmaxs
23492 Floating-point minimum and maximum. These instructions are
23493 only generated if -ffinite-math-only is specified.
23494
23495 fsqrts
23496 Unary square root operation.
23497
23498 fcoss, fsins, ftans, fatans, fexps, flogs
23499 Floating-point trigonometric and exponential functions. These
23500 instructions are only generated if -funsafe-math-optimizations
23501 is also specified.
23502
23503 Double-precision floating point:
23504
23505 faddd, fsubd, fdivd, fmuld
23506 Binary arithmetic operations.
23507
23508 fnegd
23509 Unary negation.
23510
23511 fabsd
23512 Unary absolute value.
23513
23514 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
23515 Comparison operations.
23516
23517 fmind, fmaxd
23518 Double-precision minimum and maximum. These instructions are
23519 only generated if -ffinite-math-only is specified.
23520
23521 fsqrtd
23522 Unary square root operation.
23523
23524 fcosd, fsind, ftand, fatand, fexpd, flogd
23525 Double-precision trigonometric and exponential functions.
23526 These instructions are only generated if
23527 -funsafe-math-optimizations is also specified.
23528
23529 Conversions:
23530
23531 fextsd
23532 Conversion from single precision to double precision.
23533
23534 ftruncds
23535 Conversion from double precision to single precision.
23536
23537 fixsi, fixsu, fixdi, fixdu
23538 Conversion from floating point to signed or unsigned integer
23539 types, with truncation towards zero.
23540
23541 round
23542 Conversion from single-precision floating point to signed
23543 integer, rounding to the nearest integer and ties away from
23544 zero. This corresponds to the "__builtin_lroundf" function
23545 when -fno-math-errno is used.
23546
23547 floatis, floatus, floatid, floatud
23548 Conversion from signed or unsigned integer types to floating-
23549 point types.
23550
23551 In addition, all of the following transfer instructions for
23552 internal registers X and Y must be provided to use any of the
23553 double-precision floating-point instructions. Custom instructions
23554 taking two double-precision source operands expect the first
23555 operand in the 64-bit register X. The other operand (or only
23556 operand of a unary operation) is given to the custom arithmetic
23557 instruction with the least significant half in source register src1
23558 and the most significant half in src2. A custom instruction that
23559 returns a double-precision result returns the most significant 32
23560 bits in the destination register and the other half in 32-bit
23561 register Y. GCC automatically generates the necessary code
23562 sequences to write register X and/or read register Y when double-
23563 precision floating-point instructions are used.
23564
23565 fwrx
23566 Write src1 into the least significant half of X and src2 into
23567 the most significant half of X.
23568
23569 fwry
23570 Write src1 into Y.
23571
23572 frdxhi, frdxlo
23573 Read the most or least (respectively) significant half of X and
23574 store it in dest.
23575
23576 frdy
23577 Read the value of Y and store it into dest.
23578
23579 Note that you can gain more local control over generation of Nios
23580 II custom instructions by using the "target("custom-insn=N")" and
23581 "target("no-custom-insn")" function attributes or pragmas.
23582
23583 -mcustom-fpu-cfg=name
23584 This option enables a predefined, named set of custom instruction
23585 encodings (see -mcustom-insn above). Currently, the following sets
23586 are defined:
23587
23588 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
23589 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
23590
23591 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
23592 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
23593 -fsingle-precision-constant
23594
23595 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
23596 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
23597 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
23598 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
23599 -mcustom-fdivs=255 -fsingle-precision-constant
23600
23601 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
23602 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
23603 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
23604 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
23605 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
23606 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
23607 -mcustom-fsubs=254 -mcustom-fdivs=255
23608
23609 Custom instruction assignments given by individual -mcustom-insn=
23610 options override those given by -mcustom-fpu-cfg=, regardless of
23611 the order of the options on the command line.
23612
23613 Note that you can gain more local control over selection of a FPU
23614 configuration by using the "target("custom-fpu-cfg=name")" function
23615 attribute or pragma.
23616
23617 The name fph2 is an abbreviation for Nios II Floating Point
23618 Hardware 2 Component. Please note that the custom instructions
23619 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
23620 generated if -ffinite-math-only is specified. The custom
23621 instruction enabled by -mcustom-round=248 is only generated if
23622 -fno-math-errno is specified. In contrast to the other
23623 configurations, -fsingle-precision-constant is not set.
23624
23625 These additional -m options are available for the Altera Nios II ELF
23626 (bare-metal) target:
23627
23628 -mhal
23629 Link with HAL BSP. This suppresses linking with the GCC-provided C
23630 runtime startup and termination code, and is typically used in
23631 conjunction with -msys-crt0= to specify the location of the
23632 alternate startup code provided by the HAL BSP.
23633
23634 -msmallc
23635 Link with a limited version of the C library, -lsmallc, rather than
23636 Newlib.
23637
23638 -msys-crt0=startfile
23639 startfile is the file name of the startfile (crt0) to use when
23640 linking. This option is only useful in conjunction with -mhal.
23641
23642 -msys-lib=systemlib
23643 systemlib is the library name of the library that provides low-
23644 level system calls required by the C library, e.g. "read" and
23645 "write". This option is typically used to link with a library
23646 provided by a HAL BSP.
23647
23648 Nvidia PTX Options
23649
23650 These options are defined for Nvidia PTX:
23651
23652 -m64
23653 Ignored, but preserved for backward compatibility. Only 64-bit ABI
23654 is supported.
23655
23656 -march=architecture-string
23657 Generate code for the specified PTX ISA target architecture (e.g.
23658 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
23659 sm_75 and sm_80. The default target architecture is sm_30.
23660
23661 This option sets the value of the preprocessor macro "__PTX_SM__";
23662 for instance, for sm_35, it has the value 350.
23663
23664 -misa=architecture-string
23665 Alias of -march=.
23666
23667 -march-map=architecture-string
23668 Select the closest available -march= value that is not more
23669 capable. For instance, for -march-map=sm_50 select -march=sm_35,
23670 and for -march-map=sm_53 select -march=sm_53.
23671
23672 -mptx=version-string
23673 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
23674 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
23675 ISA version is 6.0, unless a higher version is required for
23676 specified PTX ISA target architecture via option -march=.
23677
23678 This option sets the values of the preprocessor macros
23679 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
23680 instance, for 3.1 the macros have the values 3 and 1, respectively.
23681
23682 -mmainkernel
23683 Link in code for a __main kernel. This is for stand-alone instead
23684 of offloading execution.
23685
23686 -moptimize
23687 Apply partitioned execution optimizations. This is the default
23688 when any level of optimization is selected.
23689
23690 -msoft-stack
23691 Generate code that does not use ".local" memory directly for stack
23692 storage. Instead, a per-warp stack pointer is maintained
23693 explicitly. This enables variable-length stack allocation (with
23694 variable-length arrays or "alloca"), and when global memory is used
23695 for underlying storage, makes it possible to access automatic
23696 variables from other threads, or with atomic instructions. This
23697 code generation variant is used for OpenMP offloading, but the
23698 option is exposed on its own for the purpose of testing the
23699 compiler; to generate code suitable for linking into programs using
23700 OpenMP offloading, use option -mgomp.
23701
23702 -muniform-simt
23703 Switch to code generation variant that allows to execute all
23704 threads in each warp, while maintaining memory state and side
23705 effects as if only one thread in each warp was active outside of
23706 OpenMP SIMD regions. All atomic operations and calls to runtime
23707 (malloc, free, vprintf) are conditionally executed (iff current
23708 lane index equals the master lane index), and the register being
23709 assigned is copied via a shuffle instruction from the master lane.
23710 Outside of SIMD regions lane 0 is the master; inside, each thread
23711 sees itself as the master. Shared memory array "int __nvptx_uni[]"
23712 stores all-zeros or all-ones bitmasks for each warp, indicating
23713 current mode (0 outside of SIMD regions). Each thread can bitwise-
23714 and the bitmask at position "tid.y" with current lane index to
23715 compute the master lane index.
23716
23717 -mgomp
23718 Generate code for use in OpenMP offloading: enables -msoft-stack
23719 and -muniform-simt options, and selects corresponding multilib
23720 variant.
23721
23722 OpenRISC Options
23723
23724 These options are defined for OpenRISC:
23725
23726 -mboard=name
23727 Configure a board specific runtime. This will be passed to the
23728 linker for newlib board library linking. The default is "or1ksim".
23729
23730 -mnewlib
23731 This option is ignored; it is for compatibility purposes only.
23732 This used to select linker and preprocessor options for use with
23733 newlib.
23734
23735 -msoft-div
23736 -mhard-div
23737 Select software or hardware divide ("l.div", "l.divu")
23738 instructions. This default is hardware divide.
23739
23740 -msoft-mul
23741 -mhard-mul
23742 Select software or hardware multiply ("l.mul", "l.muli")
23743 instructions. This default is hardware multiply.
23744
23745 -msoft-float
23746 -mhard-float
23747 Select software or hardware for floating point operations. The
23748 default is software.
23749
23750 -mdouble-float
23751 When -mhard-float is selected, enables generation of double-
23752 precision floating point instructions. By default functions from
23753 libgcc are used to perform double-precision floating point
23754 operations.
23755
23756 -munordered-float
23757 When -mhard-float is selected, enables generation of unordered
23758 floating point compare and set flag ("lf.sfun*") instructions. By
23759 default functions from libgcc are used to perform unordered
23760 floating point compare and set flag operations.
23761
23762 -mcmov
23763 Enable generation of conditional move ("l.cmov") instructions. By
23764 default the equivalent will be generated using set and branch.
23765
23766 -mror
23767 Enable generation of rotate right ("l.ror") instructions. By
23768 default functions from libgcc are used to perform rotate right
23769 operations.
23770
23771 -mrori
23772 Enable generation of rotate right with immediate ("l.rori")
23773 instructions. By default functions from libgcc are used to perform
23774 rotate right with immediate operations.
23775
23776 -msext
23777 Enable generation of sign extension ("l.ext*") instructions. By
23778 default memory loads are used to perform sign extension.
23779
23780 -msfimm
23781 Enable generation of compare and set flag with immediate ("l.sf*i")
23782 instructions. By default extra instructions will be generated to
23783 store the immediate to a register first.
23784
23785 -mshftimm
23786 Enable generation of shift with immediate ("l.srai", "l.srli",
23787 "l.slli") instructions. By default extra instructions will be
23788 generated to store the immediate to a register first.
23789
23790 -mcmodel=small
23791 Generate OpenRISC code for the small model: The GOT is limited to
23792 64k. This is the default model.
23793
23794 -mcmodel=large
23795 Generate OpenRISC code for the large model: The GOT may grow up to
23796 4G in size.
23797
23798 PDP-11 Options
23799
23800 These options are defined for the PDP-11:
23801
23802 -mfpu
23803 Use hardware FPP floating point. This is the default. (FIS
23804 floating point on the PDP-11/40 is not supported.) Implies -m45.
23805
23806 -msoft-float
23807 Do not use hardware floating point.
23808
23809 -mac0
23810 Return floating-point results in ac0 (fr0 in Unix assembler
23811 syntax).
23812
23813 -mno-ac0
23814 Return floating-point results in memory. This is the default.
23815
23816 -m40
23817 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23818
23819 -m45
23820 Generate code for a PDP-11/45. This is the default.
23821
23822 -m10
23823 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23824
23825 -mint16
23826 -mno-int32
23827 Use 16-bit "int". This is the default.
23828
23829 -mint32
23830 -mno-int16
23831 Use 32-bit "int".
23832
23833 -msplit
23834 Target has split instruction and data space. Implies -m45.
23835
23836 -munix-asm
23837 Use Unix assembler syntax.
23838
23839 -mdec-asm
23840 Use DEC assembler syntax.
23841
23842 -mgnu-asm
23843 Use GNU assembler syntax. This is the default.
23844
23845 -mlra
23846 Use the new LRA register allocator. By default, the old "reload"
23847 allocator is used.
23848
23849 picoChip Options
23850
23851 These -m options are defined for picoChip implementations:
23852
23853 -mae=ae_type
23854 Set the instruction set, register set, and instruction scheduling
23855 parameters for array element type ae_type. Supported values for
23856 ae_type are ANY, MUL, and MAC.
23857
23858 -mae=ANY selects a completely generic AE type. Code generated with
23859 this option runs on any of the other AE types. The code is not as
23860 efficient as it would be if compiled for a specific AE type, and
23861 some types of operation (e.g., multiplication) do not work properly
23862 on all types of AE.
23863
23864 -mae=MUL selects a MUL AE type. This is the most useful AE type
23865 for compiled code, and is the default.
23866
23867 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
23868 option may suffer from poor performance of byte (char)
23869 manipulation, since the DSP AE does not provide hardware support
23870 for byte load/stores.
23871
23872 -msymbol-as-address
23873 Enable the compiler to directly use a symbol name as an address in
23874 a load/store instruction, without first loading it into a register.
23875 Typically, the use of this option generates larger programs, which
23876 run faster than when the option isn't used. However, the results
23877 vary from program to program, so it is left as a user option,
23878 rather than being permanently enabled.
23879
23880 -mno-inefficient-warnings
23881 Disables warnings about the generation of inefficient code. These
23882 warnings can be generated, for example, when compiling code that
23883 performs byte-level memory operations on the MAC AE type. The MAC
23884 AE has no hardware support for byte-level memory operations, so all
23885 byte load/stores must be synthesized from word load/store
23886 operations. This is inefficient and a warning is generated to
23887 indicate that you should rewrite the code to avoid byte operations,
23888 or to target an AE type that has the necessary hardware support.
23889 This option disables these warnings.
23890
23891 PowerPC Options
23892
23893 These are listed under
23894
23895 PRU Options
23896
23897 These command-line options are defined for PRU target:
23898
23899 -minrt
23900 Link with a minimum runtime environment, with no support for static
23901 initializers and constructors. Using this option can significantly
23902 reduce the size of the final ELF binary. Beware that the compiler
23903 could still generate code with static initializers and
23904 constructors. It is up to the programmer to ensure that the source
23905 program will not use those features.
23906
23907 -mmcu=mcu
23908 Specify the PRU MCU variant to use. Check Newlib for the exact
23909 list of supported MCUs.
23910
23911 -mno-relax
23912 Make GCC pass the --no-relax command-line option to the linker
23913 instead of the --relax option.
23914
23915 -mloop
23916 Allow (or do not allow) GCC to use the LOOP instruction.
23917
23918 -mabi=variant
23919 Specify the ABI variant to output code for. -mabi=ti selects the
23920 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
23921 more naturally with certain GCC assumptions. These are the
23922 differences:
23923
23924 Function Pointer Size
23925 TI ABI specifies that function (code) pointers are 16-bit,
23926 whereas GNU supports only 32-bit data and code pointers.
23927
23928 Optional Return Value Pointer
23929 Function return values larger than 64 bits are passed by using
23930 a hidden pointer as the first argument of the function. TI
23931 ABI, though, mandates that the pointer can be NULL in case the
23932 caller is not using the returned value. GNU always passes and
23933 expects a valid return value pointer.
23934
23935 The current -mabi=ti implementation simply raises a compile error
23936 when any of the above code constructs is detected. As a
23937 consequence the standard C library cannot be built and it is
23938 omitted when linking with -mabi=ti.
23939
23940 Relaxation is a GNU feature and for safety reasons is disabled when
23941 using -mabi=ti. The TI toolchain does not emit relocations for
23942 QBBx instructions, so the GNU linker cannot adjust them when
23943 shortening adjacent LDI32 pseudo instructions.
23944
23945 RISC-V Options
23946
23947 These command-line options are defined for RISC-V targets:
23948
23949 -mbranch-cost=n
23950 Set the cost of branches to roughly n instructions.
23951
23952 -mplt
23953 -mno-plt
23954 When generating PIC code, do or don't allow the use of PLTs.
23955 Ignored for non-PIC. The default is -mplt.
23956
23957 -mabi=ABI-string
23958 Specify integer and floating-point calling convention. ABI-string
23959 contains two parts: the size of integer types and the registers
23960 used for floating-point types. For example -march=rv64ifd
23961 -mabi=lp64d means that long and pointers are 64-bit (implicitly
23962 defining int to be 32-bit), and that floating-point values up to 64
23963 bits wide are passed in F registers. Contrast this with
23964 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
23965 generate code that uses the F and D extensions but only allows
23966 floating-point values up to 32 bits long to be passed in registers;
23967 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
23968 will be passed in registers.
23969
23970 The default for this argument is system dependent, users who want a
23971 specific calling convention should specify one explicitly. The
23972 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
23973 and lp64d. Some calling conventions are impossible to implement on
23974 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
23975 because the ABI requires 64-bit values be passed in F registers,
23976 but F registers are only 32 bits wide. There is also the ilp32e
23977 ABI that can only be used with the rv32e architecture. This ABI is
23978 not well specified at present, and is subject to change.
23979
23980 -mfdiv
23981 -mno-fdiv
23982 Do or don't use hardware floating-point divide and square root
23983 instructions. This requires the F or D extensions for floating-
23984 point registers. The default is to use them if the specified
23985 architecture has these instructions.
23986
23987 -mdiv
23988 -mno-div
23989 Do or don't use hardware instructions for integer division. This
23990 requires the M extension. The default is to use them if the
23991 specified architecture has these instructions.
23992
23993 -misa-spec=ISA-spec-string
23994 Specify the version of the RISC-V Unprivileged (formerly User-
23995 Level) ISA specification to produce code conforming to. The
23996 possibilities for ISA-spec-string are:
23997
23998 2.2 Produce code conforming to version 2.2.
23999
24000 20190608
24001 Produce code conforming to version 20190608.
24002
24003 20191213
24004 Produce code conforming to version 20191213.
24005
24006 The default is -misa-spec=20191213 unless GCC has been configured
24007 with --with-isa-spec= specifying a different default version.
24008
24009 -march=ISA-string
24010 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
24011 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
24012
24013 When -march= is not specified, use the setting from -mcpu.
24014
24015 If both -march and -mcpu= are not specified, the default for this
24016 argument is system dependent, users who want a specific
24017 architecture extensions should specify one explicitly.
24018
24019 -mcpu=processor-string
24020 Use architecture of and optimize the output for the given
24021 processor, specified by particular CPU name. Permissible values
24022 for this option are: sifive-e20, sifive-e21, sifive-e24,
24023 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
24024 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
24025
24026 -mtune=processor-string
24027 Optimize the output for the given processor, specified by
24028 microarchitecture or particular CPU name. Permissible values for
24029 this option are: rocket, sifive-3-series, sifive-5-series,
24030 sifive-7-series, size, and all valid options for -mcpu=.
24031
24032 When -mtune= is not specified, use the setting from -mcpu, the
24033 default is rocket if both are not specified.
24034
24035 The size choice is not intended for use by end-users. This is used
24036 when -Os is specified. It overrides the instruction cost info
24037 provided by -mtune=, but does not override the pipeline info. This
24038 helps reduce code size while still giving good performance.
24039
24040 -mpreferred-stack-boundary=num
24041 Attempt to keep the stack boundary aligned to a 2 raised to num
24042 byte boundary. If -mpreferred-stack-boundary is not specified, the
24043 default is 4 (16 bytes or 128-bits).
24044
24045 Warning: If you use this switch, then you must build all modules
24046 with the same value, including any libraries. This includes the
24047 system libraries and startup modules.
24048
24049 -msmall-data-limit=n
24050 Put global and static data smaller than n bytes into a special
24051 section (on some targets).
24052
24053 -msave-restore
24054 -mno-save-restore
24055 Do or don't use smaller but slower prologue and epilogue code that
24056 uses library function calls. The default is to use fast inline
24057 prologues and epilogues.
24058
24059 -mshorten-memrefs
24060 -mno-shorten-memrefs
24061 Do or do not attempt to make more use of compressed load/store
24062 instructions by replacing a load/store of 'base register + large
24063 offset' with a new load/store of 'new base + small offset'. If the
24064 new base gets stored in a compressed register, then the new
24065 load/store can be compressed. Currently targets 32-bit integer
24066 load/stores only.
24067
24068 -mstrict-align
24069 -mno-strict-align
24070 Do not or do generate unaligned memory accesses. The default is
24071 set depending on whether the processor we are optimizing for
24072 supports fast unaligned access or not.
24073
24074 -mcmodel=medlow
24075 Generate code for the medium-low code model. The program and its
24076 statically defined symbols must lie within a single 2 GiB address
24077 range and must lie between absolute addresses -2 GiB and +2 GiB.
24078 Programs can be statically or dynamically linked. This is the
24079 default code model.
24080
24081 -mcmodel=medany
24082 Generate code for the medium-any code model. The program and its
24083 statically defined symbols must be within any single 2 GiB address
24084 range. Programs can be statically or dynamically linked.
24085
24086 The code generated by the medium-any code model is position-
24087 independent, but is not guaranteed to function correctly when
24088 linked into position-independent executables or libraries.
24089
24090 -mexplicit-relocs
24091 -mno-exlicit-relocs
24092 Use or do not use assembler relocation operators when dealing with
24093 symbolic addresses. The alternative is to use assembler macros
24094 instead, which may limit optimization.
24095
24096 -mrelax
24097 -mno-relax
24098 Take advantage of linker relaxations to reduce the number of
24099 instructions required to materialize symbol addresses. The default
24100 is to take advantage of linker relaxations.
24101
24102 -memit-attribute
24103 -mno-emit-attribute
24104 Emit (do not emit) RISC-V attribute to record extra information
24105 into ELF objects. This feature requires at least binutils 2.32.
24106
24107 -malign-data=type
24108 Control how GCC aligns variables and constants of array, structure,
24109 or union types. Supported values for type are xlen which uses x
24110 register width as the alignment value, and natural which uses
24111 natural alignment. xlen is the default.
24112
24113 -mbig-endian
24114 Generate big-endian code. This is the default when GCC is
24115 configured for a riscv64be-*-* or riscv32be-*-* target.
24116
24117 -mlittle-endian
24118 Generate little-endian code. This is the default when GCC is
24119 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
24120 or riscv32be-*-* target.
24121
24122 -mstack-protector-guard=guard
24123 -mstack-protector-guard-reg=reg
24124 -mstack-protector-guard-offset=offset
24125 Generate stack protection code using canary at guard. Supported
24126 locations are global for a global canary or tls for per-thread
24127 canary in the TLS block.
24128
24129 With the latter choice the options -mstack-protector-guard-reg=reg
24130 and -mstack-protector-guard-offset=offset furthermore specify which
24131 register to use as base register for reading the canary, and from
24132 what offset from that base register. There is no default register
24133 or offset as this is entirely for use within the Linux kernel.
24134
24135 RL78 Options
24136
24137 -msim
24138 Links in additional target libraries to support operation within a
24139 simulator.
24140
24141 -mmul=none
24142 -mmul=g10
24143 -mmul=g13
24144 -mmul=g14
24145 -mmul=rl78
24146 Specifies the type of hardware multiplication and division support
24147 to be used. The simplest is "none", which uses software for both
24148 multiplication and division. This is the default. The "g13" value
24149 is for the hardware multiply/divide peripheral found on the
24150 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
24151 multiplication and division instructions supported by the RL78/G14
24152 (S3 core) parts. The value "rl78" is an alias for "g14" and the
24153 value "mg10" is an alias for "none".
24154
24155 In addition a C preprocessor macro is defined, based upon the
24156 setting of this option. Possible values are: "__RL78_MUL_NONE__",
24157 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
24158
24159 -mcpu=g10
24160 -mcpu=g13
24161 -mcpu=g14
24162 -mcpu=rl78
24163 Specifies the RL78 core to target. The default is the G14 core,
24164 also known as an S3 core or just RL78. The G13 or S2 core does not
24165 have multiply or divide instructions, instead it uses a hardware
24166 peripheral for these operations. The G10 or S1 core does not have
24167 register banks, so it uses a different calling convention.
24168
24169 If this option is set it also selects the type of hardware multiply
24170 support to use, unless this is overridden by an explicit -mmul=none
24171 option on the command line. Thus specifying -mcpu=g13 enables the
24172 use of the G13 hardware multiply peripheral and specifying
24173 -mcpu=g10 disables the use of hardware multiplications altogether.
24174
24175 Note, although the RL78/G14 core is the default target, specifying
24176 -mcpu=g14 or -mcpu=rl78 on the command line does change the
24177 behavior of the toolchain since it also enables G14 hardware
24178 multiply support. If these options are not specified on the
24179 command line then software multiplication routines will be used
24180 even though the code targets the RL78 core. This is for backwards
24181 compatibility with older toolchains which did not have hardware
24182 multiply and divide support.
24183
24184 In addition a C preprocessor macro is defined, based upon the
24185 setting of this option. Possible values are: "__RL78_G10__",
24186 "__RL78_G13__" or "__RL78_G14__".
24187
24188 -mg10
24189 -mg13
24190 -mg14
24191 -mrl78
24192 These are aliases for the corresponding -mcpu= option. They are
24193 provided for backwards compatibility.
24194
24195 -mallregs
24196 Allow the compiler to use all of the available registers. By
24197 default registers "r24..r31" are reserved for use in interrupt
24198 handlers. With this option enabled these registers can be used in
24199 ordinary functions as well.
24200
24201 -m64bit-doubles
24202 -m32bit-doubles
24203 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24204 (-m32bit-doubles) in size. The default is -m32bit-doubles.
24205
24206 -msave-mduc-in-interrupts
24207 -mno-save-mduc-in-interrupts
24208 Specifies that interrupt handler functions should preserve the MDUC
24209 registers. This is only necessary if normal code might use the
24210 MDUC registers, for example because it performs multiplication and
24211 division operations. The default is to ignore the MDUC registers
24212 as this makes the interrupt handlers faster. The target option
24213 -mg13 needs to be passed for this to work as this feature is only
24214 available on the G13 target (S2 core). The MDUC registers will
24215 only be saved if the interrupt handler performs a multiplication or
24216 division operation or it calls another function.
24217
24218 IBM RS/6000 and PowerPC Options
24219
24220 These -m options are defined for the IBM RS/6000 and PowerPC:
24221
24222 -mpowerpc-gpopt
24223 -mno-powerpc-gpopt
24224 -mpowerpc-gfxopt
24225 -mno-powerpc-gfxopt
24226 -mpowerpc64
24227 -mno-powerpc64
24228 -mmfcrf
24229 -mno-mfcrf
24230 -mpopcntb
24231 -mno-popcntb
24232 -mpopcntd
24233 -mno-popcntd
24234 -mfprnd
24235 -mno-fprnd
24236 -mcmpb
24237 -mno-cmpb
24238 -mhard-dfp
24239 -mno-hard-dfp
24240 You use these options to specify which instructions are available
24241 on the processor you are using. The default value of these options
24242 is determined when configuring GCC. Specifying the -mcpu=cpu_type
24243 overrides the specification of these options. We recommend you use
24244 the -mcpu=cpu_type option rather than the options listed above.
24245
24246 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
24247 architecture instructions in the General Purpose group, including
24248 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
24249 to use the optional PowerPC architecture instructions in the
24250 Graphics group, including floating-point select.
24251
24252 The -mmfcrf option allows GCC to generate the move from condition
24253 register field instruction implemented on the POWER4 processor and
24254 other processors that support the PowerPC V2.01 architecture. The
24255 -mpopcntb option allows GCC to generate the popcount and double-
24256 precision FP reciprocal estimate instruction implemented on the
24257 POWER5 processor and other processors that support the PowerPC
24258 V2.02 architecture. The -mpopcntd option allows GCC to generate
24259 the popcount instruction implemented on the POWER7 processor and
24260 other processors that support the PowerPC V2.06 architecture. The
24261 -mfprnd option allows GCC to generate the FP round to integer
24262 instructions implemented on the POWER5+ processor and other
24263 processors that support the PowerPC V2.03 architecture. The -mcmpb
24264 option allows GCC to generate the compare bytes instruction
24265 implemented on the POWER6 processor and other processors that
24266 support the PowerPC V2.05 architecture. The -mhard-dfp option
24267 allows GCC to generate the decimal floating-point instructions
24268 implemented on some POWER processors.
24269
24270 The -mpowerpc64 option allows GCC to generate the additional 64-bit
24271 instructions that are found in the full PowerPC64 architecture and
24272 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24273 -mno-powerpc64.
24274
24275 -mcpu=cpu_type
24276 Set architecture type, register usage, and instruction scheduling
24277 parameters for machine type cpu_type. Supported values for
24278 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
24279 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
24280 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
24281 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
24282 power4, power5, power5+, power6, power6x, power7, power8, power9,
24283 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
24284
24285 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
24286 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
24287 64-bit little endian PowerPC architecture machine types, with an
24288 appropriate, generic processor model assumed for scheduling
24289 purposes.
24290
24291 Specifying native as cpu type detects and selects the architecture
24292 option that corresponds to the host processor of the system
24293 performing the compilation. -mcpu=native has no effect if GCC does
24294 not recognize the processor.
24295
24296 The other options specify a specific processor. Code generated
24297 under those options runs best on that processor, and may not run at
24298 all on others.
24299
24300 The -mcpu options automatically enable or disable the following
24301 options:
24302
24303 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
24304 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
24305 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
24306 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
24307 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
24308
24309 The particular options set for any particular CPU varies between
24310 compiler versions, depending on what setting seems to produce
24311 optimal code for that CPU; it doesn't necessarily reflect the
24312 actual hardware's capabilities. If you wish to set an individual
24313 option to a particular value, you may specify it after the -mcpu
24314 option, like -mcpu=970 -mno-altivec.
24315
24316 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
24317 disabled by the -mcpu option at present because AIX does not have
24318 full support for these options. You may still enable or disable
24319 them individually if you're sure it'll work in your environment.
24320
24321 -mtune=cpu_type
24322 Set the instruction scheduling parameters for machine type
24323 cpu_type, but do not set the architecture type or register usage,
24324 as -mcpu=cpu_type does. The same values for cpu_type are used for
24325 -mtune as for -mcpu. If both are specified, the code generated
24326 uses the architecture and registers set by -mcpu, but the
24327 scheduling parameters set by -mtune.
24328
24329 -mcmodel=small
24330 Generate PowerPC64 code for the small model: The TOC is limited to
24331 64k.
24332
24333 -mcmodel=medium
24334 Generate PowerPC64 code for the medium model: The TOC and other
24335 static data may be up to a total of 4G in size. This is the
24336 default for 64-bit Linux.
24337
24338 -mcmodel=large
24339 Generate PowerPC64 code for the large model: The TOC may be up to
24340 4G in size. Other data and code is only limited by the 64-bit
24341 address space.
24342
24343 -maltivec
24344 -mno-altivec
24345 Generate code that uses (does not use) AltiVec instructions, and
24346 also enable the use of built-in functions that allow more direct
24347 access to the AltiVec instruction set. You may also need to set
24348 -mabi=altivec to adjust the current ABI with AltiVec ABI
24349 enhancements.
24350
24351 When -maltivec is used, the element order for AltiVec intrinsics
24352 such as "vec_splat", "vec_extract", and "vec_insert" match array
24353 element order corresponding to the endianness of the target. That
24354 is, element zero identifies the leftmost element in a vector
24355 register when targeting a big-endian platform, and identifies the
24356 rightmost element in a vector register when targeting a little-
24357 endian platform.
24358
24359 -mvrsave
24360 -mno-vrsave
24361 Generate VRSAVE instructions when generating AltiVec code.
24362
24363 -msecure-plt
24364 Generate code that allows ld and ld.so to build executables and
24365 shared libraries with non-executable ".plt" and ".got" sections.
24366 This is a PowerPC 32-bit SYSV ABI option.
24367
24368 -mbss-plt
24369 Generate code that uses a BSS ".plt" section that ld.so fills in,
24370 and requires ".plt" and ".got" sections that are both writable and
24371 executable. This is a PowerPC 32-bit SYSV ABI option.
24372
24373 -misel
24374 -mno-isel
24375 This switch enables or disables the generation of ISEL
24376 instructions.
24377
24378 -mvsx
24379 -mno-vsx
24380 Generate code that uses (does not use) vector/scalar (VSX)
24381 instructions, and also enable the use of built-in functions that
24382 allow more direct access to the VSX instruction set.
24383
24384 -mcrypto
24385 -mno-crypto
24386 Enable the use (disable) of the built-in functions that allow
24387 direct access to the cryptographic instructions that were added in
24388 version 2.07 of the PowerPC ISA.
24389
24390 -mhtm
24391 -mno-htm
24392 Enable (disable) the use of the built-in functions that allow
24393 direct access to the Hardware Transactional Memory (HTM)
24394 instructions that were added in version 2.07 of the PowerPC ISA.
24395
24396 -mpower8-fusion
24397 -mno-power8-fusion
24398 Generate code that keeps (does not keeps) some integer operations
24399 adjacent so that the instructions can be fused together on power8
24400 and later processors.
24401
24402 -mpower8-vector
24403 -mno-power8-vector
24404 Generate code that uses (does not use) the vector and scalar
24405 instructions that were added in version 2.07 of the PowerPC ISA.
24406 Also enable the use of built-in functions that allow more direct
24407 access to the vector instructions.
24408
24409 -mquad-memory
24410 -mno-quad-memory
24411 Generate code that uses (does not use) the non-atomic quad word
24412 memory instructions. The -mquad-memory option requires use of
24413 64-bit mode.
24414
24415 -mquad-memory-atomic
24416 -mno-quad-memory-atomic
24417 Generate code that uses (does not use) the atomic quad word memory
24418 instructions. The -mquad-memory-atomic option requires use of
24419 64-bit mode.
24420
24421 -mfloat128
24422 -mno-float128
24423 Enable/disable the __float128 keyword for IEEE 128-bit floating
24424 point and use either software emulation for IEEE 128-bit floating
24425 point or hardware instructions.
24426
24427 The VSX instruction set (-mvsx) must be enabled to use the IEEE
24428 128-bit floating point support. The IEEE 128-bit floating point is
24429 only supported on Linux.
24430
24431 The default for -mfloat128 is enabled on PowerPC Linux systems
24432 using the VSX instruction set, and disabled on other systems.
24433
24434 If you use the ISA 3.0 instruction set (-mpower9-vector or
24435 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
24436 support will also enable the generation of ISA 3.0 IEEE 128-bit
24437 floating point instructions. Otherwise, if you do not specify to
24438 generate ISA 3.0 instructions or you are targeting a 32-bit big
24439 endian system, IEEE 128-bit floating point will be done with
24440 software emulation.
24441
24442 -mfloat128-hardware
24443 -mno-float128-hardware
24444 Enable/disable using ISA 3.0 hardware instructions to support the
24445 __float128 data type.
24446
24447 The default for -mfloat128-hardware is enabled on PowerPC Linux
24448 systems using the ISA 3.0 instruction set, and disabled on other
24449 systems.
24450
24451 -m32
24452 -m64
24453 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24454 targets (including GNU/Linux). The 32-bit environment sets int,
24455 long and pointer to 32 bits and generates code that runs on any
24456 PowerPC variant. The 64-bit environment sets int to 32 bits and
24457 long and pointer to 64 bits, and generates code for PowerPC64, as
24458 for -mpowerpc64.
24459
24460 -mfull-toc
24461 -mno-fp-in-toc
24462 -mno-sum-in-toc
24463 -mminimal-toc
24464 Modify generation of the TOC (Table Of Contents), which is created
24465 for every executable file. The -mfull-toc option is selected by
24466 default. In that case, GCC allocates at least one TOC entry for
24467 each unique non-automatic variable reference in your program. GCC
24468 also places floating-point constants in the TOC. However, only
24469 16,384 entries are available in the TOC.
24470
24471 If you receive a linker error message that saying you have
24472 overflowed the available TOC space, you can reduce the amount of
24473 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
24474 -mno-fp-in-toc prevents GCC from putting floating-point constants
24475 in the TOC and -mno-sum-in-toc forces GCC to generate code to
24476 calculate the sum of an address and a constant at run time instead
24477 of putting that sum into the TOC. You may specify one or both of
24478 these options. Each causes GCC to produce very slightly slower and
24479 larger code at the expense of conserving TOC space.
24480
24481 If you still run out of space in the TOC even when you specify both
24482 of these options, specify -mminimal-toc instead. This option
24483 causes GCC to make only one TOC entry for every file. When you
24484 specify this option, GCC produces code that is slower and larger
24485 but which uses extremely little TOC space. You may wish to use
24486 this option only on files that contain less frequently-executed
24487 code.
24488
24489 -maix64
24490 -maix32
24491 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
24492 64-bit "long" type, and the infrastructure needed to support them.
24493 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
24494 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
24495
24496 -mxl-compat
24497 -mno-xl-compat
24498 Produce code that conforms more closely to IBM XL compiler
24499 semantics when using AIX-compatible ABI. Pass floating-point
24500 arguments to prototyped functions beyond the register save area
24501 (RSA) on the stack in addition to argument FPRs. Do not assume
24502 that most significant double in 128-bit long double value is
24503 properly rounded when comparing values and converting to double.
24504 Use XL symbol names for long double support routines.
24505
24506 The AIX calling convention was extended but not initially
24507 documented to handle an obscure K&R C case of calling a function
24508 that takes the address of its arguments with fewer arguments than
24509 declared. IBM XL compilers access floating-point arguments that do
24510 not fit in the RSA from the stack when a subroutine is compiled
24511 without optimization. Because always storing floating-point
24512 arguments on the stack is inefficient and rarely needed, this
24513 option is not enabled by default and only is necessary when calling
24514 subroutines compiled by IBM XL compilers without optimization.
24515
24516 -mpe
24517 Support IBM RS/6000 SP Parallel Environment (PE). Link an
24518 application written to use message passing with special startup
24519 code to enable the application to run. The system must have PE
24520 installed in the standard location (/usr/lpp/ppe.poe/), or the
24521 specs file must be overridden with the -specs= option to specify
24522 the appropriate directory location. The Parallel Environment does
24523 not support threads, so the -mpe option and the -pthread option are
24524 incompatible.
24525
24526 -malign-natural
24527 -malign-power
24528 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24529 -malign-natural overrides the ABI-defined alignment of larger
24530 types, such as floating-point doubles, on their natural size-based
24531 boundary. The option -malign-power instructs GCC to follow the
24532 ABI-specified alignment rules. GCC defaults to the standard
24533 alignment defined in the ABI.
24534
24535 On 64-bit Darwin, natural alignment is the default, and
24536 -malign-power is not supported.
24537
24538 -msoft-float
24539 -mhard-float
24540 Generate code that does not use (uses) the floating-point register
24541 set. Software floating-point emulation is provided if you use the
24542 -msoft-float option, and pass the option to GCC when linking.
24543
24544 -mmultiple
24545 -mno-multiple
24546 Generate code that uses (does not use) the load multiple word
24547 instructions and the store multiple word instructions. These
24548 instructions are generated by default on POWER systems, and not
24549 generated on PowerPC systems. Do not use -mmultiple on little-
24550 endian PowerPC systems, since those instructions do not work when
24551 the processor is in little-endian mode. The exceptions are PPC740
24552 and PPC750 which permit these instructions in little-endian mode.
24553
24554 -mupdate
24555 -mno-update
24556 Generate code that uses (does not use) the load or store
24557 instructions that update the base register to the address of the
24558 calculated memory location. These instructions are generated by
24559 default. If you use -mno-update, there is a small window between
24560 the time that the stack pointer is updated and the address of the
24561 previous frame is stored, which means code that walks the stack
24562 frame across interrupts or signals may get corrupted data.
24563
24564 -mavoid-indexed-addresses
24565 -mno-avoid-indexed-addresses
24566 Generate code that tries to avoid (not avoid) the use of indexed
24567 load or store instructions. These instructions can incur a
24568 performance penalty on Power6 processors in certain situations,
24569 such as when stepping through large arrays that cross a 16M
24570 boundary. This option is enabled by default when targeting Power6
24571 and disabled otherwise.
24572
24573 -mfused-madd
24574 -mno-fused-madd
24575 Generate code that uses (does not use) the floating-point multiply
24576 and accumulate instructions. These instructions are generated by
24577 default if hardware floating point is used. The machine-dependent
24578 -mfused-madd option is now mapped to the machine-independent
24579 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24580 -ffp-contract=off.
24581
24582 -mmulhw
24583 -mno-mulhw
24584 Generate code that uses (does not use) the half-word multiply and
24585 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
24586 processors. These instructions are generated by default when
24587 targeting those processors.
24588
24589 -mdlmzb
24590 -mno-dlmzb
24591 Generate code that uses (does not use) the string-search dlmzb
24592 instruction on the IBM 405, 440, 464 and 476 processors. This
24593 instruction is generated by default when targeting those
24594 processors.
24595
24596 -mno-bit-align
24597 -mbit-align
24598 On System V.4 and embedded PowerPC systems do not (do) force
24599 structures and unions that contain bit-fields to be aligned to the
24600 base type of the bit-field.
24601
24602 For example, by default a structure containing nothing but 8
24603 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
24604 and has a size of 4 bytes. By using -mno-bit-align, the structure
24605 is aligned to a 1-byte boundary and is 1 byte in size.
24606
24607 -mno-strict-align
24608 -mstrict-align
24609 On System V.4 and embedded PowerPC systems do not (do) assume that
24610 unaligned memory references are handled by the system.
24611
24612 -mrelocatable
24613 -mno-relocatable
24614 Generate code that allows (does not allow) a static executable to
24615 be relocated to a different address at run time. A simple embedded
24616 PowerPC system loader should relocate the entire contents of
24617 ".got2" and 4-byte locations listed in the ".fixup" section, a
24618 table of 32-bit addresses generated by this option. For this to
24619 work, all objects linked together must be compiled with
24620 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
24621 stack to an 8-byte boundary.
24622
24623 -mrelocatable-lib
24624 -mno-relocatable-lib
24625 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
24626 to allow static executables to be relocated at run time, but
24627 -mrelocatable-lib does not use the smaller stack alignment of
24628 -mrelocatable. Objects compiled with -mrelocatable-lib may be
24629 linked with objects compiled with any combination of the
24630 -mrelocatable options.
24631
24632 -mno-toc
24633 -mtoc
24634 On System V.4 and embedded PowerPC systems do not (do) assume that
24635 register 2 contains a pointer to a global area pointing to the
24636 addresses used in the program.
24637
24638 -mlittle
24639 -mlittle-endian
24640 On System V.4 and embedded PowerPC systems compile code for the
24641 processor in little-endian mode. The -mlittle-endian option is the
24642 same as -mlittle.
24643
24644 -mbig
24645 -mbig-endian
24646 On System V.4 and embedded PowerPC systems compile code for the
24647 processor in big-endian mode. The -mbig-endian option is the same
24648 as -mbig.
24649
24650 -mdynamic-no-pic
24651 On Darwin and Mac OS X systems, compile code so that it is not
24652 relocatable, but that its external references are relocatable. The
24653 resulting code is suitable for applications, but not shared
24654 libraries.
24655
24656 -msingle-pic-base
24657 Treat the register used for PIC addressing as read-only, rather
24658 than loading it in the prologue for each function. The runtime
24659 system is responsible for initializing this register with an
24660 appropriate value before execution begins.
24661
24662 -mprioritize-restricted-insns=priority
24663 This option controls the priority that is assigned to dispatch-slot
24664 restricted instructions during the second scheduling pass. The
24665 argument priority takes the value 0, 1, or 2 to assign no, highest,
24666 or second-highest (respectively) priority to dispatch-slot
24667 restricted instructions.
24668
24669 -msched-costly-dep=dependence_type
24670 This option controls which dependences are considered costly by the
24671 target during instruction scheduling. The argument dependence_type
24672 takes one of the following values:
24673
24674 no No dependence is costly.
24675
24676 all All dependences are costly.
24677
24678 true_store_to_load
24679 A true dependence from store to load is costly.
24680
24681 store_to_load
24682 Any dependence from store to load is costly.
24683
24684 number
24685 Any dependence for which the latency is greater than or equal
24686 to number is costly.
24687
24688 -minsert-sched-nops=scheme
24689 This option controls which NOP insertion scheme is used during the
24690 second scheduling pass. The argument scheme takes one of the
24691 following values:
24692
24693 no Don't insert NOPs.
24694
24695 pad Pad with NOPs any dispatch group that has vacant issue slots,
24696 according to the scheduler's grouping.
24697
24698 regroup_exact
24699 Insert NOPs to force costly dependent insns into separate
24700 groups. Insert exactly as many NOPs as needed to force an insn
24701 to a new group, according to the estimated processor grouping.
24702
24703 number
24704 Insert NOPs to force costly dependent insns into separate
24705 groups. Insert number NOPs to force an insn to a new group.
24706
24707 -mcall-sysv
24708 On System V.4 and embedded PowerPC systems compile code using
24709 calling conventions that adhere to the March 1995 draft of the
24710 System V Application Binary Interface, PowerPC processor
24711 supplement. This is the default unless you configured GCC using
24712 powerpc-*-eabiaix.
24713
24714 -mcall-sysv-eabi
24715 -mcall-eabi
24716 Specify both -mcall-sysv and -meabi options.
24717
24718 -mcall-sysv-noeabi
24719 Specify both -mcall-sysv and -mno-eabi options.
24720
24721 -mcall-aixdesc
24722 On System V.4 and embedded PowerPC systems compile code for the AIX
24723 operating system.
24724
24725 -mcall-linux
24726 On System V.4 and embedded PowerPC systems compile code for the
24727 Linux-based GNU system.
24728
24729 -mcall-freebsd
24730 On System V.4 and embedded PowerPC systems compile code for the
24731 FreeBSD operating system.
24732
24733 -mcall-netbsd
24734 On System V.4 and embedded PowerPC systems compile code for the
24735 NetBSD operating system.
24736
24737 -mcall-openbsd
24738 On System V.4 and embedded PowerPC systems compile code for the
24739 OpenBSD operating system.
24740
24741 -mtraceback=traceback_type
24742 Select the type of traceback table. Valid values for traceback_type
24743 are full, part, and no.
24744
24745 -maix-struct-return
24746 Return all structures in memory (as specified by the AIX ABI).
24747
24748 -msvr4-struct-return
24749 Return structures smaller than 8 bytes in registers (as specified
24750 by the SVR4 ABI).
24751
24752 -mabi=abi-type
24753 Extend the current ABI with a particular extension, or remove such
24754 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
24755 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
24756
24757 -mabi=ibmlongdouble
24758 Change the current ABI to use IBM extended-precision long double.
24759 This is not likely to work if your system defaults to using IEEE
24760 extended-precision long double. If you change the long double type
24761 from IEEE extended-precision, the compiler will issue a warning
24762 unless you use the -Wno-psabi option. Requires -mlong-double-128
24763 to be enabled.
24764
24765 -mabi=ieeelongdouble
24766 Change the current ABI to use IEEE extended-precision long double.
24767 This is not likely to work if your system defaults to using IBM
24768 extended-precision long double. If you change the long double type
24769 from IBM extended-precision, the compiler will issue a warning
24770 unless you use the -Wno-psabi option. Requires -mlong-double-128
24771 to be enabled.
24772
24773 -mabi=elfv1
24774 Change the current ABI to use the ELFv1 ABI. This is the default
24775 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
24776 ABI requires special system support and is likely to fail in
24777 spectacular ways.
24778
24779 -mabi=elfv2
24780 Change the current ABI to use the ELFv2 ABI. This is the default
24781 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
24782 ABI requires special system support and is likely to fail in
24783 spectacular ways.
24784
24785 -mgnu-attribute
24786 -mno-gnu-attribute
24787 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24788 .gnu.attributes section that specify ABI variations in function
24789 parameters or return values.
24790
24791 -mprototype
24792 -mno-prototype
24793 On System V.4 and embedded PowerPC systems assume that all calls to
24794 variable argument functions are properly prototyped. Otherwise,
24795 the compiler must insert an instruction before every non-prototyped
24796 call to set or clear bit 6 of the condition code register ("CR") to
24797 indicate whether floating-point values are passed in the floating-
24798 point registers in case the function takes variable arguments.
24799 With -mprototype, only calls to prototyped variable argument
24800 functions set or clear the bit.
24801
24802 -msim
24803 On embedded PowerPC systems, assume that the startup module is
24804 called sim-crt0.o and that the standard C libraries are libsim.a
24805 and libc.a. This is the default for powerpc-*-eabisim
24806 configurations.
24807
24808 -mmvme
24809 On embedded PowerPC systems, assume that the startup module is
24810 called crt0.o and the standard C libraries are libmvme.a and
24811 libc.a.
24812
24813 -mads
24814 On embedded PowerPC systems, assume that the startup module is
24815 called crt0.o and the standard C libraries are libads.a and libc.a.
24816
24817 -myellowknife
24818 On embedded PowerPC systems, assume that the startup module is
24819 called crt0.o and the standard C libraries are libyk.a and libc.a.
24820
24821 -mvxworks
24822 On System V.4 and embedded PowerPC systems, specify that you are
24823 compiling for a VxWorks system.
24824
24825 -memb
24826 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
24827 header to indicate that eabi extended relocations are used.
24828
24829 -meabi
24830 -mno-eabi
24831 On System V.4 and embedded PowerPC systems do (do not) adhere to
24832 the Embedded Applications Binary Interface (EABI), which is a set
24833 of modifications to the System V.4 specifications. Selecting
24834 -meabi means that the stack is aligned to an 8-byte boundary, a
24835 function "__eabi" is called from "main" to set up the EABI
24836 environment, and the -msdata option can use both "r2" and "r13" to
24837 point to two separate small data areas. Selecting -mno-eabi means
24838 that the stack is aligned to a 16-byte boundary, no EABI
24839 initialization function is called from "main", and the -msdata
24840 option only uses "r13" to point to a single small data area. The
24841 -meabi option is on by default if you configured GCC using one of
24842 the powerpc*-*-eabi* options.
24843
24844 -msdata=eabi
24845 On System V.4 and embedded PowerPC systems, put small initialized
24846 "const" global and static data in the ".sdata2" section, which is
24847 pointed to by register "r2". Put small initialized non-"const"
24848 global and static data in the ".sdata" section, which is pointed to
24849 by register "r13". Put small uninitialized global and static data
24850 in the ".sbss" section, which is adjacent to the ".sdata" section.
24851 The -msdata=eabi option is incompatible with the -mrelocatable
24852 option. The -msdata=eabi option also sets the -memb option.
24853
24854 -msdata=sysv
24855 On System V.4 and embedded PowerPC systems, put small global and
24856 static data in the ".sdata" section, which is pointed to by
24857 register "r13". Put small uninitialized global and static data in
24858 the ".sbss" section, which is adjacent to the ".sdata" section.
24859 The -msdata=sysv option is incompatible with the -mrelocatable
24860 option.
24861
24862 -msdata=default
24863 -msdata
24864 On System V.4 and embedded PowerPC systems, if -meabi is used,
24865 compile code the same as -msdata=eabi, otherwise compile code the
24866 same as -msdata=sysv.
24867
24868 -msdata=data
24869 On System V.4 and embedded PowerPC systems, put small global data
24870 in the ".sdata" section. Put small uninitialized global data in
24871 the ".sbss" section. Do not use register "r13" to address small
24872 data however. This is the default behavior unless other -msdata
24873 options are used.
24874
24875 -msdata=none
24876 -mno-sdata
24877 On embedded PowerPC systems, put all initialized global and static
24878 data in the ".data" section, and all uninitialized data in the
24879 ".bss" section.
24880
24881 -mreadonly-in-sdata
24882 Put read-only objects in the ".sdata" section as well. This is the
24883 default.
24884
24885 -mblock-move-inline-limit=num
24886 Inline all block moves (such as calls to "memcpy" or structure
24887 copies) less than or equal to num bytes. The minimum value for num
24888 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
24889 default value is target-specific.
24890
24891 -mblock-compare-inline-limit=num
24892 Generate non-looping inline code for all block compares (such as
24893 calls to "memcmp" or structure compares) less than or equal to num
24894 bytes. If num is 0, all inline expansion (non-loop and loop) of
24895 block compare is disabled. The default value is target-specific.
24896
24897 -mblock-compare-inline-loop-limit=num
24898 Generate an inline expansion using loop code for all block compares
24899 that are less than or equal to num bytes, but greater than the
24900 limit for non-loop inline block compare expansion. If the block
24901 length is not constant, at most num bytes will be compared before
24902 "memcmp" is called to compare the remainder of the block. The
24903 default value is target-specific.
24904
24905 -mstring-compare-inline-limit=num
24906 Compare at most num string bytes with inline code. If the
24907 difference or end of string is not found at the end of the inline
24908 compare a call to "strcmp" or "strncmp" will take care of the rest
24909 of the comparison. The default is 64 bytes.
24910
24911 -G num
24912 On embedded PowerPC systems, put global and static items less than
24913 or equal to num bytes into the small data or BSS sections instead
24914 of the normal data or BSS section. By default, num is 8. The -G
24915 num switch is also passed to the linker. All modules should be
24916 compiled with the same -G num value.
24917
24918 -mregnames
24919 -mno-regnames
24920 On System V.4 and embedded PowerPC systems do (do not) emit
24921 register names in the assembly language output using symbolic
24922 forms.
24923
24924 -mlongcall
24925 -mno-longcall
24926 By default assume that all calls are far away so that a longer and
24927 more expensive calling sequence is required. This is required for
24928 calls farther than 32 megabytes (33,554,432 bytes) from the current
24929 location. A short call is generated if the compiler knows the call
24930 cannot be that far away. This setting can be overridden by the
24931 "shortcall" function attribute, or by "#pragma longcall(0)".
24932
24933 Some linkers are capable of detecting out-of-range calls and
24934 generating glue code on the fly. On these systems, long calls are
24935 unnecessary and generate slower code. As of this writing, the AIX
24936 linker can do this, as can the GNU linker for PowerPC/64. It is
24937 planned to add this feature to the GNU linker for 32-bit PowerPC
24938 systems as well.
24939
24940 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24941 linkers, GCC can generate long calls using an inline PLT call
24942 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
24943 ELFv1 (big-endian) do not support inline PLT calls.
24944
24945 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
24946 L42", plus a branch island (glue code). The two target addresses
24947 represent the callee and the branch island. The Darwin/PPC linker
24948 prefers the first address and generates a "bl callee" if the PPC
24949 "bl" instruction reaches the callee directly; otherwise, the linker
24950 generates "bl L42" to call the branch island. The branch island is
24951 appended to the body of the calling function; it computes the full
24952 32-bit address of the callee and jumps to it.
24953
24954 On Mach-O (Darwin) systems, this option directs the compiler emit
24955 to the glue for every direct call, and the Darwin linker decides
24956 whether to use or discard it.
24957
24958 In the future, GCC may ignore all longcall specifications when the
24959 linker is known to generate glue.
24960
24961 -mpltseq
24962 -mno-pltseq
24963 Implement (do not implement) -fno-plt and long calls using an
24964 inline PLT call sequence that supports lazy linking and long calls
24965 to functions in dlopen'd shared libraries. Inline PLT calls are
24966 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
24967 newer GNU linkers, and are enabled by default if the support is
24968 detected when configuring GCC, and, in the case of 32-bit PowerPC,
24969 if GCC is configured with --enable-secureplt. -mpltseq code and
24970 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
24971 together.
24972
24973 -mtls-markers
24974 -mno-tls-markers
24975 Mark (do not mark) calls to "__tls_get_addr" with a relocation
24976 specifying the function argument. The relocation allows the linker
24977 to reliably associate function call with argument setup
24978 instructions for TLS optimization, which in turn allows GCC to
24979 better schedule the sequence.
24980
24981 -mrecip
24982 -mno-recip
24983 This option enables use of the reciprocal estimate and reciprocal
24984 square root estimate instructions with additional Newton-Raphson
24985 steps to increase precision instead of doing a divide or square
24986 root and divide for floating-point arguments. You should use the
24987 -ffast-math option when using -mrecip (or at least
24988 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
24989 and -fno-trapping-math). Note that while the throughput of the
24990 sequence is generally higher than the throughput of the non-
24991 reciprocal instruction, the precision of the sequence can be
24992 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
24993 0.99999994) for reciprocal square roots.
24994
24995 -mrecip=opt
24996 This option controls which reciprocal estimate instructions may be
24997 used. opt is a comma-separated list of options, which may be
24998 preceded by a "!" to invert the option:
24999
25000 all Enable all estimate instructions.
25001
25002 default
25003 Enable the default instructions, equivalent to -mrecip.
25004
25005 none
25006 Disable all estimate instructions, equivalent to -mno-recip.
25007
25008 div Enable the reciprocal approximation instructions for both
25009 single and double precision.
25010
25011 divf
25012 Enable the single-precision reciprocal approximation
25013 instructions.
25014
25015 divd
25016 Enable the double-precision reciprocal approximation
25017 instructions.
25018
25019 rsqrt
25020 Enable the reciprocal square root approximation instructions
25021 for both single and double precision.
25022
25023 rsqrtf
25024 Enable the single-precision reciprocal square root
25025 approximation instructions.
25026
25027 rsqrtd
25028 Enable the double-precision reciprocal square root
25029 approximation instructions.
25030
25031 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
25032 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
25033 "XVRSQRTEDP" instructions which handle the double-precision
25034 reciprocal square root calculations.
25035
25036 -mrecip-precision
25037 -mno-recip-precision
25038 Assume (do not assume) that the reciprocal estimate instructions
25039 provide higher-precision estimates than is mandated by the PowerPC
25040 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
25041 automatically selects -mrecip-precision. The double-precision
25042 square root estimate instructions are not generated by default on
25043 low-precision machines, since they do not provide an estimate that
25044 converges after three steps.
25045
25046 -mveclibabi=type
25047 Specifies the ABI type to use for vectorizing intrinsics using an
25048 external library. The only type supported at present is mass,
25049 which specifies to use IBM's Mathematical Acceleration Subsystem
25050 (MASS) libraries for vectorizing intrinsics using external
25051 libraries. GCC currently emits calls to "acosd2", "acosf4",
25052 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25053 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25054 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25055 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25056 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25057 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25058 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25059 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25060 "tanhf4" when generating code for power7. Both -ftree-vectorize
25061 and -funsafe-math-optimizations must also be enabled. The MASS
25062 libraries must be specified at link time.
25063
25064 -mfriz
25065 -mno-friz
25066 Generate (do not generate) the "friz" instruction when the
25067 -funsafe-math-optimizations option is used to optimize rounding of
25068 floating-point values to 64-bit integer and back to floating point.
25069 The "friz" instruction does not return the same value if the
25070 floating-point number is too large to fit in an integer.
25071
25072 -mpointers-to-nested-functions
25073 -mno-pointers-to-nested-functions
25074 Generate (do not generate) code to load up the static chain
25075 register ("r11") when calling through a pointer on AIX and 64-bit
25076 Linux systems where a function pointer points to a 3-word
25077 descriptor giving the function address, TOC value to be loaded in
25078 register "r2", and static chain value to be loaded in register
25079 "r11". The -mpointers-to-nested-functions is on by default. You
25080 cannot call through pointers to nested functions or pointers to
25081 functions compiled in other languages that use the static chain if
25082 you use -mno-pointers-to-nested-functions.
25083
25084 -msave-toc-indirect
25085 -mno-save-toc-indirect
25086 Generate (do not generate) code to save the TOC value in the
25087 reserved stack location in the function prologue if the function
25088 calls through a pointer on AIX and 64-bit Linux systems. If the
25089 TOC value is not saved in the prologue, it is saved just before the
25090 call through the pointer. The -mno-save-toc-indirect option is the
25091 default.
25092
25093 -mcompat-align-parm
25094 -mno-compat-align-parm
25095 Generate (do not generate) code to pass structure parameters with a
25096 maximum alignment of 64 bits, for compatibility with older versions
25097 of GCC.
25098
25099 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25100 structure parameter on a 128-bit boundary when that structure
25101 contained a member requiring 128-bit alignment. This is corrected
25102 in more recent versions of GCC. This option may be used to
25103 generate code that is compatible with functions compiled with older
25104 versions of GCC.
25105
25106 The -mno-compat-align-parm option is the default.
25107
25108 -mstack-protector-guard=guard
25109 -mstack-protector-guard-reg=reg
25110 -mstack-protector-guard-offset=offset
25111 -mstack-protector-guard-symbol=symbol
25112 Generate stack protection code using canary at guard. Supported
25113 locations are global for global canary or tls for per-thread canary
25114 in the TLS block (the default with GNU libc version 2.4 or later).
25115
25116 With the latter choice the options -mstack-protector-guard-reg=reg
25117 and -mstack-protector-guard-offset=offset furthermore specify which
25118 register to use as base register for reading the canary, and from
25119 what offset from that base register. The default for those is as
25120 specified in the relevant ABI.
25121 -mstack-protector-guard-symbol=symbol overrides the offset with a
25122 symbol reference to a canary in the TLS block.
25123
25124 -mpcrel
25125 -mno-pcrel
25126 Generate (do not generate) pc-relative addressing. The -mpcrel
25127 option requires that the medium code model (-mcmodel=medium) and
25128 prefixed addressing (-mprefixed) options are enabled.
25129
25130 -mprefixed
25131 -mno-prefixed
25132 Generate (do not generate) addressing modes using prefixed load and
25133 store instructions. The -mprefixed option requires that the option
25134 -mcpu=power10 (or later) is enabled.
25135
25136 -mmma
25137 -mno-mma
25138 Generate (do not generate) the MMA instructions. The -mma option
25139 requires that the option -mcpu=power10 (or later) is enabled.
25140
25141 -mrop-protect
25142 -mno-rop-protect
25143 Generate (do not generate) ROP protection instructions when the
25144 target processor supports them. Currently this option disables the
25145 shrink-wrap optimization (-fshrink-wrap).
25146
25147 -mprivileged
25148 -mno-privileged
25149 Generate (do not generate) code that will run in privileged state.
25150
25151 -mblock-ops-unaligned-vsx
25152 -mno-block-ops-unaligned-vsx
25153 Generate (do not generate) unaligned vsx loads and stores for
25154 inline expansion of "memcpy" and "memmove".
25155
25156 RX Options
25157
25158 These command-line options are defined for RX targets:
25159
25160 -m64bit-doubles
25161 -m32bit-doubles
25162 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25163 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
25164 RX floating-point hardware only works on 32-bit values, which is
25165 why the default is -m32bit-doubles.
25166
25167 -fpu
25168 -nofpu
25169 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
25170 hardware. The default is enabled for the RX600 series and disabled
25171 for the RX200 series.
25172
25173 Floating-point instructions are only generated for 32-bit floating-
25174 point values, however, so the FPU hardware is not used for doubles
25175 if the -m64bit-doubles option is used.
25176
25177 Note If the -fpu option is enabled then -funsafe-math-optimizations
25178 is also enabled automatically. This is because the RX FPU
25179 instructions are themselves unsafe.
25180
25181 -mcpu=name
25182 Selects the type of RX CPU to be targeted. Currently three types
25183 are supported, the generic RX600 and RX200 series hardware and the
25184 specific RX610 CPU. The default is RX600.
25185
25186 The only difference between RX600 and RX610 is that the RX610 does
25187 not support the "MVTIPL" instruction.
25188
25189 The RX200 series does not have a hardware floating-point unit and
25190 so -nofpu is enabled by default when this type is selected.
25191
25192 -mbig-endian-data
25193 -mlittle-endian-data
25194 Store data (but not code) in the big-endian format. The default is
25195 -mlittle-endian-data, i.e. to store data in the little-endian
25196 format.
25197
25198 -msmall-data-limit=N
25199 Specifies the maximum size in bytes of global and static variables
25200 which can be placed into the small data area. Using the small data
25201 area can lead to smaller and faster code, but the size of area is
25202 limited and it is up to the programmer to ensure that the area does
25203 not overflow. Also when the small data area is used one of the
25204 RX's registers (usually "r13") is reserved for use pointing to this
25205 area, so it is no longer available for use by the compiler. This
25206 could result in slower and/or larger code if variables are pushed
25207 onto the stack instead of being held in this register.
25208
25209 Note, common variables (variables that have not been initialized)
25210 and constants are not placed into the small data area as they are
25211 assigned to other sections in the output executable.
25212
25213 The default value is zero, which disables this feature. Note, this
25214 feature is not enabled by default with higher optimization levels
25215 (-O2 etc) because of the potentially detrimental effects of
25216 reserving a register. It is up to the programmer to experiment and
25217 discover whether this feature is of benefit to their program. See
25218 the description of the -mpid option for a description of how the
25219 actual register to hold the small data area pointer is chosen.
25220
25221 -msim
25222 -mno-sim
25223 Use the simulator runtime. The default is to use the libgloss
25224 board-specific runtime.
25225
25226 -mas100-syntax
25227 -mno-as100-syntax
25228 When generating assembler output use a syntax that is compatible
25229 with Renesas's AS100 assembler. This syntax can also be handled by
25230 the GAS assembler, but it has some restrictions so it is not
25231 generated by default.
25232
25233 -mmax-constant-size=N
25234 Specifies the maximum size, in bytes, of a constant that can be
25235 used as an operand in a RX instruction. Although the RX
25236 instruction set does allow constants of up to 4 bytes in length to
25237 be used in instructions, a longer value equates to a longer
25238 instruction. Thus in some circumstances it can be beneficial to
25239 restrict the size of constants that are used in instructions.
25240 Constants that are too big are instead placed into a constant pool
25241 and referenced via register indirection.
25242
25243 The value N can be between 0 and 4. A value of 0 (the default) or
25244 4 means that constants of any size are allowed.
25245
25246 -mrelax
25247 Enable linker relaxation. Linker relaxation is a process whereby
25248 the linker attempts to reduce the size of a program by finding
25249 shorter versions of various instructions. Disabled by default.
25250
25251 -mint-register=N
25252 Specify the number of registers to reserve for fast interrupt
25253 handler functions. The value N can be between 0 and 4. A value of
25254 1 means that register "r13" is reserved for the exclusive use of
25255 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
25256 value of 3 reserves "r13", "r12" and "r11", and a value of 4
25257 reserves "r13" through "r10". A value of 0, the default, does not
25258 reserve any registers.
25259
25260 -msave-acc-in-interrupts
25261 Specifies that interrupt handler functions should preserve the
25262 accumulator register. This is only necessary if normal code might
25263 use the accumulator register, for example because it performs
25264 64-bit multiplications. The default is to ignore the accumulator
25265 as this makes the interrupt handlers faster.
25266
25267 -mpid
25268 -mno-pid
25269 Enables the generation of position independent data. When enabled
25270 any access to constant data is done via an offset from a base
25271 address held in a register. This allows the location of constant
25272 data to be determined at run time without requiring the executable
25273 to be relocated, which is a benefit to embedded applications with
25274 tight memory constraints. Data that can be modified is not
25275 affected by this option.
25276
25277 Note, using this feature reserves a register, usually "r13", for
25278 the constant data base address. This can result in slower and/or
25279 larger code, especially in complicated functions.
25280
25281 The actual register chosen to hold the constant data base address
25282 depends upon whether the -msmall-data-limit and/or the
25283 -mint-register command-line options are enabled. Starting with
25284 register "r13" and proceeding downwards, registers are allocated
25285 first to satisfy the requirements of -mint-register, then -mpid and
25286 finally -msmall-data-limit. Thus it is possible for the small data
25287 area register to be "r8" if both -mint-register=4 and -mpid are
25288 specified on the command line.
25289
25290 By default this feature is not enabled. The default can be
25291 restored via the -mno-pid command-line option.
25292
25293 -mno-warn-multiple-fast-interrupts
25294 -mwarn-multiple-fast-interrupts
25295 Prevents GCC from issuing a warning message if it finds more than
25296 one fast interrupt handler when it is compiling a file. The
25297 default is to issue a warning for each extra fast interrupt handler
25298 found, as the RX only supports one such interrupt.
25299
25300 -mallow-string-insns
25301 -mno-allow-string-insns
25302 Enables or disables the use of the string manipulation instructions
25303 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
25304 "RMPA" instruction. These instructions may prefetch data, which is
25305 not safe to do if accessing an I/O register. (See section 12.2.7
25306 of the RX62N Group User's Manual for more information).
25307
25308 The default is to allow these instructions, but it is not possible
25309 for GCC to reliably detect all circumstances where a string
25310 instruction might be used to access an I/O register, so their use
25311 cannot be disabled automatically. Instead it is reliant upon the
25312 programmer to use the -mno-allow-string-insns option if their
25313 program accesses I/O space.
25314
25315 When the instructions are enabled GCC defines the C preprocessor
25316 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
25317 "__RX_DISALLOW_STRING_INSNS__".
25318
25319 -mjsr
25320 -mno-jsr
25321 Use only (or not only) "JSR" instructions to access functions.
25322 This option can be used when code size exceeds the range of "BSR"
25323 instructions. Note that -mno-jsr does not mean to not use "JSR"
25324 but instead means that any type of branch may be used.
25325
25326 Note: The generic GCC command-line option -ffixed-reg has special
25327 significance to the RX port when used with the "interrupt" function
25328 attribute. This attribute indicates a function intended to process
25329 fast interrupts. GCC ensures that it only uses the registers "r10",
25330 "r11", "r12" and/or "r13" and only provided that the normal use of the
25331 corresponding registers have been restricted via the -ffixed-reg or
25332 -mint-register command-line options.
25333
25334 S/390 and zSeries Options
25335
25336 These are the -m options defined for the S/390 and zSeries
25337 architecture.
25338
25339 -mhard-float
25340 -msoft-float
25341 Use (do not use) the hardware floating-point instructions and
25342 registers for floating-point operations. When -msoft-float is
25343 specified, functions in libgcc.a are used to perform floating-point
25344 operations. When -mhard-float is specified, the compiler generates
25345 IEEE floating-point instructions. This is the default.
25346
25347 -mhard-dfp
25348 -mno-hard-dfp
25349 Use (do not use) the hardware decimal-floating-point instructions
25350 for decimal-floating-point operations. When -mno-hard-dfp is
25351 specified, functions in libgcc.a are used to perform decimal-
25352 floating-point operations. When -mhard-dfp is specified, the
25353 compiler generates decimal-floating-point hardware instructions.
25354 This is the default for -march=z9-ec or higher.
25355
25356 -mlong-double-64
25357 -mlong-double-128
25358 These switches control the size of "long double" type. A size of 64
25359 bits makes the "long double" type equivalent to the "double" type.
25360 This is the default.
25361
25362 -mbackchain
25363 -mno-backchain
25364 Store (do not store) the address of the caller's frame as backchain
25365 pointer into the callee's stack frame. A backchain may be needed
25366 to allow debugging using tools that do not understand DWARF call
25367 frame information. When -mno-packed-stack is in effect, the
25368 backchain pointer is stored at the bottom of the stack frame; when
25369 -mpacked-stack is in effect, the backchain is placed into the
25370 topmost word of the 96/160 byte register save area.
25371
25372 In general, code compiled with -mbackchain is call-compatible with
25373 code compiled with -mno-backchain; however, use of the backchain
25374 for debugging purposes usually requires that the whole binary is
25375 built with -mbackchain. Note that the combination of -mbackchain,
25376 -mpacked-stack and -mhard-float is not supported. In order to
25377 build a linux kernel use -msoft-float.
25378
25379 The default is to not maintain the backchain.
25380
25381 -mpacked-stack
25382 -mno-packed-stack
25383 Use (do not use) the packed stack layout. When -mno-packed-stack
25384 is specified, the compiler uses the all fields of the 96/160 byte
25385 register save area only for their default purpose; unused fields
25386 still take up stack space. When -mpacked-stack is specified,
25387 register save slots are densely packed at the top of the register
25388 save area; unused space is reused for other purposes, allowing for
25389 more efficient use of the available stack space. However, when
25390 -mbackchain is also in effect, the topmost word of the save area is
25391 always used to store the backchain, and the return address register
25392 is always saved two words below the backchain.
25393
25394 As long as the stack frame backchain is not used, code generated
25395 with -mpacked-stack is call-compatible with code generated with
25396 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
25397 S/390 or zSeries generated code that uses the stack frame backchain
25398 at run time, not just for debugging purposes. Such code is not
25399 call-compatible with code compiled with -mpacked-stack. Also, note
25400 that the combination of -mbackchain, -mpacked-stack and
25401 -mhard-float is not supported. In order to build a linux kernel
25402 use -msoft-float.
25403
25404 The default is to not use the packed stack layout.
25405
25406 -msmall-exec
25407 -mno-small-exec
25408 Generate (or do not generate) code using the "bras" instruction to
25409 do subroutine calls. This only works reliably if the total
25410 executable size does not exceed 64k. The default is to use the
25411 "basr" instruction instead, which does not have this limitation.
25412
25413 -m64
25414 -m31
25415 When -m31 is specified, generate code compliant to the GNU/Linux
25416 for S/390 ABI. When -m64 is specified, generate code compliant to
25417 the GNU/Linux for zSeries ABI. This allows GCC in particular to
25418 generate 64-bit instructions. For the s390 targets, the default is
25419 -m31, while the s390x targets default to -m64.
25420
25421 -mzarch
25422 -mesa
25423 When -mzarch is specified, generate code using the instructions
25424 available on z/Architecture. When -mesa is specified, generate
25425 code using the instructions available on ESA/390. Note that -mesa
25426 is not possible with -m64. When generating code compliant to the
25427 GNU/Linux for S/390 ABI, the default is -mesa. When generating
25428 code compliant to the GNU/Linux for zSeries ABI, the default is
25429 -mzarch.
25430
25431 -mhtm
25432 -mno-htm
25433 The -mhtm option enables a set of builtins making use of
25434 instructions available with the transactional execution facility
25435 introduced with the IBM zEnterprise EC12 machine generation S/390
25436 System z Built-in Functions. -mhtm is enabled by default when
25437 using -march=zEC12.
25438
25439 -mvx
25440 -mno-vx
25441 When -mvx is specified, generate code using the instructions
25442 available with the vector extension facility introduced with the
25443 IBM z13 machine generation. This option changes the ABI for some
25444 vector type values with regard to alignment and calling
25445 conventions. In case vector type values are being used in an ABI-
25446 relevant context a GAS .gnu_attribute command will be added to mark
25447 the resulting binary with the ABI used. -mvx is enabled by default
25448 when using -march=z13.
25449
25450 -mzvector
25451 -mno-zvector
25452 The -mzvector option enables vector language extensions and
25453 builtins using instructions available with the vector extension
25454 facility introduced with the IBM z13 machine generation. This
25455 option adds support for vector to be used as a keyword to define
25456 vector type variables and arguments. vector is only available when
25457 GNU extensions are enabled. It will not be expanded when
25458 requesting strict standard compliance e.g. with -std=c99. In
25459 addition to the GCC low-level builtins -mzvector enables a set of
25460 builtins added for compatibility with AltiVec-style implementations
25461 like Power and Cell. In order to make use of these builtins the
25462 header file vecintrin.h needs to be included. -mzvector is
25463 disabled by default.
25464
25465 -mmvcle
25466 -mno-mvcle
25467 Generate (or do not generate) code using the "mvcle" instruction to
25468 perform block moves. When -mno-mvcle is specified, use a "mvc"
25469 loop instead. This is the default unless optimizing for size.
25470
25471 -mdebug
25472 -mno-debug
25473 Print (or do not print) additional debug information when
25474 compiling. The default is to not print debug information.
25475
25476 -march=cpu-type
25477 Generate code that runs on cpu-type, which is the name of a system
25478 representing a certain processor type. Possible values for cpu-
25479 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
25480 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
25481 and native.
25482
25483 The default is -march=z900.
25484
25485 Specifying native as cpu type can be used to select the best
25486 architecture option for the host processor. -march=native has no
25487 effect if GCC does not recognize the processor.
25488
25489 -mtune=cpu-type
25490 Tune to cpu-type everything applicable about the generated code,
25491 except for the ABI and the set of available instructions. The list
25492 of cpu-type values is the same as for -march. The default is the
25493 value used for -march.
25494
25495 -mtpf-trace
25496 -mno-tpf-trace
25497 Generate code that adds (does not add) in TPF OS specific branches
25498 to trace routines in the operating system. This option is off by
25499 default, even when compiling for the TPF OS.
25500
25501 -mtpf-trace-skip
25502 -mno-tpf-trace-skip
25503 Generate code that changes (does not change) the default branch
25504 targets enabled by -mtpf-trace to point to specialized trace
25505 routines providing the ability of selectively skipping function
25506 trace entries for the TPF OS. This option is off by default, even
25507 when compiling for the TPF OS and specifying -mtpf-trace.
25508
25509 -mfused-madd
25510 -mno-fused-madd
25511 Generate code that uses (does not use) the floating-point multiply
25512 and accumulate instructions. These instructions are generated by
25513 default if hardware floating point is used.
25514
25515 -mwarn-framesize=framesize
25516 Emit a warning if the current function exceeds the given frame
25517 size. Because this is a compile-time check it doesn't need to be a
25518 real problem when the program runs. It is intended to identify
25519 functions that most probably cause a stack overflow. It is useful
25520 to be used in an environment with limited stack size e.g. the linux
25521 kernel.
25522
25523 -mwarn-dynamicstack
25524 Emit a warning if the function calls "alloca" or uses dynamically-
25525 sized arrays. This is generally a bad idea with a limited stack
25526 size.
25527
25528 -mstack-guard=stack-guard
25529 -mstack-size=stack-size
25530 If these options are provided the S/390 back end emits additional
25531 instructions in the function prologue that trigger a trap if the
25532 stack size is stack-guard bytes above the stack-size (remember that
25533 the stack on S/390 grows downward). If the stack-guard option is
25534 omitted the smallest power of 2 larger than the frame size of the
25535 compiled function is chosen. These options are intended to be used
25536 to help debugging stack overflow problems. The additionally
25537 emitted code causes only little overhead and hence can also be used
25538 in production-like systems without greater performance degradation.
25539 The given values have to be exact powers of 2 and stack-size has to
25540 be greater than stack-guard without exceeding 64k. In order to be
25541 efficient the extra code makes the assumption that the stack starts
25542 at an address aligned to the value given by stack-size. The stack-
25543 guard option can only be used in conjunction with stack-size.
25544
25545 -mhotpatch=pre-halfwords,post-halfwords
25546 If the hotpatch option is enabled, a "hot-patching" function
25547 prologue is generated for all functions in the compilation unit.
25548 The funtion label is prepended with the given number of two-byte
25549 NOP instructions (pre-halfwords, maximum 1000000). After the
25550 label, 2 * post-halfwords bytes are appended, using the largest NOP
25551 like instructions the architecture allows (maximum 1000000).
25552
25553 If both arguments are zero, hotpatching is disabled.
25554
25555 This option can be overridden for individual functions with the
25556 "hotpatch" attribute.
25557
25558 Score Options
25559
25560 These options are defined for Score implementations:
25561
25562 -meb
25563 Compile code for big-endian mode. This is the default.
25564
25565 -mel
25566 Compile code for little-endian mode.
25567
25568 -mnhwloop
25569 Disable generation of "bcnz" instructions.
25570
25571 -muls
25572 Enable generation of unaligned load and store instructions.
25573
25574 -mmac
25575 Enable the use of multiply-accumulate instructions. Disabled by
25576 default.
25577
25578 -mscore5
25579 Specify the SCORE5 as the target architecture.
25580
25581 -mscore5u
25582 Specify the SCORE5U of the target architecture.
25583
25584 -mscore7
25585 Specify the SCORE7 as the target architecture. This is the default.
25586
25587 -mscore7d
25588 Specify the SCORE7D as the target architecture.
25589
25590 SH Options
25591
25592 These -m options are defined for the SH implementations:
25593
25594 -m1 Generate code for the SH1.
25595
25596 -m2 Generate code for the SH2.
25597
25598 -m2e
25599 Generate code for the SH2e.
25600
25601 -m2a-nofpu
25602 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
25603 way that the floating-point unit is not used.
25604
25605 -m2a-single-only
25606 Generate code for the SH2a-FPU, in such a way that no double-
25607 precision floating-point operations are used.
25608
25609 -m2a-single
25610 Generate code for the SH2a-FPU assuming the floating-point unit is
25611 in single-precision mode by default.
25612
25613 -m2a
25614 Generate code for the SH2a-FPU assuming the floating-point unit is
25615 in double-precision mode by default.
25616
25617 -m3 Generate code for the SH3.
25618
25619 -m3e
25620 Generate code for the SH3e.
25621
25622 -m4-nofpu
25623 Generate code for the SH4 without a floating-point unit.
25624
25625 -m4-single-only
25626 Generate code for the SH4 with a floating-point unit that only
25627 supports single-precision arithmetic.
25628
25629 -m4-single
25630 Generate code for the SH4 assuming the floating-point unit is in
25631 single-precision mode by default.
25632
25633 -m4 Generate code for the SH4.
25634
25635 -m4-100
25636 Generate code for SH4-100.
25637
25638 -m4-100-nofpu
25639 Generate code for SH4-100 in such a way that the floating-point
25640 unit is not used.
25641
25642 -m4-100-single
25643 Generate code for SH4-100 assuming the floating-point unit is in
25644 single-precision mode by default.
25645
25646 -m4-100-single-only
25647 Generate code for SH4-100 in such a way that no double-precision
25648 floating-point operations are used.
25649
25650 -m4-200
25651 Generate code for SH4-200.
25652
25653 -m4-200-nofpu
25654 Generate code for SH4-200 without in such a way that the floating-
25655 point unit is not used.
25656
25657 -m4-200-single
25658 Generate code for SH4-200 assuming the floating-point unit is in
25659 single-precision mode by default.
25660
25661 -m4-200-single-only
25662 Generate code for SH4-200 in such a way that no double-precision
25663 floating-point operations are used.
25664
25665 -m4-300
25666 Generate code for SH4-300.
25667
25668 -m4-300-nofpu
25669 Generate code for SH4-300 without in such a way that the floating-
25670 point unit is not used.
25671
25672 -m4-300-single
25673 Generate code for SH4-300 in such a way that no double-precision
25674 floating-point operations are used.
25675
25676 -m4-300-single-only
25677 Generate code for SH4-300 in such a way that no double-precision
25678 floating-point operations are used.
25679
25680 -m4-340
25681 Generate code for SH4-340 (no MMU, no FPU).
25682
25683 -m4-500
25684 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
25685 assembler.
25686
25687 -m4a-nofpu
25688 Generate code for the SH4al-dsp, or for a SH4a in such a way that
25689 the floating-point unit is not used.
25690
25691 -m4a-single-only
25692 Generate code for the SH4a, in such a way that no double-precision
25693 floating-point operations are used.
25694
25695 -m4a-single
25696 Generate code for the SH4a assuming the floating-point unit is in
25697 single-precision mode by default.
25698
25699 -m4a
25700 Generate code for the SH4a.
25701
25702 -m4al
25703 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
25704 assembler. GCC doesn't generate any DSP instructions at the
25705 moment.
25706
25707 -mb Compile code for the processor in big-endian mode.
25708
25709 -ml Compile code for the processor in little-endian mode.
25710
25711 -mdalign
25712 Align doubles at 64-bit boundaries. Note that this changes the
25713 calling conventions, and thus some functions from the standard C
25714 library do not work unless you recompile it first with -mdalign.
25715
25716 -mrelax
25717 Shorten some address references at link time, when possible; uses
25718 the linker option -relax.
25719
25720 -mbigtable
25721 Use 32-bit offsets in "switch" tables. The default is to use
25722 16-bit offsets.
25723
25724 -mbitops
25725 Enable the use of bit manipulation instructions on SH2A.
25726
25727 -mfmovd
25728 Enable the use of the instruction "fmovd". Check -mdalign for
25729 alignment constraints.
25730
25731 -mrenesas
25732 Comply with the calling conventions defined by Renesas.
25733
25734 -mno-renesas
25735 Comply with the calling conventions defined for GCC before the
25736 Renesas conventions were available. This option is the default for
25737 all targets of the SH toolchain.
25738
25739 -mnomacsave
25740 Mark the "MAC" register as call-clobbered, even if -mrenesas is
25741 given.
25742
25743 -mieee
25744 -mno-ieee
25745 Control the IEEE compliance of floating-point comparisons, which
25746 affects the handling of cases where the result of a comparison is
25747 unordered. By default -mieee is implicitly enabled. If
25748 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
25749 results in faster floating-point greater-equal and less-equal
25750 comparisons. The implicit settings can be overridden by specifying
25751 either -mieee or -mno-ieee.
25752
25753 -minline-ic_invalidate
25754 Inline code to invalidate instruction cache entries after setting
25755 up nested function trampolines. This option has no effect if
25756 -musermode is in effect and the selected code generation option
25757 (e.g. -m4) does not allow the use of the "icbi" instruction. If
25758 the selected code generation option does not allow the use of the
25759 "icbi" instruction, and -musermode is not in effect, the inlined
25760 code manipulates the instruction cache address array directly with
25761 an associative write. This not only requires privileged mode at
25762 run time, but it also fails if the cache line had been mapped via
25763 the TLB and has become unmapped.
25764
25765 -misize
25766 Dump instruction size and location in the assembly code.
25767
25768 -mpadstruct
25769 This option is deprecated. It pads structures to multiple of 4
25770 bytes, which is incompatible with the SH ABI.
25771
25772 -matomic-model=model
25773 Sets the model of atomic operations and additional parameters as a
25774 comma separated list. For details on the atomic built-in functions
25775 see __atomic Builtins. The following models and parameters are
25776 supported:
25777
25778 none
25779 Disable compiler generated atomic sequences and emit library
25780 calls for atomic operations. This is the default if the target
25781 is not "sh*-*-linux*".
25782
25783 soft-gusa
25784 Generate GNU/Linux compatible gUSA software atomic sequences
25785 for the atomic built-in functions. The generated atomic
25786 sequences require additional support from the
25787 interrupt/exception handling code of the system and are only
25788 suitable for SH3* and SH4* single-core systems. This option is
25789 enabled by default when the target is "sh*-*-linux*" and SH3*
25790 or SH4*. When the target is SH4A, this option also partially
25791 utilizes the hardware atomic instructions "movli.l" and
25792 "movco.l" to create more efficient code, unless strict is
25793 specified.
25794
25795 soft-tcb
25796 Generate software atomic sequences that use a variable in the
25797 thread control block. This is a variation of the gUSA
25798 sequences which can also be used on SH1* and SH2* targets. The
25799 generated atomic sequences require additional support from the
25800 interrupt/exception handling code of the system and are only
25801 suitable for single-core systems. When using this model, the
25802 gbr-offset= parameter has to be specified as well.
25803
25804 soft-imask
25805 Generate software atomic sequences that temporarily disable
25806 interrupts by setting "SR.IMASK = 1111". This model works only
25807 when the program runs in privileged mode and is only suitable
25808 for single-core systems. Additional support from the
25809 interrupt/exception handling code of the system is not
25810 required. This model is enabled by default when the target is
25811 "sh*-*-linux*" and SH1* or SH2*.
25812
25813 hard-llcs
25814 Generate hardware atomic sequences using the "movli.l" and
25815 "movco.l" instructions only. This is only available on SH4A
25816 and is suitable for multi-core systems. Since the hardware
25817 instructions support only 32 bit atomic variables access to 8
25818 or 16 bit variables is emulated with 32 bit accesses. Code
25819 compiled with this option is also compatible with other
25820 software atomic model interrupt/exception handling systems if
25821 executed on an SH4A system. Additional support from the
25822 interrupt/exception handling code of the system is not required
25823 for this model.
25824
25825 gbr-offset=
25826 This parameter specifies the offset in bytes of the variable in
25827 the thread control block structure that should be used by the
25828 generated atomic sequences when the soft-tcb model has been
25829 selected. For other models this parameter is ignored. The
25830 specified value must be an integer multiple of four and in the
25831 range 0-1020.
25832
25833 strict
25834 This parameter prevents mixed usage of multiple atomic models,
25835 even if they are compatible, and makes the compiler generate
25836 atomic sequences of the specified model only.
25837
25838 -mtas
25839 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
25840 that depending on the particular hardware and software
25841 configuration this can degrade overall performance due to the
25842 operand cache line flushes that are implied by the "tas.b"
25843 instruction. On multi-core SH4A processors the "tas.b" instruction
25844 must be used with caution since it can result in data corruption
25845 for certain cache configurations.
25846
25847 -mprefergot
25848 When generating position-independent code, emit function calls
25849 using the Global Offset Table instead of the Procedure Linkage
25850 Table.
25851
25852 -musermode
25853 -mno-usermode
25854 Don't allow (allow) the compiler generating privileged mode code.
25855 Specifying -musermode also implies -mno-inline-ic_invalidate if the
25856 inlined code would not work in user mode. -musermode is the
25857 default when the target is "sh*-*-linux*". If the target is SH1*
25858 or SH2* -musermode has no effect, since there is no user mode.
25859
25860 -multcost=number
25861 Set the cost to assume for a multiply insn.
25862
25863 -mdiv=strategy
25864 Set the division strategy to be used for integer division
25865 operations. strategy can be one of:
25866
25867 call-div1
25868 Calls a library function that uses the single-step division
25869 instruction "div1" to perform the operation. Division by zero
25870 calculates an unspecified result and does not trap. This is
25871 the default except for SH4, SH2A and SHcompact.
25872
25873 call-fp
25874 Calls a library function that performs the operation in double
25875 precision floating point. Division by zero causes a floating-
25876 point exception. This is the default for SHcompact with FPU.
25877 Specifying this for targets that do not have a double precision
25878 FPU defaults to "call-div1".
25879
25880 call-table
25881 Calls a library function that uses a lookup table for small
25882 divisors and the "div1" instruction with case distinction for
25883 larger divisors. Division by zero calculates an unspecified
25884 result and does not trap. This is the default for SH4.
25885 Specifying this for targets that do not have dynamic shift
25886 instructions defaults to "call-div1".
25887
25888 When a division strategy has not been specified the default
25889 strategy is selected based on the current target. For SH2A the
25890 default strategy is to use the "divs" and "divu" instructions
25891 instead of library function calls.
25892
25893 -maccumulate-outgoing-args
25894 Reserve space once for outgoing arguments in the function prologue
25895 rather than around each call. Generally beneficial for performance
25896 and size. Also needed for unwinding to avoid changing the stack
25897 frame around conditional code.
25898
25899 -mdivsi3_libfunc=name
25900 Set the name of the library function used for 32-bit signed
25901 division to name. This only affects the name used in the call
25902 division strategies, and the compiler still expects the same sets
25903 of input/output/clobbered registers as if this option were not
25904 present.
25905
25906 -mfixed-range=register-range
25907 Generate code treating the given register range as fixed registers.
25908 A fixed register is one that the register allocator cannot use.
25909 This is useful when compiling kernel code. A register range is
25910 specified as two registers separated by a dash. Multiple register
25911 ranges can be specified separated by a comma.
25912
25913 -mbranch-cost=num
25914 Assume num to be the cost for a branch instruction. Higher numbers
25915 make the compiler try to generate more branch-free code if
25916 possible. If not specified the value is selected depending on the
25917 processor type that is being compiled for.
25918
25919 -mzdcbranch
25920 -mno-zdcbranch
25921 Assume (do not assume) that zero displacement conditional branch
25922 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
25923 the compiler prefers zero displacement branch code sequences. This
25924 is enabled by default when generating code for SH4 and SH4A. It
25925 can be explicitly disabled by specifying -mno-zdcbranch.
25926
25927 -mcbranch-force-delay-slot
25928 Force the usage of delay slots for conditional branches, which
25929 stuffs the delay slot with a "nop" if a suitable instruction cannot
25930 be found. By default this option is disabled. It can be enabled
25931 to work around hardware bugs as found in the original SH7055.
25932
25933 -mfused-madd
25934 -mno-fused-madd
25935 Generate code that uses (does not use) the floating-point multiply
25936 and accumulate instructions. These instructions are generated by
25937 default if hardware floating point is used. The machine-dependent
25938 -mfused-madd option is now mapped to the machine-independent
25939 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25940 -ffp-contract=off.
25941
25942 -mfsca
25943 -mno-fsca
25944 Allow or disallow the compiler to emit the "fsca" instruction for
25945 sine and cosine approximations. The option -mfsca must be used in
25946 combination with -funsafe-math-optimizations. It is enabled by
25947 default when generating code for SH4A. Using -mno-fsca disables
25948 sine and cosine approximations even if -funsafe-math-optimizations
25949 is in effect.
25950
25951 -mfsrra
25952 -mno-fsrra
25953 Allow or disallow the compiler to emit the "fsrra" instruction for
25954 reciprocal square root approximations. The option -mfsrra must be
25955 used in combination with -funsafe-math-optimizations and
25956 -ffinite-math-only. It is enabled by default when generating code
25957 for SH4A. Using -mno-fsrra disables reciprocal square root
25958 approximations even if -funsafe-math-optimizations and
25959 -ffinite-math-only are in effect.
25960
25961 -mpretend-cmove
25962 Prefer zero-displacement conditional branches for conditional move
25963 instruction patterns. This can result in faster code on the SH4
25964 processor.
25965
25966 -mfdpic
25967 Generate code using the FDPIC ABI.
25968
25969 Solaris 2 Options
25970
25971 These -m options are supported on Solaris 2:
25972
25973 -mclear-hwcap
25974 -mclear-hwcap tells the compiler to remove the hardware
25975 capabilities generated by the Solaris assembler. This is only
25976 necessary when object files use ISA extensions not supported by the
25977 current machine, but check at runtime whether or not to use them.
25978
25979 -mimpure-text
25980 -mimpure-text, used in addition to -shared, tells the compiler to
25981 not pass -z text to the linker when linking a shared object. Using
25982 this option, you can link position-dependent code into a shared
25983 object.
25984
25985 -mimpure-text suppresses the "relocations remain against
25986 allocatable but non-writable sections" linker error message.
25987 However, the necessary relocations trigger copy-on-write, and the
25988 shared object is not actually shared across processes. Instead of
25989 using -mimpure-text, you should compile all source code with -fpic
25990 or -fPIC.
25991
25992 These switches are supported in addition to the above on Solaris 2:
25993
25994 -pthreads
25995 This is a synonym for -pthread.
25996
25997 SPARC Options
25998
25999 These -m options are supported on the SPARC:
26000
26001 -mno-app-regs
26002 -mapp-regs
26003 Specify -mapp-regs to generate output using the global registers 2
26004 through 4, which the SPARC SVR4 ABI reserves for applications.
26005 Like the global register 1, each global register 2 through 4 is
26006 then treated as an allocable register that is clobbered by function
26007 calls. This is the default.
26008
26009 To be fully SVR4 ABI-compliant at the cost of some performance
26010 loss, specify -mno-app-regs. You should compile libraries and
26011 system software with this option.
26012
26013 -mflat
26014 -mno-flat
26015 With -mflat, the compiler does not generate save/restore
26016 instructions and uses a "flat" or single register window model.
26017 This model is compatible with the regular register window model.
26018 The local registers and the input registers (0--5) are still
26019 treated as "call-saved" registers and are saved on the stack as
26020 needed.
26021
26022 With -mno-flat (the default), the compiler generates save/restore
26023 instructions (except for leaf functions). This is the normal
26024 operating mode.
26025
26026 -mfpu
26027 -mhard-float
26028 Generate output containing floating-point instructions. This is
26029 the default.
26030
26031 -mno-fpu
26032 -msoft-float
26033 Generate output containing library calls for floating point.
26034 Warning: the requisite libraries are not available for all SPARC
26035 targets. Normally the facilities of the machine's usual C compiler
26036 are used, but this cannot be done directly in cross-compilation.
26037 You must make your own arrangements to provide suitable library
26038 functions for cross-compilation. The embedded targets sparc-*-aout
26039 and sparclite-*-* do provide software floating-point support.
26040
26041 -msoft-float changes the calling convention in the output file;
26042 therefore, it is only useful if you compile all of a program with
26043 this option. In particular, you need to compile libgcc.a, the
26044 library that comes with GCC, with -msoft-float in order for this to
26045 work.
26046
26047 -mhard-quad-float
26048 Generate output containing quad-word (long double) floating-point
26049 instructions.
26050
26051 -msoft-quad-float
26052 Generate output containing library calls for quad-word (long
26053 double) floating-point instructions. The functions called are
26054 those specified in the SPARC ABI. This is the default.
26055
26056 As of this writing, there are no SPARC implementations that have
26057 hardware support for the quad-word floating-point instructions.
26058 They all invoke a trap handler for one of these instructions, and
26059 then the trap handler emulates the effect of the instruction.
26060 Because of the trap handler overhead, this is much slower than
26061 calling the ABI library routines. Thus the -msoft-quad-float
26062 option is the default.
26063
26064 -mno-unaligned-doubles
26065 -munaligned-doubles
26066 Assume that doubles have 8-byte alignment. This is the default.
26067
26068 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26069 alignment only if they are contained in another type, or if they
26070 have an absolute address. Otherwise, it assumes they have 4-byte
26071 alignment. Specifying this option avoids some rare compatibility
26072 problems with code generated by other compilers. It is not the
26073 default because it results in a performance loss, especially for
26074 floating-point code.
26075
26076 -muser-mode
26077 -mno-user-mode
26078 Do not generate code that can only run in supervisor mode. This is
26079 relevant only for the "casa" instruction emitted for the LEON3
26080 processor. This is the default.
26081
26082 -mfaster-structs
26083 -mno-faster-structs
26084 With -mfaster-structs, the compiler assumes that structures should
26085 have 8-byte alignment. This enables the use of pairs of "ldd" and
26086 "std" instructions for copies in structure assignment, in place of
26087 twice as many "ld" and "st" pairs. However, the use of this
26088 changed alignment directly violates the SPARC ABI. Thus, it's
26089 intended only for use on targets where the developer acknowledges
26090 that their resulting code is not directly in line with the rules of
26091 the ABI.
26092
26093 -mstd-struct-return
26094 -mno-std-struct-return
26095 With -mstd-struct-return, the compiler generates checking code in
26096 functions returning structures or unions to detect size mismatches
26097 between the two sides of function calls, as per the 32-bit ABI.
26098
26099 The default is -mno-std-struct-return. This option has no effect
26100 in 64-bit mode.
26101
26102 -mlra
26103 -mno-lra
26104 Enable Local Register Allocation. This is the default for SPARC
26105 since GCC 7 so -mno-lra needs to be passed to get old Reload.
26106
26107 -mcpu=cpu_type
26108 Set the instruction set, register set, and instruction scheduling
26109 parameters for machine type cpu_type. Supported values for
26110 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
26111 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
26112 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
26113 niagara4, niagara7 and m8.
26114
26115 Native Solaris and GNU/Linux toolchains also support the value
26116 native, which selects the best architecture option for the host
26117 processor. -mcpu=native has no effect if GCC does not recognize
26118 the processor.
26119
26120 Default instruction scheduling parameters are used for values that
26121 select an architecture and not an implementation. These are v7,
26122 v8, sparclite, sparclet, v9.
26123
26124 Here is a list of each supported architecture and their supported
26125 implementations.
26126
26127 v7 cypress, leon3v7
26128
26129 v8 supersparc, hypersparc, leon, leon3, leon5
26130
26131 sparclite
26132 f930, f934, sparclite86x
26133
26134 sparclet
26135 tsc701
26136
26137 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26138 niagara7, m8
26139
26140 By default (unless configured otherwise), GCC generates code for
26141 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
26142 compiler additionally optimizes it for the Cypress CY7C602 chip, as
26143 used in the SPARCStation/SPARCServer 3xx series. This is also
26144 appropriate for the older SPARCStation 1, 2, IPX etc.
26145
26146 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
26147 architecture. The only difference from V7 code is that the
26148 compiler emits the integer multiply and integer divide instructions
26149 which exist in SPARC-V8 but not in SPARC-V7. With
26150 -mcpu=supersparc, the compiler additionally optimizes it for the
26151 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
26152 series.
26153
26154 With -mcpu=sparclite, GCC generates code for the SPARClite variant
26155 of the SPARC architecture. This adds the integer multiply, integer
26156 divide step and scan ("ffs") instructions which exist in SPARClite
26157 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
26158 optimizes it for the Fujitsu MB86930 chip, which is the original
26159 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
26160 optimizes it for the Fujitsu MB86934 chip, which is the more recent
26161 SPARClite with FPU.
26162
26163 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
26164 the SPARC architecture. This adds the integer multiply,
26165 multiply/accumulate, integer divide step and scan ("ffs")
26166 instructions which exist in SPARClet but not in SPARC-V7. With
26167 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
26168 SPARClet chip.
26169
26170 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
26171 architecture. This adds 64-bit integer and floating-point move
26172 instructions, 3 additional floating-point condition code registers
26173 and conditional move instructions. With -mcpu=ultrasparc, the
26174 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
26175 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
26176 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26177 -mcpu=niagara, the compiler additionally optimizes it for Sun
26178 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
26179 additionally optimizes it for Sun UltraSPARC T2 chips. With
26180 -mcpu=niagara3, the compiler additionally optimizes it for Sun
26181 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
26182 additionally optimizes it for Sun UltraSPARC T4 chips. With
26183 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
26184 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
26185 it for Oracle M8 chips.
26186
26187 -mtune=cpu_type
26188 Set the instruction scheduling parameters for machine type
26189 cpu_type, but do not set the instruction set or register set that
26190 the option -mcpu=cpu_type does.
26191
26192 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
26193 but the only useful values are those that select a particular CPU
26194 implementation. Those are cypress, supersparc, hypersparc, leon,
26195 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
26196 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26197 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
26198 native can also be used.
26199
26200 -mv8plus
26201 -mno-v8plus
26202 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
26203 difference from the V8 ABI is that the global and out registers are
26204 considered 64 bits wide. This is enabled by default on Solaris in
26205 32-bit mode for all SPARC-V9 processors.
26206
26207 -mvis
26208 -mno-vis
26209 With -mvis, GCC generates code that takes advantage of the
26210 UltraSPARC Visual Instruction Set extensions. The default is
26211 -mno-vis.
26212
26213 -mvis2
26214 -mno-vis2
26215 With -mvis2, GCC generates code that takes advantage of version 2.0
26216 of the UltraSPARC Visual Instruction Set extensions. The default
26217 is -mvis2 when targeting a cpu that supports such instructions,
26218 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
26219
26220 -mvis3
26221 -mno-vis3
26222 With -mvis3, GCC generates code that takes advantage of version 3.0
26223 of the UltraSPARC Visual Instruction Set extensions. The default
26224 is -mvis3 when targeting a cpu that supports such instructions,
26225 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
26226 -mvis.
26227
26228 -mvis4
26229 -mno-vis4
26230 With -mvis4, GCC generates code that takes advantage of version 4.0
26231 of the UltraSPARC Visual Instruction Set extensions. The default
26232 is -mvis4 when targeting a cpu that supports such instructions,
26233 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
26234 -mvis2 and -mvis.
26235
26236 -mvis4b
26237 -mno-vis4b
26238 With -mvis4b, GCC generates code that takes advantage of version
26239 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
26240 additional VIS instructions introduced in the Oracle SPARC
26241 Architecture 2017. The default is -mvis4b when targeting a cpu
26242 that supports such instructions, such as m8 and later. Setting
26243 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
26244
26245 -mcbcond
26246 -mno-cbcond
26247 With -mcbcond, GCC generates code that takes advantage of the
26248 UltraSPARC Compare-and-Branch-on-Condition instructions. The
26249 default is -mcbcond when targeting a CPU that supports such
26250 instructions, such as Niagara-4 and later.
26251
26252 -mfmaf
26253 -mno-fmaf
26254 With -mfmaf, GCC generates code that takes advantage of the
26255 UltraSPARC Fused Multiply-Add Floating-point instructions. The
26256 default is -mfmaf when targeting a CPU that supports such
26257 instructions, such as Niagara-3 and later.
26258
26259 -mfsmuld
26260 -mno-fsmuld
26261 With -mfsmuld, GCC generates code that takes advantage of the
26262 Floating-point Multiply Single to Double (FsMULd) instruction. The
26263 default is -mfsmuld when targeting a CPU supporting the
26264 architecture versions V8 or V9 with FPU except -mcpu=leon.
26265
26266 -mpopc
26267 -mno-popc
26268 With -mpopc, GCC generates code that takes advantage of the
26269 UltraSPARC Population Count instruction. The default is -mpopc
26270 when targeting a CPU that supports such an instruction, such as
26271 Niagara-2 and later.
26272
26273 -msubxc
26274 -mno-subxc
26275 With -msubxc, GCC generates code that takes advantage of the
26276 UltraSPARC Subtract-Extended-with-Carry instruction. The default
26277 is -msubxc when targeting a CPU that supports such an instruction,
26278 such as Niagara-7 and later.
26279
26280 -mfix-at697f
26281 Enable the documented workaround for the single erratum of the
26282 Atmel AT697F processor (which corresponds to erratum #13 of the
26283 AT697E processor).
26284
26285 -mfix-ut699
26286 Enable the documented workarounds for the floating-point errata and
26287 the data cache nullify errata of the UT699 processor.
26288
26289 -mfix-ut700
26290 Enable the documented workaround for the back-to-back store errata
26291 of the UT699E/UT700 processor.
26292
26293 -mfix-gr712rc
26294 Enable the documented workaround for the back-to-back store errata
26295 of the GR712RC processor.
26296
26297 These -m options are supported in addition to the above on SPARC-V9
26298 processors in 64-bit environments:
26299
26300 -m32
26301 -m64
26302 Generate code for a 32-bit or 64-bit environment. The 32-bit
26303 environment sets int, long and pointer to 32 bits. The 64-bit
26304 environment sets int to 32 bits and long and pointer to 64 bits.
26305
26306 -mcmodel=which
26307 Set the code model to one of
26308
26309 medlow
26310 The Medium/Low code model: 64-bit addresses, programs must be
26311 linked in the low 32 bits of memory. Programs can be
26312 statically or dynamically linked.
26313
26314 medmid
26315 The Medium/Middle code model: 64-bit addresses, programs must
26316 be linked in the low 44 bits of memory, the text and data
26317 segments must be less than 2GB in size and the data segment
26318 must be located within 2GB of the text segment.
26319
26320 medany
26321 The Medium/Anywhere code model: 64-bit addresses, programs may
26322 be linked anywhere in memory, the text and data segments must
26323 be less than 2GB in size and the data segment must be located
26324 within 2GB of the text segment.
26325
26326 embmedany
26327 The Medium/Anywhere code model for embedded systems: 64-bit
26328 addresses, the text and data segments must be less than 2GB in
26329 size, both starting anywhere in memory (determined at link
26330 time). The global register %g4 points to the base of the data
26331 segment. Programs are statically linked and PIC is not
26332 supported.
26333
26334 -mmemory-model=mem-model
26335 Set the memory model in force on the processor to one of
26336
26337 default
26338 The default memory model for the processor and operating
26339 system.
26340
26341 rmo Relaxed Memory Order
26342
26343 pso Partial Store Order
26344
26345 tso Total Store Order
26346
26347 sc Sequential Consistency
26348
26349 These memory models are formally defined in Appendix D of the
26350 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
26351 field.
26352
26353 -mstack-bias
26354 -mno-stack-bias
26355 With -mstack-bias, GCC assumes that the stack pointer, and frame
26356 pointer if present, are offset by -2047 which must be added back
26357 when making stack frame references. This is the default in 64-bit
26358 mode. Otherwise, assume no such offset is present.
26359
26360 Options for System V
26361
26362 These additional options are available on System V Release 4 for
26363 compatibility with other compilers on those systems:
26364
26365 -G Create a shared object. It is recommended that -symbolic or
26366 -shared be used instead.
26367
26368 -Qy Identify the versions of each tool used by the compiler, in a
26369 ".ident" assembler directive in the output.
26370
26371 -Qn Refrain from adding ".ident" directives to the output file (this is
26372 the default).
26373
26374 -YP,dirs
26375 Search the directories dirs, and no others, for libraries specified
26376 with -l.
26377
26378 -Ym,dir
26379 Look in the directory dir to find the M4 preprocessor. The
26380 assembler uses this option.
26381
26382 TILE-Gx Options
26383
26384 These -m options are supported on the TILE-Gx:
26385
26386 -mcmodel=small
26387 Generate code for the small model. The distance for direct calls
26388 is limited to 500M in either direction. PC-relative addresses are
26389 32 bits. Absolute addresses support the full address range.
26390
26391 -mcmodel=large
26392 Generate code for the large model. There is no limitation on call
26393 distance, pc-relative addresses, or absolute addresses.
26394
26395 -mcpu=name
26396 Selects the type of CPU to be targeted. Currently the only
26397 supported type is tilegx.
26398
26399 -m32
26400 -m64
26401 Generate code for a 32-bit or 64-bit environment. The 32-bit
26402 environment sets int, long, and pointer to 32 bits. The 64-bit
26403 environment sets int to 32 bits and long and pointer to 64 bits.
26404
26405 -mbig-endian
26406 -mlittle-endian
26407 Generate code in big/little endian mode, respectively.
26408
26409 TILEPro Options
26410
26411 These -m options are supported on the TILEPro:
26412
26413 -mcpu=name
26414 Selects the type of CPU to be targeted. Currently the only
26415 supported type is tilepro.
26416
26417 -m32
26418 Generate code for a 32-bit environment, which sets int, long, and
26419 pointer to 32 bits. This is the only supported behavior so the
26420 flag is essentially ignored.
26421
26422 V850 Options
26423
26424 These -m options are defined for V850 implementations:
26425
26426 -mlong-calls
26427 -mno-long-calls
26428 Treat all calls as being far away (near). If calls are assumed to
26429 be far away, the compiler always loads the function's address into
26430 a register, and calls indirect through the pointer.
26431
26432 -mno-ep
26433 -mep
26434 Do not optimize (do optimize) basic blocks that use the same index
26435 pointer 4 or more times to copy pointer into the "ep" register, and
26436 use the shorter "sld" and "sst" instructions. The -mep option is
26437 on by default if you optimize.
26438
26439 -mno-prolog-function
26440 -mprolog-function
26441 Do not use (do use) external functions to save and restore
26442 registers at the prologue and epilogue of a function. The external
26443 functions are slower, but use less code space if more than one
26444 function saves the same number of registers. The -mprolog-function
26445 option is on by default if you optimize.
26446
26447 -mspace
26448 Try to make the code as small as possible. At present, this just
26449 turns on the -mep and -mprolog-function options.
26450
26451 -mtda=n
26452 Put static or global variables whose size is n bytes or less into
26453 the tiny data area that register "ep" points to. The tiny data
26454 area can hold up to 256 bytes in total (128 bytes for byte
26455 references).
26456
26457 -msda=n
26458 Put static or global variables whose size is n bytes or less into
26459 the small data area that register "gp" points to. The small data
26460 area can hold up to 64 kilobytes.
26461
26462 -mzda=n
26463 Put static or global variables whose size is n bytes or less into
26464 the first 32 kilobytes of memory.
26465
26466 -mv850
26467 Specify that the target processor is the V850.
26468
26469 -mv850e3v5
26470 Specify that the target processor is the V850E3V5. The
26471 preprocessor constant "__v850e3v5__" is defined if this option is
26472 used.
26473
26474 -mv850e2v4
26475 Specify that the target processor is the V850E3V5. This is an
26476 alias for the -mv850e3v5 option.
26477
26478 -mv850e2v3
26479 Specify that the target processor is the V850E2V3. The
26480 preprocessor constant "__v850e2v3__" is defined if this option is
26481 used.
26482
26483 -mv850e2
26484 Specify that the target processor is the V850E2. The preprocessor
26485 constant "__v850e2__" is defined if this option is used.
26486
26487 -mv850e1
26488 Specify that the target processor is the V850E1. The preprocessor
26489 constants "__v850e1__" and "__v850e__" are defined if this option
26490 is used.
26491
26492 -mv850es
26493 Specify that the target processor is the V850ES. This is an alias
26494 for the -mv850e1 option.
26495
26496 -mv850e
26497 Specify that the target processor is the V850E. The preprocessor
26498 constant "__v850e__" is defined if this option is used.
26499
26500 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
26501 -mv850e2v3 nor -mv850e3v5 are defined then a default target
26502 processor is chosen and the relevant __v850*__ preprocessor
26503 constant is defined.
26504
26505 The preprocessor constants "__v850" and "__v851__" are always
26506 defined, regardless of which processor variant is the target.
26507
26508 -mdisable-callt
26509 -mno-disable-callt
26510 This option suppresses generation of the "CALLT" instruction for
26511 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
26512 v850 architecture.
26513
26514 This option is enabled by default when the RH850 ABI is in use (see
26515 -mrh850-abi), and disabled by default when the GCC ABI is in use.
26516 If "CALLT" instructions are being generated then the C preprocessor
26517 symbol "__V850_CALLT__" is defined.
26518
26519 -mrelax
26520 -mno-relax
26521 Pass on (or do not pass on) the -mrelax command-line option to the
26522 assembler.
26523
26524 -mlong-jumps
26525 -mno-long-jumps
26526 Disable (or re-enable) the generation of PC-relative jump
26527 instructions.
26528
26529 -msoft-float
26530 -mhard-float
26531 Disable (or re-enable) the generation of hardware floating point
26532 instructions. This option is only significant when the target
26533 architecture is V850E2V3 or higher. If hardware floating point
26534 instructions are being generated then the C preprocessor symbol
26535 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
26536 defined.
26537
26538 -mloop
26539 Enables the use of the e3v5 LOOP instruction. The use of this
26540 instruction is not enabled by default when the e3v5 architecture is
26541 selected because its use is still experimental.
26542
26543 -mrh850-abi
26544 -mghs
26545 Enables support for the RH850 version of the V850 ABI. This is the
26546 default. With this version of the ABI the following rules apply:
26547
26548 * Integer sized structures and unions are returned via a memory
26549 pointer rather than a register.
26550
26551 * Large structures and unions (more than 8 bytes in size) are
26552 passed by value.
26553
26554 * Functions are aligned to 16-bit boundaries.
26555
26556 * The -m8byte-align command-line option is supported.
26557
26558 * The -mdisable-callt command-line option is enabled by default.
26559 The -mno-disable-callt command-line option is not supported.
26560
26561 When this version of the ABI is enabled the C preprocessor symbol
26562 "__V850_RH850_ABI__" is defined.
26563
26564 -mgcc-abi
26565 Enables support for the old GCC version of the V850 ABI. With this
26566 version of the ABI the following rules apply:
26567
26568 * Integer sized structures and unions are returned in register
26569 "r10".
26570
26571 * Large structures and unions (more than 8 bytes in size) are
26572 passed by reference.
26573
26574 * Functions are aligned to 32-bit boundaries, unless optimizing
26575 for size.
26576
26577 * The -m8byte-align command-line option is not supported.
26578
26579 * The -mdisable-callt command-line option is supported but not
26580 enabled by default.
26581
26582 When this version of the ABI is enabled the C preprocessor symbol
26583 "__V850_GCC_ABI__" is defined.
26584
26585 -m8byte-align
26586 -mno-8byte-align
26587 Enables support for "double" and "long long" types to be aligned on
26588 8-byte boundaries. The default is to restrict the alignment of all
26589 objects to at most 4-bytes. When -m8byte-align is in effect the C
26590 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
26591
26592 -mbig-switch
26593 Generate code suitable for big switch tables. Use this option only
26594 if the assembler/linker complain about out of range branches within
26595 a switch table.
26596
26597 -mapp-regs
26598 This option causes r2 and r5 to be used in the code generated by
26599 the compiler. This setting is the default.
26600
26601 -mno-app-regs
26602 This option causes r2 and r5 to be treated as fixed registers.
26603
26604 VAX Options
26605
26606 These -m options are defined for the VAX:
26607
26608 -munix
26609 Do not output certain jump instructions ("aobleq" and so on) that
26610 the Unix assembler for the VAX cannot handle across long ranges.
26611
26612 -mgnu
26613 Do output those jump instructions, on the assumption that the GNU
26614 assembler is being used.
26615
26616 -mg Output code for G-format floating-point numbers instead of
26617 D-format.
26618
26619 -mlra
26620 -mno-lra
26621 Enable Local Register Allocation. This is still experimental for
26622 the VAX, so by default the compiler uses standard reload.
26623
26624 Visium Options
26625
26626 -mdebug
26627 A program which performs file I/O and is destined to run on an MCM
26628 target should be linked with this option. It causes the libraries
26629 libc.a and libdebug.a to be linked. The program should be run on
26630 the target under the control of the GDB remote debugging stub.
26631
26632 -msim
26633 A program which performs file I/O and is destined to run on the
26634 simulator should be linked with option. This causes libraries
26635 libc.a and libsim.a to be linked.
26636
26637 -mfpu
26638 -mhard-float
26639 Generate code containing floating-point instructions. This is the
26640 default.
26641
26642 -mno-fpu
26643 -msoft-float
26644 Generate code containing library calls for floating-point.
26645
26646 -msoft-float changes the calling convention in the output file;
26647 therefore, it is only useful if you compile all of a program with
26648 this option. In particular, you need to compile libgcc.a, the
26649 library that comes with GCC, with -msoft-float in order for this to
26650 work.
26651
26652 -mcpu=cpu_type
26653 Set the instruction set, register set, and instruction scheduling
26654 parameters for machine type cpu_type. Supported values for
26655 cpu_type are mcm, gr5 and gr6.
26656
26657 mcm is a synonym of gr5 present for backward compatibility.
26658
26659 By default (unless configured otherwise), GCC generates code for
26660 the GR5 variant of the Visium architecture.
26661
26662 With -mcpu=gr6, GCC generates code for the GR6 variant of the
26663 Visium architecture. The only difference from GR5 code is that the
26664 compiler will generate block move instructions.
26665
26666 -mtune=cpu_type
26667 Set the instruction scheduling parameters for machine type
26668 cpu_type, but do not set the instruction set or register set that
26669 the option -mcpu=cpu_type would.
26670
26671 -msv-mode
26672 Generate code for the supervisor mode, where there are no
26673 restrictions on the access to general registers. This is the
26674 default.
26675
26676 -muser-mode
26677 Generate code for the user mode, where the access to some general
26678 registers is forbidden: on the GR5, registers r24 to r31 cannot be
26679 accessed in this mode; on the GR6, only registers r29 to r31 are
26680 affected.
26681
26682 VMS Options
26683
26684 These -m options are defined for the VMS implementations:
26685
26686 -mvms-return-codes
26687 Return VMS condition codes from "main". The default is to return
26688 POSIX-style condition (e.g. error) codes.
26689
26690 -mdebug-main=prefix
26691 Flag the first routine whose name starts with prefix as the main
26692 routine for the debugger.
26693
26694 -mmalloc64
26695 Default to 64-bit memory allocation routines.
26696
26697 -mpointer-size=size
26698 Set the default size of pointers. Possible options for size are 32
26699 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
26700 no for supporting only 32 bit pointers. The later option disables
26701 "pragma pointer_size".
26702
26703 VxWorks Options
26704
26705 The options in this section are defined for all VxWorks targets.
26706 Options specific to the target hardware are listed with the other
26707 options for that target.
26708
26709 -mrtp
26710 GCC can generate code for both VxWorks kernels and real time
26711 processes (RTPs). This option switches from the former to the
26712 latter. It also defines the preprocessor macro "__RTP__".
26713
26714 -non-static
26715 Link an RTP executable against shared libraries rather than static
26716 libraries. The options -static and -shared can also be used for
26717 RTPs; -static is the default.
26718
26719 -Bstatic
26720 -Bdynamic
26721 These options are passed down to the linker. They are defined for
26722 compatibility with Diab.
26723
26724 -Xbind-lazy
26725 Enable lazy binding of function calls. This option is equivalent
26726 to -Wl,-z,now and is defined for compatibility with Diab.
26727
26728 -Xbind-now
26729 Disable lazy binding of function calls. This option is the default
26730 and is defined for compatibility with Diab.
26731
26732 x86 Options
26733
26734 These -m options are defined for the x86 family of computers.
26735
26736 -march=cpu-type
26737 Generate instructions for the machine type cpu-type. In contrast
26738 to -mtune=cpu-type, which merely tunes the generated code for the
26739 specified cpu-type, -march=cpu-type allows GCC to generate code
26740 that may not run at all on processors other than the one indicated.
26741 Specifying -march=cpu-type implies -mtune=cpu-type, except where
26742 noted otherwise.
26743
26744 The choices for cpu-type are:
26745
26746 native
26747 This selects the CPU to generate code for at compilation time
26748 by determining the processor type of the compiling machine.
26749 Using -march=native enables all instruction subsets supported
26750 by the local machine (hence the result might not run on
26751 different machines). Using -mtune=native produces code
26752 optimized for the local machine under the constraints of the
26753 selected instruction set.
26754
26755 x86-64
26756 A generic CPU with 64-bit extensions.
26757
26758 x86-64-v2
26759 x86-64-v3
26760 x86-64-v4
26761 These choices for cpu-type select the corresponding micro-
26762 architecture level from the x86-64 psABI. On ABIs other than
26763 the x86-64 psABI they select the same CPU features as the
26764 x86-64 psABI documents for the particular micro-architecture
26765 level.
26766
26767 Since these cpu-type values do not have a corresponding -mtune
26768 setting, using -march with these values enables generic tuning.
26769 Specific tuning can be enabled using the -mtune=other-cpu-type
26770 option with an appropriate other-cpu-type value.
26771
26772 i386
26773 Original Intel i386 CPU.
26774
26775 i486
26776 Intel i486 CPU. (No scheduling is implemented for this chip.)
26777
26778 i586
26779 pentium
26780 Intel Pentium CPU with no MMX support.
26781
26782 lakemont
26783 Intel Lakemont MCU, based on Intel Pentium CPU.
26784
26785 pentium-mmx
26786 Intel Pentium MMX CPU, based on Pentium core with MMX
26787 instruction set support.
26788
26789 pentiumpro
26790 Intel Pentium Pro CPU.
26791
26792 i686
26793 When used with -march, the Pentium Pro instruction set is used,
26794 so the code runs on all i686 family chips. When used with
26795 -mtune, it has the same meaning as generic.
26796
26797 pentium2
26798 Intel Pentium II CPU, based on Pentium Pro core with MMX and
26799 FXSR instruction set support.
26800
26801 pentium3
26802 pentium3m
26803 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
26804 and SSE instruction set support.
26805
26806 pentium-m
26807 Intel Pentium M; low-power version of Intel Pentium III CPU
26808 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
26809 Centrino notebooks.
26810
26811 pentium4
26812 pentium4m
26813 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
26814 set support.
26815
26816 prescott
26817 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
26818 SSE3 and FXSR instruction set support.
26819
26820 nocona
26821 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
26822 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
26823
26824 core2
26825 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26826 SSSE3, CX16, SAHF and FXSR instruction set support.
26827
26828 nehalem
26829 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26830 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
26831 set support.
26832
26833 westmere
26834 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
26835 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
26836 PCLMUL instruction set support.
26837
26838 sandybridge
26839 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26840 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26841 XSAVE and PCLMUL instruction set support.
26842
26843 ivybridge
26844 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26845 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26846 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
26847 support.
26848
26849 haswell
26850 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26851 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26852 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26853 LZCNT, FMA, MOVBE and HLE instruction set support.
26854
26855 broadwell
26856 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26857 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26858 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26859 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
26860 set support.
26861
26862 skylake
26863 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26864 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26865 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26866 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26867 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
26868
26869 bonnell
26870 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26871 SSE2, SSE3 and SSSE3 instruction set support.
26872
26873 silvermont
26874 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26875 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26876 PCLMUL, PREFETCHW and RDRND instruction set support.
26877
26878 goldmont
26879 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26880 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26881 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26882 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
26883 support.
26884
26885 goldmont-plus
26886 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
26887 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26888 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
26889 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
26890 and SGX instruction set support.
26891
26892 tremont
26893 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26894 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26895 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26896 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
26897 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
26898 instruction set support.
26899
26900 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
26901 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26902 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26903 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
26904 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
26905 instruction set support.
26906
26907 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
26908 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26909 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26910 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
26911 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
26912 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26913
26914 skylake-avx512
26915 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
26916 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26917 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26918 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26919 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26920 AVX512BW, AVX512DQ and AVX512CD instruction set support.
26921
26922 cannonlake
26923 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
26924 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26925 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26926 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26927 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26928 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
26929 instruction set support.
26930
26931 icelake-client
26932 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
26933 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26934 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26935 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26936 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26937 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26938 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26939 RDPID and AVX512VPOPCNTDQ instruction set support.
26940
26941 icelake-server
26942 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
26943 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26944 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26945 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26946 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26947 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26948 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26949 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
26950 set support.
26951
26952 cascadelake
26953 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26954 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26955 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26956 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26957 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26958 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
26959 support.
26960
26961 cooperlake
26962 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26963 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26964 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26965 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26966 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26967 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
26968 instruction set support.
26969
26970 tigerlake
26971 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26972 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26973 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26974 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26975 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26976 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
26977 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26978 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
26979 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
26980
26981 sapphirerapids
26982 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
26983 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26984 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26985 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26986 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26987 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26988 AVX512VNNI, GFNI, VAES, AVX512VBMI2 VPCLMULQDQ, AVX512BITALG,
26989 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
26990 MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE,
26991 WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE,
26992 AMX-INT8, AVX-VNNI, AVX512FP16 and AVX512BF16 instruction set
26993 support.
26994
26995 alderlake
26996 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26997 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
26998 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
26999 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27000 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27001 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27002 WIDEKL and AVX-VNNI instruction set support.
27003
27004 rocketlake
27005 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27006 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27007 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27008 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27009 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
27010 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27011 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27012 RDPID and AVX512VPOPCNTDQ instruction set support.
27013
27014 k6 AMD K6 CPU with MMX instruction set support.
27015
27016 k6-2
27017 k6-3
27018 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
27019 set support.
27020
27021 athlon
27022 athlon-tbird
27023 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
27024 prefetch instructions support.
27025
27026 athlon-4
27027 athlon-xp
27028 athlon-mp
27029 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
27030 full SSE instruction set support.
27031
27032 k8
27033 opteron
27034 athlon64
27035 athlon-fx
27036 Processors based on the AMD K8 core with x86-64 instruction set
27037 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
27038 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
27039 3DNow! and 64-bit instruction set extensions.)
27040
27041 k8-sse3
27042 opteron-sse3
27043 athlon64-sse3
27044 Improved versions of AMD K8 cores with SSE3 instruction set
27045 support.
27046
27047 amdfam10
27048 barcelona
27049 CPUs based on AMD Family 10h cores with x86-64 instruction set
27050 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
27051 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
27052
27053 bdver1
27054 CPUs based on AMD Family 15h cores with x86-64 instruction set
27055 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
27056 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
27057 and 64-bit instruction set extensions.)
27058
27059 bdver2
27060 AMD Family 15h core based CPUs with x86-64 instruction set
27061 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27062 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27063 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27064
27065 bdver3
27066 AMD Family 15h core based CPUs with x86-64 instruction set
27067 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27068 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27069 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27070 extensions.)
27071
27072 bdver4
27073 AMD Family 15h core based CPUs with x86-64 instruction set
27074 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27075 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27076 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27077 instruction set extensions.)
27078
27079 znver1
27080 AMD Family 17h core based CPUs with x86-64 instruction set
27081 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27082 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27083 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27084 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27085 extensions.)
27086
27087 znver2
27088 AMD Family 17h core based CPUs with x86-64 instruction set
27089 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27090 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27091 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27092 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27093 WBNOINVD, and 64-bit instruction set extensions.)
27094
27095 znver3
27096 AMD Family 19h core based CPUs with x86-64 instruction set
27097 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27098 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27099 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27100 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27101 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
27102 extensions.)
27103
27104 btver1
27105 CPUs based on AMD Family 14h cores with x86-64 instruction set
27106 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
27107 CX16, ABM and 64-bit instruction set extensions.)
27108
27109 btver2
27110 CPUs based on AMD Family 16h cores with x86-64 instruction set
27111 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
27112 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
27113 and 64-bit instruction set extensions.
27114
27115 winchip-c6
27116 IDT WinChip C6 CPU, dealt in same way as i486 with additional
27117 MMX instruction set support.
27118
27119 winchip2
27120 IDT WinChip 2 CPU, dealt in same way as i486 with additional
27121 MMX and 3DNow! instruction set support.
27122
27123 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
27124 scheduling is implemented for this chip.)
27125
27126 c3-2
27127 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
27128 support. (No scheduling is implemented for this chip.)
27129
27130 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
27131 set support. (No scheduling is implemented for this chip.)
27132
27133 samuel-2
27134 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
27135 support. (No scheduling is implemented for this chip.)
27136
27137 nehemiah
27138 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27139 (No scheduling is implemented for this chip.)
27140
27141 esther
27142 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
27143 set support. (No scheduling is implemented for this chip.)
27144
27145 eden-x2
27146 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
27147 instruction set support. (No scheduling is implemented for
27148 this chip.)
27149
27150 eden-x4
27151 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
27152 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
27153 scheduling is implemented for this chip.)
27154
27155 nano
27156 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
27157 SSSE3 instruction set support. (No scheduling is implemented
27158 for this chip.)
27159
27160 nano-1000
27161 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27162 instruction set support. (No scheduling is implemented for
27163 this chip.)
27164
27165 nano-2000
27166 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27167 instruction set support. (No scheduling is implemented for
27168 this chip.)
27169
27170 nano-3000
27171 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
27172 SSE4.1 instruction set support. (No scheduling is implemented
27173 for this chip.)
27174
27175 nano-x2
27176 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27177 and SSE4.1 instruction set support. (No scheduling is
27178 implemented for this chip.)
27179
27180 nano-x4
27181 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27182 and SSE4.1 instruction set support. (No scheduling is
27183 implemented for this chip.)
27184
27185 geode
27186 AMD Geode embedded processor with MMX and 3DNow! instruction
27187 set support.
27188
27189 -mtune=cpu-type
27190 Tune to cpu-type everything applicable about the generated code,
27191 except for the ABI and the set of available instructions. While
27192 picking a specific cpu-type schedules things appropriately for that
27193 particular chip, the compiler does not generate any code that
27194 cannot run on the default machine type unless you use a -march=cpu-
27195 type option. For example, if GCC is configured for
27196 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
27197 for Pentium 4 but still runs on i686 machines.
27198
27199 The choices for cpu-type are the same as for -march. In addition,
27200 -mtune supports 2 extra choices for cpu-type:
27201
27202 generic
27203 Produce code optimized for the most common IA32/AMD64/EM64T
27204 processors. If you know the CPU on which your code will run,
27205 then you should use the corresponding -mtune or -march option
27206 instead of -mtune=generic. But, if you do not know exactly
27207 what CPU users of your application will have, then you should
27208 use this option.
27209
27210 As new processors are deployed in the marketplace, the behavior
27211 of this option will change. Therefore, if you upgrade to a
27212 newer version of GCC, code generation controlled by this option
27213 will change to reflect the processors that are most common at
27214 the time that version of GCC is released.
27215
27216 There is no -march=generic option because -march indicates the
27217 instruction set the compiler can use, and there is no generic
27218 instruction set applicable to all processors. In contrast,
27219 -mtune indicates the processor (or, in this case, collection of
27220 processors) for which the code is optimized.
27221
27222 intel
27223 Produce code optimized for the most current Intel processors,
27224 which are Haswell and Silvermont for this version of GCC. If
27225 you know the CPU on which your code will run, then you should
27226 use the corresponding -mtune or -march option instead of
27227 -mtune=intel. But, if you want your application performs
27228 better on both Haswell and Silvermont, then you should use this
27229 option.
27230
27231 As new Intel processors are deployed in the marketplace, the
27232 behavior of this option will change. Therefore, if you upgrade
27233 to a newer version of GCC, code generation controlled by this
27234 option will change to reflect the most current Intel processors
27235 at the time that version of GCC is released.
27236
27237 There is no -march=intel option because -march indicates the
27238 instruction set the compiler can use, and there is no common
27239 instruction set applicable to all processors. In contrast,
27240 -mtune indicates the processor (or, in this case, collection of
27241 processors) for which the code is optimized.
27242
27243 -mcpu=cpu-type
27244 A deprecated synonym for -mtune.
27245
27246 -mfpmath=unit
27247 Generate floating-point arithmetic for selected unit unit. The
27248 choices for unit are:
27249
27250 387 Use the standard 387 floating-point coprocessor present on the
27251 majority of chips and emulated otherwise. Code compiled with
27252 this option runs almost everywhere. The temporary results are
27253 computed in 80-bit precision instead of the precision specified
27254 by the type, resulting in slightly different results compared
27255 to most of other chips. See -ffloat-store for more detailed
27256 description.
27257
27258 This is the default choice for non-Darwin x86-32 targets.
27259
27260 sse Use scalar floating-point instructions present in the SSE
27261 instruction set. This instruction set is supported by Pentium
27262 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
27263 and Athlon MP chips. The earlier version of the SSE
27264 instruction set supports only single-precision arithmetic, thus
27265 the double and extended-precision arithmetic are still done
27266 using 387. A later version, present only in Pentium 4 and AMD
27267 x86-64 chips, supports double-precision arithmetic too.
27268
27269 For the x86-32 compiler, you must use -march=cpu-type, -msse or
27270 -msse2 switches to enable SSE extensions and make this option
27271 effective. For the x86-64 compiler, these extensions are
27272 enabled by default.
27273
27274 The resulting code should be considerably faster in the
27275 majority of cases and avoid the numerical instability problems
27276 of 387 code, but may break some existing code that expects
27277 temporaries to be 80 bits.
27278
27279 This is the default choice for the x86-64 compiler, Darwin
27280 x86-32 targets, and the default choice for x86-32 targets with
27281 the SSE2 instruction set when -ffast-math is enabled.
27282
27283 sse,387
27284 sse+387
27285 both
27286 Attempt to utilize both instruction sets at once. This
27287 effectively doubles the amount of available registers, and on
27288 chips with separate execution units for 387 and SSE the
27289 execution resources too. Use this option with care, as it is
27290 still experimental, because the GCC register allocator does not
27291 model separate functional units well, resulting in unstable
27292 performance.
27293
27294 -masm=dialect
27295 Output assembly instructions using selected dialect. Also affects
27296 which dialect is used for basic "asm" and extended "asm". Supported
27297 choices (in dialect order) are att or intel. The default is att.
27298 Darwin does not support intel.
27299
27300 -mieee-fp
27301 -mno-ieee-fp
27302 Control whether or not the compiler uses IEEE floating-point
27303 comparisons. These correctly handle the case where the result of a
27304 comparison is unordered.
27305
27306 -m80387
27307 -mhard-float
27308 Generate output containing 80387 instructions for floating point.
27309
27310 -mno-80387
27311 -msoft-float
27312 Generate output containing library calls for floating point.
27313
27314 Warning: the requisite libraries are not part of GCC. Normally the
27315 facilities of the machine's usual C compiler are used, but this
27316 cannot be done directly in cross-compilation. You must make your
27317 own arrangements to provide suitable library functions for cross-
27318 compilation.
27319
27320 On machines where a function returns floating-point results in the
27321 80387 register stack, some floating-point opcodes may be emitted
27322 even if -msoft-float is used.
27323
27324 -mno-fp-ret-in-387
27325 Do not use the FPU registers for return values of functions.
27326
27327 The usual calling convention has functions return values of types
27328 "float" and "double" in an FPU register, even if there is no FPU.
27329 The idea is that the operating system should emulate an FPU.
27330
27331 The option -mno-fp-ret-in-387 causes such values to be returned in
27332 ordinary CPU registers instead.
27333
27334 -mno-fancy-math-387
27335 Some 387 emulators do not support the "sin", "cos" and "sqrt"
27336 instructions for the 387. Specify this option to avoid generating
27337 those instructions. This option is overridden when -march
27338 indicates that the target CPU always has an FPU and so the
27339 instruction does not need emulation. These instructions are not
27340 generated unless you also use the -funsafe-math-optimizations
27341 switch.
27342
27343 -malign-double
27344 -mno-align-double
27345 Control whether GCC aligns "double", "long double", and "long long"
27346 variables on a two-word boundary or a one-word boundary. Aligning
27347 "double" variables on a two-word boundary produces code that runs
27348 somewhat faster on a Pentium at the expense of more memory.
27349
27350 On x86-64, -malign-double is enabled by default.
27351
27352 Warning: if you use the -malign-double switch, structures
27353 containing the above types are aligned differently than the
27354 published application binary interface specifications for the
27355 x86-32 and are not binary compatible with structures in code
27356 compiled without that switch.
27357
27358 -m96bit-long-double
27359 -m128bit-long-double
27360 These switches control the size of "long double" type. The x86-32
27361 application binary interface specifies the size to be 96 bits, so
27362 -m96bit-long-double is the default in 32-bit mode.
27363
27364 Modern architectures (Pentium and newer) prefer "long double" to be
27365 aligned to an 8- or 16-byte boundary. In arrays or structures
27366 conforming to the ABI, this is not possible. So specifying
27367 -m128bit-long-double aligns "long double" to a 16-byte boundary by
27368 padding the "long double" with an additional 32-bit zero.
27369
27370 In the x86-64 compiler, -m128bit-long-double is the default choice
27371 as its ABI specifies that "long double" is aligned on 16-byte
27372 boundary.
27373
27374 Notice that neither of these options enable any extra precision
27375 over the x87 standard of 80 bits for a "long double".
27376
27377 Warning: if you override the default value for your target ABI,
27378 this changes the size of structures and arrays containing "long
27379 double" variables, as well as modifying the function calling
27380 convention for functions taking "long double". Hence they are not
27381 binary-compatible with code compiled without that switch.
27382
27383 -mlong-double-64
27384 -mlong-double-80
27385 -mlong-double-128
27386 These switches control the size of "long double" type. A size of 64
27387 bits makes the "long double" type equivalent to the "double" type.
27388 This is the default for 32-bit Bionic C library. A size of 128
27389 bits makes the "long double" type equivalent to the "__float128"
27390 type. This is the default for 64-bit Bionic C library.
27391
27392 Warning: if you override the default value for your target ABI,
27393 this changes the size of structures and arrays containing "long
27394 double" variables, as well as modifying the function calling
27395 convention for functions taking "long double". Hence they are not
27396 binary-compatible with code compiled without that switch.
27397
27398 -malign-data=type
27399 Control how GCC aligns variables. Supported values for type are
27400 compat uses increased alignment value compatible uses GCC 4.8 and
27401 earlier, abi uses alignment value as specified by the psABI, and
27402 cacheline uses increased alignment value to match the cache line
27403 size. compat is the default.
27404
27405 -mlarge-data-threshold=threshold
27406 When -mcmodel=medium is specified, data objects larger than
27407 threshold are placed in the large data section. This value must be
27408 the same across all objects linked into the binary, and defaults to
27409 65535.
27410
27411 -mrtd
27412 Use a different function-calling convention, in which functions
27413 that take a fixed number of arguments return with the "ret num"
27414 instruction, which pops their arguments while returning. This
27415 saves one instruction in the caller since there is no need to pop
27416 the arguments there.
27417
27418 You can specify that an individual function is called with this
27419 calling sequence with the function attribute "stdcall". You can
27420 also override the -mrtd option by using the function attribute
27421 "cdecl".
27422
27423 Warning: this calling convention is incompatible with the one
27424 normally used on Unix, so you cannot use it if you need to call
27425 libraries compiled with the Unix compiler.
27426
27427 Also, you must provide function prototypes for all functions that
27428 take variable numbers of arguments (including "printf"); otherwise
27429 incorrect code is generated for calls to those functions.
27430
27431 In addition, seriously incorrect code results if you call a
27432 function with too many arguments. (Normally, extra arguments are
27433 harmlessly ignored.)
27434
27435 -mregparm=num
27436 Control how many registers are used to pass integer arguments. By
27437 default, no registers are used to pass arguments, and at most 3
27438 registers can be used. You can control this behavior for a
27439 specific function by using the function attribute "regparm".
27440
27441 Warning: if you use this switch, and num is nonzero, then you must
27442 build all modules with the same value, including any libraries.
27443 This includes the system libraries and startup modules.
27444
27445 -msseregparm
27446 Use SSE register passing conventions for float and double arguments
27447 and return values. You can control this behavior for a specific
27448 function by using the function attribute "sseregparm".
27449
27450 Warning: if you use this switch then you must build all modules
27451 with the same value, including any libraries. This includes the
27452 system libraries and startup modules.
27453
27454 -mvect8-ret-in-mem
27455 Return 8-byte vectors in memory instead of MMX registers. This is
27456 the default on VxWorks to match the ABI of the Sun Studio compilers
27457 until version 12. Only use this option if you need to remain
27458 compatible with existing code produced by those previous compiler
27459 versions or older versions of GCC.
27460
27461 -mpc32
27462 -mpc64
27463 -mpc80
27464 Set 80387 floating-point precision to 32, 64 or 80 bits. When
27465 -mpc32 is specified, the significands of results of floating-point
27466 operations are rounded to 24 bits (single precision); -mpc64 rounds
27467 the significands of results of floating-point operations to 53 bits
27468 (double precision) and -mpc80 rounds the significands of results of
27469 floating-point operations to 64 bits (extended double precision),
27470 which is the default. When this option is used, floating-point
27471 operations in higher precisions are not available to the programmer
27472 without setting the FPU control word explicitly.
27473
27474 Setting the rounding of floating-point operations to less than the
27475 default 80 bits can speed some programs by 2% or more. Note that
27476 some mathematical libraries assume that extended-precision (80-bit)
27477 floating-point operations are enabled by default; routines in such
27478 libraries could suffer significant loss of accuracy, typically
27479 through so-called "catastrophic cancellation", when this option is
27480 used to set the precision to less than extended precision.
27481
27482 -mstackrealign
27483 Realign the stack at entry. On the x86, the -mstackrealign option
27484 generates an alternate prologue and epilogue that realigns the run-
27485 time stack if necessary. This supports mixing legacy codes that
27486 keep 4-byte stack alignment with modern codes that keep 16-byte
27487 stack alignment for SSE compatibility. See also the attribute
27488 "force_align_arg_pointer", applicable to individual functions.
27489
27490 -mpreferred-stack-boundary=num
27491 Attempt to keep the stack boundary aligned to a 2 raised to num
27492 byte boundary. If -mpreferred-stack-boundary is not specified, the
27493 default is 4 (16 bytes or 128 bits).
27494
27495 Warning: When generating code for the x86-64 architecture with SSE
27496 extensions disabled, -mpreferred-stack-boundary=3 can be used to
27497 keep the stack boundary aligned to 8 byte boundary. Since x86-64
27498 ABI require 16 byte stack alignment, this is ABI incompatible and
27499 intended to be used in controlled environment where stack space is
27500 important limitation. This option leads to wrong code when
27501 functions compiled with 16 byte stack alignment (such as functions
27502 from a standard library) are called with misaligned stack. In this
27503 case, SSE instructions may lead to misaligned memory access traps.
27504 In addition, variable arguments are handled incorrectly for 16 byte
27505 aligned objects (including x87 long double and __int128), leading
27506 to wrong results. You must build all modules with
27507 -mpreferred-stack-boundary=3, including any libraries. This
27508 includes the system libraries and startup modules.
27509
27510 -mincoming-stack-boundary=num
27511 Assume the incoming stack is aligned to a 2 raised to num byte
27512 boundary. If -mincoming-stack-boundary is not specified, the one
27513 specified by -mpreferred-stack-boundary is used.
27514
27515 On Pentium and Pentium Pro, "double" and "long double" values
27516 should be aligned to an 8-byte boundary (see -malign-double) or
27517 suffer significant run time performance penalties. On Pentium III,
27518 the Streaming SIMD Extension (SSE) data type "__m128" may not work
27519 properly if it is not 16-byte aligned.
27520
27521 To ensure proper alignment of this values on the stack, the stack
27522 boundary must be as aligned as that required by any value stored on
27523 the stack. Further, every function must be generated such that it
27524 keeps the stack aligned. Thus calling a function compiled with a
27525 higher preferred stack boundary from a function compiled with a
27526 lower preferred stack boundary most likely misaligns the stack. It
27527 is recommended that libraries that use callbacks always use the
27528 default setting.
27529
27530 This extra alignment does consume extra stack space, and generally
27531 increases code size. Code that is sensitive to stack space usage,
27532 such as embedded systems and operating system kernels, may want to
27533 reduce the preferred alignment to -mpreferred-stack-boundary=2.
27534
27535 -mmmx
27536 -msse
27537 -msse2
27538 -msse3
27539 -mssse3
27540 -msse4
27541 -msse4a
27542 -msse4.1
27543 -msse4.2
27544 -mavx
27545 -mavx2
27546 -mavx512f
27547 -mavx512pf
27548 -mavx512er
27549 -mavx512cd
27550 -mavx512vl
27551 -mavx512bw
27552 -mavx512dq
27553 -mavx512ifma
27554 -mavx512vbmi
27555 -msha
27556 -maes
27557 -mpclmul
27558 -mclflushopt
27559 -mclwb
27560 -mfsgsbase
27561 -mptwrite
27562 -mrdrnd
27563 -mf16c
27564 -mfma
27565 -mpconfig
27566 -mwbnoinvd
27567 -mfma4
27568 -mprfchw
27569 -mrdpid
27570 -mprefetchwt1
27571 -mrdseed
27572 -msgx
27573 -mxop
27574 -mlwp
27575 -m3dnow
27576 -m3dnowa
27577 -mpopcnt
27578 -mabm
27579 -madx
27580 -mbmi
27581 -mbmi2
27582 -mlzcnt
27583 -mfxsr
27584 -mxsave
27585 -mxsaveopt
27586 -mxsavec
27587 -mxsaves
27588 -mrtm
27589 -mhle
27590 -mtbm
27591 -mmwaitx
27592 -mclzero
27593 -mpku
27594 -mavx512vbmi2
27595 -mavx512bf16
27596 -mavx512fp16
27597 -mgfni
27598 -mvaes
27599 -mwaitpkg
27600 -mvpclmulqdq
27601 -mavx512bitalg
27602 -mmovdiri
27603 -mmovdir64b
27604 -menqcmd
27605 -muintr
27606 -mtsxldtrk
27607 -mavx512vpopcntdq
27608 -mavx512vp2intersect
27609 -mavx5124fmaps
27610 -mavx512vnni
27611 -mavxvnni
27612 -mavx5124vnniw
27613 -mcldemote
27614 -mserialize
27615 -mamx-tile
27616 -mamx-int8
27617 -mamx-bf16
27618 -mhreset
27619 -mkl
27620 -mwidekl
27621 These switches enable the use of instructions in the MMX, SSE,
27622 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
27623 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
27624 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
27625 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
27626 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
27627 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
27628 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
27629 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
27630 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
27631 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
27632 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16 or
27633 CLDEMOTE extended instruction sets. Each has a corresponding -mno-
27634 option to disable use of these instructions.
27635
27636 These extensions are also available as built-in functions: see x86
27637 Built-in Functions, for details of the functions enabled and
27638 disabled by these switches.
27639
27640 To generate SSE/SSE2 instructions automatically from floating-point
27641 code (as opposed to 387 instructions), see -mfpmath=sse.
27642
27643 GCC depresses SSEx instructions when -mavx is used. Instead, it
27644 generates new AVX instructions or AVX equivalence for all SSEx
27645 instructions when needed.
27646
27647 These options enable GCC to use these extended instructions in
27648 generated code, even without -mfpmath=sse. Applications that
27649 perform run-time CPU detection must compile separate files for each
27650 supported architecture, using the appropriate flags. In
27651 particular, the file containing the CPU detection code should be
27652 compiled without these options.
27653
27654 -mdump-tune-features
27655 This option instructs GCC to dump the names of the x86 performance
27656 tuning features and default settings. The names can be used in
27657 -mtune-ctrl=feature-list.
27658
27659 -mtune-ctrl=feature-list
27660 This option is used to do fine grain control of x86 code generation
27661 features. feature-list is a comma separated list of feature names.
27662 See also -mdump-tune-features. When specified, the feature is
27663 turned on if it is not preceded with ^, otherwise, it is turned
27664 off. -mtune-ctrl=feature-list is intended to be used by GCC
27665 developers. Using it may lead to code paths not covered by testing
27666 and can potentially result in compiler ICEs or runtime errors.
27667
27668 -mno-default
27669 This option instructs GCC to turn off all tunable features. See
27670 also -mtune-ctrl=feature-list and -mdump-tune-features.
27671
27672 -mcld
27673 This option instructs GCC to emit a "cld" instruction in the
27674 prologue of functions that use string instructions. String
27675 instructions depend on the DF flag to select between autoincrement
27676 or autodecrement mode. While the ABI specifies the DF flag to be
27677 cleared on function entry, some operating systems violate this
27678 specification by not clearing the DF flag in their exception
27679 dispatchers. The exception handler can be invoked with the DF flag
27680 set, which leads to wrong direction mode when string instructions
27681 are used. This option can be enabled by default on 32-bit x86
27682 targets by configuring GCC with the --enable-cld configure option.
27683 Generation of "cld" instructions can be suppressed with the
27684 -mno-cld compiler option in this case.
27685
27686 -mvzeroupper
27687 This option instructs GCC to emit a "vzeroupper" instruction before
27688 a transfer of control flow out of the function to minimize the AVX
27689 to SSE transition penalty as well as remove unnecessary "zeroupper"
27690 intrinsics.
27691
27692 -mprefer-avx128
27693 This option instructs GCC to use 128-bit AVX instructions instead
27694 of 256-bit AVX instructions in the auto-vectorizer.
27695
27696 -mprefer-vector-width=opt
27697 This option instructs GCC to use opt-bit vector width in
27698 instructions instead of default on the selected platform.
27699
27700 -mmove-max=bits
27701 This option instructs GCC to set the maximum number of bits can be
27702 moved from memory to memory efficiently to bits. The valid bits
27703 are 128, 256 and 512.
27704
27705 -mstore-max=bits
27706 This option instructs GCC to set the maximum number of bits can be
27707 stored to memory efficiently to bits. The valid bits are 128, 256
27708 and 512.
27709
27710 none
27711 No extra limitations applied to GCC other than defined by the
27712 selected platform.
27713
27714 128 Prefer 128-bit vector width for instructions.
27715
27716 256 Prefer 256-bit vector width for instructions.
27717
27718 512 Prefer 512-bit vector width for instructions.
27719
27720 -mcx16
27721 This option enables GCC to generate "CMPXCHG16B" instructions in
27722 64-bit code to implement compare-and-exchange operations on 16-byte
27723 aligned 128-bit objects. This is useful for atomic updates of data
27724 structures exceeding one machine word in size. The compiler uses
27725 this instruction to implement __sync Builtins. However, for
27726 __atomic Builtins operating on 128-bit integers, a library call is
27727 always used.
27728
27729 -msahf
27730 This option enables generation of "SAHF" instructions in 64-bit
27731 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
27732 the introduction of Pentium 4 G1 step in December 2005, lacked the
27733 "LAHF" and "SAHF" instructions which are supported by AMD64. These
27734 are load and store instructions, respectively, for certain status
27735 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
27736 "fmod", "drem", and "remainder" built-in functions; see Other
27737 Builtins for details.
27738
27739 -mmovbe
27740 This option enables use of the "movbe" instruction to implement
27741 "__builtin_bswap32" and "__builtin_bswap64".
27742
27743 -mshstk
27744 The -mshstk option enables shadow stack built-in functions from x86
27745 Control-flow Enforcement Technology (CET).
27746
27747 -mcrc32
27748 This option enables built-in functions "__builtin_ia32_crc32qi",
27749 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
27750 "__builtin_ia32_crc32di" to generate the "crc32" machine
27751 instruction.
27752
27753 -mmwait
27754 This option enables built-in functions "__builtin_ia32_monitor",
27755 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
27756 machine instructions.
27757
27758 -mrecip
27759 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
27760 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
27761 Newton-Raphson step to increase precision instead of "DIVSS" and
27762 "SQRTSS" (and their vectorized variants) for single-precision
27763 floating-point arguments. These instructions are generated only
27764 when -funsafe-math-optimizations is enabled together with
27765 -ffinite-math-only and -fno-trapping-math. Note that while the
27766 throughput of the sequence is higher than the throughput of the
27767 non-reciprocal instruction, the precision of the sequence can be
27768 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
27769 0.99999994).
27770
27771 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
27772 "RSQRTPS") already with -ffast-math (or the above option
27773 combination), and doesn't need -mrecip.
27774
27775 Also note that GCC emits the above sequence with additional Newton-
27776 Raphson step for vectorized single-float division and vectorized
27777 "sqrtf(x)" already with -ffast-math (or the above option
27778 combination), and doesn't need -mrecip.
27779
27780 -mrecip=opt
27781 This option controls which reciprocal estimate instructions may be
27782 used. opt is a comma-separated list of options, which may be
27783 preceded by a ! to invert the option:
27784
27785 all Enable all estimate instructions.
27786
27787 default
27788 Enable the default instructions, equivalent to -mrecip.
27789
27790 none
27791 Disable all estimate instructions, equivalent to -mno-recip.
27792
27793 div Enable the approximation for scalar division.
27794
27795 vec-div
27796 Enable the approximation for vectorized division.
27797
27798 sqrt
27799 Enable the approximation for scalar square root.
27800
27801 vec-sqrt
27802 Enable the approximation for vectorized square root.
27803
27804 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
27805 approximations, except for square root.
27806
27807 -mveclibabi=type
27808 Specifies the ABI type to use for vectorizing intrinsics using an
27809 external library. Supported values for type are svml for the Intel
27810 short vector math library and acml for the AMD math core library.
27811 To use this option, both -ftree-vectorize and
27812 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
27813 ABI-compatible library must be specified at link time.
27814
27815 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
27816 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
27817 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
27818 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
27819 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
27820 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
27821 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
27822 and "vmlsAcos4" for corresponding function type when
27823 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
27824 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
27825 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
27826 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
27827 corresponding function type when -mveclibabi=acml is used.
27828
27829 -mabi=name
27830 Generate code for the specified calling convention. Permissible
27831 values are sysv for the ABI used on GNU/Linux and other systems,
27832 and ms for the Microsoft ABI. The default is to use the Microsoft
27833 ABI when targeting Microsoft Windows and the SysV ABI on all other
27834 systems. You can control this behavior for specific functions by
27835 using the function attributes "ms_abi" and "sysv_abi".
27836
27837 -mforce-indirect-call
27838 Force all calls to functions to be indirect. This is useful when
27839 using Intel Processor Trace where it generates more precise timing
27840 information for function calls.
27841
27842 -mmanual-endbr
27843 Insert ENDBR instruction at function entry only via the "cf_check"
27844 function attribute. This is useful when used with the option
27845 -fcf-protection=branch to control ENDBR insertion at the function
27846 entry.
27847
27848 -mcall-ms2sysv-xlogues
27849 Due to differences in 64-bit ABIs, any Microsoft ABI function that
27850 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
27851 clobbered. By default, the code for saving and restoring these
27852 registers is emitted inline, resulting in fairly lengthy prologues
27853 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
27854 epilogues that use stubs in the static portion of libgcc to perform
27855 these saves and restores, thus reducing function size at the cost
27856 of a few extra instructions.
27857
27858 -mtls-dialect=type
27859 Generate code to access thread-local storage using the gnu or gnu2
27860 conventions. gnu is the conservative default; gnu2 is more
27861 efficient, but it may add compile- and run-time requirements that
27862 cannot be satisfied on all systems.
27863
27864 -mpush-args
27865 -mno-push-args
27866 Use PUSH operations to store outgoing parameters. This method is
27867 shorter and usually equally fast as method using SUB/MOV operations
27868 and is enabled by default. In some cases disabling it may improve
27869 performance because of improved scheduling and reduced
27870 dependencies.
27871
27872 -maccumulate-outgoing-args
27873 If enabled, the maximum amount of space required for outgoing
27874 arguments is computed in the function prologue. This is faster on
27875 most modern CPUs because of reduced dependencies, improved
27876 scheduling and reduced stack usage when the preferred stack
27877 boundary is not equal to 2. The drawback is a notable increase in
27878 code size. This switch implies -mno-push-args.
27879
27880 -mthreads
27881 Support thread-safe exception handling on MinGW. Programs that
27882 rely on thread-safe exception handling must compile and link all
27883 code with the -mthreads option. When compiling, -mthreads defines
27884 -D_MT; when linking, it links in a special thread helper library
27885 -lmingwthrd which cleans up per-thread exception-handling data.
27886
27887 -mms-bitfields
27888 -mno-ms-bitfields
27889 Enable/disable bit-field layout compatible with the native
27890 Microsoft Windows compiler.
27891
27892 If "packed" is used on a structure, or if bit-fields are used, it
27893 may be that the Microsoft ABI lays out the structure differently
27894 than the way GCC normally does. Particularly when moving packed
27895 data between functions compiled with GCC and the native Microsoft
27896 compiler (either via function call or as data in a file), it may be
27897 necessary to access either format.
27898
27899 This option is enabled by default for Microsoft Windows targets.
27900 This behavior can also be controlled locally by use of variable or
27901 type attributes. For more information, see x86 Variable Attributes
27902 and x86 Type Attributes.
27903
27904 The Microsoft structure layout algorithm is fairly simple with the
27905 exception of the bit-field packing. The padding and alignment of
27906 members of structures and whether a bit-field can straddle a
27907 storage-unit boundary are determine by these rules:
27908
27909 1. Structure members are stored sequentially in the order in which
27910 they are
27911 declared: the first member has the lowest memory address and
27912 the last member the highest.
27913
27914 2. Every data object has an alignment requirement. The alignment
27915 requirement
27916 for all data except structures, unions, and arrays is either
27917 the size of the object or the current packing size (specified
27918 with either the "aligned" attribute or the "pack" pragma),
27919 whichever is less. For structures, unions, and arrays, the
27920 alignment requirement is the largest alignment requirement of
27921 its members. Every object is allocated an offset so that:
27922
27923 offset % alignment_requirement == 0
27924
27925 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
27926 allocation
27927 unit if the integral types are the same size and if the next
27928 bit-field fits into the current allocation unit without
27929 crossing the boundary imposed by the common alignment
27930 requirements of the bit-fields.
27931
27932 MSVC interprets zero-length bit-fields in the following ways:
27933
27934 1. If a zero-length bit-field is inserted between two bit-fields
27935 that
27936 are normally coalesced, the bit-fields are not coalesced.
27937
27938 For example:
27939
27940 struct
27941 {
27942 unsigned long bf_1 : 12;
27943 unsigned long : 0;
27944 unsigned long bf_2 : 12;
27945 } t1;
27946
27947 The size of "t1" is 8 bytes with the zero-length bit-field. If
27948 the zero-length bit-field were removed, "t1"'s size would be 4
27949 bytes.
27950
27951 2. If a zero-length bit-field is inserted after a bit-field, "foo",
27952 and the
27953 alignment of the zero-length bit-field is greater than the
27954 member that follows it, "bar", "bar" is aligned as the type of
27955 the zero-length bit-field.
27956
27957 For example:
27958
27959 struct
27960 {
27961 char foo : 4;
27962 short : 0;
27963 char bar;
27964 } t2;
27965
27966 struct
27967 {
27968 char foo : 4;
27969 short : 0;
27970 double bar;
27971 } t3;
27972
27973 For "t2", "bar" is placed at offset 2, rather than offset 1.
27974 Accordingly, the size of "t2" is 4. For "t3", the zero-length
27975 bit-field does not affect the alignment of "bar" or, as a
27976 result, the size of the structure.
27977
27978 Taking this into account, it is important to note the
27979 following:
27980
27981 1. If a zero-length bit-field follows a normal bit-field, the
27982 type of the
27983 zero-length bit-field may affect the alignment of the
27984 structure as whole. For example, "t2" has a size of 4
27985 bytes, since the zero-length bit-field follows a normal
27986 bit-field, and is of type short.
27987
27988 2. Even if a zero-length bit-field is not followed by a normal
27989 bit-field, it may
27990 still affect the alignment of the structure:
27991
27992 struct
27993 {
27994 char foo : 6;
27995 long : 0;
27996 } t4;
27997
27998 Here, "t4" takes up 4 bytes.
27999
28000 3. Zero-length bit-fields following non-bit-field members are
28001 ignored:
28002 struct
28003 {
28004 char foo;
28005 long : 0;
28006 char bar;
28007 } t5;
28008
28009 Here, "t5" takes up 2 bytes.
28010
28011 -mno-align-stringops
28012 Do not align the destination of inlined string operations. This
28013 switch reduces code size and improves performance in case the
28014 destination is already aligned, but GCC doesn't know about it.
28015
28016 -minline-all-stringops
28017 By default GCC inlines string operations only when the destination
28018 is known to be aligned to least a 4-byte boundary. This enables
28019 more inlining and increases code size, but may improve performance
28020 of code that depends on fast "memcpy" and "memset" for short
28021 lengths. The option enables inline expansion of "strlen" for all
28022 pointer alignments.
28023
28024 -minline-stringops-dynamically
28025 For string operations of unknown size, use run-time checks with
28026 inline code for small blocks and a library call for large blocks.
28027
28028 -mstringop-strategy=alg
28029 Override the internal decision heuristic for the particular
28030 algorithm to use for inlining string operations. The allowed
28031 values for alg are:
28032
28033 rep_byte
28034 rep_4byte
28035 rep_8byte
28036 Expand using i386 "rep" prefix of the specified size.
28037
28038 byte_loop
28039 loop
28040 unrolled_loop
28041 Expand into an inline loop.
28042
28043 libcall
28044 Always use a library call.
28045
28046 -mmemcpy-strategy=strategy
28047 Override the internal decision heuristic to decide if
28048 "__builtin_memcpy" should be inlined and what inline algorithm to
28049 use when the expected size of the copy operation is known. strategy
28050 is a comma-separated list of alg:max_size:dest_align triplets. alg
28051 is specified in -mstringop-strategy, max_size specifies the max
28052 byte size with which inline algorithm alg is allowed. For the last
28053 triplet, the max_size must be "-1". The max_size of the triplets in
28054 the list must be specified in increasing order. The minimal byte
28055 size for alg is 0 for the first triplet and "max_size + 1" of the
28056 preceding range.
28057
28058 -mmemset-strategy=strategy
28059 The option is similar to -mmemcpy-strategy= except that it is to
28060 control "__builtin_memset" expansion.
28061
28062 -momit-leaf-frame-pointer
28063 Don't keep the frame pointer in a register for leaf functions.
28064 This avoids the instructions to save, set up, and restore frame
28065 pointers and makes an extra register available in leaf functions.
28066 The option -fomit-leaf-frame-pointer removes the frame pointer for
28067 leaf functions, which might make debugging harder.
28068
28069 -mtls-direct-seg-refs
28070 -mno-tls-direct-seg-refs
28071 Controls whether TLS variables may be accessed with offsets from
28072 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
28073 whether the thread base pointer must be added. Whether or not this
28074 is valid depends on the operating system, and whether it maps the
28075 segment to cover the entire TLS area.
28076
28077 For systems that use the GNU C Library, the default is on.
28078
28079 -msse2avx
28080 -mno-sse2avx
28081 Specify that the assembler should encode SSE instructions with VEX
28082 prefix. The option -mavx turns this on by default.
28083
28084 -mfentry
28085 -mno-fentry
28086 If profiling is active (-pg), put the profiling counter call before
28087 the prologue. Note: On x86 architectures the attribute
28088 "ms_hook_prologue" isn't possible at the moment for -mfentry and
28089 -pg.
28090
28091 -mrecord-mcount
28092 -mno-record-mcount
28093 If profiling is active (-pg), generate a __mcount_loc section that
28094 contains pointers to each profiling call. This is useful for
28095 automatically patching and out calls.
28096
28097 -mnop-mcount
28098 -mno-nop-mcount
28099 If profiling is active (-pg), generate the calls to the profiling
28100 functions as NOPs. This is useful when they should be patched in
28101 later dynamically. This is likely only useful together with
28102 -mrecord-mcount.
28103
28104 -minstrument-return=type
28105 Instrument function exit in -pg -mfentry instrumented functions
28106 with call to specified function. This only instruments true returns
28107 ending with ret, but not sibling calls ending with jump. Valid
28108 types are none to not instrument, call to generate a call to
28109 __return__, or nop5 to generate a 5 byte nop.
28110
28111 -mrecord-return
28112 -mno-record-return
28113 Generate a __return_loc section pointing to all return
28114 instrumentation code.
28115
28116 -mfentry-name=name
28117 Set name of __fentry__ symbol called at function entry for -pg
28118 -mfentry functions.
28119
28120 -mfentry-section=name
28121 Set name of section to record -mrecord-mcount calls (default
28122 __mcount_loc).
28123
28124 -mskip-rax-setup
28125 -mno-skip-rax-setup
28126 When generating code for the x86-64 architecture with SSE
28127 extensions disabled, -mskip-rax-setup can be used to skip setting
28128 up RAX register when there are no variable arguments passed in
28129 vector registers.
28130
28131 Warning: Since RAX register is used to avoid unnecessarily saving
28132 vector registers on stack when passing variable arguments, the
28133 impacts of this option are callees may waste some stack space,
28134 misbehave or jump to a random location. GCC 4.4 or newer don't
28135 have those issues, regardless the RAX register value.
28136
28137 -m8bit-idiv
28138 -mno-8bit-idiv
28139 On some processors, like Intel Atom, 8-bit unsigned integer divide
28140 is much faster than 32-bit/64-bit integer divide. This option
28141 generates a run-time check. If both dividend and divisor are
28142 within range of 0 to 255, 8-bit unsigned integer divide is used
28143 instead of 32-bit/64-bit integer divide.
28144
28145 -mavx256-split-unaligned-load
28146 -mavx256-split-unaligned-store
28147 Split 32-byte AVX unaligned load and store.
28148
28149 -mstack-protector-guard=guard
28150 -mstack-protector-guard-reg=reg
28151 -mstack-protector-guard-offset=offset
28152 Generate stack protection code using canary at guard. Supported
28153 locations are global for global canary or tls for per-thread canary
28154 in the TLS block (the default). This option has effect only when
28155 -fstack-protector or -fstack-protector-all is specified.
28156
28157 With the latter choice the options -mstack-protector-guard-reg=reg
28158 and -mstack-protector-guard-offset=offset furthermore specify which
28159 segment register (%fs or %gs) to use as base register for reading
28160 the canary, and from what offset from that base register. The
28161 default for those is as specified in the relevant ABI.
28162
28163 -mgeneral-regs-only
28164 Generate code that uses only the general-purpose registers. This
28165 prevents the compiler from using floating-point, vector, mask and
28166 bound registers.
28167
28168 -mrelax-cmpxchg-loop
28169 Relax cmpxchg loop by emitting an early load and compare before
28170 cmpxchg, execute pause if load value is not expected. This reduces
28171 excessive cachline bouncing when and works for all atomic logic
28172 fetch builtins that generates compare and swap loop.
28173
28174 -mindirect-branch=choice
28175 Convert indirect call and jump with choice. The default is keep,
28176 which keeps indirect call and jump unmodified. thunk converts
28177 indirect call and jump to call and return thunk. thunk-inline
28178 converts indirect call and jump to inlined call and return thunk.
28179 thunk-extern converts indirect call and jump to external call and
28180 return thunk provided in a separate object file. You can control
28181 this behavior for a specific function by using the function
28182 attribute "indirect_branch".
28183
28184 Note that -mcmodel=large is incompatible with
28185 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
28186 the thunk function may not be reachable in the large code model.
28187
28188 Note that -mindirect-branch=thunk-extern is compatible with
28189 -fcf-protection=branch since the external thunk can be made to
28190 enable control-flow check.
28191
28192 -mfunction-return=choice
28193 Convert function return with choice. The default is keep, which
28194 keeps function return unmodified. thunk converts function return
28195 to call and return thunk. thunk-inline converts function return to
28196 inlined call and return thunk. thunk-extern converts function
28197 return to external call and return thunk provided in a separate
28198 object file. You can control this behavior for a specific function
28199 by using the function attribute "function_return".
28200
28201 Note that -mindirect-return=thunk-extern is compatible with
28202 -fcf-protection=branch since the external thunk can be made to
28203 enable control-flow check.
28204
28205 Note that -mcmodel=large is incompatible with
28206 -mfunction-return=thunk and -mfunction-return=thunk-extern since
28207 the thunk function may not be reachable in the large code model.
28208
28209 -mindirect-branch-register
28210 Force indirect call and jump via register.
28211
28212 -mharden-sls=choice
28213 Generate code to mitigate against straight line speculation (SLS)
28214 with choice. The default is none which disables all SLS hardening.
28215 return enables SLS hardening for function returns. indirect-jmp
28216 enables SLS hardening for indirect jumps. all enables all SLS
28217 hardening.
28218
28219 -mindirect-branch-cs-prefix
28220 Add CS prefix to call and jmp to indirect thunk with branch target
28221 in r8-r15 registers so that the call and jmp instruction length is
28222 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
28223 lfence; jmp *%r8-r15 at run-time.
28224
28225 These -m switches are supported in addition to the above on x86-64
28226 processors in 64-bit environments.
28227
28228 -m32
28229 -m64
28230 -mx32
28231 -m16
28232 -miamcu
28233 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
28234 option sets "int", "long", and pointer types to 32 bits, and
28235 generates code that runs on any i386 system.
28236
28237 The -m64 option sets "int" to 32 bits and "long" and pointer types
28238 to 64 bits, and generates code for the x86-64 architecture. For
28239 Darwin only the -m64 option also turns off the -fno-pic and
28240 -mdynamic-no-pic options.
28241
28242 The -mx32 option sets "int", "long", and pointer types to 32 bits,
28243 and generates code for the x86-64 architecture.
28244
28245 The -m16 option is the same as -m32, except for that it outputs the
28246 ".code16gcc" assembly directive at the beginning of the assembly
28247 output so that the binary can run in 16-bit mode.
28248
28249 The -miamcu option generates code which conforms to Intel MCU
28250 psABI. It requires the -m32 option to be turned on.
28251
28252 -mno-red-zone
28253 Do not use a so-called "red zone" for x86-64 code. The red zone is
28254 mandated by the x86-64 ABI; it is a 128-byte area beyond the
28255 location of the stack pointer that is not modified by signal or
28256 interrupt handlers and therefore can be used for temporary data
28257 without adjusting the stack pointer. The flag -mno-red-zone
28258 disables this red zone.
28259
28260 -mcmodel=small
28261 Generate code for the small code model: the program and its symbols
28262 must be linked in the lower 2 GB of the address space. Pointers
28263 are 64 bits. Programs can be statically or dynamically linked.
28264 This is the default code model.
28265
28266 -mcmodel=kernel
28267 Generate code for the kernel code model. The kernel runs in the
28268 negative 2 GB of the address space. This model has to be used for
28269 Linux kernel code.
28270
28271 -mcmodel=medium
28272 Generate code for the medium model: the program is linked in the
28273 lower 2 GB of the address space. Small symbols are also placed
28274 there. Symbols with sizes larger than -mlarge-data-threshold are
28275 put into large data or BSS sections and can be located above 2GB.
28276 Programs can be statically or dynamically linked.
28277
28278 -mcmodel=large
28279 Generate code for the large model. This model makes no assumptions
28280 about addresses and sizes of sections.
28281
28282 -maddress-mode=long
28283 Generate code for long address mode. This is only supported for
28284 64-bit and x32 environments. It is the default address mode for
28285 64-bit environments.
28286
28287 -maddress-mode=short
28288 Generate code for short address mode. This is only supported for
28289 32-bit and x32 environments. It is the default address mode for
28290 32-bit and x32 environments.
28291
28292 -mneeded
28293 -mno-needed
28294 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
28295 indicate the micro-architecture ISA level required to execute the
28296 binary.
28297
28298 -mno-direct-extern-access
28299 Without -fpic nor -fPIC, always use the GOT pointer to access
28300 external symbols. With -fpic or -fPIC, treat access to protected
28301 symbols as local symbols. The default is -mdirect-extern-access.
28302
28303 Warning: shared libraries compiled with -mno-direct-extern-access
28304 and executable compiled with -mdirect-extern-access may not be
28305 binary compatible if protected symbols are used in shared libraries
28306 and executable.
28307
28308 x86 Windows Options
28309
28310 These additional options are available for Microsoft Windows targets:
28311
28312 -mconsole
28313 This option specifies that a console application is to be
28314 generated, by instructing the linker to set the PE header subsystem
28315 type required for console applications. This option is available
28316 for Cygwin and MinGW targets and is enabled by default on those
28317 targets.
28318
28319 -mdll
28320 This option is available for Cygwin and MinGW targets. It
28321 specifies that a DLL---a dynamic link library---is to be generated,
28322 enabling the selection of the required runtime startup object and
28323 entry point.
28324
28325 -mnop-fun-dllimport
28326 This option is available for Cygwin and MinGW targets. It
28327 specifies that the "dllimport" attribute should be ignored.
28328
28329 -mthreads
28330 This option is available for MinGW targets. It specifies that
28331 MinGW-specific thread support is to be used.
28332
28333 -municode
28334 This option is available for MinGW-w64 targets. It causes the
28335 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
28336 capable runtime startup code.
28337
28338 -mwin32
28339 This option is available for Cygwin and MinGW targets. It
28340 specifies that the typical Microsoft Windows predefined macros are
28341 to be set in the pre-processor, but does not influence the choice
28342 of runtime library/startup code.
28343
28344 -mwindows
28345 This option is available for Cygwin and MinGW targets. It
28346 specifies that a GUI application is to be generated by instructing
28347 the linker to set the PE header subsystem type appropriately.
28348
28349 -fno-set-stack-executable
28350 This option is available for MinGW targets. It specifies that the
28351 executable flag for the stack used by nested functions isn't set.
28352 This is necessary for binaries running in kernel mode of Microsoft
28353 Windows, as there the User32 API, which is used to set executable
28354 privileges, isn't available.
28355
28356 -fwritable-relocated-rdata
28357 This option is available for MinGW and Cygwin targets. It
28358 specifies that relocated-data in read-only section is put into the
28359 ".data" section. This is a necessary for older runtimes not
28360 supporting modification of ".rdata" sections for pseudo-relocation.
28361
28362 -mpe-aligned-commons
28363 This option is available for Cygwin and MinGW targets. It
28364 specifies that the GNU extension to the PE file format that permits
28365 the correct alignment of COMMON variables should be used when
28366 generating code. It is enabled by default if GCC detects that the
28367 target assembler found during configuration supports the feature.
28368
28369 See also under x86 Options for standard options.
28370
28371 Xstormy16 Options
28372
28373 These options are defined for Xstormy16:
28374
28375 -msim
28376 Choose startup files and linker script suitable for the simulator.
28377
28378 Xtensa Options
28379
28380 These options are supported for Xtensa targets:
28381
28382 -mconst16
28383 -mno-const16
28384 Enable or disable use of "CONST16" instructions for loading
28385 constant values. The "CONST16" instruction is currently not a
28386 standard option from Tensilica. When enabled, "CONST16"
28387 instructions are always used in place of the standard "L32R"
28388 instructions. The use of "CONST16" is enabled by default only if
28389 the "L32R" instruction is not available.
28390
28391 -mfused-madd
28392 -mno-fused-madd
28393 Enable or disable use of fused multiply/add and multiply/subtract
28394 instructions in the floating-point option. This has no effect if
28395 the floating-point option is not also enabled. Disabling fused
28396 multiply/add and multiply/subtract instructions forces the compiler
28397 to use separate instructions for the multiply and add/subtract
28398 operations. This may be desirable in some cases where strict IEEE
28399 754-compliant results are required: the fused multiply add/subtract
28400 instructions do not round the intermediate result, thereby
28401 producing results with more bits of precision than specified by the
28402 IEEE standard. Disabling fused multiply add/subtract instructions
28403 also ensures that the program output is not sensitive to the
28404 compiler's ability to combine multiply and add/subtract operations.
28405
28406 -mserialize-volatile
28407 -mno-serialize-volatile
28408 When this option is enabled, GCC inserts "MEMW" instructions before
28409 "volatile" memory references to guarantee sequential consistency.
28410 The default is -mserialize-volatile. Use -mno-serialize-volatile
28411 to omit the "MEMW" instructions.
28412
28413 -mforce-no-pic
28414 For targets, like GNU/Linux, where all user-mode Xtensa code must
28415 be position-independent code (PIC), this option disables PIC for
28416 compiling kernel code.
28417
28418 -mtext-section-literals
28419 -mno-text-section-literals
28420 These options control the treatment of literal pools. The default
28421 is -mno-text-section-literals, which places literals in a separate
28422 section in the output file. This allows the literal pool to be
28423 placed in a data RAM/ROM, and it also allows the linker to combine
28424 literal pools from separate object files to remove redundant
28425 literals and improve code size. With -mtext-section-literals, the
28426 literals are interspersed in the text section in order to keep them
28427 as close as possible to their references. This may be necessary
28428 for large assembly files. Literals for each function are placed
28429 right before that function.
28430
28431 -mauto-litpools
28432 -mno-auto-litpools
28433 These options control the treatment of literal pools. The default
28434 is -mno-auto-litpools, which places literals in a separate section
28435 in the output file unless -mtext-section-literals is used. With
28436 -mauto-litpools the literals are interspersed in the text section
28437 by the assembler. Compiler does not produce explicit ".literal"
28438 directives and loads literals into registers with "MOVI"
28439 instructions instead of "L32R" to let the assembler do relaxation
28440 and place literals as necessary. This option allows assembler to
28441 create several literal pools per function and assemble very big
28442 functions, which may not be possible with -mtext-section-literals.
28443
28444 -mtarget-align
28445 -mno-target-align
28446 When this option is enabled, GCC instructs the assembler to
28447 automatically align instructions to reduce branch penalties at the
28448 expense of some code density. The assembler attempts to widen
28449 density instructions to align branch targets and the instructions
28450 following call instructions. If there are not enough preceding
28451 safe density instructions to align a target, no widening is
28452 performed. The default is -mtarget-align. These options do not
28453 affect the treatment of auto-aligned instructions like "LOOP",
28454 which the assembler always aligns, either by widening density
28455 instructions or by inserting NOP instructions.
28456
28457 -mlongcalls
28458 -mno-longcalls
28459 When this option is enabled, GCC instructs the assembler to
28460 translate direct calls to indirect calls unless it can determine
28461 that the target of a direct call is in the range allowed by the
28462 call instruction. This translation typically occurs for calls to
28463 functions in other source files. Specifically, the assembler
28464 translates a direct "CALL" instruction into an "L32R" followed by a
28465 "CALLX" instruction. The default is -mno-longcalls. This option
28466 should be used in programs where the call target can potentially be
28467 out of range. This option is implemented in the assembler, not the
28468 compiler, so the assembly code generated by GCC still shows direct
28469 call instructions---look at the disassembled object code to see the
28470 actual instructions. Note that the assembler uses an indirect call
28471 for every cross-file call, not just those that really are out of
28472 range.
28473
28474 -mabi=name
28475 Generate code for the specified ABI. Permissible values are:
28476 call0, windowed. Default ABI is chosen by the Xtensa core
28477 configuration.
28478
28479 -mabi=call0
28480 When this option is enabled function parameters are passed in
28481 registers "a2" through "a7", registers "a12" through "a15" are
28482 caller-saved, and register "a15" may be used as a frame pointer.
28483 When this version of the ABI is enabled the C preprocessor symbol
28484 "__XTENSA_CALL0_ABI__" is defined.
28485
28486 -mabi=windowed
28487 When this option is enabled function parameters are passed in
28488 registers "a10" through "a15", and called function rotates register
28489 window by 8 registers on entry so that its arguments are found in
28490 registers "a2" through "a7". Register "a7" may be used as a frame
28491 pointer. Register window is rotated 8 registers back upon return.
28492 When this version of the ABI is enabled the C preprocessor symbol
28493 "__XTENSA_WINDOWED_ABI__" is defined.
28494
28495 zSeries Options
28496
28497 These are listed under
28498
28500 This section describes several environment variables that affect how
28501 GCC operates. Some of them work by specifying directories or prefixes
28502 to use when searching for various kinds of files. Some are used to
28503 specify other aspects of the compilation environment.
28504
28505 Note that you can also specify places to search using options such as
28506 -B, -I and -L. These take precedence over places specified using
28507 environment variables, which in turn take precedence over those
28508 specified by the configuration of GCC.
28509
28510 LANG
28511 LC_CTYPE
28512 LC_MESSAGES
28513 LC_ALL
28514 These environment variables control the way that GCC uses
28515 localization information which allows GCC to work with different
28516 national conventions. GCC inspects the locale categories LC_CTYPE
28517 and LC_MESSAGES if it has been configured to do so. These locale
28518 categories can be set to any value supported by your installation.
28519 A typical value is en_GB.UTF-8 for English in the United Kingdom
28520 encoded in UTF-8.
28521
28522 The LC_CTYPE environment variable specifies character
28523 classification. GCC uses it to determine the character boundaries
28524 in a string; this is needed for some multibyte encodings that
28525 contain quote and escape characters that are otherwise interpreted
28526 as a string end or escape.
28527
28528 The LC_MESSAGES environment variable specifies the language to use
28529 in diagnostic messages.
28530
28531 If the LC_ALL environment variable is set, it overrides the value
28532 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
28533 default to the value of the LANG environment variable. If none of
28534 these variables are set, GCC defaults to traditional C English
28535 behavior.
28536
28537 TMPDIR
28538 If TMPDIR is set, it specifies the directory to use for temporary
28539 files. GCC uses temporary files to hold the output of one stage of
28540 compilation which is to be used as input to the next stage: for
28541 example, the output of the preprocessor, which is the input to the
28542 compiler proper.
28543
28544 GCC_COMPARE_DEBUG
28545 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
28546 -fcompare-debug to the compiler driver. See the documentation of
28547 this option for more details.
28548
28549 GCC_EXEC_PREFIX
28550 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
28551 names of the subprograms executed by the compiler. No slash is
28552 added when this prefix is combined with the name of a subprogram,
28553 but you can specify a prefix that ends with a slash if you wish.
28554
28555 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
28556 appropriate prefix to use based on the pathname it is invoked with.
28557
28558 If GCC cannot find the subprogram using the specified prefix, it
28559 tries looking in the usual places for the subprogram.
28560
28561 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
28562 prefix is the prefix to the installed compiler. In many cases
28563 prefix is the value of "prefix" when you ran the configure script.
28564
28565 Other prefixes specified with -B take precedence over this prefix.
28566
28567 This prefix is also used for finding files such as crt0.o that are
28568 used for linking.
28569
28570 In addition, the prefix is used in an unusual way in finding the
28571 directories to search for header files. For each of the standard
28572 directories whose name normally begins with /usr/local/lib/gcc
28573 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
28574 replacing that beginning with the specified prefix to produce an
28575 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
28576 just before it searches the standard directory /usr/local/lib/bar.
28577 If a standard directory begins with the configured prefix then the
28578 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
28579 header files.
28580
28581 COMPILER_PATH
28582 The value of COMPILER_PATH is a colon-separated list of
28583 directories, much like PATH. GCC tries the directories thus
28584 specified when searching for subprograms, if it cannot find the
28585 subprograms using GCC_EXEC_PREFIX.
28586
28587 LIBRARY_PATH
28588 The value of LIBRARY_PATH is a colon-separated list of directories,
28589 much like PATH. When configured as a native compiler, GCC tries
28590 the directories thus specified when searching for special linker
28591 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
28592 GCC also uses these directories when searching for ordinary
28593 libraries for the -l option (but directories specified with -L come
28594 first).
28595
28596 LANG
28597 This variable is used to pass locale information to the compiler.
28598 One way in which this information is used is to determine the
28599 character set to be used when character literals, string literals
28600 and comments are parsed in C and C++. When the compiler is
28601 configured to allow multibyte characters, the following values for
28602 LANG are recognized:
28603
28604 C-JIS
28605 Recognize JIS characters.
28606
28607 C-SJIS
28608 Recognize SJIS characters.
28609
28610 C-EUCJP
28611 Recognize EUCJP characters.
28612
28613 If LANG is not defined, or if it has some other value, then the
28614 compiler uses "mblen" and "mbtowc" as defined by the default locale
28615 to recognize and translate multibyte characters.
28616
28617 GCC_EXTRA_DIAGNOSTIC_OUTPUT
28618 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
28619 values, then additional text will be emitted to stderr when fix-it
28620 hints are emitted. -fdiagnostics-parseable-fixits and
28621 -fno-diagnostics-parseable-fixits take precedence over this
28622 environment variable.
28623
28624 fixits-v1
28625 Emit parseable fix-it hints, equivalent to
28626 -fdiagnostics-parseable-fixits. In particular, columns are
28627 expressed as a count of bytes, starting at byte 1 for the
28628 initial column.
28629
28630 fixits-v2
28631 As "fixits-v1", but columns are expressed as display columns,
28632 as per -fdiagnostics-column-unit=display.
28633
28634 Some additional environment variables affect the behavior of the
28635 preprocessor.
28636
28637 CPATH
28638 C_INCLUDE_PATH
28639 CPLUS_INCLUDE_PATH
28640 OBJC_INCLUDE_PATH
28641 Each variable's value is a list of directories separated by a
28642 special character, much like PATH, in which to look for header
28643 files. The special character, "PATH_SEPARATOR", is target-
28644 dependent and determined at GCC build time. For Microsoft Windows-
28645 based targets it is a semicolon, and for almost all other targets
28646 it is a colon.
28647
28648 CPATH specifies a list of directories to be searched as if
28649 specified with -I, but after any paths given with -I options on the
28650 command line. This environment variable is used regardless of
28651 which language is being preprocessed.
28652
28653 The remaining environment variables apply only when preprocessing
28654 the particular language indicated. Each specifies a list of
28655 directories to be searched as if specified with -isystem, but after
28656 any paths given with -isystem options on the command line.
28657
28658 In all these variables, an empty element instructs the compiler to
28659 search its current working directory. Empty elements can appear at
28660 the beginning or end of a path. For instance, if the value of
28661 CPATH is ":/special/include", that has the same effect as
28662 -I. -I/special/include.
28663
28664 DEPENDENCIES_OUTPUT
28665 If this variable is set, its value specifies how to output
28666 dependencies for Make based on the non-system header files
28667 processed by the compiler. System header files are ignored in the
28668 dependency output.
28669
28670 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
28671 case the Make rules are written to that file, guessing the target
28672 name from the source file name. Or the value can have the form
28673 file target, in which case the rules are written to file file using
28674 target as the target name.
28675
28676 In other words, this environment variable is equivalent to
28677 combining the options -MM and -MF, with an optional -MT switch too.
28678
28679 SUNPRO_DEPENDENCIES
28680 This variable is the same as DEPENDENCIES_OUTPUT (see above),
28681 except that system header files are not ignored, so it implies -M
28682 rather than -MM. However, the dependence on the main input file is
28683 omitted.
28684
28685 SOURCE_DATE_EPOCH
28686 If this variable is set, its value specifies a UNIX timestamp to be
28687 used in replacement of the current date and time in the "__DATE__"
28688 and "__TIME__" macros, so that the embedded timestamps become
28689 reproducible.
28690
28691 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
28692 the number of seconds (excluding leap seconds) since 01 Jan 1970
28693 00:00:00 represented in ASCII; identical to the output of "date
28694 +%s" on GNU/Linux and other systems that support the %s extension
28695 in the "date" command.
28696
28697 The value should be a known timestamp such as the last modification
28698 time of the source or package and it should be set by the build
28699 process.
28700
28702 For instructions on reporting bugs, see <https://bugzilla.redhat.com/>.
28703
28705 1. On some systems, gcc -shared needs to build supplementary stub code
28706 for constructors to work. On multi-libbed systems, gcc -shared
28707 must select the correct support libraries to link against. Failing
28708 to supply the correct flags may lead to subtle defects. Supplying
28709 them in cases where they are not necessary is innocuous.
28710
28712 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
28713 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
28714
28716 See the Info entry for gcc, or
28717 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
28718 contributors to GCC.
28719
28721 Copyright (c) 1988-2022 Free Software Foundation, Inc.
28722
28723 Permission is granted to copy, distribute and/or modify this document
28724 under the terms of the GNU Free Documentation License, Version 1.3 or
28725 any later version published by the Free Software Foundation; with the
28726 Invariant Sections being "GNU General Public License" and "Funding Free
28727 Software", the Front-Cover texts being (a) (see below), and with the
28728 Back-Cover Texts being (b) (see below). A copy of the license is
28729 included in the gfdl(7) man page.
28730
28731 (a) The FSF's Front-Cover Text is:
28732
28733 A GNU Manual
28734
28735 (b) The FSF's Back-Cover Text is:
28736
28737 You have freedom to copy and modify this GNU Manual, like GNU
28738 software. Copies published by the Free Software Foundation raise
28739 funds for GNU development.
28740
28741
28742
28743gcc-12.2.0 2022-08-19 GCC(1)