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 -fgnu89-inline
89 -fpermitted-flt-eval-methods=standard -aux-info filename
90 -fallow-parameterless-variadic-functions -fno-asm -fno-builtin
91 -fno-builtin-function -fgimple -fhosted -ffreestanding -fopenacc
92 -fopenacc-dim=geom -fopenmp -fopenmp-simd -fms-extensions
93 -fplan9-extensions -fsso-struct=endianness
94 -fallow-single-precision -fcond-mismatch -flax-vector-conversions
95 -fsigned-bitfields -fsigned-char -funsigned-bitfields
96 -funsigned-char
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 -Wdeprecated-copy
122 -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion
123 -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-exceptions
124 -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor
125 -Wno-init-list-lifetime -Winvalid-imported-macros
126 -Wno-invalid-offsetof -Wno-literal-suffix
127 -Wno-mismatched-new-delete -Wmismatched-tags -Wmultiple-inheritance
128 -Wnamespaces -Wnarrowing -Wnoexcept -Wnoexcept-type
129 -Wnon-virtual-dtor -Wpessimizing-move -Wno-placement-new
130 -Wplacement-new=n -Wrange-loop-construct -Wredundant-move
131 -Wredundant-tags -Wreorder -Wregister -Wstrict-null-sentinel
132 -Wno-subobject-linkage -Wtemplates -Wno-non-template-friend
133 -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions
134 -Wsign-promo -Wsized-deallocation -Wsuggest-final-methods
135 -Wsuggest-final-types -Wsuggest-override -Wno-terminate
136 -Wuseless-cast -Wno-vexing-parse -Wvirtual-inheritance
137 -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
166 Warning Options
167 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
168 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
169 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
170 -Walloca -Walloca-larger-than=byte-size
171 -Wno-aggressive-loop-optimizations -Warith-conversion
172 -Warray-bounds -Warray-bounds=n -Wno-attributes
173 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
174 -Wbool-compare -Wbool-operation -Wno-builtin-declaration-mismatch
175 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
176 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
177 -Wc++17-compat -Wc++20-compat -Wcast-align -Wcast-align=strict
178 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
179 -Wcomment -Wconversion -Wno-coverage-mismatch -Wno-cpp
180 -Wdangling-else -Wdate-time -Wno-deprecated
181 -Wno-deprecated-declarations -Wno-designated-init
182 -Wdisabled-optimization -Wno-discarded-array-qualifiers
183 -Wno-discarded-qualifiers -Wno-div-by-zero -Wdouble-promotion
184 -Wduplicated-branches -Wduplicated-cond -Wempty-body
185 -Wno-endif-labels -Wenum-compare -Wenum-conversion -Werror
186 -Werror=* -Wexpansion-to-defined -Wfatal-errors
187 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2
188 -Wno-format-contains-nul -Wno-format-extra-args
189 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
190 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
191 -Wframe-address -Wframe-larger-than=byte-size
192 -Wno-free-nonheap-object -Wno-if-not-aligned
193 -Wno-ignored-attributes -Wignored-qualifiers
194 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
195 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
196 -Wno-implicit-int -Winit-self -Winline -Wno-int-conversion
197 -Wint-in-bool-context -Wno-int-to-pointer-cast
198 -Wno-invalid-memory-model -Winvalid-pch -Wjump-misses-init
199 -Wlarger-than=byte-size -Wlogical-not-parentheses -Wlogical-op
200 -Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
201 -Wmemset-elt-size -Wmemset-transposed-args
202 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
203 -Wmissing-field-initializers -Wmissing-format-attribute
204 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
205 -Wno-multichar -Wmultistatement-macros -Wnonnull
206 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
207 -Wnull-dereference -Wno-odr -Wopenmp-simd -Wno-overflow
208 -Woverlength-strings -Wno-override-init-side-effects -Wpacked
209 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
210 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
211 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
212 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
213 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
214 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
215 -Wshadow=compatible-local -Wno-shadow-ivar
216 -Wno-shift-count-negative -Wno-shift-count-overflow
217 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
218 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
219 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
220 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
221 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
222 -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread
223 -Wno-stringop-truncation
224 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
225 -Wno-switch-bool -Wswitch-default -Wswitch-enum
226 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
227 -Wsystem-headers -Wtautological-compare -Wtrampolines
228 -Wtrigraphs -Wtsan -Wtype-limits -Wundef -Wuninitialized
229 -Wunknown-pragmas -Wunsuffixed-float-constants -Wunused
230 -Wunused-but-set-parameter -Wunused-but-set-variable
231 -Wunused-const-variable -Wunused-const-variable=n
232 -Wunused-function -Wunused-label -Wunused-local-typedefs
233 -Wunused-macros -Wunused-parameter -Wno-unused-result
234 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
235 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
236 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
237 -Wzero-length-bounds
238
239 Static Analyzer Options
240 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
241 -fno-analyzer-feasibility -fanalyzer-fine-grained
242 -fanalyzer-state-merge -fanalyzer-state-purge
243 -fanalyzer-transitivity -fanalyzer-verbose-edges
244 -fanalyzer-verbose-state-changes -fanalyzer-verbosity=level
245 -fdump-analyzer -fdump-analyzer-stderr -fdump-analyzer-callgraph
246 -fdump-analyzer-exploded-graph -fdump-analyzer-exploded-nodes
247 -fdump-analyzer-exploded-nodes-2 -fdump-analyzer-exploded-nodes-3
248 -fdump-analyzer-feasibility -fdump-analyzer-json
249 -fdump-analyzer-state-purge -fdump-analyzer-supergraph
250 -Wno-analyzer-double-fclose -Wno-analyzer-double-free
251 -Wno-analyzer-exposure-through-output-file -Wno-analyzer-file-leak
252 -Wno-analyzer-free-of-non-heap -Wno-analyzer-malloc-leak
253 -Wno-analyzer-mismatching-deallocation -Wno-analyzer-null-argument
254 -Wno-analyzer-null-dereference -Wno-analyzer-possible-null-argument
255 -Wno-analyzer-possible-null-dereference
256 -Wno-analyzer-shift-count-negative
257 -Wno-analyzer-shift-count-overflow
258 -Wno-analyzer-stale-setjmp-buffer -Wno-analyzer-tainted-array-index
259 -Wanalyzer-too-complex
260 -Wno-analyzer-unsafe-call-within-signal-handler
261 -Wno-analyzer-use-after-free
262 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
263 -Wno-analyzer-use-of-uninitialized-value
264 -Wno-analyzer-write-to-const -Wno-analyzer-write-to-string-literal
265
266 C and Objective-C-only Warning Options
267 -Wbad-function-cast -Wmissing-declarations
268 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
269 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
270 -Wtraditional -Wtraditional-conversion
271 -Wdeclaration-after-statement -Wpointer-sign
272
273 Debugging Options
274 -g -glevel -gdwarf -gdwarf-version -ggdb -grecord-gcc-switches
275 -gno-record-gcc-switches -gstabs -gstabs+ -gstrict-dwarf
276 -gno-strict-dwarf -gas-loc-support -gno-as-loc-support
277 -gas-locview-support -gno-as-locview-support -gcolumn-info
278 -gno-column-info -gdwarf32 -gdwarf64 -gstatement-frontiers
279 -gno-statement-frontiers -gvariable-location-views
280 -gno-variable-location-views -ginternal-reset-location-views
281 -gno-internal-reset-location-views -ginline-points
282 -gno-inline-points -gvms -gxcoff -gxcoff+ -gz[=type]
283 -gsplit-dwarf -gdescribe-dies -gno-describe-dies
284 -fdebug-prefix-map=old=new -fdebug-types-section
285 -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
286 -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-
287 list] -fno-eliminate-unused-debug-symbols
288 -femit-class-debug-always -fno-merge-debug-strings
289 -fno-dwarf2-cfi-asm -fvar-tracking -fvar-tracking-assignments
290
291 Optimization Options
292 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
293 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
294 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
295 -fallow-store-data-races -fassociative-math -fauto-profile
296 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
297 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
298 -fcompare-elim -fcprop-registers -fcrossjumping
299 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
300 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
301 -fdelete-null-pointer-checks -fdevirtualize
302 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
303 -fearly-inlining -fipa-sra -fexpensive-optimizations
304 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
305 -fexcess-precision=style -ffinite-loops -fforward-propagate
306 -ffp-contract=style -ffunction-sections -fgcse
307 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
308 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
309 -findirect-inlining -finline-functions
310 -finline-functions-called-once -finline-limit=n
311 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
312 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
313 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
314 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
315 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
316 -fno-ira-share-save-slots -fno-ira-share-spill-slots
317 -fisolate-erroneous-paths-dereference
318 -fisolate-erroneous-paths-attribute -fivopts
319 -fkeep-inline-functions -fkeep-static-functions
320 -fkeep-static-consts -flimit-function-alignment
321 -flive-range-shrinkage -floop-block -floop-interchange
322 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
323 -floop-parallelize-all -flra-remat -flto -flto-compression-level
324 -flto-partition=alg -fmerge-all-constants -fmerge-constants
325 -fmodulo-sched -fmodulo-sched-allow-regmoves
326 -fmove-loop-invariants -fno-branch-count-reg -fno-defer-pop
327 -fno-fp-int-builtin-inexact -fno-function-cse
328 -fno-guess-branch-probability -fno-inline -fno-math-errno
329 -fno-peephole -fno-peephole2 -fno-printf-return-value
330 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
331 -fno-toplevel-reorder -fno-trapping-math
332 -fno-zero-initialized-in-bss -fomit-frame-pointer
333 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
334 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
335 -fprofile-use -fprofile-use=path -fprofile-partial-training
336 -fprofile-values -fprofile-reorder-functions -freciprocal-math
337 -free -frename-registers -freorder-blocks
338 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
339 -freorder-functions -frerun-cse-after-loop
340 -freschedule-modulo-scheduled-loops -frounding-math
341 -fsave-optimization-record -fsched2-use-superblocks
342 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
343 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
344 -fsched-group-heuristic -fsched-critical-path-heuristic
345 -fsched-spec-insn-heuristic -fsched-rank-heuristic
346 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
347 -fschedule-fusion -fschedule-insns -fschedule-insns2
348 -fsection-anchors -fselective-scheduling -fselective-scheduling2
349 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
350 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
351 -fsignaling-nans -fsingle-precision-constant
352 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
353 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
354 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
355 -fthread-jumps -ftracer -ftree-bit-ccp -ftree-builtin-call-dce
356 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
357 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
358 -ftree-fre -fcode-hoisting -ftree-loop-if-convert -ftree-loop-im
359 -ftree-phiprop -ftree-loop-distribution
360 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
361 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
362 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
363 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
364 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
365 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons
366 -funit-at-a-time -funroll-all-loops -funroll-loops
367 -funsafe-math-optimizations -funswitch-loops -fipa-ra
368 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb
369 -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs
370 --param name=value -O -O0 -O1 -O2 -O3 -Os -Ofast -Og
371
372 Program Instrumentation Options
373 -p -pg -fprofile-arcs --coverage -ftest-coverage
374 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
375 -fprofile-generate=path -fprofile-info-section
376 -fprofile-info-section=name -fprofile-note=path
377 -fprofile-prefix-path=path -fprofile-update=method
378 -fprofile-filter-files=regex -fprofile-exclude-files=regex
379 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
380 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
381 -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
382 -fsanitize-undefined-trap-on-error -fbounds-check
383 -fcf-protection=[full|branch|return|none|check] -fstack-protector
384 -fstack-protector-all -fstack-protector-strong
385 -fstack-protector-explicit -fstack-check
386 -fstack-limit-register=reg -fstack-limit-symbol=sym
387 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
388 -fvtv-counts -fvtv-debug -finstrument-functions
389 -finstrument-functions-exclude-function-list=sym,sym,...
390 -finstrument-functions-exclude-file-list=file,file,...
391
392 Preprocessor Options
393 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
394 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
395 -fdollars-in-identifiers -fexec-charset=charset
396 -fextended-identifiers -finput-charset=charset
397 -flarge-source-files -fmacro-prefix-map=old=new
398 -fmax-include-depth=depth -fno-canonical-system-headers -fpch-deps
399 -fpch-preprocess -fpreprocessed -ftabstop=width
400 -ftrack-macro-expansion -fwide-exec-charset=charset
401 -fworking-directory -H -imacros file -include file -M -MD -MF
402 -MG -MM -MMD -MP -MQ -MT -Mno-modules -no-integrated-cpp -P
403 -pthread -remap -traditional -traditional-cpp -trigraphs -Umacro
404 -undef -Wp,option -Xpreprocessor option
405
406 Assembler Options
407 -Wa,option -Xassembler option
408
409 Linker Options
410 object-file-name -fuse-ld=linker -llibrary -nostartfiles
411 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
412 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
413 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
414 -static-libubsan -shared -shared-libgcc -symbolic -T script
415 -Wl,option -Xlinker option -u symbol -z keyword
416
417 Directory Options
418 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
419 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
420 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
421 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
422 --sysroot=dir
423
424 Code Generation Options
425 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
426 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
427 -fasynchronous-unwind-tables -fno-gnu-unique
428 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
429 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
430 -fno-bit-tests -frecord-gcc-switches -freg-struct-return
431 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
432 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
433 -ftrampolines -ftrapv -fwrapv
434 -fvisibility=[default|internal|hidden|protected]
435 -fstrict-volatile-bitfields -fsync-libcalls
436
437 Developer Options
438 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
439 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
440 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
441 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
442 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
443 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
444 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
445 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
446 -fdump-lang-switch -fdump-lang-switch-options
447 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
448 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
449 -fdump-tree-switch -fdump-tree-switch-options
450 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
451 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
452 list -fira-verbose=n -flto-report -flto-report-wpa
453 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
454 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
455 -fprofile-report -frandom-seed=string -fsched-verbose=n
456 -fsel-sched-verbose -fsel-sched-dump-cfg
457 -fsel-sched-pipelining-verbose -fstats -fstack-usage
458 -ftime-report -ftime-report-details
459 -fvar-tracking-assignments-toggle -gtoggle
460 -print-file-name=library -print-libgcc-file-name
461 -print-multi-directory -print-multi-lib -print-multi-os-directory
462 -print-prog-name=program -print-search-dirs -Q -print-sysroot
463 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
464 -save-temps=obj -time[=file]
465
466 Machine-Dependent Options
467 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
468 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
469 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
470 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
471 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
472 -mlow-precision-recip-sqrt -mlow-precision-sqrt
473 -mlow-precision-div -mpc-relative-literal-loads
474 -msign-return-address=scope -mbranch-protection=none|standard|pac-
475 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
476 -mtune=name -moverride=string -mverbose-cost-dump
477 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
478 -mstack-protector-guard-offset=offset -mtrack-speculation
479 -moutline-atomics
480
481 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
482 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
483 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
484 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
485 -mvect-double -max-vect-align=num -msplit-vecmove-early
486 -m1reg-reg
487
488 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
489
490 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
491 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
492 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
493 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
494 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
495 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
496 -marclinux_prof -mlong-calls -mmedium-calls -msdata
497 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
498 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
499 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
500 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
501 -mlra -mlra-priority-none -mlra-priority-compact mlra-priority-
502 noncompact -mmillicode -mmixed-code -mq-class -mRcq -mRcw
503 -msize-level=level -mtune=cpu -mmultcost=num -mcode-density-frame
504 -munalign-prob-threshold=probability -mmpy-option=multo -mdiv-rem
505 -mcode-density -mll64 -mfpu=fpu -mrf16 -mbranch-index
506
507 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
508 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
509 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
510 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
511 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
512 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
513 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
514 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
515 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
516 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
517 -mtpcs-leaf-frame -mcaller-super-interworking
518 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
519 -mword-relocations -mfix-cortex-m3-ldrd -munaligned-access
520 -mneon-for-64bits -mslow-flash-data -masm-syntax-unified
521 -mrestrict-it -mverbose-cost-dump -mpure-code -mcmse -mfdpic
522
523 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
524 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
525 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
526 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
527 -mfract-convert-truncate -mshort-calls -nodevicelib
528 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
529
530 Blackfin Options -mcpu=cpu[-sirevision] -msim
531 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
532 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
533 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
534 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
535 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
536 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
537 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
538
539 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
540 -msdata=sdata-type
541
542 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
543 -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init
544 -mno-side-effects -mstack-align -mdata-align -mconst-align
545 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt
546 -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround
547 -mno-mul-bug-workaround
548
549 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
550 -mdata-model=model
551
552 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
553 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
554 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
555 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
556 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
557 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
558 -msched-prolog -msim
559
560 Darwin Options -all_load -allowable_client -arch
561 -arch_errors_fatal -arch_only -bind_at_load -bundle
562 -bundle_loader -client_name -compatibility_version
563 -current_version -dead_strip -dependency-file -dylib_file
564 -dylinker_install_name -dynamic -dynamiclib
565 -exported_symbols_list -filelist -flat_namespace
566 -force_cpusubtype_ALL -force_flat_namespace
567 -headerpad_max_install_names -iframework -image_base -init
568 -install_name -keep_private_externs -multi_module
569 -multiply_defined -multiply_defined_unused -noall_load
570 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
571 -noprebind -noseglinkedit -pagezero_size -prebind
572 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
573 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
574 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
575 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
576 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
577 -single_module -static -sub_library -sub_umbrella
578 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
579 -weak_reference_mismatches -whatsloaded -F -gused -gfull
580 -mmacosx-version-min=version -mkernel -mone-byte-bool
581
582 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
583 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
584 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
585 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
586 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
587 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
588
589 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
590 -mframe-limit=bytes -mxbpf
591
592 FR30 Options -msmall-model -mno-lsim
593
594 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
595
596 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
597 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
598 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
599 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
600 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
601 -mno-pack -mno-eflags -mcond-move -mno-cond-move
602 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
603 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
604 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
605 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
606
607 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
608 -tno-android-cc -tno-android-ld
609
610 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
611 -malign-300
612
613 HPPA Options -march=architecture-type -mcaller-copies
614 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
615 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
616 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
617 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
618 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
619 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
620 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
621 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
622 -static -threads
623
624 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
625 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
626 -mconstant-gp -mauto-pic -mfused-madd
627 -minline-float-divide-min-latency
628 -minline-float-divide-max-throughput -mno-inline-float-divide
629 -minline-int-divide-min-latency -minline-int-divide-max-throughput
630 -mno-inline-int-divide -minline-sqrt-min-latency
631 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
632 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
633 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
634 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
635 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
636 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
637 -msched-prefer-non-control-spec-insns
638 -msched-stop-bits-after-every-cycle
639 -msched-count-spec-in-critical-path
640 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
641 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
642 insns
643
644 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
645 -mmultiply-enabled -msign-extend-enabled -muser-enabled
646
647 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
648 -mno-align-loops -missue-rate=number -mbranch-cost=number
649 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
650 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
651
652 M32C Options -mcpu=cpu -msim -memregs=number
653
654 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
655 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
656 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
657 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
658 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
659 -malign-int -mstrict-align -msep-data -mno-sep-data
660 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
661 -mxgot -mno-xgot -mlong-jump-table-offsets
662
663 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
664 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
665 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
666 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
667 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
668 -mstack-increment
669
670 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
671 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
672 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
673 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
674 -msimnovec -mtf -mtiny=n
675
676 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
677 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
678 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
679 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
680 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
681 -mpic-data-is-text-relative
682
683 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
684 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
685 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
686 -mno-mips16 -mflip-mips16 -minterlink-compressed
687 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
688 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
689 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
690 -mhard-float -msoft-float -mno-float -msingle-float
691 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
692 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
693 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
694 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
695 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
696 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
697 type -msmartmips -mno-smartmips -mpaired-single
698 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
699 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
700 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
701 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
702 -mno-embedded-data -muninit-const-in-rodata
703 -mno-uninit-const-in-rodata -mcode-readable=setting
704 -msplit-addresses -mno-split-addresses -mexplicit-relocs
705 -mno-explicit-relocs -mcheck-zero-division
706 -mno-check-zero-division -mdivide-traps -mdivide-breaks
707 -mload-store-pairs -mno-load-store-pairs -mmemcpy -mno-memcpy
708 -mlong-calls -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd
709 -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k
710 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
711 -mfix-r5900 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000
712 -mfix-rm7000 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120
713 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1
714 -mflush-func=func -mno-flush-func -mbranch-cost=num
715 -mbranch-likely -mno-branch-likely -mcompact-branches=policy
716 -mfp-exceptions -mno-fp-exceptions -mvr4130-align
717 -mno-vr4130-align -msynci -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1
718 -mmadd4 -mno-madd4 -mrelax-pic-calls -mno-relax-pic-calls
719 -mmcount-ra-address -mframe-header-opt -mno-frame-header-opt
720
721 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
722 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
723 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
724 -mbase-addresses -mno-base-addresses -msingle-exit
725 -mno-single-exit
726
727 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
728 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
729 -mrelax -mliw -msetlb
730
731 Moxie Options -meb -mel -mmul.x -mno-crt0
732
733 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
734 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
735 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
736 -mmax-inline-shift=
737
738 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
739 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
740 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
741 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
742 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
743
744 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
745 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
746 -mbypass-cache -mno-cache-volatile -mcache-volatile
747 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
748 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
749 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
750 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
751 -mno-cdx
752
753 Nvidia PTX Options -m64 -mmainkernel -moptimize
754
755 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
756 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
757 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
758
759 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
760 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
761 -mdec-asm -mgnu-asm -mlra
762
763 picoChip Options -mae=ae_type -mvliw-lookahead=N
764 -msymbol-as-address -mno-inefficient-warnings
765
766 PowerPC Options See RS/6000 and PowerPC Options.
767
768 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
769
770 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
771 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -march=ISA-
772 string -mtune=processor-string -mpreferred-stack-boundary=num
773 -msmall-data-limit=N-bytes -msave-restore -mno-save-restore
774 -mshorten-memrefs -mno-shorten-memrefs -mstrict-align
775 -mno-strict-align -mcmodel=medlow -mcmodel=medany
776 -mexplicit-relocs -mno-explicit-relocs -mrelax -mno-relax
777 -mriscv-attribute -mmo-riscv-attribute -malign-data=type
778 -mbig-endian -mlittle-endian +-mstack-protector-guard=guard
779 -mstack-protector-guard-reg=reg
780 +-mstack-protector-guard-offset=offset
781
782 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
783 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
784 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
785
786 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
787 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
788 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
789 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
790 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
791 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
792 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
793 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
794 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
795 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
796 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
797 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
798 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
799 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
800 -msingle-pic-base -mprioritize-restricted-insns=priority
801 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
802 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
803 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
804 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
805 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
806 -mlongcall -mno-longcall -mpltseq -mno-pltseq
807 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
808 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
809 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
810 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
811 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
812 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
813 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
814 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
815 -mno-pointers-to-nested-functions -msave-toc-indirect
816 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
817 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
818 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
819 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
820 -mfloat128 -mno-float128 -mfloat128-hardware
821 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
822 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
823 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
824 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
825 -mprivileged -mno-privileged
826
827 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
828 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
829 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
830 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
831 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
832 -msave-acc-in-interrupts
833
834 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
835 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
836 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
837 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
838 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
839 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
840 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
841 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
842 -mhotpatch=halfwords,halfwords
843
844 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
845 -mscore7 -mscore7d
846
847 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
848 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
849 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
850 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
851 -mnomacsave -mieee -mno-ieee -mbitops -misize
852 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
853 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
854 -mfixed-range=register-range -maccumulate-outgoing-args
855 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
856 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
857 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
858 -mpretend-cmove -mtas
859
860 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
861 -mno-impure-text -pthreads
862
863 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
864 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
865 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
866 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
867 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
868 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
869 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
870 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
871 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
872 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
873 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
874
875 System V Options -Qy -Qn -YP,paths -Ym,dir
876
877 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
878 -mlittle-endian -mcmodel=code-model
879
880 TILEPro Options -mcpu=cpu -m32
881
882 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
883 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
884 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
885 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
886 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
887 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
888
889 VAX Options -mg -mgnu -munix
890
891 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
892 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
893 -muser-mode
894
895 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
896 -mpointer-size=size
897
898 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
899 -Xbind-now
900
901 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
902 list -mdump-tune-features -mno-default -mfpmath=unit
903 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
904 -mhard-float -msoft-float -mno-wide-multiply -mrtd
905 -malign-double -mpreferred-stack-boundary=num
906 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
907 -mcrc32 -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
908 -mprefer-vector-width=opt -mmmx -msse -msse2 -msse3 -mssse3
909 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf
910 -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq
911 -mavx512ifma -mavx512vbmi -msha -maes -mpclmul -mfsgsbase
912 -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite
913 -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves -msse4a
914 -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
915 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle
916 -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
917 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
918 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
919 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
920 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
921 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
922 -mamx-bf16 -muintr -mhreset -mavxvnni -mcldemote -mms-bitfields
923 -mno-align-stringops -minline-all-stringops
924 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
925 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
926 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
927 -m96bit-long-double -mlong-double-64 -mlong-double-80
928 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
929 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
930 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
931 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
932 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
933 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
934 -minstrument-return=type -mfentry-name=name -mfentry-section=name
935 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
936 -malign-data=type -mstack-protector-guard=guard
937 -mstack-protector-guard-reg=reg
938 -mstack-protector-guard-offset=offset
939 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
940 -mcall-ms2sysv-xlogues -mindirect-branch=choice
941 -mfunction-return=choice -mindirect-branch-register -mneeded
942
943 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
944 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
945 -fno-set-stack-executable
946
947 Xstormy16 Options -msim
948
949 Xtensa Options -mconst16 -mno-const16 -mfused-madd
950 -mno-fused-madd -mforce-no-pic -mserialize-volatile
951 -mno-serialize-volatile -mtext-section-literals
952 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
953 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
954 -mabi=abi-type
955
956 zSeries Options See S/390 and zSeries Options.
957
958 Options Controlling the Kind of Output
959 Compilation can involve up to four stages: preprocessing, compilation
960 proper, assembly and linking, always in that order. GCC is capable of
961 preprocessing and compiling several files either into several assembler
962 input files, or into one assembler input file; then each assembler
963 input file produces an object file, and linking combines all the object
964 files (those newly compiled, and those specified as input) into an
965 executable file.
966
967 For any given input file, the file name suffix determines what kind of
968 compilation is done:
969
970 file.c
971 C source code that must be preprocessed.
972
973 file.i
974 C source code that should not be preprocessed.
975
976 file.ii
977 C++ source code that should not be preprocessed.
978
979 file.m
980 Objective-C source code. Note that you must link with the libobjc
981 library to make an Objective-C program work.
982
983 file.mi
984 Objective-C source code that should not be preprocessed.
985
986 file.mm
987 file.M
988 Objective-C++ source code. Note that you must link with the
989 libobjc library to make an Objective-C++ program work. Note that
990 .M refers to a literal capital M.
991
992 file.mii
993 Objective-C++ source code that should not be preprocessed.
994
995 file.h
996 C, C++, Objective-C or Objective-C++ header file to be turned into
997 a precompiled header (default), or C, C++ header file to be turned
998 into an Ada spec (via the -fdump-ada-spec switch).
999
1000 file.cc
1001 file.cp
1002 file.cxx
1003 file.cpp
1004 file.CPP
1005 file.c++
1006 file.C
1007 C++ source code that must be preprocessed. Note that in .cxx, the
1008 last two letters must both be literally x. Likewise, .C refers to
1009 a literal capital C.
1010
1011 file.mm
1012 file.M
1013 Objective-C++ source code that must be preprocessed.
1014
1015 file.mii
1016 Objective-C++ source code that should not be preprocessed.
1017
1018 file.hh
1019 file.H
1020 file.hp
1021 file.hxx
1022 file.hpp
1023 file.HPP
1024 file.h++
1025 file.tcc
1026 C++ header file to be turned into a precompiled header or Ada spec.
1027
1028 file.f
1029 file.for
1030 file.ftn
1031 Fixed form Fortran source code that should not be preprocessed.
1032
1033 file.F
1034 file.FOR
1035 file.fpp
1036 file.FPP
1037 file.FTN
1038 Fixed form Fortran source code that must be preprocessed (with the
1039 traditional preprocessor).
1040
1041 file.f90
1042 file.f95
1043 file.f03
1044 file.f08
1045 Free form Fortran source code that should not be preprocessed.
1046
1047 file.F90
1048 file.F95
1049 file.F03
1050 file.F08
1051 Free form Fortran source code that must be preprocessed (with the
1052 traditional preprocessor).
1053
1054 file.go
1055 Go source code.
1056
1057 file.brig
1058 BRIG files (binary representation of HSAIL).
1059
1060 file.d
1061 D source code.
1062
1063 file.di
1064 D interface file.
1065
1066 file.dd
1067 D documentation code (Ddoc).
1068
1069 file.ads
1070 Ada source code file that contains a library unit declaration (a
1071 declaration of a package, subprogram, or generic, or a generic
1072 instantiation), or a library unit renaming declaration (a package,
1073 generic, or subprogram renaming declaration). Such files are also
1074 called specs.
1075
1076 file.adb
1077 Ada source code file containing a library unit body (a subprogram
1078 or package body). Such files are also called bodies.
1079
1080 file.s
1081 Assembler code.
1082
1083 file.S
1084 file.sx
1085 Assembler code that must be preprocessed.
1086
1087 other
1088 An object file to be fed straight into linking. Any file name with
1089 no recognized suffix is treated this way.
1090
1091 You can specify the input language explicitly with the -x option:
1092
1093 -x language
1094 Specify explicitly the language for the following input files
1095 (rather than letting the compiler choose a default based on the
1096 file name suffix). This option applies to all following input
1097 files until the next -x option. Possible values for language are:
1098
1099 c c-header cpp-output
1100 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1101 objective-c objective-c-header objective-c-cpp-output
1102 objective-c++ objective-c++-header objective-c++-cpp-output
1103 assembler assembler-with-cpp
1104 ada
1105 d
1106 f77 f77-cpp-input f95 f95-cpp-input
1107 go
1108 brig
1109
1110 -x none
1111 Turn off any specification of a language, so that subsequent files
1112 are handled according to their file name suffixes (as they are if
1113 -x has not been used at all).
1114
1115 If you only want some of the stages of compilation, you can use -x (or
1116 filename suffixes) to tell gcc where to start, and one of the options
1117 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1118 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1119
1120 -c Compile or assemble the source files, but do not link. The linking
1121 stage simply is not done. The ultimate output is in the form of an
1122 object file for each source file.
1123
1124 By default, the object file name for a source file is made by
1125 replacing the suffix .c, .i, .s, etc., with .o.
1126
1127 Unrecognized input files, not requiring compilation or assembly,
1128 are ignored.
1129
1130 -S Stop after the stage of compilation proper; do not assemble. The
1131 output is in the form of an assembler code file for each non-
1132 assembler input file specified.
1133
1134 By default, the assembler file name for a source file is made by
1135 replacing the suffix .c, .i, etc., with .s.
1136
1137 Input files that don't require compilation are ignored.
1138
1139 -E Stop after the preprocessing stage; do not run the compiler proper.
1140 The output is in the form of preprocessed source code, which is
1141 sent to the standard output.
1142
1143 Input files that don't require preprocessing are ignored.
1144
1145 -o file
1146 Place the primary output in file file. This applies to whatever
1147 sort of output is being produced, whether it be an executable file,
1148 an object file, an assembler file or preprocessed C code.
1149
1150 If -o is not specified, the default is to put an executable file in
1151 a.out, the object file for source.suffix in source.o, its assembler
1152 file in source.s, a precompiled header file in source.suffix.gch,
1153 and all preprocessed C source on standard output.
1154
1155 Though -o names only the primary output, it also affects the naming
1156 of auxiliary and dump outputs. See the examples below. Unless
1157 overridden, both auxiliary outputs and dump outputs are placed in
1158 the same directory as the primary output. In auxiliary outputs,
1159 the suffix of the input file is replaced with that of the auxiliary
1160 output file type; in dump outputs, the suffix of the dump file is
1161 appended to the input file suffix. In compilation commands, the
1162 base name of both auxiliary and dump outputs is that of the primary
1163 output; in compile and link commands, the primary output name,
1164 minus the executable suffix, is combined with the input file name.
1165 If both share the same base name, disregarding the suffix, the
1166 result of the combination is that base name, otherwise, they are
1167 concatenated, separated by a dash.
1168
1169 gcc -c foo.c ...
1170
1171 will use foo.o as the primary output, and place aux outputs and
1172 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1173 dump file foo.c.???r.final for -fdump-rtl-final.
1174
1175 If a non-linker output file is explicitly specified, aux and dump
1176 files by default take the same base name:
1177
1178 gcc -c foo.c -o dir/foobar.o ...
1179
1180 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1181
1182 A linker output will instead prefix aux and dump outputs:
1183
1184 gcc foo.c bar.c -o dir/foobar ...
1185
1186 will generally name aux outputs dir/foobar-foo.* and
1187 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1188 dir/foobar-bar.c.*.
1189
1190 The one exception to the above is when the executable shares the
1191 base name with the single input:
1192
1193 gcc foo.c -o dir/foo ...
1194
1195 in which case aux outputs are named dir/foo.* and dump outputs
1196 named dir/foo.c.*.
1197
1198 The location and the names of auxiliary and dump outputs can be
1199 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1200 -save-temps=cwd, and -save-temps=obj.
1201
1202 -dumpbase dumpbase
1203 This option sets the base name for auxiliary and dump output files.
1204 It does not affect the name of the primary output file.
1205 Intermediate outputs, when preserved, are not regarded as primary
1206 outputs, but as auxiliary outputs:
1207
1208 gcc -save-temps -S foo.c
1209
1210 saves the (no longer) temporary preprocessed file in foo.i, and
1211 then compiles to the (implied) output file foo.s, whereas:
1212
1213 gcc -save-temps -dumpbase save-foo -c foo.c
1214
1215 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1216 intermediate, thus auxiliary output), and then assembles to the
1217 (implied) output file foo.o.
1218
1219 Absent this option, dump and aux files take their names from the
1220 input file, or from the (non-linker) output file, if one is
1221 explicitly specified: dump output files (e.g. those requested by
1222 -fdump-* options) with the input name suffix, and aux output files
1223 (those requested by other non-dump options, e.g. "-save-temps",
1224 "-gsplit-dwarf", "-fcallgraph-info") without it.
1225
1226 Similar suffix differentiation of dump and aux outputs can be
1227 attained for explicitly-given -dumpbase basename.suf by also
1228 specifying -dumpbase-ext .suf.
1229
1230 If dumpbase is explicitly specified with any directory component,
1231 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1232 ignored, and instead of appending to it, dumpbase fully overrides
1233 it:
1234
1235 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1236 -dumpdir pfx- -save-temps=cwd ...
1237
1238 creates auxiliary and dump outputs named alt/foo.*, disregarding
1239 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1240 -dumpdir.
1241
1242 When -dumpbase is specified in a command that compiles multiple
1243 inputs, or that compiles and then links, it may be combined with
1244 dumppfx, as specified under -dumpdir. Then, each input file is
1245 compiled using the combined dumppfx, and default values for
1246 dumpbase and auxdropsuf are computed for each input file:
1247
1248 gcc foo.c bar.c -c -dumpbase main ...
1249
1250 creates foo.o and bar.o as primary outputs, and avoids overwriting
1251 the auxiliary and dump outputs by using the dumpbase as a prefix,
1252 creating auxiliary and dump outputs named main-foo.* and
1253 main-bar.*.
1254
1255 An empty string specified as dumpbase avoids the influence of the
1256 output basename in the naming of auxiliary and dump outputs during
1257 compilation, computing default values :
1258
1259 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1260
1261 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1262 how their basenames are taken from the input name, but the
1263 directory still defaults to that of the output.
1264
1265 The empty-string dumpbase does not prevent the use of the output
1266 basename for outputs during linking:
1267
1268 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1269
1270 The compilation of the source files will name auxiliary outputs
1271 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1272 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1273 as the prefix for dumps and auxiliary files.
1274
1275 -dumpbase-ext auxdropsuf
1276 When forming the name of an auxiliary (but not a dump) output file,
1277 drop trailing auxdropsuf from dumpbase before appending any
1278 suffixes. If not specified, this option defaults to the suffix of
1279 a default dumpbase, i.e., the suffix of the input file when
1280 -dumpbase is not present in the command line, or dumpbase is
1281 combined with dumppfx.
1282
1283 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1284
1285 creates dir/foo.o as the main output, and generates auxiliary
1286 outputs in dir/x-foo.*, taking the location of the primary output,
1287 and dropping the .c suffix from the dumpbase. Dump outputs retain
1288 the suffix: dir/x-foo.c.*.
1289
1290 This option is disregarded if it does not match the suffix of a
1291 specified dumpbase, except as an alternative to the executable
1292 suffix when appending the linker output base name to dumppfx, as
1293 specified below:
1294
1295 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1296
1297 creates main.out as the primary output, and avoids overwriting the
1298 auxiliary and dump outputs by using the executable name minus
1299 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1300 and main-bar.* and dump outputs named main-foo.c.* and
1301 main-bar.c.*.
1302
1303 -dumpdir dumppfx
1304 When forming the name of an auxiliary or dump output file, use
1305 dumppfx as a prefix:
1306
1307 gcc -dumpdir pfx- -c foo.c ...
1308
1309 creates foo.o as the primary output, and auxiliary outputs named
1310 pfx-foo.*, combining the given dumppfx with the default dumpbase
1311 derived from the default primary output, derived in turn from the
1312 input name. Dump outputs also take the input name suffix:
1313 pfx-foo.c.*.
1314
1315 If dumppfx is to be used as a directory name, it must end with a
1316 directory separator:
1317
1318 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1319
1320 creates obj/bar.o as the primary output, and auxiliary outputs
1321 named dir/bar.*, combining the given dumppfx with the default
1322 dumpbase derived from the primary output name. Dump outputs also
1323 take the input name suffix: dir/bar.c.*.
1324
1325 It defaults to the location of the output file; options
1326 -save-temps=cwd and -save-temps=obj override this default, just
1327 like an explicit -dumpdir option. In case multiple such options
1328 are given, the last one prevails:
1329
1330 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1331
1332 outputs foo.o, with auxiliary outputs named foo.* because
1333 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1334 option. It does not matter that =obj is the default for
1335 -save-temps, nor that the output directory is implicitly the
1336 current directory. Dump outputs are named foo.c.*.
1337
1338 When compiling from multiple input files, if -dumpbase is
1339 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1340 appended to (or override, if containing any directory components)
1341 an explicit or defaulted dumppfx, so that each of the multiple
1342 compilations gets differently-named aux and dump outputs.
1343
1344 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1345
1346 outputs auxiliary dumps to dir/pfx-main-foo.* and
1347 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1348 retain the input file suffix: dir/pfx-main-foo.c.* and
1349 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1350 compilation:
1351
1352 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1353
1354 that, applying -dumpbase to a single source, does not compute and
1355 append a separate dumpbase per input file. Its auxiliary and dump
1356 outputs go in dir/pfx-main.*.
1357
1358 When compiling and then linking from multiple input files, a
1359 defaulted or explicitly specified dumppfx also undergoes the
1360 dumpbase- transformation above (e.g. the compilation of foo.c and
1361 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1362 are given, the linker output base name, minus auxdropsuf, if
1363 specified, or the executable suffix otherwise, plus a dash is
1364 appended to the default dumppfx instead. Note, however, that
1365 unlike earlier cases of linking:
1366
1367 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1368
1369 does not append the output name main to dumppfx, because -dumpdir
1370 is explicitly specified. The goal is that the explicitly-specified
1371 dumppfx may contain the specified output name as part of the
1372 prefix, if desired; only an explicitly-specified -dumpbase would be
1373 combined with it, in order to avoid simply discarding a meaningful
1374 option.
1375
1376 When compiling and then linking from a single input file, the
1377 linker output base name will only be appended to the default
1378 dumppfx as above if it does not share the base name with the single
1379 input file name. This has been covered in single-input linking
1380 cases above, but not with an explicit -dumpdir that inhibits the
1381 combination, even if overridden by -save-temps=*:
1382
1383 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1384
1385 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1386 current working directory as ultimately requested by
1387 -save-temps=cwd.
1388
1389 Summing it all up for an intuitive though slightly imprecise data
1390 flow: the primary output name is broken into a directory part and a
1391 basename part; dumppfx is set to the former, unless overridden by
1392 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1393 unless overriden by -dumpbase. If there are multiple inputs or
1394 linking, this dumpbase may be combined with dumppfx and taken from
1395 each input file. Auxiliary output names for each input are formed
1396 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1397 output suffix; dump output names are only different in that the
1398 suffix from dumpbase is retained.
1399
1400 When it comes to auxiliary and dump outputs created during LTO
1401 recompilation, a combination of dumppfx and dumpbase, as given or
1402 as derived from the linker output name but not from inputs, even in
1403 cases in which this combination would not otherwise be used as
1404 such, is passed down with a trailing period replacing the compiler-
1405 added dash, if any, as a -dumpdir option to lto-wrapper; being
1406 involved in linking, this program does not normally get any
1407 -dumpbase and -dumpbase-ext, and it ignores them.
1408
1409 When running sub-compilers, lto-wrapper appends LTO stage names to
1410 the received dumppfx, ensures it contains a directory component so
1411 that it overrides any -dumpdir, and passes that as -dumpbase to
1412 sub-compilers.
1413
1414 -v Print (on standard error output) the commands executed to run the
1415 stages of compilation. Also print the version number of the
1416 compiler driver program and of the preprocessor and the compiler
1417 proper.
1418
1419 -###
1420 Like -v except the commands are not executed and arguments are
1421 quoted unless they contain only alphanumeric characters or "./-_".
1422 This is useful for shell scripts to capture the driver-generated
1423 command lines.
1424
1425 --help
1426 Print (on the standard output) a description of the command-line
1427 options understood by gcc. If the -v option is also specified then
1428 --help is also passed on to the various processes invoked by gcc,
1429 so that they can display the command-line options they accept. If
1430 the -Wextra option has also been specified (prior to the --help
1431 option), then command-line options that have no documentation
1432 associated with them are also displayed.
1433
1434 --target-help
1435 Print (on the standard output) a description of target-specific
1436 command-line options for each tool. For some targets extra target-
1437 specific information may also be printed.
1438
1439 --help={class|[^]qualifier}[,...]
1440 Print (on the standard output) a description of the command-line
1441 options understood by the compiler that fit into all specified
1442 classes and qualifiers. These are the supported classes:
1443
1444 optimizers
1445 Display all of the optimization options supported by the
1446 compiler.
1447
1448 warnings
1449 Display all of the options controlling warning messages
1450 produced by the compiler.
1451
1452 target
1453 Display target-specific options. Unlike the --target-help
1454 option however, target-specific options of the linker and
1455 assembler are not displayed. This is because those tools do
1456 not currently support the extended --help= syntax.
1457
1458 params
1459 Display the values recognized by the --param option.
1460
1461 language
1462 Display the options supported for language, where language is
1463 the name of one of the languages supported in this version of
1464 GCC. If an option is supported by all languages, one needs to
1465 select common class.
1466
1467 common
1468 Display the options that are common to all languages.
1469
1470 These are the supported qualifiers:
1471
1472 undocumented
1473 Display only those options that are undocumented.
1474
1475 joined
1476 Display options taking an argument that appears after an equal
1477 sign in the same continuous piece of text, such as:
1478 --help=target.
1479
1480 separate
1481 Display options taking an argument that appears as a separate
1482 word following the original option, such as: -o output-file.
1483
1484 Thus for example to display all the undocumented target-specific
1485 switches supported by the compiler, use:
1486
1487 --help=target,undocumented
1488
1489 The sense of a qualifier can be inverted by prefixing it with the ^
1490 character, so for example to display all binary warning options
1491 (i.e., ones that are either on or off and that do not take an
1492 argument) that have a description, use:
1493
1494 --help=warnings,^joined,^undocumented
1495
1496 The argument to --help= should not consist solely of inverted
1497 qualifiers.
1498
1499 Combining several classes is possible, although this usually
1500 restricts the output so much that there is nothing to display. One
1501 case where it does work, however, is when one of the classes is
1502 target. For example, to display all the target-specific
1503 optimization options, use:
1504
1505 --help=target,optimizers
1506
1507 The --help= option can be repeated on the command line. Each
1508 successive use displays its requested class of options, skipping
1509 those that have already been displayed. If --help is also
1510 specified anywhere on the command line then this takes precedence
1511 over any --help= option.
1512
1513 If the -Q option appears on the command line before the --help=
1514 option, then the descriptive text displayed by --help= is changed.
1515 Instead of describing the displayed options, an indication is given
1516 as to whether the option is enabled, disabled or set to a specific
1517 value (assuming that the compiler knows this at the point where the
1518 --help= option is used).
1519
1520 Here is a truncated example from the ARM port of gcc:
1521
1522 % gcc -Q -mabi=2 --help=target -c
1523 The following options are target specific:
1524 -mabi= 2
1525 -mabort-on-noreturn [disabled]
1526 -mapcs [disabled]
1527
1528 The output is sensitive to the effects of previous command-line
1529 options, so for example it is possible to find out which
1530 optimizations are enabled at -O2 by using:
1531
1532 -Q -O2 --help=optimizers
1533
1534 Alternatively you can discover which binary optimizations are
1535 enabled by -O3 by using:
1536
1537 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1538 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1539 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1540
1541 --version
1542 Display the version number and copyrights of the invoked GCC.
1543
1544 -pass-exit-codes
1545 Normally the gcc program exits with the code of 1 if any phase of
1546 the compiler returns a non-success return code. If you specify
1547 -pass-exit-codes, the gcc program instead returns with the
1548 numerically highest error produced by any phase returning an error
1549 indication. The C, C++, and Fortran front ends return 4 if an
1550 internal compiler error is encountered.
1551
1552 -pipe
1553 Use pipes rather than temporary files for communication between the
1554 various stages of compilation. This fails to work on some systems
1555 where the assembler is unable to read from a pipe; but the GNU
1556 assembler has no trouble.
1557
1558 -specs=file
1559 Process file after the compiler reads in the standard specs file,
1560 in order to override the defaults which the gcc driver program uses
1561 when determining what switches to pass to cc1, cc1plus, as, ld,
1562 etc. More than one -specs=file can be specified on the command
1563 line, and they are processed in order, from left to right.
1564
1565 -wrapper
1566 Invoke all subcommands under a wrapper program. The name of the
1567 wrapper program and its parameters are passed as a comma separated
1568 list.
1569
1570 gcc -c t.c -wrapper gdb,--args
1571
1572 This invokes all subprograms of gcc under gdb --args, thus the
1573 invocation of cc1 is gdb --args cc1 ....
1574
1575 -ffile-prefix-map=old=new
1576 When compiling files residing in directory old, record any
1577 references to them in the result of the compilation as if the files
1578 resided in directory new instead. Specifying this option is
1579 equivalent to specifying all the individual -f*-prefix-map options.
1580 This can be used to make reproducible builds that are location
1581 independent. See also -fmacro-prefix-map and -fdebug-prefix-map.
1582
1583 -fplugin=name.so
1584 Load the plugin code in file name.so, assumed to be a shared object
1585 to be dlopen'd by the compiler. The base name of the shared object
1586 file is used to identify the plugin for the purposes of argument
1587 parsing (See -fplugin-arg-name-key=value below). Each plugin
1588 should define the callback functions specified in the Plugins API.
1589
1590 -fplugin-arg-name-key=value
1591 Define an argument called key with a value of value for the plugin
1592 called name.
1593
1594 -fdump-ada-spec[-slim]
1595 For C and C++ source and include files, generate corresponding Ada
1596 specs.
1597
1598 -fada-spec-parent=unit
1599 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1600 specs as child units of parent unit.
1601
1602 -fdump-go-spec=file
1603 For input files in any language, generate corresponding Go
1604 declarations in file. This generates Go "const", "type", "var",
1605 and "func" declarations which may be a useful way to start writing
1606 a Go interface to code written in some other language.
1607
1608 @file
1609 Read command-line options from file. The options read are inserted
1610 in place of the original @file option. If file does not exist, or
1611 cannot be read, then the option will be treated literally, and not
1612 removed.
1613
1614 Options in file are separated by whitespace. A whitespace
1615 character may be included in an option by surrounding the entire
1616 option in either single or double quotes. Any character (including
1617 a backslash) may be included by prefixing the character to be
1618 included with a backslash. The file may itself contain additional
1619 @file options; any such options will be processed recursively.
1620
1621 Compiling C++ Programs
1622 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1623 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1624 (for shared template code) .tcc; and preprocessed C++ files use the
1625 suffix .ii. GCC recognizes files with these names and compiles them as
1626 C++ programs even if you call the compiler the same way as for
1627 compiling C programs (usually with the name gcc).
1628
1629 However, the use of gcc does not add the C++ library. g++ is a program
1630 that calls GCC and automatically specifies linking against the C++
1631 library. It treats .c, .h and .i files as C++ source files instead of
1632 C source files unless -x is used. This program is also useful when
1633 precompiling a C header file with a .h extension for use in C++
1634 compilations. On many systems, g++ is also installed with the name
1635 c++.
1636
1637 When you compile C++ programs, you may specify many of the same
1638 command-line options that you use for compiling programs in any
1639 language; or command-line options meaningful for C and related
1640 languages; or options that are meaningful only for C++ programs.
1641
1642 Options Controlling C Dialect
1643 The following options control the dialect of C (or languages derived
1644 from C, such as C++, Objective-C and Objective-C++) that the compiler
1645 accepts:
1646
1647 -ansi
1648 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1649 equivalent to -std=c++98.
1650
1651 This turns off certain features of GCC that are incompatible with
1652 ISO C90 (when compiling C code), or of standard C++ (when compiling
1653 C++ code), such as the "asm" and "typeof" keywords, and predefined
1654 macros such as "unix" and "vax" that identify the type of system
1655 you are using. It also enables the undesirable and rarely used ISO
1656 trigraph feature. For the C compiler, it disables recognition of
1657 C++ style // comments as well as the "inline" keyword.
1658
1659 The alternate keywords "__asm__", "__extension__", "__inline__" and
1660 "__typeof__" continue to work despite -ansi. You would not want to
1661 use them in an ISO C program, of course, but it is useful to put
1662 them in header files that might be included in compilations done
1663 with -ansi. Alternate predefined macros such as "__unix__" and
1664 "__vax__" are also available, with or without -ansi.
1665
1666 The -ansi option does not cause non-ISO programs to be rejected
1667 gratuitously. For that, -Wpedantic is required in addition to
1668 -ansi.
1669
1670 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1671 used. Some header files may notice this macro and refrain from
1672 declaring certain functions or defining certain macros that the ISO
1673 standard doesn't call for; this is to avoid interfering with any
1674 programs that might use these names for other things.
1675
1676 Functions that are normally built in but do not have semantics
1677 defined by ISO C (such as "alloca" and "ffs") are not built-in
1678 functions when -ansi is used.
1679
1680 -std=
1681 Determine the language standard. This option is currently only
1682 supported when compiling C or C++.
1683
1684 The compiler can accept several base standards, such as c90 or
1685 c++98, and GNU dialects of those standards, such as gnu90 or
1686 gnu++98. When a base standard is specified, the compiler accepts
1687 all programs following that standard plus those using GNU
1688 extensions that do not contradict it. For example, -std=c90 turns
1689 off certain features of GCC that are incompatible with ISO C90,
1690 such as the "asm" and "typeof" keywords, but not other GNU
1691 extensions that do not have a meaning in ISO C90, such as omitting
1692 the middle term of a "?:" expression. On the other hand, when a GNU
1693 dialect of a standard is specified, all features supported by the
1694 compiler are enabled, even when those features change the meaning
1695 of the base standard. As a result, some strict-conforming programs
1696 may be rejected. The particular standard is used by -Wpedantic to
1697 identify which features are GNU extensions given that version of
1698 the standard. For example -std=gnu90 -Wpedantic warns about C++
1699 style // comments, while -std=gnu99 -Wpedantic does not.
1700
1701 A value for this option must be provided; possible values are
1702
1703 c90
1704 c89
1705 iso9899:1990
1706 Support all ISO C90 programs (certain GNU extensions that
1707 conflict with ISO C90 are disabled). Same as -ansi for C code.
1708
1709 iso9899:199409
1710 ISO C90 as modified in amendment 1.
1711
1712 c99
1713 c9x
1714 iso9899:1999
1715 iso9899:199x
1716 ISO C99. This standard is substantially completely supported,
1717 modulo bugs and floating-point issues (mainly but not entirely
1718 relating to optional C99 features from Annexes F and G). See
1719 <http://gcc.gnu.org/c99status.html> for more information. The
1720 names c9x and iso9899:199x are deprecated.
1721
1722 c11
1723 c1x
1724 iso9899:2011
1725 ISO C11, the 2011 revision of the ISO C standard. This
1726 standard is substantially completely supported, modulo bugs,
1727 floating-point issues (mainly but not entirely relating to
1728 optional C11 features from Annexes F and G) and the optional
1729 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1730 The name c1x is deprecated.
1731
1732 c17
1733 c18
1734 iso9899:2017
1735 iso9899:2018
1736 ISO C17, the 2017 revision of the ISO C standard (published in
1737 2018). This standard is same as C11 except for corrections of
1738 defects (all of which are also applied with -std=c11) and a new
1739 value of "__STDC_VERSION__", and so is supported to the same
1740 extent as C11.
1741
1742 c2x The next version of the ISO C standard, still under
1743 development. The support for this version is experimental and
1744 incomplete.
1745
1746 gnu90
1747 gnu89
1748 GNU dialect of ISO C90 (including some C99 features).
1749
1750 gnu99
1751 gnu9x
1752 GNU dialect of ISO C99. The name gnu9x is deprecated.
1753
1754 gnu11
1755 gnu1x
1756 GNU dialect of ISO C11. The name gnu1x is deprecated.
1757
1758 gnu17
1759 gnu18
1760 GNU dialect of ISO C17. This is the default for C code.
1761
1762 gnu2x
1763 The next version of the ISO C standard, still under
1764 development, plus GNU extensions. The support for this version
1765 is experimental and incomplete.
1766
1767 c++98
1768 c++03
1769 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1770 and some additional defect reports. Same as -ansi for C++ code.
1771
1772 gnu++98
1773 gnu++03
1774 GNU dialect of -std=c++98.
1775
1776 c++11
1777 c++0x
1778 The 2011 ISO C++ standard plus amendments. The name c++0x is
1779 deprecated.
1780
1781 gnu++11
1782 gnu++0x
1783 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1784
1785 c++14
1786 c++1y
1787 The 2014 ISO C++ standard plus amendments. The name c++1y is
1788 deprecated.
1789
1790 gnu++14
1791 gnu++1y
1792 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1793
1794 c++17
1795 c++1z
1796 The 2017 ISO C++ standard plus amendments. The name c++1z is
1797 deprecated.
1798
1799 gnu++17
1800 gnu++1z
1801 GNU dialect of -std=c++17. This is the default for C++ code.
1802 The name gnu++1z is deprecated.
1803
1804 c++20
1805 c++2a
1806 The 2020 ISO C++ standard plus amendments. Support is
1807 experimental, and could change in incompatible ways in future
1808 releases. The name c++2a is deprecated.
1809
1810 gnu++20
1811 gnu++2a
1812 GNU dialect of -std=c++20. Support is experimental, and could
1813 change in incompatible ways in future releases. The name
1814 gnu++2a is deprecated.
1815
1816 c++2b
1817 c++23
1818 The next revision of the ISO C++ standard, planned for 2023.
1819 Support is highly experimental, and will almost certainly
1820 change in incompatible ways in future releases.
1821
1822 gnu++2b
1823 gnu++23
1824 GNU dialect of -std=c++2b. Support is highly experimental, and
1825 will almost certainly change in incompatible ways in future
1826 releases.
1827
1828 -fgnu89-inline
1829 The option -fgnu89-inline tells GCC to use the traditional GNU
1830 semantics for "inline" functions when in C99 mode.
1831
1832 Using this option is roughly equivalent to adding the "gnu_inline"
1833 function attribute to all inline functions.
1834
1835 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1836 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1837 specifies the default behavior). This option is not supported in
1838 -std=c90 or -std=gnu90 mode.
1839
1840 The preprocessor macros "__GNUC_GNU_INLINE__" and
1841 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1842 effect for "inline" functions.
1843
1844 -fpermitted-flt-eval-methods=style
1845 ISO/IEC TS 18661-3 defines new permissible values for
1846 "FLT_EVAL_METHOD" that indicate that operations and constants with
1847 a semantic type that is an interchange or extended format should be
1848 evaluated to the precision and range of that type. These new
1849 values are a superset of those permitted under C99/C11, which does
1850 not specify the meaning of other positive values of
1851 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
1852 been written expecting the possibility of the new values.
1853
1854 -fpermitted-flt-eval-methods specifies whether the compiler should
1855 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
1856 the extended set of values specified in ISO/IEC TS 18661-3.
1857
1858 style is either "c11" or "ts-18661-3" as appropriate.
1859
1860 The default when in a standards compliant mode (-std=c11 or
1861 similar) is -fpermitted-flt-eval-methods=c11. The default when in
1862 a GNU dialect (-std=gnu11 or similar) is
1863 -fpermitted-flt-eval-methods=ts-18661-3.
1864
1865 -aux-info filename
1866 Output to the given filename prototyped declarations for all
1867 functions declared and/or defined in a translation unit, including
1868 those in header files. This option is silently ignored in any
1869 language other than C.
1870
1871 Besides declarations, the file indicates, in comments, the origin
1872 of each declaration (source file and line), whether the declaration
1873 was implicit, prototyped or unprototyped (I, N for new or O for
1874 old, respectively, in the first character after the line number and
1875 the colon), and whether it came from a declaration or a definition
1876 (C or F, respectively, in the following character). In the case of
1877 function definitions, a K&R-style list of arguments followed by
1878 their declarations is also provided, inside comments, after the
1879 declaration.
1880
1881 -fallow-parameterless-variadic-functions
1882 Accept variadic functions without named parameters.
1883
1884 Although it is possible to define such a function, this is not very
1885 useful as it is not possible to read the arguments. This is only
1886 supported for C as this construct is allowed by C++.
1887
1888 -fno-asm
1889 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1890 code can use these words as identifiers. You can use the keywords
1891 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
1892 -fno-asm.
1893
1894 In C++, this switch only affects the "typeof" keyword, since "asm"
1895 and "inline" are standard keywords. You may want to use the
1896 -fno-gnu-keywords flag instead, which has the same effect. In C99
1897 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
1898 and "typeof" keywords, since "inline" is a standard keyword in ISO
1899 C99.
1900
1901 -fno-builtin
1902 -fno-builtin-function
1903 Don't recognize built-in functions that do not begin with
1904 __builtin_ as prefix.
1905
1906 GCC normally generates special code to handle certain built-in
1907 functions more efficiently; for instance, calls to "alloca" may
1908 become single instructions which adjust the stack directly, and
1909 calls to "memcpy" may become inline copy loops. The resulting code
1910 is often both smaller and faster, but since the function calls no
1911 longer appear as such, you cannot set a breakpoint on those calls,
1912 nor can you change the behavior of the functions by linking with a
1913 different library. In addition, when a function is recognized as a
1914 built-in function, GCC may use information about that function to
1915 warn about problems with calls to that function, or to generate
1916 more efficient code, even if the resulting code still contains
1917 calls to that function. For example, warnings are given with
1918 -Wformat for bad calls to "printf" when "printf" is built in and
1919 "strlen" is known not to modify global memory.
1920
1921 With the -fno-builtin-function option only the built-in function
1922 function is disabled. function must not begin with __builtin_. If
1923 a function is named that is not built-in in this version of GCC,
1924 this option is ignored. There is no corresponding
1925 -fbuiltin-function option; if you wish to enable built-in functions
1926 selectively when using -fno-builtin or -ffreestanding, you may
1927 define macros such as:
1928
1929 #define abs(n) __builtin_abs ((n))
1930 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1931
1932 -fgimple
1933 Enable parsing of function definitions marked with "__GIMPLE".
1934 This is an experimental feature that allows unit testing of GIMPLE
1935 passes.
1936
1937 -fhosted
1938 Assert that compilation targets a hosted environment. This implies
1939 -fbuiltin. A hosted environment is one in which the entire
1940 standard library is available, and in which "main" has a return
1941 type of "int". Examples are nearly everything except a kernel.
1942 This is equivalent to -fno-freestanding.
1943
1944 -ffreestanding
1945 Assert that compilation targets a freestanding environment. This
1946 implies -fno-builtin. A freestanding environment is one in which
1947 the standard library may not exist, and program startup may not
1948 necessarily be at "main". The most obvious example is an OS
1949 kernel. This is equivalent to -fno-hosted.
1950
1951 -fopenacc
1952 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
1953 "!$acc" in Fortran. When -fopenacc is specified, the compiler
1954 generates accelerated code according to the OpenACC Application
1955 Programming Interface v2.6 <https://www.openacc.org>. This option
1956 implies -pthread, and thus is only supported on targets that have
1957 support for -pthread.
1958
1959 -fopenacc-dim=geom
1960 Specify default compute dimensions for parallel offload regions
1961 that do not explicitly specify. The geom value is a triple of
1962 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
1963 size can be omitted, to use a target-specific default value.
1964
1965 -fopenmp
1966 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
1967 "!$omp" in Fortran. When -fopenmp is specified, the compiler
1968 generates parallel code according to the OpenMP Application Program
1969 Interface v4.5 <https://www.openmp.org>. This option implies
1970 -pthread, and thus is only supported on targets that have support
1971 for -pthread. -fopenmp implies -fopenmp-simd.
1972
1973 -fopenmp-simd
1974 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
1975 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
1976
1977 -fgnu-tm
1978 When the option -fgnu-tm is specified, the compiler generates code
1979 for the Linux variant of Intel's current Transactional Memory ABI
1980 specification document (Revision 1.1, May 6 2009). This is an
1981 experimental feature whose interface may change in future versions
1982 of GCC, as the official specification changes. Please note that
1983 not all architectures are supported for this feature.
1984
1985 For more information on GCC's support for transactional memory,
1986
1987 Note that the transactional memory feature is not supported with
1988 non-call exceptions (-fnon-call-exceptions).
1989
1990 -fms-extensions
1991 Accept some non-standard constructs used in Microsoft header files.
1992
1993 In C++ code, this allows member names in structures to be similar
1994 to previous types declarations.
1995
1996 typedef int UOW;
1997 struct ABC {
1998 UOW UOW;
1999 };
2000
2001 Some cases of unnamed fields in structures and unions are only
2002 accepted with this option.
2003
2004 Note that this option is off for all targets except for x86 targets
2005 using ms-abi.
2006
2007 -fplan9-extensions
2008 Accept some non-standard constructs used in Plan 9 code.
2009
2010 This enables -fms-extensions, permits passing pointers to
2011 structures with anonymous fields to functions that expect pointers
2012 to elements of the type of the field, and permits referring to
2013 anonymous fields declared using a typedef. This is only
2014 supported for C, not C++.
2015
2016 -fcond-mismatch
2017 Allow conditional expressions with mismatched types in the second
2018 and third arguments. The value of such an expression is void.
2019 This option is not supported for C++.
2020
2021 -flax-vector-conversions
2022 Allow implicit conversions between vectors with differing numbers
2023 of elements and/or incompatible element types. This option should
2024 not be used for new code.
2025
2026 -funsigned-char
2027 Let the type "char" be unsigned, like "unsigned char".
2028
2029 Each kind of machine has a default for what "char" should be. It
2030 is either like "unsigned char" by default or like "signed char" by
2031 default.
2032
2033 Ideally, a portable program should always use "signed char" or
2034 "unsigned char" when it depends on the signedness of an object.
2035 But many programs have been written to use plain "char" and expect
2036 it to be signed, or expect it to be unsigned, depending on the
2037 machines they were written for. This option, and its inverse, let
2038 you make such a program work with the opposite default.
2039
2040 The type "char" is always a distinct type from each of "signed
2041 char" or "unsigned char", even though its behavior is always just
2042 like one of those two.
2043
2044 -fsigned-char
2045 Let the type "char" be signed, like "signed char".
2046
2047 Note that this is equivalent to -fno-unsigned-char, which is the
2048 negative form of -funsigned-char. Likewise, the option
2049 -fno-signed-char is equivalent to -funsigned-char.
2050
2051 -fsigned-bitfields
2052 -funsigned-bitfields
2053 -fno-signed-bitfields
2054 -fno-unsigned-bitfields
2055 These options control whether a bit-field is signed or unsigned,
2056 when the declaration does not use either "signed" or "unsigned".
2057 By default, such a bit-field is signed, because this is consistent:
2058 the basic integer types such as "int" are signed types.
2059
2060 -fsso-struct=endianness
2061 Set the default scalar storage order of structures and unions to
2062 the specified endianness. The accepted values are big-endian,
2063 little-endian and native for the native endianness of the target
2064 (the default). This option is not supported for C++.
2065
2066 Warning: the -fsso-struct switch causes GCC to generate code that
2067 is not binary compatible with code generated without it if the
2068 specified endianness is not the native endianness of the target.
2069
2070 Options Controlling C++ Dialect
2071 This section describes the command-line options that are only
2072 meaningful for C++ programs. You can also use most of the GNU compiler
2073 options regardless of what language your program is in. For example,
2074 you might compile a file firstClass.C like this:
2075
2076 g++ -g -fstrict-enums -O -c firstClass.C
2077
2078 In this example, only -fstrict-enums is an option meant only for C++
2079 programs; you can use the other options with any language supported by
2080 GCC.
2081
2082 Some options for compiling C programs, such as -std, are also relevant
2083 for C++ programs.
2084
2085 Here is a list of options that are only for compiling C++ programs:
2086
2087 -fabi-version=n
2088 Use version n of the C++ ABI. The default is version 0.
2089
2090 Version 0 refers to the version conforming most closely to the C++
2091 ABI specification. Therefore, the ABI obtained using version 0
2092 will change in different versions of G++ as ABI bugs are fixed.
2093
2094 Version 1 is the version of the C++ ABI that first appeared in G++
2095 3.2.
2096
2097 Version 2 is the version of the C++ ABI that first appeared in G++
2098 3.4, and was the default through G++ 4.9.
2099
2100 Version 3 corrects an error in mangling a constant address as a
2101 template argument.
2102
2103 Version 4, which first appeared in G++ 4.5, implements a standard
2104 mangling for vector types.
2105
2106 Version 5, which first appeared in G++ 4.6, corrects the mangling
2107 of attribute const/volatile on function pointer types, decltype of
2108 a plain decl, and use of a function parameter in the declaration of
2109 another parameter.
2110
2111 Version 6, which first appeared in G++ 4.7, corrects the promotion
2112 behavior of C++11 scoped enums and the mangling of template
2113 argument packs, const/static_cast, prefix ++ and --, and a class
2114 scope function used as a template argument.
2115
2116 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2117 as a builtin type and corrects the mangling of lambdas in default
2118 argument scope.
2119
2120 Version 8, which first appeared in G++ 4.9, corrects the
2121 substitution behavior of function types with function-cv-
2122 qualifiers.
2123
2124 Version 9, which first appeared in G++ 5.2, corrects the alignment
2125 of "nullptr_t".
2126
2127 Version 10, which first appeared in G++ 6.1, adds mangling of
2128 attributes that affect type identity, such as ia32 calling
2129 convention attributes (e.g. stdcall).
2130
2131 Version 11, which first appeared in G++ 7, corrects the mangling of
2132 sizeof... expressions and operator names. For multiple entities
2133 with the same name within a function, that are declared in
2134 different scopes, the mangling now changes starting with the
2135 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2136
2137 Version 12, which first appeared in G++ 8, corrects the calling
2138 conventions for empty classes on the x86_64 target and for classes
2139 with only deleted copy/move constructors. It accidentally changes
2140 the calling convention for classes with a deleted copy constructor
2141 and a trivial move constructor.
2142
2143 Version 13, which first appeared in G++ 8.2, fixes the accidental
2144 change in version 12.
2145
2146 Version 14, which first appeared in G++ 10, corrects the mangling
2147 of the nullptr expression.
2148
2149 Version 15, which first appeared in G++ 11, changes the mangling of
2150 "__alignof__" to be distinct from that of "alignof", and dependent
2151 operator names.
2152
2153 See also -Wabi.
2154
2155 -fabi-compat-version=n
2156 On targets that support strong aliases, G++ works around mangling
2157 changes by creating an alias with the correct mangled name when
2158 defining a symbol with an incorrect mangled name. This switch
2159 specifies which ABI version to use for the alias.
2160
2161 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
2162 compatibility). If another ABI version is explicitly selected,
2163 this defaults to 0. For compatibility with GCC versions 3.2
2164 through 4.9, use -fabi-compat-version=2.
2165
2166 If this option is not provided but -Wabi=n is, that version is used
2167 for compatibility aliases. If this option is provided along with
2168 -Wabi (without the version), the version from this option is used
2169 for the warning.
2170
2171 -fno-access-control
2172 Turn off all access checking. This switch is mainly useful for
2173 working around bugs in the access control code.
2174
2175 -faligned-new
2176 Enable support for C++17 "new" of types that require more alignment
2177 than "void* ::operator new(std::size_t)" provides. A numeric
2178 argument such as "-faligned-new=32" can be used to specify how much
2179 alignment (in bytes) is provided by that function, but few users
2180 will need to override the default of "alignof(std::max_align_t)".
2181
2182 This flag is enabled by default for -std=c++17.
2183
2184 -fchar8_t
2185 -fno-char8_t
2186 Enable support for "char8_t" as adopted for C++20. This includes
2187 the addition of a new "char8_t" fundamental type, changes to the
2188 types of UTF-8 string and character literals, new signatures for
2189 user-defined literals, associated standard library updates, and new
2190 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2191
2192 This option enables functions to be overloaded for ordinary and
2193 UTF-8 strings:
2194
2195 int f(const char *); // #1
2196 int f(const char8_t *); // #2
2197 int v1 = f("text"); // Calls #1
2198 int v2 = f(u8"text"); // Calls #2
2199
2200 and introduces new signatures for user-defined literals:
2201
2202 int operator""_udl1(char8_t);
2203 int v3 = u8'x'_udl1;
2204 int operator""_udl2(const char8_t*, std::size_t);
2205 int v4 = u8"text"_udl2;
2206 template<typename T, T...> int operator""_udl3();
2207 int v5 = u8"text"_udl3;
2208
2209 The change to the types of UTF-8 string and character literals
2210 introduces incompatibilities with ISO C++11 and later standards.
2211 For example, the following code is well-formed under ISO C++11, but
2212 is ill-formed when -fchar8_t is specified.
2213
2214 char ca[] = u8"xx"; // error: char-array initialized from wide
2215 // string
2216 const char *cp = u8"xx";// error: invalid conversion from
2217 // `const char8_t*' to `const char*'
2218 int f(const char*);
2219 auto v = f(u8"xx"); // error: invalid conversion from
2220 // `const char8_t*' to `const char*'
2221 std::string s{u8"xx"}; // error: no matching function for call to
2222 // `std::basic_string<char>::basic_string()'
2223 using namespace std::literals;
2224 s = u8"xx"s; // error: conversion from
2225 // `basic_string<char8_t>' to non-scalar
2226 // type `basic_string<char>' requested
2227
2228 -fcheck-new
2229 Check that the pointer returned by "operator new" is non-null
2230 before attempting to modify the storage allocated. This check is
2231 normally unnecessary because the C++ standard specifies that
2232 "operator new" only returns 0 if it is declared "throw()", in which
2233 case the compiler always checks the return value even without this
2234 option. In all other cases, when "operator new" has a non-empty
2235 exception specification, memory exhaustion is signalled by throwing
2236 "std::bad_alloc". See also new (nothrow).
2237
2238 -fconcepts
2239 -fconcepts-ts
2240 Below -std=c++20, -fconcepts enables support for the C++ Extensions
2241 for Concepts Technical Specification, ISO 19217 (2015).
2242
2243 With -std=c++20 and above, Concepts are part of the language
2244 standard, so -fconcepts defaults to on. But the standard
2245 specification of Concepts differs significantly from the TS, so
2246 some constructs that were allowed in the TS but didn't make it into
2247 the standard can still be enabled by -fconcepts-ts.
2248
2249 -fconstexpr-depth=n
2250 Set the maximum nested evaluation depth for C++11 constexpr
2251 functions to n. A limit is needed to detect endless recursion
2252 during constant expression evaluation. The minimum specified by
2253 the standard is 512.
2254
2255 -fconstexpr-cache-depth=n
2256 Set the maximum level of nested evaluation depth for C++11
2257 constexpr functions that will be cached to n. This is a heuristic
2258 that trades off compilation speed (when the cache avoids repeated
2259 calculations) against memory consumption (when the cache grows very
2260 large from highly recursive evaluations). The default is 8. Very
2261 few users are likely to want to adjust it, but if your code does
2262 heavy constexpr calculations you might want to experiment to find
2263 which value works best for you.
2264
2265 -fconstexpr-loop-limit=n
2266 Set the maximum number of iterations for a loop in C++14 constexpr
2267 functions to n. A limit is needed to detect infinite loops during
2268 constant expression evaluation. The default is 262144 (1<<18).
2269
2270 -fconstexpr-ops-limit=n
2271 Set the maximum number of operations during a single constexpr
2272 evaluation. Even when number of iterations of a single loop is
2273 limited with the above limit, if there are several nested loops and
2274 each of them has many iterations but still smaller than the above
2275 limit, or if in a body of some loop or even outside of a loop too
2276 many expressions need to be evaluated, the resulting constexpr
2277 evaluation might take too long. The default is 33554432 (1<<25).
2278
2279 -fcoroutines
2280 Enable support for the C++ coroutines extension (experimental).
2281
2282 -fno-elide-constructors
2283 The C++ standard allows an implementation to omit creating a
2284 temporary that is only used to initialize another object of the
2285 same type. Specifying this option disables that optimization, and
2286 forces G++ to call the copy constructor in all cases. This option
2287 also causes G++ to call trivial member functions which otherwise
2288 would be expanded inline.
2289
2290 In C++17, the compiler is required to omit these temporaries, but
2291 this option still affects trivial member functions.
2292
2293 -fno-enforce-eh-specs
2294 Don't generate code to check for violation of exception
2295 specifications at run time. This option violates the C++ standard,
2296 but may be useful for reducing code size in production builds, much
2297 like defining "NDEBUG". This does not give user code permission to
2298 throw exceptions in violation of the exception specifications; the
2299 compiler still optimizes based on the specifications, so throwing
2300 an unexpected exception results in undefined behavior at run time.
2301
2302 -fextern-tls-init
2303 -fno-extern-tls-init
2304 The C++11 and OpenMP standards allow "thread_local" and
2305 "threadprivate" variables to have dynamic (runtime) initialization.
2306 To support this, any use of such a variable goes through a wrapper
2307 function that performs any necessary initialization. When the use
2308 and definition of the variable are in the same translation unit,
2309 this overhead can be optimized away, but when the use is in a
2310 different translation unit there is significant overhead even if
2311 the variable doesn't actually need dynamic initialization. If the
2312 programmer can be sure that no use of the variable in a non-
2313 defining TU needs to trigger dynamic initialization (either because
2314 the variable is statically initialized, or a use of the variable in
2315 the defining TU will be executed before any uses in another TU),
2316 they can avoid this overhead with the -fno-extern-tls-init option.
2317
2318 On targets that support symbol aliases, the default is
2319 -fextern-tls-init. On targets that do not support symbol aliases,
2320 the default is -fno-extern-tls-init.
2321
2322 -fno-gnu-keywords
2323 Do not recognize "typeof" as a keyword, so that code can use this
2324 word as an identifier. You can use the keyword "__typeof__"
2325 instead. This option is implied by the strict ISO C++ dialects:
2326 -ansi, -std=c++98, -std=c++11, etc.
2327
2328 -fno-implicit-templates
2329 Never emit code for non-inline templates that are instantiated
2330 implicitly (i.e. by use); only emit code for explicit
2331 instantiations. If you use this option, you must take care to
2332 structure your code to include all the necessary explicit
2333 instantiations to avoid getting undefined symbols at link time.
2334
2335 -fno-implicit-inline-templates
2336 Don't emit code for implicit instantiations of inline templates,
2337 either. The default is to handle inlines differently so that
2338 compiles with and without optimization need the same set of
2339 explicit instantiations.
2340
2341 -fno-implement-inlines
2342 To save space, do not emit out-of-line copies of inline functions
2343 controlled by "#pragma implementation". This causes linker errors
2344 if these functions are not inlined everywhere they are called.
2345
2346 -fmodules-ts
2347 -fno-modules-ts
2348 Enable support for C++20 modules The -fno-modules-ts is usually
2349 not needed, as that is the default. Even though this is a C++20
2350 feature, it is not currently implicitly enabled by selecting that
2351 standard version.
2352
2353 -fmodule-header
2354 -fmodule-header=user
2355 -fmodule-header=system
2356 Compile a header file to create an importable header unit.
2357
2358 -fmodule-implicit-inline
2359 Member functions defined in their class definitions are not
2360 implicitly inline for modular code. This is different to
2361 traditional C++ behavior, for good reasons. However, it may result
2362 in a difficulty during code porting. This option makes such
2363 function definitions implicitly inline. It does however generate
2364 an ABI incompatibility, so you must use it everywhere or nowhere.
2365 (Such definitions outside of a named module remain implicitly
2366 inline, regardless.)
2367
2368 -fno-module-lazy
2369 Disable lazy module importing and module mapper creation.
2370
2371 -fmodule-mapper=[hostname]:port[?ident]
2372 -fmodule-mapper=|program[?ident] args...
2373 -fmodule-mapper==socket[?ident]
2374 -fmodule-mapper=<>[inout][?ident]
2375 -fmodule-mapper=<in>out[?ident]
2376 -fmodule-mapper=file[?ident]
2377 An oracle to query for module name to filename mappings. If
2378 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2379 if that is unset, an in-process default is provided.
2380
2381 -fmodule-only
2382 Only emit the Compiled Module Interface, inhibiting any object
2383 file.
2384
2385 -fms-extensions
2386 Disable Wpedantic warnings about constructs used in MFC, such as
2387 implicit int and getting a pointer to member function via non-
2388 standard syntax.
2389
2390 -fnew-inheriting-ctors
2391 Enable the P0136 adjustment to the semantics of C++11 constructor
2392 inheritance. This is part of C++17 but also considered to be a
2393 Defect Report against C++11 and C++14. This flag is enabled by
2394 default unless -fabi-version=10 or lower is specified.
2395
2396 -fnew-ttp-matching
2397 Enable the P0522 resolution to Core issue 150, template template
2398 parameters and default arguments: this allows a template with
2399 default template arguments as an argument for a template template
2400 parameter with fewer template parameters. This flag is enabled by
2401 default for -std=c++17.
2402
2403 -fno-nonansi-builtins
2404 Disable built-in declarations of functions that are not mandated by
2405 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2406 "bzero", "conjf", and other related functions.
2407
2408 -fnothrow-opt
2409 Treat a "throw()" exception specification as if it were a
2410 "noexcept" specification to reduce or eliminate the text size
2411 overhead relative to a function with no exception specification.
2412 If the function has local variables of types with non-trivial
2413 destructors, the exception specification actually makes the
2414 function smaller because the EH cleanups for those variables can be
2415 optimized away. The semantic effect is that an exception thrown
2416 out of a function with such an exception specification results in a
2417 call to "terminate" rather than "unexpected".
2418
2419 -fno-operator-names
2420 Do not treat the operator name keywords "and", "bitand", "bitor",
2421 "compl", "not", "or" and "xor" as synonyms as keywords.
2422
2423 -fno-optional-diags
2424 Disable diagnostics that the standard says a compiler does not need
2425 to issue. Currently, the only such diagnostic issued by G++ is the
2426 one for a name having multiple meanings within a class.
2427
2428 -fpermissive
2429 Downgrade some diagnostics about nonconformant code from errors to
2430 warnings. Thus, using -fpermissive allows some nonconforming code
2431 to compile.
2432
2433 -fno-pretty-templates
2434 When an error message refers to a specialization of a function
2435 template, the compiler normally prints the signature of the
2436 template followed by the template arguments and any typedefs or
2437 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2438 than "void f(int)") so that it's clear which template is involved.
2439 When an error message refers to a specialization of a class
2440 template, the compiler omits any template arguments that match the
2441 default template arguments for that template. If either of these
2442 behaviors make it harder to understand the error message rather
2443 than easier, you can use -fno-pretty-templates to disable them.
2444
2445 -fno-rtti
2446 Disable generation of information about every class with virtual
2447 functions for use by the C++ run-time type identification features
2448 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2449 language, you can save some space by using this flag. Note that
2450 exception handling uses the same information, but G++ generates it
2451 as needed. The "dynamic_cast" operator can still be used for casts
2452 that do not require run-time type information, i.e. casts to "void
2453 *" or to unambiguous base classes.
2454
2455 Mixing code compiled with -frtti with that compiled with -fno-rtti
2456 may not work. For example, programs may fail to link if a class
2457 compiled with -fno-rtti is used as a base for a class compiled with
2458 -frtti.
2459
2460 -fsized-deallocation
2461 Enable the built-in global declarations
2462
2463 void operator delete (void *, std::size_t) noexcept;
2464 void operator delete[] (void *, std::size_t) noexcept;
2465
2466 as introduced in C++14. This is useful for user-defined
2467 replacement deallocation functions that, for example, use the size
2468 of the object to make deallocation faster. Enabled by default
2469 under -std=c++14 and above. The flag -Wsized-deallocation warns
2470 about places that might want to add a definition.
2471
2472 -fstrict-enums
2473 Allow the compiler to optimize using the assumption that a value of
2474 enumerated type can only be one of the values of the enumeration
2475 (as defined in the C++ standard; basically, a value that can be
2476 represented in the minimum number of bits needed to represent all
2477 the enumerators). This assumption may not be valid if the program
2478 uses a cast to convert an arbitrary integer value to the enumerated
2479 type.
2480
2481 -fstrong-eval-order
2482 Evaluate member access, array subscripting, and shift expressions
2483 in left-to-right order, and evaluate assignment in right-to-left
2484 order, as adopted for C++17. Enabled by default with -std=c++17.
2485 -fstrong-eval-order=some enables just the ordering of member access
2486 and shift expressions, and is the default without -std=c++17.
2487
2488 -ftemplate-backtrace-limit=n
2489 Set the maximum number of template instantiation notes for a single
2490 warning or error to n. The default value is 10.
2491
2492 -ftemplate-depth=n
2493 Set the maximum instantiation depth for template classes to n. A
2494 limit on the template instantiation depth is needed to detect
2495 endless recursions during template class instantiation. ANSI/ISO
2496 C++ conforming programs must not rely on a maximum depth greater
2497 than 17 (changed to 1024 in C++11). The default value is 900, as
2498 the compiler can run out of stack space before hitting 1024 in some
2499 situations.
2500
2501 -fno-threadsafe-statics
2502 Do not emit the extra code to use the routines specified in the C++
2503 ABI for thread-safe initialization of local statics. You can use
2504 this option to reduce code size slightly in code that doesn't need
2505 to be thread-safe.
2506
2507 -fuse-cxa-atexit
2508 Register destructors for objects with static storage duration with
2509 the "__cxa_atexit" function rather than the "atexit" function.
2510 This option is required for fully standards-compliant handling of
2511 static destructors, but only works if your C library supports
2512 "__cxa_atexit".
2513
2514 -fno-use-cxa-get-exception-ptr
2515 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2516 causes "std::uncaught_exception" to be incorrect, but is necessary
2517 if the runtime routine is not available.
2518
2519 -fvisibility-inlines-hidden
2520 This switch declares that the user does not attempt to compare
2521 pointers to inline functions or methods where the addresses of the
2522 two functions are taken in different shared objects.
2523
2524 The effect of this is that GCC may, effectively, mark inline
2525 methods with "__attribute__ ((visibility ("hidden")))" so that they
2526 do not appear in the export table of a DSO and do not require a PLT
2527 indirection when used within the DSO. Enabling this option can
2528 have a dramatic effect on load and link times of a DSO as it
2529 massively reduces the size of the dynamic export table when the
2530 library makes heavy use of templates.
2531
2532 The behavior of this switch is not quite the same as marking the
2533 methods as hidden directly, because it does not affect static
2534 variables local to the function or cause the compiler to deduce
2535 that the function is defined in only one shared object.
2536
2537 You may mark a method as having a visibility explicitly to negate
2538 the effect of the switch for that method. For example, if you do
2539 want to compare pointers to a particular inline method, you might
2540 mark it as having default visibility. Marking the enclosing class
2541 with explicit visibility has no effect.
2542
2543 Explicitly instantiated inline methods are unaffected by this
2544 option as their linkage might otherwise cross a shared library
2545 boundary.
2546
2547 -fvisibility-ms-compat
2548 This flag attempts to use visibility settings to make GCC's C++
2549 linkage model compatible with that of Microsoft Visual Studio.
2550
2551 The flag makes these changes to GCC's linkage model:
2552
2553 1. It sets the default visibility to "hidden", like
2554 -fvisibility=hidden.
2555
2556 2. Types, but not their members, are not hidden by default.
2557
2558 3. The One Definition Rule is relaxed for types without explicit
2559 visibility specifications that are defined in more than one
2560 shared object: those declarations are permitted if they are
2561 permitted when this option is not used.
2562
2563 In new code it is better to use -fvisibility=hidden and export
2564 those classes that are intended to be externally visible.
2565 Unfortunately it is possible for code to rely, perhaps
2566 accidentally, on the Visual Studio behavior.
2567
2568 Among the consequences of these changes are that static data
2569 members of the same type with the same name but defined in
2570 different shared objects are different, so changing one does not
2571 change the other; and that pointers to function members defined in
2572 different shared objects may not compare equal. When this flag is
2573 given, it is a violation of the ODR to define types with the same
2574 name differently.
2575
2576 -fno-weak
2577 Do not use weak symbol support, even if it is provided by the
2578 linker. By default, G++ uses weak symbols if they are available.
2579 This option exists only for testing, and should not be used by end-
2580 users; it results in inferior code and has no benefits. This
2581 option may be removed in a future release of G++.
2582
2583 -fext-numeric-literals (C++ and Objective-C++ only)
2584 Accept imaginary, fixed-point, or machine-defined literal number
2585 suffixes as GNU extensions. When this option is turned off these
2586 suffixes are treated as C++11 user-defined literal numeric
2587 suffixes. This is on by default for all pre-C++11 dialects and all
2588 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2589 This option is off by default for ISO C++11 onwards (-std=c++11,
2590 ...).
2591
2592 -nostdinc++
2593 Do not search for header files in the standard directories specific
2594 to C++, but do still search the other standard directories. (This
2595 option is used when building the C++ library.)
2596
2597 -flang-info-include-translate
2598 -flang-info-include-translate-not
2599 -flang-info-include-translate=header
2600 Inform of include translation events. The first will note accepted
2601 include translations, the second will note declined include
2602 translations. The header form will inform of include translations
2603 relating to that specific header. If header is of the form "user"
2604 or "<system>" it will be resolved to a specific user or system
2605 header using the include path.
2606
2607 -flang-info-module-cmi
2608 -flang-info-module-cmi=module
2609 Inform of Compiled Module Interface pathnames. The first will note
2610 all read CMI pathnames. The module form will not reading a
2611 specific module's CMI. module may be a named module or a header-
2612 unit (the latter indicated by either being a pathname containing
2613 directory separators or enclosed in "<>" or "").
2614
2615 -stdlib=libstdc++,libc++
2616 When G++ is configured to support this option, it allows
2617 specification of alternate C++ runtime libraries. Two options are
2618 available: libstdc++ (the default, native C++ runtime for G++) and
2619 libc++ which is the C++ runtime installed on some operating systems
2620 (e.g. Darwin versions from Darwin11 onwards). The option switches
2621 G++ to use the headers from the specified library and to emit
2622 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2623 for linking.
2624
2625 In addition, these warning options have meanings only for C++ programs:
2626
2627 -Wabi-tag (C++ and Objective-C++ only)
2628 Warn when a type with an ABI tag is used in a context that does not
2629 have that ABI tag. See C++ Attributes for more information about
2630 ABI tags.
2631
2632 -Wcomma-subscript (C++ and Objective-C++ only)
2633 Warn about uses of a comma expression within a subscripting
2634 expression. This usage was deprecated in C++20. However, a comma
2635 expression wrapped in "( )" is not deprecated. Example:
2636
2637 void f(int *a, int b, int c) {
2638 a[b,c]; // deprecated
2639 a[(b,c)]; // OK
2640 }
2641
2642 Enabled by default with -std=c++20.
2643
2644 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2645 Warn when performing class template argument deduction (CTAD) on a
2646 type with no explicitly written deduction guides. This warning
2647 will point out cases where CTAD succeeded only because the compiler
2648 synthesized the implicit deduction guides, which might not be what
2649 the programmer intended. Certain style guides allow CTAD only on
2650 types that specifically "opt-in"; i.e., on types that are designed
2651 to support CTAD. This warning can be suppressed with the following
2652 pattern:
2653
2654 struct allow_ctad_t; // any name works
2655 template <typename T> struct S {
2656 S(T) { }
2657 };
2658 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
2659
2660 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2661 Warn when a class seems unusable because all the constructors or
2662 destructors in that class are private, and it has neither friends
2663 nor public static member functions. Also warn if there are no non-
2664 private methods, and there's at least one private member function
2665 that isn't a constructor or destructor.
2666
2667 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2668 Warn when "delete" is used to destroy an instance of a class that
2669 has virtual functions and non-virtual destructor. It is unsafe to
2670 delete an instance of a derived class through a pointer to a base
2671 class if the base class does not have a virtual destructor. This
2672 warning is enabled by -Wall.
2673
2674 -Wdeprecated-copy (C++ and Objective-C++ only)
2675 Warn that the implicit declaration of a copy constructor or copy
2676 assignment operator is deprecated if the class has a user-provided
2677 copy constructor or copy assignment operator, in C++11 and up.
2678 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2679 also deprecate if the class has a user-provided destructor.
2680
2681 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2682 Disable the warning about the case when the usual arithmetic
2683 conversions are applied on operands where one is of enumeration
2684 type and the other is of a different enumeration type. This
2685 conversion was deprecated in C++20. For example:
2686
2687 enum E1 { e };
2688 enum E2 { f };
2689 int k = f - e;
2690
2691 -Wdeprecated-enum-enum-conversion is enabled by default with
2692 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2693 -Wenum-conversion.
2694
2695 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2696 Disable the warning about the case when the usual arithmetic
2697 conversions are applied on operands where one is of enumeration
2698 type and the other is of a floating-point type. This conversion
2699 was deprecated in C++20. For example:
2700
2701 enum E1 { e };
2702 enum E2 { f };
2703 bool b = e <= 3.7;
2704
2705 -Wdeprecated-enum-float-conversion is enabled by default with
2706 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2707 -Wenum-conversion.
2708
2709 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2710 Do not warn about uses of "std::initializer_list" that are likely
2711 to result in dangling pointers. Since the underlying array for an
2712 "initializer_list" is handled like a normal C++ temporary object,
2713 it is easy to inadvertently keep a pointer to the array past the
2714 end of the array's lifetime. For example:
2715
2716 * If a function returns a temporary "initializer_list", or a
2717 local "initializer_list" variable, the array's lifetime ends at
2718 the end of the return statement, so the value returned has a
2719 dangling pointer.
2720
2721 * If a new-expression creates an "initializer_list", the array
2722 only lives until the end of the enclosing full-expression, so
2723 the "initializer_list" in the heap has a dangling pointer.
2724
2725 * When an "initializer_list" variable is assigned from a brace-
2726 enclosed initializer list, the temporary array created for the
2727 right side of the assignment only lives until the end of the
2728 full-expression, so at the next statement the
2729 "initializer_list" variable has a dangling pointer.
2730
2731 // li's initial underlying array lives as long as li
2732 std::initializer_list<int> li = { 1,2,3 };
2733 // assignment changes li to point to a temporary array
2734 li = { 4, 5 };
2735 // now the temporary is gone and li has a dangling pointer
2736 int i = li.begin()[0] // undefined behavior
2737
2738 * When a list constructor stores the "begin" pointer from the
2739 "initializer_list" argument, this doesn't extend the lifetime
2740 of the array, so if a class variable is constructed from a
2741 temporary "initializer_list", the pointer is left dangling by
2742 the end of the variable declaration statement.
2743
2744 -Winvalid-imported-macros
2745 Verify all imported macro definitions are valid at the end of
2746 compilation. This is not enabled by default, as it requires
2747 additional processing to determine. It may be useful when
2748 preparing sets of header-units to ensure consistent macros.
2749
2750 -Wno-literal-suffix (C++ and Objective-C++ only)
2751 Do not warn when a string or character literal is followed by a ud-
2752 suffix which does not begin with an underscore. As a conforming
2753 extension, GCC treats such suffixes as separate preprocessing
2754 tokens in order to maintain backwards compatibility with code that
2755 uses formatting macros from "<inttypes.h>". For example:
2756
2757 #define __STDC_FORMAT_MACROS
2758 #include <inttypes.h>
2759 #include <stdio.h>
2760
2761 int main() {
2762 int64_t i64 = 123;
2763 printf("My int64: %" PRId64"\n", i64);
2764 }
2765
2766 In this case, "PRId64" is treated as a separate preprocessing
2767 token.
2768
2769 This option also controls warnings when a user-defined literal
2770 operator is declared with a literal suffix identifier that doesn't
2771 begin with an underscore. Literal suffix identifiers that don't
2772 begin with an underscore are reserved for future standardization.
2773
2774 These warnings are enabled by default.
2775
2776 -Wno-narrowing (C++ and Objective-C++ only)
2777 For C++11 and later standards, narrowing conversions are diagnosed
2778 by default, as required by the standard. A narrowing conversion
2779 from a constant produces an error, and a narrowing conversion from
2780 a non-constant produces a warning, but -Wno-narrowing suppresses
2781 the diagnostic. Note that this does not affect the meaning of
2782 well-formed code; narrowing conversions are still considered ill-
2783 formed in SFINAE contexts.
2784
2785 With -Wnarrowing in C++98, warn when a narrowing conversion
2786 prohibited by C++11 occurs within { }, e.g.
2787
2788 int i = { 2.2 }; // error: narrowing from double to int
2789
2790 This flag is included in -Wall and -Wc++11-compat.
2791
2792 -Wnoexcept (C++ and Objective-C++ only)
2793 Warn when a noexcept-expression evaluates to false because of a
2794 call to a function that does not have a non-throwing exception
2795 specification (i.e. "throw()" or "noexcept") but is known by the
2796 compiler to never throw an exception.
2797
2798 -Wnoexcept-type (C++ and Objective-C++ only)
2799 Warn if the C++17 feature making "noexcept" part of a function type
2800 changes the mangled name of a symbol relative to C++14. Enabled by
2801 -Wabi and -Wc++17-compat.
2802
2803 As an example:
2804
2805 template <class T> void f(T t) { t(); };
2806 void g() noexcept;
2807 void h() { f(g); }
2808
2809 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2810 "f<void(*)()noexcept>".
2811
2812 -Wclass-memaccess (C++ and Objective-C++ only)
2813 Warn when the destination of a call to a raw memory function such
2814 as "memset" or "memcpy" is an object of class type, and when
2815 writing into such an object might bypass the class non-trivial or
2816 deleted constructor or copy assignment, violate const-correctness
2817 or encapsulation, or corrupt virtual table pointers. Modifying the
2818 representation of such objects may violate invariants maintained by
2819 member functions of the class. For example, the call to "memset"
2820 below is undefined because it modifies a non-trivial class object
2821 and is, therefore, diagnosed. The safe way to either initialize or
2822 clear the storage of objects of such types is by using the
2823 appropriate constructor or assignment operator, if one is
2824 available.
2825
2826 std::string str = "abc";
2827 memset (&str, 0, sizeof str);
2828
2829 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2830 casting the pointer to the class object to "void *" or to a type
2831 that can be safely accessed by the raw memory function suppresses
2832 the warning.
2833
2834 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2835 Warn when a class has virtual functions and an accessible non-
2836 virtual destructor itself or in an accessible polymorphic base
2837 class, in which case it is possible but unsafe to delete an
2838 instance of a derived class through a pointer to the class itself
2839 or base class. This warning is automatically enabled if -Weffc++
2840 is specified.
2841
2842 -Wregister (C++ and Objective-C++ only)
2843 Warn on uses of the "register" storage class specifier, except when
2844 it is part of the GNU Explicit Register Variables extension. The
2845 use of the "register" keyword as storage class specifier has been
2846 deprecated in C++11 and removed in C++17. Enabled by default with
2847 -std=c++17.
2848
2849 -Wreorder (C++ and Objective-C++ only)
2850 Warn when the order of member initializers given in the code does
2851 not match the order in which they must be executed. For instance:
2852
2853 struct A {
2854 int i;
2855 int j;
2856 A(): j (0), i (1) { }
2857 };
2858
2859 The compiler rearranges the member initializers for "i" and "j" to
2860 match the declaration order of the members, emitting a warning to
2861 that effect. This warning is enabled by -Wall.
2862
2863 -Wno-pessimizing-move (C++ and Objective-C++ only)
2864 This warning warns when a call to "std::move" prevents copy
2865 elision. A typical scenario when copy elision can occur is when
2866 returning in a function with a class return type, when the
2867 expression being returned is the name of a non-volatile automatic
2868 object, and is not a function parameter, and has the same type as
2869 the function return type.
2870
2871 struct T {
2872 ...
2873 };
2874 T fn()
2875 {
2876 T t;
2877 ...
2878 return std::move (t);
2879 }
2880
2881 But in this example, the "std::move" call prevents copy elision.
2882
2883 This warning is enabled by -Wall.
2884
2885 -Wno-redundant-move (C++ and Objective-C++ only)
2886 This warning warns about redundant calls to "std::move"; that is,
2887 when a move operation would have been performed even without the
2888 "std::move" call. This happens because the compiler is forced to
2889 treat the object as if it were an rvalue in certain situations such
2890 as returning a local variable, where copy elision isn't applicable.
2891 Consider:
2892
2893 struct T {
2894 ...
2895 };
2896 T fn(T t)
2897 {
2898 ...
2899 return std::move (t);
2900 }
2901
2902 Here, the "std::move" call is redundant. Because G++ implements
2903 Core Issue 1579, another example is:
2904
2905 struct T { // convertible to U
2906 ...
2907 };
2908 struct U {
2909 ...
2910 };
2911 U fn()
2912 {
2913 T t;
2914 ...
2915 return std::move (t);
2916 }
2917
2918 In this example, copy elision isn't applicable because the type of
2919 the expression being returned and the function return type differ,
2920 yet G++ treats the return value as if it were designated by an
2921 rvalue.
2922
2923 This warning is enabled by -Wextra.
2924
2925 -Wrange-loop-construct (C++ and Objective-C++ only)
2926 This warning warns when a C++ range-based for-loop is creating an
2927 unnecessary copy. This can happen when the range declaration is
2928 not a reference, but probably should be. For example:
2929
2930 struct S { char arr[128]; };
2931 void fn () {
2932 S arr[5];
2933 for (const auto x : arr) { ... }
2934 }
2935
2936 It does not warn when the type being copied is a trivially-copyable
2937 type whose size is less than 64 bytes.
2938
2939 This warning also warns when a loop variable in a range-based for-
2940 loop is initialized with a value of a different type resulting in a
2941 copy. For example:
2942
2943 void fn() {
2944 int arr[10];
2945 for (const double &x : arr) { ... }
2946 }
2947
2948 In the example above, in every iteration of the loop a temporary
2949 value of type "double" is created and destroyed, to which the
2950 reference "const double &" is bound.
2951
2952 This warning is enabled by -Wall.
2953
2954 -Wredundant-tags (C++ and Objective-C++ only)
2955 Warn about redundant class-key and enum-key in references to class
2956 types and enumerated types in contexts where the key can be
2957 eliminated without causing an ambiguity. For example:
2958
2959 struct foo;
2960 struct foo *p; // warn that keyword struct can be eliminated
2961
2962 On the other hand, in this example there is no warning:
2963
2964 struct foo;
2965 void foo (); // "hides" struct foo
2966 void bar (struct foo&); // no warning, keyword struct is necessary
2967
2968 -Wno-subobject-linkage (C++ and Objective-C++ only)
2969 Do not warn if a class type has a base or a field whose type uses
2970 the anonymous namespace or depends on a type with no linkage. If a
2971 type A depends on a type B with no or internal linkage, defining it
2972 in multiple translation units would be an ODR violation because the
2973 meaning of B is different in each translation unit. If A only
2974 appears in a single translation unit, the best way to silence the
2975 warning is to give it internal linkage by putting it in an
2976 anonymous namespace as well. The compiler doesn't give this
2977 warning for types defined in the main .C file, as those are
2978 unlikely to have multiple definitions. -Wsubobject-linkage is
2979 enabled by default.
2980
2981 -Weffc++ (C++ and Objective-C++ only)
2982 Warn about violations of the following style guidelines from Scott
2983 Meyers' Effective C++ series of books:
2984
2985 * Define a copy constructor and an assignment operator for
2986 classes with dynamically-allocated memory.
2987
2988 * Prefer initialization to assignment in constructors.
2989
2990 * Have "operator=" return a reference to *this.
2991
2992 * Don't try to return a reference when you must return an object.
2993
2994 * Distinguish between prefix and postfix forms of increment and
2995 decrement operators.
2996
2997 * Never overload "&&", "||", or ",".
2998
2999 This option also enables -Wnon-virtual-dtor, which is also one of
3000 the effective C++ recommendations. However, the check is extended
3001 to warn about the lack of virtual destructor in accessible non-
3002 polymorphic bases classes too.
3003
3004 When selecting this option, be aware that the standard library
3005 headers do not obey all of these guidelines; use grep -v to filter
3006 out those warnings.
3007
3008 -Wno-exceptions (C++ and Objective-C++ only)
3009 Disable the warning about the case when an exception handler is
3010 shadowed by another handler, which can point out a wrong ordering
3011 of exception handlers.
3012
3013 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3014 Warn about the use of an uncasted "NULL" as sentinel. When
3015 compiling only with GCC this is a valid sentinel, as "NULL" is
3016 defined to "__null". Although it is a null pointer constant rather
3017 than a null pointer, it is guaranteed to be of the same size as a
3018 pointer. But this use is not portable across different compilers.
3019
3020 -Wno-non-template-friend (C++ and Objective-C++ only)
3021 Disable warnings when non-template friend functions are declared
3022 within a template. In very old versions of GCC that predate
3023 implementation of the ISO standard, declarations such as friend int
3024 foo(int), where the name of the friend is an unqualified-id, could
3025 be interpreted as a particular specialization of a template
3026 function; the warning exists to diagnose compatibility problems,
3027 and is enabled by default.
3028
3029 -Wold-style-cast (C++ and Objective-C++ only)
3030 Warn if an old-style (C-style) cast to a non-void type is used
3031 within a C++ program. The new-style casts ("dynamic_cast",
3032 "static_cast", "reinterpret_cast", and "const_cast") are less
3033 vulnerable to unintended effects and much easier to search for.
3034
3035 -Woverloaded-virtual (C++ and Objective-C++ only)
3036 Warn when a function declaration hides virtual functions from a
3037 base class. For example, in:
3038
3039 struct A {
3040 virtual void f();
3041 };
3042
3043 struct B: public A {
3044 void f(int);
3045 };
3046
3047 the "A" class version of "f" is hidden in "B", and code like:
3048
3049 B* b;
3050 b->f();
3051
3052 fails to compile.
3053
3054 -Wno-pmf-conversions (C++ and Objective-C++ only)
3055 Disable the diagnostic for converting a bound pointer to member
3056 function to a plain pointer.
3057
3058 -Wsign-promo (C++ and Objective-C++ only)
3059 Warn when overload resolution chooses a promotion from unsigned or
3060 enumerated type to a signed type, over a conversion to an unsigned
3061 type of the same size. Previous versions of G++ tried to preserve
3062 unsignedness, but the standard mandates the current behavior.
3063
3064 -Wtemplates (C++ and Objective-C++ only)
3065 Warn when a primary template declaration is encountered. Some
3066 coding rules disallow templates, and this may be used to enforce
3067 that rule. The warning is inactive inside a system header file,
3068 such as the STL, so one can still use the STL. One may also
3069 instantiate or specialize templates.
3070
3071 -Wno-mismatched-new-delete (C++ and Objective-C++ only)
3072 Warn for mismatches between calls to "operator new" or "operator
3073 delete" and the corresponding call to the allocation or
3074 deallocation function. This includes invocations of C++ "operator
3075 delete" with pointers returned from either mismatched forms of
3076 "operator new", or from other functions that allocate objects for
3077 which the "operator delete" isn't a suitable deallocator, as well
3078 as calls to other deallocation functions with pointers returned
3079 from "operator new" for which the deallocation function isn't
3080 suitable.
3081
3082 For example, the "delete" expression in the function below is
3083 diagnosed because it doesn't match the array form of the "new"
3084 expression the pointer argument was returned from. Similarly, the
3085 call to "free" is also diagnosed.
3086
3087 void f ()
3088 {
3089 int *a = new int[n];
3090 delete a; // warning: mismatch in array forms of expressions
3091
3092 char *p = new char[n];
3093 free (p); // warning: mismatch between new and free
3094 }
3095
3096 The related option -Wmismatched-dealloc diagnoses mismatches
3097 involving allocation and deallocation functions other than
3098 "operator new" and "operator delete".
3099
3100 -Wmismatched-new-delete is enabled by default.
3101
3102 -Wmismatched-tags (C++ and Objective-C++ only)
3103 Warn for declarations of structs, classes, and class templates and
3104 their specializations with a class-key that does not match either
3105 the definition or the first declaration if no definition is
3106 provided.
3107
3108 For example, the declaration of "struct Object" in the argument
3109 list of "draw" triggers the warning. To avoid it, either remove
3110 the redundant class-key "struct" or replace it with "class" to
3111 match its definition.
3112
3113 class Object {
3114 public:
3115 virtual ~Object () = 0;
3116 };
3117 void draw (struct Object*);
3118
3119 It is not wrong to declare a class with the class-key "struct" as
3120 the example above shows. The -Wmismatched-tags option is intended
3121 to help achieve a consistent style of class declarations. In code
3122 that is intended to be portable to Windows-based compilers the
3123 warning helps prevent unresolved references due to the difference
3124 in the mangling of symbols declared with different class-keys. The
3125 option can be used either on its own or in conjunction with
3126 -Wredundant-tags.
3127
3128 -Wmultiple-inheritance (C++ and Objective-C++ only)
3129 Warn when a class is defined with multiple direct base classes.
3130 Some coding rules disallow multiple inheritance, and this may be
3131 used to enforce that rule. The warning is inactive inside a system
3132 header file, such as the STL, so one can still use the STL. One
3133 may also define classes that indirectly use multiple inheritance.
3134
3135 -Wvirtual-inheritance
3136 Warn when a class is defined with a virtual direct base class.
3137 Some coding rules disallow multiple inheritance, and this may be
3138 used to enforce that rule. The warning is inactive inside a system
3139 header file, such as the STL, so one can still use the STL. One
3140 may also define classes that indirectly use virtual inheritance.
3141
3142 -Wno-virtual-move-assign
3143 Suppress warnings about inheriting from a virtual base with a non-
3144 trivial C++11 move assignment operator. This is dangerous because
3145 if the virtual base is reachable along more than one path, it is
3146 moved multiple times, which can mean both objects end up in the
3147 moved-from state. If the move assignment operator is written to
3148 avoid moving from a moved-from object, this warning can be
3149 disabled.
3150
3151 -Wnamespaces
3152 Warn when a namespace definition is opened. Some coding rules
3153 disallow namespaces, and this may be used to enforce that rule.
3154 The warning is inactive inside a system header file, such as the
3155 STL, so one can still use the STL. One may also use using
3156 directives and qualified names.
3157
3158 -Wno-terminate (C++ and Objective-C++ only)
3159 Disable the warning about a throw-expression that will immediately
3160 result in a call to "terminate".
3161
3162 -Wno-vexing-parse (C++ and Objective-C++ only)
3163 Warn about the most vexing parse syntactic ambiguity. This warns
3164 about the cases when a declaration looks like a variable
3165 definition, but the C++ language requires it to be interpreted as a
3166 function declaration. For instance:
3167
3168 void f(double a) {
3169 int i(); // extern int i (void);
3170 int n(int(a)); // extern int n (int);
3171 }
3172
3173 Another example:
3174
3175 struct S { S(int); };
3176 void f(double a) {
3177 S x(int(a)); // extern struct S x (int);
3178 S y(int()); // extern struct S y (int (*) (void));
3179 S z(); // extern struct S z (void);
3180 }
3181
3182 The warning will suggest options how to deal with such an
3183 ambiguity; e.g., it can suggest removing the parentheses or using
3184 braces instead.
3185
3186 This warning is enabled by default.
3187
3188 -Wno-class-conversion (C++ and Objective-C++ only)
3189 Do not warn when a conversion function converts an object to the
3190 same type, to a base class of that type, or to void; such a
3191 conversion function will never be called.
3192
3193 -Wvolatile (C++ and Objective-C++ only)
3194 Warn about deprecated uses of the "volatile" qualifier. This
3195 includes postfix and prefix "++" and "--" expressions of
3196 "volatile"-qualified types, using simple assignments where the left
3197 operand is a "volatile"-qualified non-class type for their value,
3198 compound assignments where the left operand is a
3199 "volatile"-qualified non-class type, "volatile"-qualified function
3200 return type, "volatile"-qualified parameter type, and structured
3201 bindings of a "volatile"-qualified type. This usage was deprecated
3202 in C++20.
3203
3204 Enabled by default with -std=c++20.
3205
3206 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3207 Warn when a literal 0 is used as null pointer constant. This can
3208 be useful to facilitate the conversion to "nullptr" in C++11.
3209
3210 -Waligned-new
3211 Warn about a new-expression of a type that requires greater
3212 alignment than the "alignof(std::max_align_t)" but uses an
3213 allocation function without an explicit alignment parameter. This
3214 option is enabled by -Wall.
3215
3216 Normally this only warns about global allocation functions, but
3217 -Waligned-new=all also warns about class member allocation
3218 functions.
3219
3220 -Wno-placement-new
3221 -Wplacement-new=n
3222 Warn about placement new expressions with undefined behavior, such
3223 as constructing an object in a buffer that is smaller than the type
3224 of the object. For example, the placement new expression below is
3225 diagnosed because it attempts to construct an array of 64 integers
3226 in a buffer only 64 bytes large.
3227
3228 char buf [64];
3229 new (buf) int[64];
3230
3231 This warning is enabled by default.
3232
3233 -Wplacement-new=1
3234 This is the default warning level of -Wplacement-new. At this
3235 level the warning is not issued for some strictly undefined
3236 constructs that GCC allows as extensions for compatibility with
3237 legacy code. For example, the following "new" expression is
3238 not diagnosed at this level even though it has undefined
3239 behavior according to the C++ standard because it writes past
3240 the end of the one-element array.
3241
3242 struct S { int n, a[1]; };
3243 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3244 new (s->a)int [32]();
3245
3246 -Wplacement-new=2
3247 At this level, in addition to diagnosing all the same
3248 constructs as at level 1, a diagnostic is also issued for
3249 placement new expressions that construct an object in the last
3250 member of structure whose type is an array of a single element
3251 and whose size is less than the size of the object being
3252 constructed. While the previous example would be diagnosed,
3253 the following construct makes use of the flexible member array
3254 extension to avoid the warning at level 2.
3255
3256 struct S { int n, a[]; };
3257 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3258 new (s->a)int [32]();
3259
3260 -Wcatch-value
3261 -Wcatch-value=n (C++ and Objective-C++ only)
3262 Warn about catch handlers that do not catch via reference. With
3263 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3264 class types that are caught by value. With -Wcatch-value=2 warn
3265 about all class types that are caught by value. With
3266 -Wcatch-value=3 warn about all types that are not caught by
3267 reference. -Wcatch-value is enabled by -Wall.
3268
3269 -Wconditionally-supported (C++ and Objective-C++ only)
3270 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3271
3272 -Wno-delete-incomplete (C++ and Objective-C++ only)
3273 Do not warn when deleting a pointer to incomplete type, which may
3274 cause undefined behavior at runtime. This warning is enabled by
3275 default.
3276
3277 -Wextra-semi (C++, Objective-C++ only)
3278 Warn about redundant semicolons after in-class function
3279 definitions.
3280
3281 -Wno-inaccessible-base (C++, Objective-C++ only)
3282 This option controls warnings when a base class is inaccessible in
3283 a class derived from it due to ambiguity. The warning is enabled
3284 by default. Note that the warning for ambiguous virtual bases is
3285 enabled by the -Wextra option.
3286
3287 struct A { int a; };
3288
3289 struct B : A { };
3290
3291 struct C : B, A { };
3292
3293 -Wno-inherited-variadic-ctor
3294 Suppress warnings about use of C++11 inheriting constructors when
3295 the base class inherited from has a C variadic constructor; the
3296 warning is on by default because the ellipsis is not inherited.
3297
3298 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3299 Suppress warnings from applying the "offsetof" macro to a non-POD
3300 type. According to the 2014 ISO C++ standard, applying "offsetof"
3301 to a non-standard-layout type is undefined. In existing C++
3302 implementations, however, "offsetof" typically gives meaningful
3303 results. This flag is for users who are aware that they are
3304 writing nonportable code and who have deliberately chosen to ignore
3305 the warning about it.
3306
3307 The restrictions on "offsetof" may be relaxed in a future version
3308 of the C++ standard.
3309
3310 -Wsized-deallocation (C++ and Objective-C++ only)
3311 Warn about a definition of an unsized deallocation function
3312
3313 void operator delete (void *) noexcept;
3314 void operator delete[] (void *) noexcept;
3315
3316 without a definition of the corresponding sized deallocation
3317 function
3318
3319 void operator delete (void *, std::size_t) noexcept;
3320 void operator delete[] (void *, std::size_t) noexcept;
3321
3322 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3323
3324 -Wsuggest-final-types
3325 Warn about types with virtual methods where code quality would be
3326 improved if the type were declared with the C++11 "final"
3327 specifier, or, if possible, declared in an anonymous namespace.
3328 This allows GCC to more aggressively devirtualize the polymorphic
3329 calls. This warning is more effective with link-time optimization,
3330 where the information about the class hierarchy graph is more
3331 complete.
3332
3333 -Wsuggest-final-methods
3334 Warn about virtual methods where code quality would be improved if
3335 the method were declared with the C++11 "final" specifier, or, if
3336 possible, its type were declared in an anonymous namespace or with
3337 the "final" specifier. This warning is more effective with link-
3338 time optimization, where the information about the class hierarchy
3339 graph is more complete. It is recommended to first consider
3340 suggestions of -Wsuggest-final-types and then rebuild with new
3341 annotations.
3342
3343 -Wsuggest-override
3344 Warn about overriding virtual functions that are not marked with
3345 the "override" keyword.
3346
3347 -Wuseless-cast (C++ and Objective-C++ only)
3348 Warn when an expression is casted to its own type.
3349
3350 -Wno-conversion-null (C++ and Objective-C++ only)
3351 Do not warn for conversions between "NULL" and non-pointer types.
3352 -Wconversion-null is enabled by default.
3353
3354 Options Controlling Objective-C and Objective-C++ Dialects
3355 (NOTE: This manual does not describe the Objective-C and Objective-C++
3356 languages themselves.
3357
3358 This section describes the command-line options that are only
3359 meaningful for Objective-C and Objective-C++ programs. You can also
3360 use most of the language-independent GNU compiler options. For
3361 example, you might compile a file some_class.m like this:
3362
3363 gcc -g -fgnu-runtime -O -c some_class.m
3364
3365 In this example, -fgnu-runtime is an option meant only for Objective-C
3366 and Objective-C++ programs; you can use the other options with any
3367 language supported by GCC.
3368
3369 Note that since Objective-C is an extension of the C language,
3370 Objective-C compilations may also use options specific to the C front-
3371 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3372 use C++-specific options (e.g., -Wabi).
3373
3374 Here is a list of options that are only for compiling Objective-C and
3375 Objective-C++ programs:
3376
3377 -fconstant-string-class=class-name
3378 Use class-name as the name of the class to instantiate for each
3379 literal string specified with the syntax "@"..."". The default
3380 class name is "NXConstantString" if the GNU runtime is being used,
3381 and "NSConstantString" if the NeXT runtime is being used (see
3382 below). The -fconstant-cfstrings option, if also present,
3383 overrides the -fconstant-string-class setting and cause "@"...""
3384 literals to be laid out as constant CoreFoundation strings.
3385
3386 -fgnu-runtime
3387 Generate object code compatible with the standard GNU Objective-C
3388 runtime. This is the default for most types of systems.
3389
3390 -fnext-runtime
3391 Generate output compatible with the NeXT runtime. This is the
3392 default for NeXT-based systems, including Darwin and Mac OS X. The
3393 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3394 is used.
3395
3396 -fno-nil-receivers
3397 Assume that all Objective-C message dispatches ("[receiver
3398 message:arg]") in this translation unit ensure that the receiver is
3399 not "nil". This allows for more efficient entry points in the
3400 runtime to be used. This option is only available in conjunction
3401 with the NeXT runtime and ABI version 0 or 1.
3402
3403 -fobjc-abi-version=n
3404 Use version n of the Objective-C ABI for the selected runtime.
3405 This option is currently supported only for the NeXT runtime. In
3406 that case, Version 0 is the traditional (32-bit) ABI without
3407 support for properties and other Objective-C 2.0 additions.
3408 Version 1 is the traditional (32-bit) ABI with support for
3409 properties and other Objective-C 2.0 additions. Version 2 is the
3410 modern (64-bit) ABI. If nothing is specified, the default is
3411 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3412 machines.
3413
3414 -fobjc-call-cxx-cdtors
3415 For each Objective-C class, check if any of its instance variables
3416 is a C++ object with a non-trivial default constructor. If so,
3417 synthesize a special "- (id) .cxx_construct" instance method which
3418 runs non-trivial default constructors on any such instance
3419 variables, in order, and then return "self". Similarly, check if
3420 any instance variable is a C++ object with a non-trivial
3421 destructor, and if so, synthesize a special "- (void)
3422 .cxx_destruct" method which runs all such default destructors, in
3423 reverse order.
3424
3425 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3426 thusly generated only operate on instance variables declared in the
3427 current Objective-C class, and not those inherited from
3428 superclasses. It is the responsibility of the Objective-C runtime
3429 to invoke all such methods in an object's inheritance hierarchy.
3430 The "- (id) .cxx_construct" methods are invoked by the runtime
3431 immediately after a new object instance is allocated; the "- (void)
3432 .cxx_destruct" methods are invoked immediately before the runtime
3433 deallocates an object instance.
3434
3435 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3436 later has support for invoking the "- (id) .cxx_construct" and "-
3437 (void) .cxx_destruct" methods.
3438
3439 -fobjc-direct-dispatch
3440 Allow fast jumps to the message dispatcher. On Darwin this is
3441 accomplished via the comm page.
3442
3443 -fobjc-exceptions
3444 Enable syntactic support for structured exception handling in
3445 Objective-C, similar to what is offered by C++. This option is
3446 required to use the Objective-C keywords @try, @throw, @catch,
3447 @finally and @synchronized. This option is available with both the
3448 GNU runtime and the NeXT runtime (but not available in conjunction
3449 with the NeXT runtime on Mac OS X 10.2 and earlier).
3450
3451 -fobjc-gc
3452 Enable garbage collection (GC) in Objective-C and Objective-C++
3453 programs. This option is only available with the NeXT runtime; the
3454 GNU runtime has a different garbage collection implementation that
3455 does not require special compiler flags.
3456
3457 -fobjc-nilcheck
3458 For the NeXT runtime with version 2 of the ABI, check for a nil
3459 receiver in method invocations before doing the actual method call.
3460 This is the default and can be disabled using -fno-objc-nilcheck.
3461 Class methods and super calls are never checked for nil in this way
3462 no matter what this flag is set to. Currently this flag does
3463 nothing when the GNU runtime, or an older version of the NeXT
3464 runtime ABI, is used.
3465
3466 -fobjc-std=objc1
3467 Conform to the language syntax of Objective-C 1.0, the language
3468 recognized by GCC 4.0. This only affects the Objective-C additions
3469 to the C/C++ language; it does not affect conformance to C/C++
3470 standards, which is controlled by the separate C/C++ dialect option
3471 flags. When this option is used with the Objective-C or
3472 Objective-C++ compiler, any Objective-C syntax that is not
3473 recognized by GCC 4.0 is rejected. This is useful if you need to
3474 make sure that your Objective-C code can be compiled with older
3475 versions of GCC.
3476
3477 -freplace-objc-classes
3478 Emit a special marker instructing ld(1) not to statically link in
3479 the resulting object file, and allow dyld(1) to load it in at run
3480 time instead. This is used in conjunction with the Fix-and-
3481 Continue debugging mode, where the object file in question may be
3482 recompiled and dynamically reloaded in the course of program
3483 execution, without the need to restart the program itself.
3484 Currently, Fix-and-Continue functionality is only available in
3485 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3486
3487 -fzero-link
3488 When compiling for the NeXT runtime, the compiler ordinarily
3489 replaces calls to "objc_getClass("...")" (when the name of the
3490 class is known at compile time) with static class references that
3491 get initialized at load time, which improves run-time performance.
3492 Specifying the -fzero-link flag suppresses this behavior and causes
3493 calls to "objc_getClass("...")" to be retained. This is useful in
3494 Zero-Link debugging mode, since it allows for individual class
3495 implementations to be modified during program execution. The GNU
3496 runtime currently always retains calls to "objc_get_class("...")"
3497 regardless of command-line options.
3498
3499 -fno-local-ivars
3500 By default instance variables in Objective-C can be accessed as if
3501 they were local variables from within the methods of the class
3502 they're declared in. This can lead to shadowing between instance
3503 variables and other variables declared either locally inside a
3504 class method or globally with the same name. Specifying the
3505 -fno-local-ivars flag disables this behavior thus avoiding variable
3506 shadowing issues.
3507
3508 -fivar-visibility=[public|protected|private|package]
3509 Set the default instance variable visibility to the specified
3510 option so that instance variables declared outside the scope of any
3511 access modifier directives default to the specified visibility.
3512
3513 -gen-decls
3514 Dump interface declarations for all classes seen in the source file
3515 to a file named sourcename.decl.
3516
3517 -Wassign-intercept (Objective-C and Objective-C++ only)
3518 Warn whenever an Objective-C assignment is being intercepted by the
3519 garbage collector.
3520
3521 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3522 Do not warn if a property for an Objective-C object has no assign
3523 semantics specified.
3524
3525 -Wno-protocol (Objective-C and Objective-C++ only)
3526 If a class is declared to implement a protocol, a warning is issued
3527 for every method in the protocol that is not implemented by the
3528 class. The default behavior is to issue a warning for every method
3529 not explicitly implemented in the class, even if a method
3530 implementation is inherited from the superclass. If you use the
3531 -Wno-protocol option, then methods inherited from the superclass
3532 are considered to be implemented, and no warning is issued for
3533 them.
3534
3535 -Wobjc-root-class (Objective-C and Objective-C++ only)
3536 Warn if a class interface lacks a superclass. Most classes will
3537 inherit from "NSObject" (or "Object") for example. When declaring
3538 classes intended to be root classes, the warning can be suppressed
3539 by marking their interfaces with
3540 "__attribute__((objc_root_class))".
3541
3542 -Wselector (Objective-C and Objective-C++ only)
3543 Warn if multiple methods of different types for the same selector
3544 are found during compilation. The check is performed on the list
3545 of methods in the final stage of compilation. Additionally, a
3546 check is performed for each selector appearing in a
3547 "@selector(...)" expression, and a corresponding method for that
3548 selector has been found during compilation. Because these checks
3549 scan the method table only at the end of compilation, these
3550 warnings are not produced if the final stage of compilation is not
3551 reached, for example because an error is found during compilation,
3552 or because the -fsyntax-only option is being used.
3553
3554 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3555 Warn if multiple methods with differing argument and/or return
3556 types are found for a given selector when attempting to send a
3557 message using this selector to a receiver of type "id" or "Class".
3558 When this flag is off (which is the default behavior), the compiler
3559 omits such warnings if any differences found are confined to types
3560 that share the same size and alignment.
3561
3562 -Wundeclared-selector (Objective-C and Objective-C++ only)
3563 Warn if a "@selector(...)" expression referring to an undeclared
3564 selector is found. A selector is considered undeclared if no
3565 method with that name has been declared before the "@selector(...)"
3566 expression, either explicitly in an @interface or @protocol
3567 declaration, or implicitly in an @implementation section. This
3568 option always performs its checks as soon as a "@selector(...)"
3569 expression is found, while -Wselector only performs its checks in
3570 the final stage of compilation. This also enforces the coding
3571 style convention that methods and selectors must be declared before
3572 being used.
3573
3574 -print-objc-runtime-info
3575 Generate C header describing the largest structure that is passed
3576 by value, if any.
3577
3578 Options to Control Diagnostic Messages Formatting
3579 Traditionally, diagnostic messages have been formatted irrespective of
3580 the output device's aspect (e.g. its width, ...). You can use the
3581 options described below to control the formatting algorithm for
3582 diagnostic messages, e.g. how many characters per line, how often
3583 source location information should be reported. Note that some
3584 language front ends may not honor these options.
3585
3586 -fmessage-length=n
3587 Try to format error messages so that they fit on lines of about n
3588 characters. If n is zero, then no line-wrapping is done; each
3589 error message appears on a single line. This is the default for
3590 all front ends.
3591
3592 Note - this option also affects the display of the #error and
3593 #warning pre-processor directives, and the deprecated
3594 function/type/variable attribute. It does not however affect the
3595 pragma GCC warning and pragma GCC error pragmas.
3596
3597 -fdiagnostics-plain-output
3598 This option requests that diagnostic output look as plain as
3599 possible, which may be useful when running dejagnu or other
3600 utilities that need to parse diagnostics output and prefer that it
3601 remain more stable over time. -fdiagnostics-plain-output is
3602 currently equivalent to the following options:
3603 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3604 -fdiagnostics-color=never -fdiagnostics-urls=never
3605 -fdiagnostics-path-format=separate-events In the future, if GCC
3606 changes the default appearance of its diagnostics, the
3607 corresponding option to disable the new behavior will be added to
3608 this list.
3609
3610 -fdiagnostics-show-location=once
3611 Only meaningful in line-wrapping mode. Instructs the diagnostic
3612 messages reporter to emit source location information once; that
3613 is, in case the message is too long to fit on a single physical
3614 line and has to be wrapped, the source location won't be emitted
3615 (as prefix) again, over and over, in subsequent continuation lines.
3616 This is the default behavior.
3617
3618 -fdiagnostics-show-location=every-line
3619 Only meaningful in line-wrapping mode. Instructs the diagnostic
3620 messages reporter to emit the same source location information (as
3621 prefix) for physical lines that result from the process of breaking
3622 a message which is too long to fit on a single line.
3623
3624 -fdiagnostics-color[=WHEN]
3625 -fno-diagnostics-color
3626 Use color in diagnostics. WHEN is never, always, or auto. The
3627 default depends on how the compiler has been configured, it can be
3628 any of the above WHEN options or also never if GCC_COLORS
3629 environment variable isn't present in the environment, and auto
3630 otherwise. auto makes GCC use color only when the standard error
3631 is a terminal, and when not executing in an emacs shell. The forms
3632 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3633 -fdiagnostics-color=always and -fdiagnostics-color=never,
3634 respectively.
3635
3636 The colors are defined by the environment variable GCC_COLORS. Its
3637 value is a colon-separated list of capabilities and Select Graphic
3638 Rendition (SGR) substrings. SGR commands are interpreted by the
3639 terminal or terminal emulator. (See the section in the
3640 documentation of your text terminal for permitted values and their
3641 meanings as character attributes.) These substring values are
3642 integers in decimal representation and can be concatenated with
3643 semicolons. Common values to concatenate include 1 for bold, 4 for
3644 underline, 5 for blink, 7 for inverse, 39 for default foreground
3645 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3646 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3647 modes foreground colors, 49 for default background color, 40 to 47
3648 for background colors, 100 to 107 for 16-color mode background
3649 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3650 background colors.
3651
3652 The default GCC_COLORS is
3653
3654 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3655 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3656 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3657 type-diff=01;32
3658
3659 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3660 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3661 GCC_COLORS to the empty string disables colors. Supported
3662 capabilities are as follows.
3663
3664 "error="
3665 SGR substring for error: markers.
3666
3667 "warning="
3668 SGR substring for warning: markers.
3669
3670 "note="
3671 SGR substring for note: markers.
3672
3673 "path="
3674 SGR substring for colorizing paths of control-flow events as
3675 printed via -fdiagnostics-path-format=, such as the identifiers
3676 of individual events and lines indicating interprocedural calls
3677 and returns.
3678
3679 "range1="
3680 SGR substring for first additional range.
3681
3682 "range2="
3683 SGR substring for second additional range.
3684
3685 "locus="
3686 SGR substring for location information, file:line or
3687 file:line:column etc.
3688
3689 "quote="
3690 SGR substring for information printed within quotes.
3691
3692 "fixit-insert="
3693 SGR substring for fix-it hints suggesting text to be inserted
3694 or replaced.
3695
3696 "fixit-delete="
3697 SGR substring for fix-it hints suggesting text to be deleted.
3698
3699 "diff-filename="
3700 SGR substring for filename headers within generated patches.
3701
3702 "diff-hunk="
3703 SGR substring for the starts of hunks within generated patches.
3704
3705 "diff-delete="
3706 SGR substring for deleted lines within generated patches.
3707
3708 "diff-insert="
3709 SGR substring for inserted lines within generated patches.
3710
3711 "type-diff="
3712 SGR substring for highlighting mismatching types within
3713 template arguments in the C++ frontend.
3714
3715 -fdiagnostics-urls[=WHEN]
3716 Use escape sequences to embed URLs in diagnostics. For example,
3717 when -fdiagnostics-show-option emits text showing the command-line
3718 option controlling a diagnostic, embed a URL for documentation of
3719 that option.
3720
3721 WHEN is never, always, or auto. auto makes GCC use URL escape
3722 sequences only when the standard error is a terminal, and when not
3723 executing in an emacs shell or any graphical terminal which is
3724 known to be incompatible with this feature, see below.
3725
3726 The default depends on how the compiler has been configured. It
3727 can be any of the above WHEN options.
3728
3729 GCC can also be configured (via the
3730 --with-diagnostics-urls=auto-if-env configure-time option) so that
3731 the default is affected by environment variables. Under such a
3732 configuration, GCC defaults to using auto if either GCC_URLS or
3733 TERM_URLS environment variables are present and non-empty in the
3734 environment of the compiler, or never if neither are.
3735
3736 However, even with -fdiagnostics-urls=always the behavior is
3737 dependent on those environment variables: If GCC_URLS is set to
3738 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3739 use ST escape sequences. If set to bel, the default, URLs use BEL
3740 escape sequences. Any other non-empty value enables the feature.
3741 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3742 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3743 character, CTRL-G that usually sounds like a beep.
3744
3745 At this time GCC tries to detect also a few terminals that are
3746 known to not implement the URL feature, and have bugs or at least
3747 had bugs in some versions that are still in use, where the URL
3748 escapes are likely to misbehave, i.e. print garbage on the screen.
3749 That list is currently xfce4-terminal, certain known to be buggy
3750 gnome-terminal versions, the linux console, and mingw. This check
3751 can be skipped with the -fdiagnostics-urls=always.
3752
3753 -fno-diagnostics-show-option
3754 By default, each diagnostic emitted includes text indicating the
3755 command-line option that directly controls the diagnostic (if such
3756 an option is known to the diagnostic machinery). Specifying the
3757 -fno-diagnostics-show-option flag suppresses that behavior.
3758
3759 -fno-diagnostics-show-caret
3760 By default, each diagnostic emitted includes the original source
3761 line and a caret ^ indicating the column. This option suppresses
3762 this information. The source line is truncated to n characters, if
3763 the -fmessage-length=n option is given. When the output is done to
3764 the terminal, the width is limited to the width given by the
3765 COLUMNS environment variable or, if not set, to the terminal width.
3766
3767 -fno-diagnostics-show-labels
3768 By default, when printing source code (via
3769 -fdiagnostics-show-caret), diagnostics can label ranges of source
3770 code with pertinent information, such as the types of expressions:
3771
3772 printf ("foo %s bar", long_i + long_j);
3773 ~^ ~~~~~~~~~~~~~~~
3774 | |
3775 char * long int
3776
3777 This option suppresses the printing of these labels (in the example
3778 above, the vertical bars and the "char *" and "long int" text).
3779
3780 -fno-diagnostics-show-cwe
3781 Diagnostic messages can optionally have an associated
3782 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3783 only provides such metadata for some of the -fanalyzer diagnostics.
3784 GCC plugins may also provide diagnostics with such metadata. By
3785 default, if this information is present, it will be printed with
3786 the diagnostic. This option suppresses the printing of this
3787 metadata.
3788
3789 -fno-diagnostics-show-line-numbers
3790 By default, when printing source code (via
3791 -fdiagnostics-show-caret), a left margin is printed, showing line
3792 numbers. This option suppresses this left margin.
3793
3794 -fdiagnostics-minimum-margin-width=width
3795 This option controls the minimum width of the left margin printed
3796 by -fdiagnostics-show-line-numbers. It defaults to 6.
3797
3798 -fdiagnostics-parseable-fixits
3799 Emit fix-it hints in a machine-parseable format, suitable for
3800 consumption by IDEs. For each fix-it, a line will be printed after
3801 the relevant diagnostic, starting with the string "fix-it:". For
3802 example:
3803
3804 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3805
3806 The location is expressed as a half-open range, expressed as a
3807 count of bytes, starting at byte 1 for the initial column. In the
3808 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3809 replaced with the given string:
3810
3811 00000000011111111112222222222
3812 12345678901234567890123456789
3813 gtk_widget_showall (dlg);
3814 ^^^^^^^^^^^^^^^^^^
3815 gtk_widget_show_all
3816
3817 The filename and replacement string escape backslash as "\\", tab
3818 as "\t", newline as "\n", double quotes as "\"", non-printable
3819 characters as octal (e.g. vertical tab as "\013").
3820
3821 An empty replacement string indicates that the given range is to be
3822 removed. An empty range (e.g. "45:3-45:3") indicates that the
3823 string is to be inserted at the given position.
3824
3825 -fdiagnostics-generate-patch
3826 Print fix-it hints to stderr in unified diff format, after any
3827 diagnostics are printed. For example:
3828
3829 --- test.c
3830 +++ test.c
3831 @ -42,5 +42,5 @
3832
3833 void show_cb(GtkDialog *dlg)
3834 {
3835 - gtk_widget_showall(dlg);
3836 + gtk_widget_show_all(dlg);
3837 }
3838
3839 The diff may or may not be colorized, following the same rules as
3840 for diagnostics (see -fdiagnostics-color).
3841
3842 -fdiagnostics-show-template-tree
3843 In the C++ frontend, when printing diagnostics showing mismatching
3844 template types, such as:
3845
3846 could not convert 'std::map<int, std::vector<double> >()'
3847 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3848
3849 the -fdiagnostics-show-template-tree flag enables printing a tree-
3850 like structure showing the common and differing parts of the types,
3851 such as:
3852
3853 map<
3854 [...],
3855 vector<
3856 [double != float]>>
3857
3858 The parts that differ are highlighted with color ("double" and
3859 "float" in this case).
3860
3861 -fno-elide-type
3862 By default when the C++ frontend prints diagnostics showing
3863 mismatching template types, common parts of the types are printed
3864 as "[...]" to simplify the error message. For example:
3865
3866 could not convert 'std::map<int, std::vector<double> >()'
3867 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3868
3869 Specifying the -fno-elide-type flag suppresses that behavior. This
3870 flag also affects the output of the
3871 -fdiagnostics-show-template-tree flag.
3872
3873 -fdiagnostics-path-format=KIND
3874 Specify how to print paths of control-flow events for diagnostics
3875 that have such a path associated with them.
3876
3877 KIND is none, separate-events, or inline-events, the default.
3878
3879 none means to not print diagnostic paths.
3880
3881 separate-events means to print a separate "note" diagnostic for
3882 each event within the diagnostic. For example:
3883
3884 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
3885 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
3886 test.c:27:3: note: (2) when 'i < count'
3887 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3888
3889 inline-events means to print the events "inline" within the source
3890 code. This view attempts to consolidate the events into runs of
3891 sufficiently-close events, printing them as labelled ranges within
3892 the source.
3893
3894 For example, the same events as above might be printed as:
3895
3896 'test': events 1-3
3897 |
3898 | 25 | list = PyList_New(0);
3899 | | ^~~~~~~~~~~~~
3900 | | |
3901 | | (1) when 'PyList_New' fails, returning NULL
3902 | 26 |
3903 | 27 | for (i = 0; i < count; i++) {
3904 | | ~~~
3905 | | |
3906 | | (2) when 'i < count'
3907 | 28 | item = PyLong_FromLong(random());
3908 | 29 | PyList_Append(list, item);
3909 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
3910 | | |
3911 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3912 |
3913
3914 Interprocedural control flow is shown by grouping the events by
3915 stack frame, and using indentation to show how stack frames are
3916 nested, pushed, and popped.
3917
3918 For example:
3919
3920 'test': events 1-2
3921 |
3922 | 133 | {
3923 | | ^
3924 | | |
3925 | | (1) entering 'test'
3926 | 134 | boxed_int *obj = make_boxed_int (i);
3927 | | ~~~~~~~~~~~~~~~~~~
3928 | | |
3929 | | (2) calling 'make_boxed_int'
3930 |
3931 +--> 'make_boxed_int': events 3-4
3932 |
3933 | 120 | {
3934 | | ^
3935 | | |
3936 | | (3) entering 'make_boxed_int'
3937 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
3938 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3939 | | |
3940 | | (4) calling 'wrapped_malloc'
3941 |
3942 +--> 'wrapped_malloc': events 5-6
3943 |
3944 | 7 | {
3945 | | ^
3946 | | |
3947 | | (5) entering 'wrapped_malloc'
3948 | 8 | return malloc (size);
3949 | | ~~~~~~~~~~~~~
3950 | | |
3951 | | (6) calling 'malloc'
3952 |
3953 <-------------+
3954 |
3955 'test': event 7
3956 |
3957 | 138 | free_boxed_int (obj);
3958 | | ^~~~~~~~~~~~~~~~~~~~
3959 | | |
3960 | | (7) calling 'free_boxed_int'
3961 |
3962 (etc)
3963
3964 -fdiagnostics-show-path-depths
3965 This option provides additional information when printing control-
3966 flow paths associated with a diagnostic.
3967
3968 If this is option is provided then the stack depth will be printed
3969 for each run of events within
3970 -fdiagnostics-path-format=separate-events.
3971
3972 This is intended for use by GCC developers and plugin developers
3973 when debugging diagnostics that report interprocedural control
3974 flow.
3975
3976 -fno-show-column
3977 Do not print column numbers in diagnostics. This may be necessary
3978 if diagnostics are being scanned by a program that does not
3979 understand the column numbers, such as dejagnu.
3980
3981 -fdiagnostics-column-unit=UNIT
3982 Select the units for the column number. This affects traditional
3983 diagnostics (in the absence of -fno-show-column), as well as JSON
3984 format diagnostics if requested.
3985
3986 The default UNIT, display, considers the number of display columns
3987 occupied by each character. This may be larger than the number of
3988 bytes required to encode the character, in the case of tab
3989 characters, or it may be smaller, in the case of multibyte
3990 characters. For example, the character "GREEK SMALL LETTER PI
3991 (U+03C0)" occupies one display column, and its UTF-8 encoding
3992 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
3993 occupies two display columns, and its UTF-8 encoding requires four
3994 bytes.
3995
3996 Setting UNIT to byte changes the column number to the raw byte
3997 count in all cases, as was traditionally output by GCC prior to
3998 version 11.1.0.
3999
4000 -fdiagnostics-column-origin=ORIGIN
4001 Select the origin for column numbers, i.e. the column number
4002 assigned to the first column. The default value of 1 corresponds
4003 to traditional GCC behavior and to the GNU style guide. Some
4004 utilities may perform better with an origin of 0; any non-negative
4005 value may be specified.
4006
4007 -fdiagnostics-format=FORMAT
4008 Select a different format for printing diagnostics. FORMAT is text
4009 or json. The default is text.
4010
4011 The json format consists of a top-level JSON array containing JSON
4012 objects representing the diagnostics.
4013
4014 The JSON is emitted as one line, without formatting; the examples
4015 below have been formatted for clarity.
4016
4017 Diagnostics can have child diagnostics. For example, this error
4018 and note:
4019
4020 misleading-indentation.c:15:3: warning: this 'if' clause does not
4021 guard... [-Wmisleading-indentation]
4022 15 | if (flag)
4023 | ^~
4024 misleading-indentation.c:17:5: note: ...this statement, but the latter
4025 is misleadingly indented as if it were guarded by the 'if'
4026 17 | y = 2;
4027 | ^
4028
4029 might be printed in JSON form (after formatting) like this:
4030
4031 [
4032 {
4033 "kind": "warning",
4034 "locations": [
4035 {
4036 "caret": {
4037 "display-column": 3,
4038 "byte-column": 3,
4039 "column": 3,
4040 "file": "misleading-indentation.c",
4041 "line": 15
4042 },
4043 "finish": {
4044 "display-column": 4,
4045 "byte-column": 4,
4046 "column": 4,
4047 "file": "misleading-indentation.c",
4048 "line": 15
4049 }
4050 }
4051 ],
4052 "message": "this \u2018if\u2019 clause does not guard...",
4053 "option": "-Wmisleading-indentation",
4054 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4055 "children": [
4056 {
4057 "kind": "note",
4058 "locations": [
4059 {
4060 "caret": {
4061 "display-column": 5,
4062 "byte-column": 5,
4063 "column": 5,
4064 "file": "misleading-indentation.c",
4065 "line": 17
4066 }
4067 }
4068 ],
4069 "message": "...this statement, but the latter is ..."
4070 }
4071 ]
4072 "column-origin": 1,
4073 },
4074 ...
4075 ]
4076
4077 where the "note" is a child of the "warning".
4078
4079 A diagnostic has a "kind". If this is "warning", then there is an
4080 "option" key describing the command-line option controlling the
4081 warning.
4082
4083 A diagnostic can contain zero or more locations. Each location has
4084 an optional "label" string and up to three positions within it: a
4085 "caret" position and optional "start" and "finish" positions. A
4086 position is described by a "file" name, a "line" number, and three
4087 numbers indicating a column position:
4088
4089 * "display-column" counts display columns, accounting for tabs
4090 and multibyte characters.
4091
4092 * "byte-column" counts raw bytes.
4093
4094 * "column" is equal to one of the previous two, as dictated by
4095 the -fdiagnostics-column-unit option.
4096
4097 All three columns are relative to the origin specified by
4098 -fdiagnostics-column-origin, which is typically equal to 1 but may
4099 be set, for instance, to 0 for compatibility with other utilities
4100 that number columns from 0. The column origin is recorded in the
4101 JSON output in the "column-origin" tag. In the remaining examples
4102 below, the extra column number outputs have been omitted for
4103 brevity.
4104
4105 For example, this error:
4106
4107 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4108 'struct s'} and 'T' {aka 'struct t'})
4109 64 | return callee_4a () + callee_4b ();
4110 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4111 | | |
4112 | | T {aka struct t}
4113 | S {aka struct s}
4114
4115 has three locations. Its primary location is at the "+" token at
4116 column 23. It has two secondary locations, describing the left and
4117 right-hand sides of the expression, which have labels. It might be
4118 printed in JSON form as:
4119
4120 {
4121 "children": [],
4122 "kind": "error",
4123 "locations": [
4124 {
4125 "caret": {
4126 "column": 23, "file": "bad-binary-ops.c", "line": 64
4127 }
4128 },
4129 {
4130 "caret": {
4131 "column": 10, "file": "bad-binary-ops.c", "line": 64
4132 },
4133 "finish": {
4134 "column": 21, "file": "bad-binary-ops.c", "line": 64
4135 },
4136 "label": "S {aka struct s}"
4137 },
4138 {
4139 "caret": {
4140 "column": 25, "file": "bad-binary-ops.c", "line": 64
4141 },
4142 "finish": {
4143 "column": 36, "file": "bad-binary-ops.c", "line": 64
4144 },
4145 "label": "T {aka struct t}"
4146 }
4147 ],
4148 "message": "invalid operands to binary + ..."
4149 }
4150
4151 If a diagnostic contains fix-it hints, it has a "fixits" array,
4152 consisting of half-open intervals, similar to the output of
4153 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4154 a replacement fix-it hint:
4155
4156 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4157 mean 'color'?
4158 8 | return ptr->colour;
4159 | ^~~~~~
4160 | color
4161
4162 might be printed in JSON form as:
4163
4164 {
4165 "children": [],
4166 "fixits": [
4167 {
4168 "next": {
4169 "column": 21,
4170 "file": "demo.c",
4171 "line": 8
4172 },
4173 "start": {
4174 "column": 15,
4175 "file": "demo.c",
4176 "line": 8
4177 },
4178 "string": "color"
4179 }
4180 ],
4181 "kind": "error",
4182 "locations": [
4183 {
4184 "caret": {
4185 "column": 15,
4186 "file": "demo.c",
4187 "line": 8
4188 },
4189 "finish": {
4190 "column": 20,
4191 "file": "demo.c",
4192 "line": 8
4193 }
4194 }
4195 ],
4196 "message": "\u2018struct s\u2019 has no member named ..."
4197 }
4198
4199 where the fix-it hint suggests replacing the text from "start" up
4200 to but not including "next" with "string"'s value. Deletions are
4201 expressed via an empty value for "string", insertions by having
4202 "start" equal "next".
4203
4204 If the diagnostic has a path of control-flow events associated with
4205 it, it has a "path" array of objects representing the events. Each
4206 event object has a "description" string, a "location" object, along
4207 with a "function" string and a "depth" number for representing
4208 interprocedural paths. The "function" represents the current
4209 function at that event, and the "depth" represents the stack depth
4210 relative to some baseline: the higher, the more frames are within
4211 the stack.
4212
4213 For example, the intraprocedural example shown for
4214 -fdiagnostics-path-format= might have this JSON for its path:
4215
4216 "path": [
4217 {
4218 "depth": 0,
4219 "description": "when 'PyList_New' fails, returning NULL",
4220 "function": "test",
4221 "location": {
4222 "column": 10,
4223 "file": "test.c",
4224 "line": 25
4225 }
4226 },
4227 {
4228 "depth": 0,
4229 "description": "when 'i < count'",
4230 "function": "test",
4231 "location": {
4232 "column": 3,
4233 "file": "test.c",
4234 "line": 27
4235 }
4236 },
4237 {
4238 "depth": 0,
4239 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4240 "function": "test",
4241 "location": {
4242 "column": 5,
4243 "file": "test.c",
4244 "line": 29
4245 }
4246 }
4247 ]
4248
4249 Options to Request or Suppress Warnings
4250 Warnings are diagnostic messages that report constructions that are not
4251 inherently erroneous but that are risky or suggest there may have been
4252 an error.
4253
4254 The following language-independent options do not enable specific
4255 warnings but control the kinds of diagnostics produced by GCC.
4256
4257 -fsyntax-only
4258 Check the code for syntax errors, but don't do anything beyond
4259 that.
4260
4261 -fmax-errors=n
4262 Limits the maximum number of error messages to n, at which point
4263 GCC bails out rather than attempting to continue processing the
4264 source code. If n is 0 (the default), there is no limit on the
4265 number of error messages produced. If -Wfatal-errors is also
4266 specified, then -Wfatal-errors takes precedence over this option.
4267
4268 -w Inhibit all warning messages.
4269
4270 -Werror
4271 Make all warnings into errors.
4272
4273 -Werror=
4274 Make the specified warning into an error. The specifier for a
4275 warning is appended; for example -Werror=switch turns the warnings
4276 controlled by -Wswitch into errors. This switch takes a negative
4277 form, to be used to negate -Werror for specific warnings; for
4278 example -Wno-error=switch makes -Wswitch warnings not be errors,
4279 even when -Werror is in effect.
4280
4281 The warning message for each controllable warning includes the
4282 option that controls the warning. That option can then be used
4283 with -Werror= and -Wno-error= as described above. (Printing of the
4284 option in the warning message can be disabled using the
4285 -fno-diagnostics-show-option flag.)
4286
4287 Note that specifying -Werror=foo automatically implies -Wfoo.
4288 However, -Wno-error=foo does not imply anything.
4289
4290 -Wfatal-errors
4291 This option causes the compiler to abort compilation on the first
4292 error occurred rather than trying to keep going and printing
4293 further error messages.
4294
4295 You can request many specific warnings with options beginning with -W,
4296 for example -Wimplicit to request warnings on implicit declarations.
4297 Each of these specific warning options also has a negative form
4298 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4299 manual lists only one of the two forms, whichever is not the default.
4300 For further language-specific options also refer to C++ Dialect Options
4301 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4302 can be produced by enabling the static analyzer;
4303
4304 Some options, such as -Wall and -Wextra, turn on other options, such as
4305 -Wunused, which may turn on further options, such as -Wunused-value.
4306 The combined effect of positive and negative forms is that more
4307 specific options have priority over less specific ones, independently
4308 of their position in the command-line. For options of the same
4309 specificity, the last one takes effect. Options enabled or disabled via
4310 pragmas take effect as if they appeared at the end of the command-line.
4311
4312 When an unrecognized warning option is requested (e.g.,
4313 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4314 not recognized. However, if the -Wno- form is used, the behavior is
4315 slightly different: no diagnostic is produced for -Wno-unknown-warning
4316 unless other diagnostics are being produced. This allows the use of
4317 new -Wno- options with old compilers, but if something goes wrong, the
4318 compiler warns that an unrecognized option is present.
4319
4320 The effectiveness of some warnings depends on optimizations also being
4321 enabled. For example -Wsuggest-final-types is more effective with link-
4322 time optimization and -Wmaybe-uninitialized does not warn at all unless
4323 optimization is enabled.
4324
4325 -Wpedantic
4326 -pedantic
4327 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4328 all programs that use forbidden extensions, and some other programs
4329 that do not follow ISO C and ISO C++. For ISO C, follows the
4330 version of the ISO C standard specified by any -std option used.
4331
4332 Valid ISO C and ISO C++ programs should compile properly with or
4333 without this option (though a rare few require -ansi or a -std
4334 option specifying the required version of ISO C). However, without
4335 this option, certain GNU extensions and traditional C and C++
4336 features are supported as well. With this option, they are
4337 rejected.
4338
4339 -Wpedantic does not cause warning messages for use of the alternate
4340 keywords whose names begin and end with __. This alternate format
4341 can also be used to disable warnings for non-ISO __intN types, i.e.
4342 __intN__. Pedantic warnings are also disabled in the expression
4343 that follows "__extension__". However, only system header files
4344 should use these escape routes; application programs should avoid
4345 them.
4346
4347 Some users try to use -Wpedantic to check programs for strict ISO C
4348 conformance. They soon find that it does not do quite what they
4349 want: it finds some non-ISO practices, but not all---only those for
4350 which ISO C requires a diagnostic, and some others for which
4351 diagnostics have been added.
4352
4353 A feature to report any failure to conform to ISO C might be useful
4354 in some instances, but would require considerable additional work
4355 and would be quite different from -Wpedantic. We don't have plans
4356 to support such a feature in the near future.
4357
4358 Where the standard specified with -std represents a GNU extended
4359 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4360 standard, the version of ISO C on which the GNU extended dialect is
4361 based. Warnings from -Wpedantic are given where they are required
4362 by the base standard. (It does not make sense for such warnings to
4363 be given only for features not in the specified GNU C dialect,
4364 since by definition the GNU dialects of C include all features the
4365 compiler supports with the given option, and there would be nothing
4366 to warn about.)
4367
4368 -pedantic-errors
4369 Give an error whenever the base standard (see -Wpedantic) requires
4370 a diagnostic, in some cases where there is undefined behavior at
4371 compile-time and in some other cases that do not prevent
4372 compilation of programs that are valid according to the standard.
4373 This is not equivalent to -Werror=pedantic, since there are errors
4374 enabled by this option and not enabled by the latter and vice
4375 versa.
4376
4377 -Wall
4378 This enables all the warnings about constructions that some users
4379 consider questionable, and that are easy to avoid (or modify to
4380 prevent the warning), even in conjunction with macros. This also
4381 enables some language-specific warnings described in C++ Dialect
4382 Options and Objective-C and Objective-C++ Dialect Options.
4383
4384 -Wall turns on the following warning flags:
4385
4386 -Waddress -Warray-bounds=1 (only with -O2) -Warray-parameter=2 (C
4387 and Objective-C only) -Wbool-compare -Wbool-operation
4388 -Wc++11-compat -Wc++14-compat -Wcatch-value (C++ and Objective-C++
4389 only) -Wchar-subscripts -Wcomment -Wduplicate-decl-specifier (C and
4390 Objective-C only) -Wenum-compare (in C/ObjC; this is on by default
4391 in C++) -Wformat -Wformat-overflow -Wformat-truncation
4392 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
4393 -Wimplicit-int (C and Objective-C only)
4394 -Wimplicit-function-declaration (C and Objective-C only)
4395 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
4396 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4397 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4398 (only for C/C++) -Wmissing-attributes -Wmissing-braces (only for
4399 C/ObjC) -Wmultistatement-macros -Wnarrowing (only for C++)
4400 -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses
4401 -Wpessimizing-move (only for C++) -Wpointer-sign
4402 -Wrange-loop-construct (only for C++) -Wreorder -Wrestrict
4403 -Wreturn-type -Wsequence-point -Wsign-compare (only in C++)
4404 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
4405 -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch
4406 -Wtautological-compare -Wtrigraphs -Wuninitialized
4407 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
4408 -Wunused-variable -Wvla-parameter (C and Objective-C only)
4409 -Wvolatile-register-var -Wzero-length-bounds
4410
4411 Note that some warning flags are not implied by -Wall. Some of
4412 them warn about constructions that users generally do not consider
4413 questionable, but which occasionally you might wish to check for;
4414 others warn about constructions that are necessary or hard to avoid
4415 in some cases, and there is no simple way to modify the code to
4416 suppress the warning. Some of them are enabled by -Wextra but many
4417 of them must be enabled individually.
4418
4419 -Wextra
4420 This enables some extra warning flags that are not enabled by
4421 -Wall. (This option used to be called -W. The older name is still
4422 supported, but the newer name is more descriptive.)
4423
4424 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4425 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4426 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4427 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4428 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4429 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4430 -Wshift-negative-value (in C++03 and in C99 and newer)
4431 -Wunused-parameter (only with -Wunused or -Wall)
4432 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4433
4434 The option -Wextra also prints warning messages for the following
4435 cases:
4436
4437 * A pointer is compared against integer zero with "<", "<=", ">",
4438 or ">=".
4439
4440 * (C++ only) An enumerator and a non-enumerator both appear in a
4441 conditional expression.
4442
4443 * (C++ only) Ambiguous virtual bases.
4444
4445 * (C++ only) Subscripting an array that has been declared
4446 "register".
4447
4448 * (C++ only) Taking the address of a variable that has been
4449 declared "register".
4450
4451 * (C++ only) A base class is not initialized in the copy
4452 constructor of a derived class.
4453
4454 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4455 Warn about code affected by ABI changes. This includes code that
4456 may not be compatible with the vendor-neutral C++ ABI as well as
4457 the psABI for the particular target.
4458
4459 Since G++ now defaults to updating the ABI with each major release,
4460 normally -Wabi warns only about C++ ABI compatibility problems if
4461 there is a check added later in a release series for an ABI issue
4462 discovered since the initial release. -Wabi warns about more
4463 things if an older ABI version is selected (with -fabi-version=n).
4464
4465 -Wabi can also be used with an explicit version number to warn
4466 about C++ ABI compatibility with a particular -fabi-version level,
4467 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4468
4469 If an explicit version number is provided and -fabi-compat-version
4470 is not specified, the version number from this option is used for
4471 compatibility aliases. If no explicit version number is provided
4472 with this option, but -fabi-compat-version is specified, that
4473 version number is used for C++ ABI warnings.
4474
4475 Although an effort has been made to warn about all such cases,
4476 there are probably some cases that are not warned about, even
4477 though G++ is generating incompatible code. There may also be
4478 cases where warnings are emitted even though the code that is
4479 generated is compatible.
4480
4481 You should rewrite your code to avoid these warnings if you are
4482 concerned about the fact that code generated by G++ may not be
4483 binary compatible with code generated by other compilers.
4484
4485 Known incompatibilities in -fabi-version=2 (which was the default
4486 from GCC 3.4 to 4.9) include:
4487
4488 * A template with a non-type template parameter of reference type
4489 was mangled incorrectly:
4490
4491 extern int N;
4492 template <int &> struct S {};
4493 void n (S<N>) {2}
4494
4495 This was fixed in -fabi-version=3.
4496
4497 * SIMD vector types declared using "__attribute ((vector_size))"
4498 were mangled in a non-standard way that does not allow for
4499 overloading of functions taking vectors of different sizes.
4500
4501 The mangling was changed in -fabi-version=4.
4502
4503 * "__attribute ((const))" and "noreturn" were mangled as type
4504 qualifiers, and "decltype" of a plain declaration was folded
4505 away.
4506
4507 These mangling issues were fixed in -fabi-version=5.
4508
4509 * Scoped enumerators passed as arguments to a variadic function
4510 are promoted like unscoped enumerators, causing "va_arg" to
4511 complain. On most targets this does not actually affect the
4512 parameter passing ABI, as there is no way to pass an argument
4513 smaller than "int".
4514
4515 Also, the ABI changed the mangling of template argument packs,
4516 "const_cast", "static_cast", prefix increment/decrement, and a
4517 class scope function used as a template argument.
4518
4519 These issues were corrected in -fabi-version=6.
4520
4521 * Lambdas in default argument scope were mangled incorrectly, and
4522 the ABI changed the mangling of "nullptr_t".
4523
4524 These issues were corrected in -fabi-version=7.
4525
4526 * When mangling a function type with function-cv-qualifiers, the
4527 un-qualified function type was incorrectly treated as a
4528 substitution candidate.
4529
4530 This was fixed in -fabi-version=8, the default for GCC 5.1.
4531
4532 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
4533 to unaligned accesses. Note that this did not affect the ABI
4534 of a function with a "nullptr_t" parameter, as parameters have
4535 a minimum alignment.
4536
4537 This was fixed in -fabi-version=9, the default for GCC 5.2.
4538
4539 * Target-specific attributes that affect the identity of a type,
4540 such as ia32 calling conventions on a function type (stdcall,
4541 regparm, etc.), did not affect the mangled name, leading to
4542 name collisions when function pointers were used as template
4543 arguments.
4544
4545 This was fixed in -fabi-version=10, the default for GCC 6.1.
4546
4547 This option also enables warnings about psABI-related changes. The
4548 known psABI changes at this point include:
4549
4550 * For SysV/x86-64, unions with "long double" members are passed
4551 in memory as specified in psABI. Prior to GCC 4.4, this was
4552 not the case. For example:
4553
4554 union U {
4555 long double ld;
4556 int i;
4557 };
4558
4559 "union U" is now always passed in memory.
4560
4561 -Wchar-subscripts
4562 Warn if an array subscript has type "char". This is a common cause
4563 of error, as programmers often forget that this type is signed on
4564 some machines. This warning is enabled by -Wall.
4565
4566 -Wno-coverage-mismatch
4567 Warn if feedback profiles do not match when using the -fprofile-use
4568 option. If a source file is changed between compiling with
4569 -fprofile-generate and with -fprofile-use, the files with the
4570 profile feedback can fail to match the source file and GCC cannot
4571 use the profile feedback information. By default, this warning is
4572 enabled and is treated as an error. -Wno-coverage-mismatch can be
4573 used to disable the warning or -Wno-error=coverage-mismatch can be
4574 used to disable the error. Disabling the error for this warning
4575 can result in poorly optimized code and is useful only in the case
4576 of very minor changes such as bug fixes to an existing code-base.
4577 Completely disabling the warning is not recommended.
4578
4579 -Wno-cpp
4580 (C, Objective-C, C++, Objective-C++ and Fortran only) Suppress
4581 warning messages emitted by "#warning" directives.
4582
4583 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
4584 Give a warning when a value of type "float" is implicitly promoted
4585 to "double". CPUs with a 32-bit "single-precision" floating-point
4586 unit implement "float" in hardware, but emulate "double" in
4587 software. On such a machine, doing computations using "double"
4588 values is much more expensive because of the overhead required for
4589 software emulation.
4590
4591 It is easy to accidentally do computations with "double" because
4592 floating-point literals are implicitly of type "double". For
4593 example, in:
4594
4595 float area(float radius)
4596 {
4597 return 3.14159 * radius * radius;
4598 }
4599
4600 the compiler performs the entire computation with "double" because
4601 the floating-point literal is a "double".
4602
4603 -Wduplicate-decl-specifier (C and Objective-C only)
4604 Warn if a declaration has duplicate "const", "volatile", "restrict"
4605 or "_Atomic" specifier. This warning is enabled by -Wall.
4606
4607 -Wformat
4608 -Wformat=n
4609 Check calls to "printf" and "scanf", etc., to make sure that the
4610 arguments supplied have types appropriate to the format string
4611 specified, and that the conversions specified in the format string
4612 make sense. This includes standard functions, and others specified
4613 by format attributes, in the "printf", "scanf", "strftime" and
4614 "strfmon" (an X/Open extension, not in the C standard) families (or
4615 other target-specific families). Which functions are checked
4616 without format attributes having been specified depends on the
4617 standard version selected, and such checks of functions without the
4618 attribute specified are disabled by -ffreestanding or -fno-builtin.
4619
4620 The formats are checked against the format features supported by
4621 GNU libc version 2.2. These include all ISO C90 and C99 features,
4622 as well as features from the Single Unix Specification and some BSD
4623 and GNU extensions. Other library implementations may not support
4624 all these features; GCC does not support warning about features
4625 that go beyond a particular library's limitations. However, if
4626 -Wpedantic is used with -Wformat, warnings are given about format
4627 features not in the selected standard version (but not for
4628 "strfmon" formats, since those are not in any version of the C
4629 standard).
4630
4631 -Wformat=1
4632 -Wformat
4633 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4634 equivalent to -Wformat=0. Since -Wformat also checks for null
4635 format arguments for several functions, -Wformat also implies
4636 -Wnonnull. Some aspects of this level of format checking can
4637 be disabled by the options: -Wno-format-contains-nul,
4638 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4639 is enabled by -Wall.
4640
4641 -Wformat=2
4642 Enable -Wformat plus additional format checks. Currently
4643 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4644 -Wformat-y2k.
4645
4646 -Wno-format-contains-nul
4647 If -Wformat is specified, do not warn about format strings that
4648 contain NUL bytes.
4649
4650 -Wno-format-extra-args
4651 If -Wformat is specified, do not warn about excess arguments to a
4652 "printf" or "scanf" format function. The C standard specifies that
4653 such arguments are ignored.
4654
4655 Where the unused arguments lie between used arguments that are
4656 specified with $ operand number specifications, normally warnings
4657 are still given, since the implementation could not know what type
4658 to pass to "va_arg" to skip the unused arguments. However, in the
4659 case of "scanf" formats, this option suppresses the warning if the
4660 unused arguments are all pointers, since the Single Unix
4661 Specification says that such unused arguments are allowed.
4662
4663 -Wformat-overflow
4664 -Wformat-overflow=level
4665 Warn about calls to formatted input/output functions such as
4666 "sprintf" and "vsprintf" that might overflow the destination
4667 buffer. When the exact number of bytes written by a format
4668 directive cannot be determined at compile-time it is estimated
4669 based on heuristics that depend on the level argument and on
4670 optimization. While enabling optimization will in most cases
4671 improve the accuracy of the warning, it may also result in false
4672 positives.
4673
4674 -Wformat-overflow
4675 -Wformat-overflow=1
4676 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4677 conservative approach that warns only about calls that most
4678 likely overflow the buffer. At this level, numeric arguments
4679 to format directives with unknown values are assumed to have
4680 the value of one, and strings of unknown length to be empty.
4681 Numeric arguments that are known to be bounded to a subrange of
4682 their type, or string arguments whose output is bounded either
4683 by their directive's precision or by a finite set of string
4684 literals, are assumed to take on the value within the range
4685 that results in the most bytes on output. For example, the
4686 call to "sprintf" below is diagnosed because even with both a
4687 and b equal to zero, the terminating NUL character ('\0')
4688 appended by the function to the destination buffer will be
4689 written past its end. Increasing the size of the buffer by a
4690 single byte is sufficient to avoid the warning, though it may
4691 not be sufficient to avoid the overflow.
4692
4693 void f (int a, int b)
4694 {
4695 char buf [13];
4696 sprintf (buf, "a = %i, b = %i\n", a, b);
4697 }
4698
4699 -Wformat-overflow=2
4700 Level 2 warns also about calls that might overflow the
4701 destination buffer given an argument of sufficient length or
4702 magnitude. At level 2, unknown numeric arguments are assumed
4703 to have the minimum representable value for signed types with a
4704 precision greater than 1, and the maximum representable value
4705 otherwise. Unknown string arguments whose length cannot be
4706 assumed to be bounded either by the directive's precision, or
4707 by a finite set of string literals they may evaluate to, or the
4708 character array they may point to, are assumed to be 1
4709 character long.
4710
4711 At level 2, the call in the example above is again diagnosed,
4712 but this time because with a equal to a 32-bit "INT_MIN" the
4713 first %i directive will write some of its digits beyond the end
4714 of the destination buffer. To make the call safe regardless of
4715 the values of the two variables, the size of the destination
4716 buffer must be increased to at least 34 bytes. GCC includes
4717 the minimum size of the buffer in an informational note
4718 following the warning.
4719
4720 An alternative to increasing the size of the destination buffer
4721 is to constrain the range of formatted values. The maximum
4722 length of string arguments can be bounded by specifying the
4723 precision in the format directive. When numeric arguments of
4724 format directives can be assumed to be bounded by less than the
4725 precision of their type, choosing an appropriate length
4726 modifier to the format specifier will reduce the required
4727 buffer size. For example, if a and b in the example above can
4728 be assumed to be within the precision of the "short int" type
4729 then using either the %hi format directive or casting the
4730 argument to "short" reduces the maximum required size of the
4731 buffer to 24 bytes.
4732
4733 void f (int a, int b)
4734 {
4735 char buf [23];
4736 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4737 }
4738
4739 -Wno-format-zero-length
4740 If -Wformat is specified, do not warn about zero-length formats.
4741 The C standard specifies that zero-length formats are allowed.
4742
4743 -Wformat-nonliteral
4744 If -Wformat is specified, also warn if the format string is not a
4745 string literal and so cannot be checked, unless the format function
4746 takes its format arguments as a "va_list".
4747
4748 -Wformat-security
4749 If -Wformat is specified, also warn about uses of format functions
4750 that represent possible security problems. At present, this warns
4751 about calls to "printf" and "scanf" functions where the format
4752 string is not a string literal and there are no format arguments,
4753 as in "printf (foo);". This may be a security hole if the format
4754 string came from untrusted input and contains %n. (This is
4755 currently a subset of what -Wformat-nonliteral warns about, but in
4756 future warnings may be added to -Wformat-security that are not
4757 included in -Wformat-nonliteral.)
4758
4759 -Wformat-signedness
4760 If -Wformat is specified, also warn if the format string requires
4761 an unsigned argument and the argument is signed and vice versa.
4762
4763 -Wformat-truncation
4764 -Wformat-truncation=level
4765 Warn about calls to formatted input/output functions such as
4766 "snprintf" and "vsnprintf" that might result in output truncation.
4767 When the exact number of bytes written by a format directive cannot
4768 be determined at compile-time it is estimated based on heuristics
4769 that depend on the level argument and on optimization. While
4770 enabling optimization will in most cases improve the accuracy of
4771 the warning, it may also result in false positives. Except as
4772 noted otherwise, the option uses the same logic -Wformat-overflow.
4773
4774 -Wformat-truncation
4775 -Wformat-truncation=1
4776 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4777 conservative approach that warns only about calls to bounded
4778 functions whose return value is unused and that will most
4779 likely result in output truncation.
4780
4781 -Wformat-truncation=2
4782 Level 2 warns also about calls to bounded functions whose
4783 return value is used and that might result in truncation given
4784 an argument of sufficient length or magnitude.
4785
4786 -Wformat-y2k
4787 If -Wformat is specified, also warn about "strftime" formats that
4788 may yield only a two-digit year.
4789
4790 -Wnonnull
4791 Warn about passing a null pointer for arguments marked as requiring
4792 a non-null value by the "nonnull" function attribute.
4793
4794 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4795 with the -Wno-nonnull option.
4796
4797 -Wnonnull-compare
4798 Warn when comparing an argument marked with the "nonnull" function
4799 attribute against null inside the function.
4800
4801 -Wnonnull-compare is included in -Wall. It can be disabled with
4802 the -Wno-nonnull-compare option.
4803
4804 -Wnull-dereference
4805 Warn if the compiler detects paths that trigger erroneous or
4806 undefined behavior due to dereferencing a null pointer. This
4807 option is only active when -fdelete-null-pointer-checks is active,
4808 which is enabled by optimizations in most targets. The precision
4809 of the warnings depends on the optimization options used.
4810
4811 -Winit-self (C, C++, Objective-C and Objective-C++ only)
4812 Warn about uninitialized variables that are initialized with
4813 themselves. Note this option can only be used with the
4814 -Wuninitialized option.
4815
4816 For example, GCC warns about "i" being uninitialized in the
4817 following snippet only when -Winit-self has been specified:
4818
4819 int f()
4820 {
4821 int i = i;
4822 return i;
4823 }
4824
4825 This warning is enabled by -Wall in C++.
4826
4827 -Wno-implicit-int (C and Objective-C only)
4828 This option controls warnings when a declaration does not specify a
4829 type. This warning is enabled by default in C99 and later dialects
4830 of C, and also by -Wall.
4831
4832 -Wno-implicit-function-declaration (C and Objective-C only)
4833 This option controls warnings when a function is used before being
4834 declared. This warning is enabled by default in C99 and later
4835 dialects of C, and also by -Wall. The warning is made into an
4836 error by -pedantic-errors.
4837
4838 -Wimplicit (C and Objective-C only)
4839 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
4840 warning is enabled by -Wall.
4841
4842 -Wimplicit-fallthrough
4843 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
4844 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
4845
4846 -Wimplicit-fallthrough=n
4847 Warn when a switch case falls through. For example:
4848
4849 switch (cond)
4850 {
4851 case 1:
4852 a = 1;
4853 break;
4854 case 2:
4855 a = 2;
4856 case 3:
4857 a = 3;
4858 break;
4859 }
4860
4861 This warning does not warn when the last statement of a case cannot
4862 fall through, e.g. when there is a return statement or a call to
4863 function declared with the noreturn attribute.
4864 -Wimplicit-fallthrough= also takes into account control flow
4865 statements, such as ifs, and only warns when appropriate. E.g.
4866
4867 switch (cond)
4868 {
4869 case 1:
4870 if (i > 3) {
4871 bar (5);
4872 break;
4873 } else if (i < 1) {
4874 bar (0);
4875 } else
4876 return;
4877 default:
4878 ...
4879 }
4880
4881 Since there are occasions where a switch case fall through is
4882 desirable, GCC provides an attribute, "__attribute__
4883 ((fallthrough))", that is to be used along with a null statement to
4884 suppress this warning that would normally occur:
4885
4886 switch (cond)
4887 {
4888 case 1:
4889 bar (0);
4890 __attribute__ ((fallthrough));
4891 default:
4892 ...
4893 }
4894
4895 C++17 provides a standard way to suppress the
4896 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
4897 the GNU attribute. In C++11 or C++14 users can use
4898 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
4899 these attributes, it is also possible to add a fallthrough comment
4900 to silence the warning. The whole body of the C or C++ style
4901 comment should match the given regular expressions listed below.
4902 The option argument n specifies what kind of comments are accepted:
4903
4904 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
4905 *<-Wimplicit-fallthrough=1 matches ".*" regular>
4906 expression, any comment is used as fallthrough comment.
4907
4908 *<-Wimplicit-fallthrough=2 case insensitively matches>
4909 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
4910
4911 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
4912 following regular expressions:
4913
4914 *<"-fallthrough">
4915 *<"@fallthrough@">
4916 *<"lint -fallthrough[ \t]*">
4917 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
4918 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
4919 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
4920 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4921 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
4922 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4923 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
4924 following regular expressions:
4925
4926 *<"-fallthrough">
4927 *<"@fallthrough@">
4928 *<"lint -fallthrough[ \t]*">
4929 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
4930 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
4931 fallthrough comments, only attributes disable the warning.
4932
4933 The comment needs to be followed after optional whitespace and
4934 other comments by "case" or "default" keywords or by a user label
4935 that precedes some "case" or "default" label.
4936
4937 switch (cond)
4938 {
4939 case 1:
4940 bar (0);
4941 /* FALLTHRU */
4942 default:
4943 ...
4944 }
4945
4946 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
4947
4948 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
4949 Control if warnings triggered by the "warn_if_not_aligned"
4950 attribute should be issued. These warnings are enabled by default.
4951
4952 -Wignored-qualifiers (C and C++ only)
4953 Warn if the return type of a function has a type qualifier such as
4954 "const". For ISO C such a type qualifier has no effect, since the
4955 value returned by a function is not an lvalue. For C++, the
4956 warning is only emitted for scalar types or "void". ISO C
4957 prohibits qualified "void" return types on function definitions, so
4958 such return types always receive a warning even without this
4959 option.
4960
4961 This warning is also enabled by -Wextra.
4962
4963 -Wno-ignored-attributes (C and C++ only)
4964 This option controls warnings when an attribute is ignored. This
4965 is different from the -Wattributes option in that it warns whenever
4966 the compiler decides to drop an attribute, not that the attribute
4967 is either unknown, used in a wrong place, etc. This warning is
4968 enabled by default.
4969
4970 -Wmain
4971 Warn if the type of "main" is suspicious. "main" should be a
4972 function with external linkage, returning int, taking either zero
4973 arguments, two, or three arguments of appropriate types. This
4974 warning is enabled by default in C++ and is enabled by either -Wall
4975 or -Wpedantic.
4976
4977 -Wmisleading-indentation (C and C++ only)
4978 Warn when the indentation of the code does not reflect the block
4979 structure. Specifically, a warning is issued for "if", "else",
4980 "while", and "for" clauses with a guarded statement that does not
4981 use braces, followed by an unguarded statement with the same
4982 indentation.
4983
4984 In the following example, the call to "bar" is misleadingly
4985 indented as if it were guarded by the "if" conditional.
4986
4987 if (some_condition ())
4988 foo ();
4989 bar (); /* Gotcha: this is not guarded by the "if". */
4990
4991 In the case of mixed tabs and spaces, the warning uses the
4992 -ftabstop= option to determine if the statements line up
4993 (defaulting to 8).
4994
4995 The warning is not issued for code involving multiline preprocessor
4996 logic such as the following example.
4997
4998 if (flagA)
4999 foo (0);
5000 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5001 if (flagB)
5002 #endif
5003 foo (1);
5004
5005 The warning is not issued after a "#line" directive, since this
5006 typically indicates autogenerated code, and no assumptions can be
5007 made about the layout of the file that the directive references.
5008
5009 This warning is enabled by -Wall in C and C++.
5010
5011 -Wmissing-attributes
5012 Warn when a declaration of a function is missing one or more
5013 attributes that a related function is declared with and whose
5014 absence may adversely affect the correctness or efficiency of
5015 generated code. For example, the warning is issued for
5016 declarations of aliases that use attributes to specify less
5017 restrictive requirements than those of their targets. This
5018 typically represents a potential optimization opportunity. By
5019 contrast, the -Wattribute-alias=2 option controls warnings issued
5020 when the alias is more restrictive than the target, which could
5021 lead to incorrect code generation. Attributes considered include
5022 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5023 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5024 "returns_nonnull", and "returns_twice".
5025
5026 In C++, the warning is issued when an explicit specialization of a
5027 primary template declared with attribute "alloc_align",
5028 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5029 or "nonnull" is declared without it. Attributes "deprecated",
5030 "error", and "warning" suppress the warning..
5031
5032 You can use the "copy" attribute to apply the same set of
5033 attributes to a declaration as that on another declaration without
5034 explicitly enumerating the attributes. This attribute can be
5035 applied to declarations of functions, variables, or types.
5036
5037 -Wmissing-attributes is enabled by -Wall.
5038
5039 For example, since the declaration of the primary function template
5040 below makes use of both attribute "malloc" and "alloc_size" the
5041 declaration of the explicit specialization of the template is
5042 diagnosed because it is missing one of the attributes.
5043
5044 template <class T>
5045 T* __attribute__ ((malloc, alloc_size (1)))
5046 allocate (size_t);
5047
5048 template <>
5049 void* __attribute__ ((malloc)) // missing alloc_size
5050 allocate<void> (size_t);
5051
5052 -Wmissing-braces
5053 Warn if an aggregate or union initializer is not fully bracketed.
5054 In the following example, the initializer for "a" is not fully
5055 bracketed, but that for "b" is fully bracketed.
5056
5057 int a[2][2] = { 0, 1, 2, 3 };
5058 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5059
5060 This warning is enabled by -Wall.
5061
5062 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
5063 Warn if a user-supplied include directory does not exist.
5064
5065 -Wno-missing-profile
5066 This option controls warnings if feedback profiles are missing when
5067 using the -fprofile-use option. This option diagnoses those cases
5068 where a new function or a new file is added between compiling with
5069 -fprofile-generate and with -fprofile-use, without regenerating the
5070 profiles. In these cases, the profile feedback data files do not
5071 contain any profile feedback information for the newly added
5072 function or file respectively. Also, in the case when profile
5073 count data (.gcda) files are removed, GCC cannot use any profile
5074 feedback information. In all these cases, warnings are issued to
5075 inform you that a profile generation step is due. Ignoring the
5076 warning can result in poorly optimized code. -Wno-missing-profile
5077 can be used to disable the warning, but this is not recommended and
5078 should be done only when non-existent profile data is justified.
5079
5080 -Wno-mismatched-dealloc
5081 Warn for calls to deallocation functions with pointer arguments
5082 returned from from allocations functions for which the former isn't
5083 a suitable deallocator. A pair of functions can be associated as
5084 matching allocators and deallocators by use of attribute "malloc".
5085 Unless disabled by the -fno-builtin option the standard functions
5086 "calloc", "malloc", "realloc", and "free", as well as the
5087 corresponding forms of C++ "operator new" and "operator delete" are
5088 implicitly associated as matching allocators and deallocators. In
5089 the following example "mydealloc" is the deallocator for pointers
5090 returned from "myalloc".
5091
5092 void mydealloc (void*);
5093
5094 __attribute__ ((malloc (mydealloc, 1))) void*
5095 myalloc (size_t);
5096
5097 void f (void)
5098 {
5099 void *p = myalloc (32);
5100 // ...use p...
5101 free (p); // warning: not a matching deallocator for myalloc
5102 mydealloc (p); // ok
5103 }
5104
5105 In C++, the related option -Wmismatched-new-delete diagnoses
5106 mismatches involving either "operator new" or "operator delete".
5107
5108 Option -Wmismatched-dealloc is enabled by default.
5109
5110 -Wmultistatement-macros
5111 Warn about unsafe multiple statement macros that appear to be
5112 guarded by a clause such as "if", "else", "for", "switch", or
5113 "while", in which only the first statement is actually guarded
5114 after the macro is expanded.
5115
5116 For example:
5117
5118 #define DOIT x++; y++
5119 if (c)
5120 DOIT;
5121
5122 will increment "y" unconditionally, not just when "c" holds. The
5123 can usually be fixed by wrapping the macro in a do-while loop:
5124
5125 #define DOIT do { x++; y++; } while (0)
5126 if (c)
5127 DOIT;
5128
5129 This warning is enabled by -Wall in C and C++.
5130
5131 -Wparentheses
5132 Warn if parentheses are omitted in certain contexts, such as when
5133 there is an assignment in a context where a truth value is
5134 expected, or when operators are nested whose precedence people
5135 often get confused about.
5136
5137 Also warn if a comparison like "x<=y<=z" appears; this is
5138 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5139 interpretation from that of ordinary mathematical notation.
5140
5141 Also warn for dangerous uses of the GNU extension to "?:" with
5142 omitted middle operand. When the condition in the "?": operator is
5143 a boolean expression, the omitted value is always 1. Often
5144 programmers expect it to be a value computed inside the conditional
5145 expression instead.
5146
5147 For C++ this also warns for some cases of unnecessary parentheses
5148 in declarations, which can indicate an attempt at a function call
5149 instead of a declaration:
5150
5151 {
5152 // Declares a local variable called mymutex.
5153 std::unique_lock<std::mutex> (mymutex);
5154 // User meant std::unique_lock<std::mutex> lock (mymutex);
5155 }
5156
5157 This warning is enabled by -Wall.
5158
5159 -Wsequence-point
5160 Warn about code that may have undefined semantics because of
5161 violations of sequence point rules in the C and C++ standards.
5162
5163 The C and C++ standards define the order in which expressions in a
5164 C/C++ program are evaluated in terms of sequence points, which
5165 represent a partial ordering between the execution of parts of the
5166 program: those executed before the sequence point, and those
5167 executed after it. These occur after the evaluation of a full
5168 expression (one which is not part of a larger expression), after
5169 the evaluation of the first operand of a "&&", "||", "? :" or ","
5170 (comma) operator, before a function is called (but after the
5171 evaluation of its arguments and the expression denoting the called
5172 function), and in certain other places. Other than as expressed by
5173 the sequence point rules, the order of evaluation of subexpressions
5174 of an expression is not specified. All these rules describe only a
5175 partial order rather than a total order, since, for example, if two
5176 functions are called within one expression with no sequence point
5177 between them, the order in which the functions are called is not
5178 specified. However, the standards committee have ruled that
5179 function calls do not overlap.
5180
5181 It is not specified when between sequence points modifications to
5182 the values of objects take effect. Programs whose behavior depends
5183 on this have undefined behavior; the C and C++ standards specify
5184 that "Between the previous and next sequence point an object shall
5185 have its stored value modified at most once by the evaluation of an
5186 expression. Furthermore, the prior value shall be read only to
5187 determine the value to be stored.". If a program breaks these
5188 rules, the results on any particular implementation are entirely
5189 unpredictable.
5190
5191 Examples of code with undefined behavior are "a = a++;", "a[n] =
5192 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5193 diagnosed by this option, and it may give an occasional false
5194 positive result, but in general it has been found fairly effective
5195 at detecting this sort of problem in programs.
5196
5197 The C++17 standard will define the order of evaluation of operands
5198 in more cases: in particular it requires that the right-hand side
5199 of an assignment be evaluated before the left-hand side, so the
5200 above examples are no longer undefined. But this option will still
5201 warn about them, to help people avoid writing code that is
5202 undefined in C and earlier revisions of C++.
5203
5204 The standard is worded confusingly, therefore there is some debate
5205 over the precise meaning of the sequence point rules in subtle
5206 cases. Links to discussions of the problem, including proposed
5207 formal definitions, may be found on the GCC readings page, at
5208 <http://gcc.gnu.org/readings.html>.
5209
5210 This warning is enabled by -Wall for C and C++.
5211
5212 -Wno-return-local-addr
5213 Do not warn about returning a pointer (or in C++, a reference) to a
5214 variable that goes out of scope after the function returns.
5215
5216 -Wreturn-type
5217 Warn whenever a function is defined with a return type that
5218 defaults to "int". Also warn about any "return" statement with no
5219 return value in a function whose return type is not "void" (falling
5220 off the end of the function body is considered returning without a
5221 value).
5222
5223 For C only, warn about a "return" statement with an expression in a
5224 function whose return type is "void", unless the expression type is
5225 also "void". As a GNU extension, the latter case is accepted
5226 without a warning unless -Wpedantic is used. Attempting to use the
5227 return value of a non-"void" function other than "main" that flows
5228 off the end by reaching the closing curly brace that terminates the
5229 function is undefined.
5230
5231 Unlike in C, in C++, flowing off the end of a non-"void" function
5232 other than "main" results in undefined behavior even when the value
5233 of the function is not used.
5234
5235 This warning is enabled by default in C++ and by -Wall otherwise.
5236
5237 -Wno-shift-count-negative
5238 Controls warnings if a shift count is negative. This warning is
5239 enabled by default.
5240
5241 -Wno-shift-count-overflow
5242 Controls warnings if a shift count is greater than or equal to the
5243 bit width of the type. This warning is enabled by default.
5244
5245 -Wshift-negative-value
5246 Warn if left shifting a negative value. This warning is enabled by
5247 -Wextra in C99 and C++11 modes (and newer).
5248
5249 -Wno-shift-overflow
5250 -Wshift-overflow=n
5251 These options control warnings about left shift overflows.
5252
5253 -Wshift-overflow=1
5254 This is the warning level of -Wshift-overflow and is enabled by
5255 default in C99 and C++11 modes (and newer). This warning level
5256 does not warn about left-shifting 1 into the sign bit.
5257 (However, in C, such an overflow is still rejected in contexts
5258 where an integer constant expression is required.) No warning
5259 is emitted in C++20 mode (and newer), as signed left shifts
5260 always wrap.
5261
5262 -Wshift-overflow=2
5263 This warning level also warns about left-shifting 1 into the
5264 sign bit, unless C++14 mode (or newer) is active.
5265
5266 -Wswitch
5267 Warn whenever a "switch" statement has an index of enumerated type
5268 and lacks a "case" for one or more of the named codes of that
5269 enumeration. (The presence of a "default" label prevents this
5270 warning.) "case" labels outside the enumeration range also provoke
5271 warnings when this option is used (even if there is a "default"
5272 label). This warning is enabled by -Wall.
5273
5274 -Wswitch-default
5275 Warn whenever a "switch" statement does not have a "default" case.
5276
5277 -Wswitch-enum
5278 Warn whenever a "switch" statement has an index of enumerated type
5279 and lacks a "case" for one or more of the named codes of that
5280 enumeration. "case" labels outside the enumeration range also
5281 provoke warnings when this option is used. The only difference
5282 between -Wswitch and this option is that this option gives a
5283 warning about an omitted enumeration code even if there is a
5284 "default" label.
5285
5286 -Wno-switch-bool
5287 Do not warn when a "switch" statement has an index of boolean type
5288 and the case values are outside the range of a boolean type. It is
5289 possible to suppress this warning by casting the controlling
5290 expression to a type other than "bool". For example:
5291
5292 switch ((int) (a == 4))
5293 {
5294 ...
5295 }
5296
5297 This warning is enabled by default for C and C++ programs.
5298
5299 -Wno-switch-outside-range
5300 This option controls warnings when a "switch" case has a value that
5301 is outside of its respective type range. This warning is enabled
5302 by default for C and C++ programs.
5303
5304 -Wno-switch-unreachable
5305 Do not warn when a "switch" statement contains statements between
5306 the controlling expression and the first case label, which will
5307 never be executed. For example:
5308
5309 switch (cond)
5310 {
5311 i = 15;
5312 ...
5313 case 5:
5314 ...
5315 }
5316
5317 -Wswitch-unreachable does not warn if the statement between the
5318 controlling expression and the first case label is just a
5319 declaration:
5320
5321 switch (cond)
5322 {
5323 int i;
5324 ...
5325 case 5:
5326 i = 5;
5327 ...
5328 }
5329
5330 This warning is enabled by default for C and C++ programs.
5331
5332 -Wsync-nand (C and C++ only)
5333 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5334 built-in functions are used. These functions changed semantics in
5335 GCC 4.4.
5336
5337 -Wunused-but-set-parameter
5338 Warn whenever a function parameter is assigned to, but otherwise
5339 unused (aside from its declaration).
5340
5341 To suppress this warning use the "unused" attribute.
5342
5343 This warning is also enabled by -Wunused together with -Wextra.
5344
5345 -Wunused-but-set-variable
5346 Warn whenever a local variable is assigned to, but otherwise unused
5347 (aside from its declaration). This warning is enabled by -Wall.
5348
5349 To suppress this warning use the "unused" attribute.
5350
5351 This warning is also enabled by -Wunused, which is enabled by
5352 -Wall.
5353
5354 -Wunused-function
5355 Warn whenever a static function is declared but not defined or a
5356 non-inline static function is unused. This warning is enabled by
5357 -Wall.
5358
5359 -Wunused-label
5360 Warn whenever a label is declared but not used. This warning is
5361 enabled by -Wall.
5362
5363 To suppress this warning use the "unused" attribute.
5364
5365 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5366 Warn when a typedef locally defined in a function is not used.
5367 This warning is enabled by -Wall.
5368
5369 -Wunused-parameter
5370 Warn whenever a function parameter is unused aside from its
5371 declaration.
5372
5373 To suppress this warning use the "unused" attribute.
5374
5375 -Wno-unused-result
5376 Do not warn if a caller of a function marked with attribute
5377 "warn_unused_result" does not use its return value. The default is
5378 -Wunused-result.
5379
5380 -Wunused-variable
5381 Warn whenever a local or static variable is unused aside from its
5382 declaration. This option implies -Wunused-const-variable=1 for C,
5383 but not for C++. This warning is enabled by -Wall.
5384
5385 To suppress this warning use the "unused" attribute.
5386
5387 -Wunused-const-variable
5388 -Wunused-const-variable=n
5389 Warn whenever a constant static variable is unused aside from its
5390 declaration. -Wunused-const-variable=1 is enabled by
5391 -Wunused-variable for C, but not for C++. In C this declares
5392 variable storage, but in C++ this is not an error since const
5393 variables take the place of "#define"s.
5394
5395 To suppress this warning use the "unused" attribute.
5396
5397 -Wunused-const-variable=1
5398 This is the warning level that is enabled by -Wunused-variable
5399 for C. It warns only about unused static const variables
5400 defined in the main compilation unit, but not about static
5401 const variables declared in any header included.
5402
5403 -Wunused-const-variable=2
5404 This warning level also warns for unused constant static
5405 variables in headers (excluding system headers). This is the
5406 warning level of -Wunused-const-variable and must be explicitly
5407 requested since in C++ this isn't an error and in C it might be
5408 harder to clean up all headers included.
5409
5410 -Wunused-value
5411 Warn whenever a statement computes a result that is explicitly not
5412 used. To suppress this warning cast the unused expression to
5413 "void". This includes an expression-statement or the left-hand side
5414 of a comma expression that contains no side effects. For example,
5415 an expression such as "x[i,j]" causes a warning, while
5416 "x[(void)i,j]" does not.
5417
5418 This warning is enabled by -Wall.
5419
5420 -Wunused
5421 All the above -Wunused options combined.
5422
5423 In order to get a warning about an unused function parameter, you
5424 must either specify -Wextra -Wunused (note that -Wall implies
5425 -Wunused), or separately specify -Wunused-parameter.
5426
5427 -Wuninitialized
5428 Warn if an object with automatic or allocated storage duration is
5429 used without having been initialized. In C++, also warn if a non-
5430 static reference or non-static "const" member appears in a class
5431 without constructors.
5432
5433 In addition, passing a pointer (or in C++, a reference) to an
5434 uninitialized object to a "const"-qualified argument of a built-in
5435 function known to read the object is also diagnosed by this
5436 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5437
5438 If you want to warn about code that uses the uninitialized value of
5439 the variable in its own initializer, use the -Winit-self option.
5440
5441 These warnings occur for individual uninitialized elements of
5442 structure, union or array variables as well as for variables that
5443 are uninitialized as a whole. They do not occur for variables or
5444 elements declared "volatile". Because these warnings depend on
5445 optimization, the exact variables or elements for which there are
5446 warnings depend on the precise optimization options and version of
5447 GCC used.
5448
5449 Note that there may be no warning about a variable that is used
5450 only to compute a value that itself is never used, because such
5451 computations may be deleted by data flow analysis before the
5452 warnings are printed.
5453
5454 -Wno-invalid-memory-model
5455 This option controls warnings for invocations of __atomic Builtins,
5456 __sync Builtins, and the C11 atomic generic functions with a memory
5457 consistency argument that is either invalid for the operation or
5458 outside the range of values of the "memory_order" enumeration. For
5459 example, since the "__atomic_store" and "__atomic_store_n" built-
5460 ins are only defined for the relaxed, release, and sequentially
5461 consistent memory orders the following code is diagnosed:
5462
5463 void store (int *i)
5464 {
5465 __atomic_store_n (i, 0, memory_order_consume);
5466 }
5467
5468 -Winvalid-memory-model is enabled by default.
5469
5470 -Wmaybe-uninitialized
5471 For an object with automatic or allocated storage duration, if
5472 there exists a path from the function entry to a use of the object
5473 that is initialized, but there exist some other paths for which the
5474 object is not initialized, the compiler emits a warning if it
5475 cannot prove the uninitialized paths are not executed at run time.
5476
5477 In addition, passing a pointer (or in C++, a reference) to an
5478 uninitialized object to a "const"-qualified function argument is
5479 also diagnosed by this warning. (-Wuninitialized is issued for
5480 built-in functions known to read the object.) Annotating the
5481 function with attribute "access (none)" indicates that the argument
5482 isn't used to access the object and avoids the warning.
5483
5484 These warnings are only possible in optimizing compilation, because
5485 otherwise GCC does not keep track of the state of variables.
5486
5487 These warnings are made optional because GCC may not be able to
5488 determine when the code is correct in spite of appearing to have an
5489 error. Here is one example of how this can happen:
5490
5491 {
5492 int x;
5493 switch (y)
5494 {
5495 case 1: x = 1;
5496 break;
5497 case 2: x = 4;
5498 break;
5499 case 3: x = 5;
5500 }
5501 foo (x);
5502 }
5503
5504 If the value of "y" is always 1, 2 or 3, then "x" is always
5505 initialized, but GCC doesn't know this. To suppress the warning,
5506 you need to provide a default case with assert(0) or similar code.
5507
5508 This option also warns when a non-volatile automatic variable might
5509 be changed by a call to "longjmp". The compiler sees only the
5510 calls to "setjmp". It cannot know where "longjmp" will be called;
5511 in fact, a signal handler could call it at any point in the code.
5512 As a result, you may get a warning even when there is in fact no
5513 problem because "longjmp" cannot in fact be called at the place
5514 that would cause a problem.
5515
5516 Some spurious warnings can be avoided if you declare all the
5517 functions you use that never return as "noreturn".
5518
5519 This warning is enabled by -Wall or -Wextra.
5520
5521 -Wunknown-pragmas
5522 Warn when a "#pragma" directive is encountered that is not
5523 understood by GCC. If this command-line option is used, warnings
5524 are even issued for unknown pragmas in system header files. This
5525 is not the case if the warnings are only enabled by the -Wall
5526 command-line option.
5527
5528 -Wno-pragmas
5529 Do not warn about misuses of pragmas, such as incorrect parameters,
5530 invalid syntax, or conflicts between pragmas. See also
5531 -Wunknown-pragmas.
5532
5533 -Wno-prio-ctor-dtor
5534 Do not warn if a priority from 0 to 100 is used for constructor or
5535 destructor. The use of constructor and destructor attributes allow
5536 you to assign a priority to the constructor/destructor to control
5537 its order of execution before "main" is called or after it returns.
5538 The priority values must be greater than 100 as the compiler
5539 reserves priority values between 0--100 for the implementation.
5540
5541 -Wstrict-aliasing
5542 This option is only active when -fstrict-aliasing is active. It
5543 warns about code that might break the strict aliasing rules that
5544 the compiler is using for optimization. The warning does not catch
5545 all cases, but does attempt to catch the more common pitfalls. It
5546 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
5547
5548 -Wstrict-aliasing=n
5549 This option is only active when -fstrict-aliasing is active. It
5550 warns about code that might break the strict aliasing rules that
5551 the compiler is using for optimization. Higher levels correspond
5552 to higher accuracy (fewer false positives). Higher levels also
5553 correspond to more effort, similar to the way -O works.
5554 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
5555
5556 Level 1: Most aggressive, quick, least accurate. Possibly useful
5557 when higher levels do not warn but -fstrict-aliasing still breaks
5558 the code, as it has very few false negatives. However, it has many
5559 false positives. Warns for all pointer conversions between
5560 possibly incompatible types, even if never dereferenced. Runs in
5561 the front end only.
5562
5563 Level 2: Aggressive, quick, not too precise. May still have many
5564 false positives (not as many as level 1 though), and few false
5565 negatives (but possibly more than level 1). Unlike level 1, it
5566 only warns when an address is taken. Warns about incomplete types.
5567 Runs in the front end only.
5568
5569 Level 3 (default for -Wstrict-aliasing): Should have very few false
5570 positives and few false negatives. Slightly slower than levels 1
5571 or 2 when optimization is enabled. Takes care of the common
5572 pun+dereference pattern in the front end: "*(int*)&some_float". If
5573 optimization is enabled, it also runs in the back end, where it
5574 deals with multiple statement cases using flow-sensitive points-to
5575 information. Only warns when the converted pointer is
5576 dereferenced. Does not warn about incomplete types.
5577
5578 -Wstrict-overflow
5579 -Wstrict-overflow=n
5580 This option is only active when signed overflow is undefined. It
5581 warns about cases where the compiler optimizes based on the
5582 assumption that signed overflow does not occur. Note that it does
5583 not warn about all cases where the code might overflow: it only
5584 warns about cases where the compiler implements some optimization.
5585 Thus this warning depends on the optimization level.
5586
5587 An optimization that assumes that signed overflow does not occur is
5588 perfectly safe if the values of the variables involved are such
5589 that overflow never does, in fact, occur. Therefore this warning
5590 can easily give a false positive: a warning about code that is not
5591 actually a problem. To help focus on important issues, several
5592 warning levels are defined. No warnings are issued for the use of
5593 undefined signed overflow when estimating how many iterations a
5594 loop requires, in particular when determining whether a loop will
5595 be executed at all.
5596
5597 -Wstrict-overflow=1
5598 Warn about cases that are both questionable and easy to avoid.
5599 For example the compiler simplifies "x + 1 > x" to 1. This
5600 level of -Wstrict-overflow is enabled by -Wall; higher levels
5601 are not, and must be explicitly requested.
5602
5603 -Wstrict-overflow=2
5604 Also warn about other cases where a comparison is simplified to
5605 a constant. For example: "abs (x) >= 0". This can only be
5606 simplified when signed integer overflow is undefined, because
5607 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
5608 zero. -Wstrict-overflow (with no level) is the same as
5609 -Wstrict-overflow=2.
5610
5611 -Wstrict-overflow=3
5612 Also warn about other cases where a comparison is simplified.
5613 For example: "x + 1 > 1" is simplified to "x > 0".
5614
5615 -Wstrict-overflow=4
5616 Also warn about other simplifications not covered by the above
5617 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
5618
5619 -Wstrict-overflow=5
5620 Also warn about cases where the compiler reduces the magnitude
5621 of a constant involved in a comparison. For example: "x + 2 >
5622 y" is simplified to "x + 1 >= y". This is reported only at the
5623 highest warning level because this simplification applies to
5624 many comparisons, so this warning level gives a very large
5625 number of false positives.
5626
5627 -Wstring-compare
5628 Warn for calls to "strcmp" and "strncmp" whose result is determined
5629 to be either zero or non-zero in tests for such equality owing to
5630 the length of one argument being greater than the size of the array
5631 the other argument is stored in (or the bound in the case of
5632 "strncmp"). Such calls could be mistakes. For example, the call
5633 to "strcmp" below is diagnosed because its result is necessarily
5634 non-zero irrespective of the contents of the array "a".
5635
5636 extern char a[4];
5637 void f (char *d)
5638 {
5639 strcpy (d, "string");
5640 ...
5641 if (0 == strcmp (a, d)) // cannot be true
5642 puts ("a and d are the same");
5643 }
5644
5645 -Wstring-compare is enabled by -Wextra.
5646
5647 -Wno-stringop-overflow
5648 -Wstringop-overflow
5649 -Wstringop-overflow=type
5650 Warn for calls to string manipulation functions such as "memcpy"
5651 and "strcpy" that are determined to overflow the destination
5652 buffer. The optional argument is one greater than the type of
5653 Object Size Checking to perform to determine the size of the
5654 destination. The argument is meaningful only for functions that
5655 operate on character arrays but not for raw memory functions like
5656 "memcpy" which always make use of Object Size type-0. The option
5657 also warns for calls that specify a size in excess of the largest
5658 possible object or at most "SIZE_MAX / 2" bytes. The option
5659 produces the best results with optimization enabled but can detect
5660 a small subset of simple buffer overflows even without optimization
5661 in calls to the GCC built-in functions like "__builtin_memcpy" that
5662 correspond to the standard functions. In any case, the option
5663 warns about just a subset of buffer overflows detected by the
5664 corresponding overflow checking built-ins. For example, the option
5665 issues a warning for the "strcpy" call below because it copies at
5666 least 5 characters (the string "blue" including the terminating
5667 NUL) into the buffer of size 4.
5668
5669 enum Color { blue, purple, yellow };
5670 const char* f (enum Color clr)
5671 {
5672 static char buf [4];
5673 const char *str;
5674 switch (clr)
5675 {
5676 case blue: str = "blue"; break;
5677 case purple: str = "purple"; break;
5678 case yellow: str = "yellow"; break;
5679 }
5680
5681 return strcpy (buf, str); // warning here
5682 }
5683
5684 Option -Wstringop-overflow=2 is enabled by default.
5685
5686 -Wstringop-overflow
5687 -Wstringop-overflow=1
5688 The -Wstringop-overflow=1 option uses type-zero Object Size
5689 Checking to determine the sizes of destination objects. At
5690 this setting the option does not warn for writes past the end
5691 of subobjects of larger objects accessed by pointers unless the
5692 size of the largest surrounding object is known. When the
5693 destination may be one of several objects it is assumed to be
5694 the largest one of them. On Linux systems, when optimization
5695 is enabled at this setting the option warns for the same code
5696 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
5697 value.
5698
5699 -Wstringop-overflow=2
5700 The -Wstringop-overflow=2 option uses type-one Object Size
5701 Checking to determine the sizes of destination objects. At
5702 this setting the option warns about overflows when writing to
5703 members of the largest complete objects whose exact size is
5704 known. However, it does not warn for excessive writes to the
5705 same members of unknown objects referenced by pointers since
5706 they may point to arrays containing unknown numbers of
5707 elements. This is the default setting of the option.
5708
5709 -Wstringop-overflow=3
5710 The -Wstringop-overflow=3 option uses type-two Object Size
5711 Checking to determine the sizes of destination objects. At
5712 this setting the option warns about overflowing the smallest
5713 object or data member. This is the most restrictive setting of
5714 the option that may result in warnings for safe code.
5715
5716 -Wstringop-overflow=4
5717 The -Wstringop-overflow=4 option uses type-three Object Size
5718 Checking to determine the sizes of destination objects. At
5719 this setting the option warns about overflowing any data
5720 members, and when the destination is one of several objects it
5721 uses the size of the largest of them to decide whether to issue
5722 a warning. Similarly to -Wstringop-overflow=3 this setting of
5723 the option may result in warnings for benign code.
5724
5725 -Wno-stringop-overread
5726 Warn for calls to string manipulation functions such as "memchr",
5727 or "strcpy" that are determined to read past the end of the source
5728 sequence.
5729
5730 Option -Wstringop-overread is enabled by default.
5731
5732 -Wno-stringop-truncation
5733 Do not warn for calls to bounded string manipulation functions such
5734 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5735 copied string or leave the destination unchanged.
5736
5737 In the following example, the call to "strncat" specifies a bound
5738 that is less than the length of the source string. As a result,
5739 the copy of the source will be truncated and so the call is
5740 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5741 as the bound.
5742
5743 void append (char *buf, size_t bufsize)
5744 {
5745 strncat (buf, ".txt", 3);
5746 }
5747
5748 As another example, the following call to "strncpy" results in
5749 copying to "d" just the characters preceding the terminating NUL,
5750 without appending the NUL to the end. Assuming the result of
5751 "strncpy" is necessarily a NUL-terminated string is a common
5752 mistake, and so the call is diagnosed. To avoid the warning when
5753 the result is not expected to be NUL-terminated, call "memcpy"
5754 instead.
5755
5756 void copy (char *d, const char *s)
5757 {
5758 strncpy (d, s, strlen (s));
5759 }
5760
5761 In the following example, the call to "strncpy" specifies the size
5762 of the destination buffer as the bound. If the length of the
5763 source string is equal to or greater than this size the result of
5764 the copy will not be NUL-terminated. Therefore, the call is also
5765 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5766 bound and set the last element of the buffer to "NUL".
5767
5768 void copy (const char *s)
5769 {
5770 char buf[80];
5771 strncpy (buf, s, sizeof buf);
5772 ...
5773 }
5774
5775 In situations where a character array is intended to store a
5776 sequence of bytes with no terminating "NUL" such an array may be
5777 annotated with attribute "nonstring" to avoid this warning. Such
5778 arrays, however, are not suitable arguments to functions that
5779 expect "NUL"-terminated strings. To help detect accidental misuses
5780 of such arrays GCC issues warnings unless it can prove that the use
5781 is safe.
5782
5783 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
5784 Warn for cases where adding an attribute may be beneficial. The
5785 attributes currently supported are listed below.
5786
5787 -Wsuggest-attribute=pure
5788 -Wsuggest-attribute=const
5789 -Wsuggest-attribute=noreturn
5790 -Wmissing-noreturn
5791 -Wsuggest-attribute=malloc
5792 Warn about functions that might be candidates for attributes
5793 "pure", "const" or "noreturn" or "malloc". The compiler only
5794 warns for functions visible in other compilation units or (in
5795 the case of "pure" and "const") if it cannot prove that the
5796 function returns normally. A function returns normally if it
5797 doesn't contain an infinite loop or return abnormally by
5798 throwing, calling "abort" or trapping. This analysis requires
5799 option -fipa-pure-const, which is enabled by default at -O and
5800 higher. Higher optimization levels improve the accuracy of the
5801 analysis.
5802
5803 -Wsuggest-attribute=format
5804 -Wmissing-format-attribute
5805 Warn about function pointers that might be candidates for
5806 "format" attributes. Note these are only possible candidates,
5807 not absolute ones. GCC guesses that function pointers with
5808 "format" attributes that are used in assignment,
5809 initialization, parameter passing or return statements should
5810 have a corresponding "format" attribute in the resulting type.
5811 I.e. the left-hand side of the assignment or initialization,
5812 the type of the parameter variable, or the return type of the
5813 containing function respectively should also have a "format"
5814 attribute to avoid the warning.
5815
5816 GCC also warns about function definitions that might be
5817 candidates for "format" attributes. Again, these are only
5818 possible candidates. GCC guesses that "format" attributes
5819 might be appropriate for any function that calls a function
5820 like "vprintf" or "vscanf", but this might not always be the
5821 case, and some functions for which "format" attributes are
5822 appropriate may not be detected.
5823
5824 -Wsuggest-attribute=cold
5825 Warn about functions that might be candidates for "cold"
5826 attribute. This is based on static detection and generally
5827 only warns about functions which always leads to a call to
5828 another "cold" function such as wrappers of C++ "throw" or
5829 fatal error reporting functions leading to "abort".
5830
5831 -Walloc-zero
5832 Warn about calls to allocation functions decorated with attribute
5833 "alloc_size" that specify zero bytes, including those to the built-
5834 in forms of the functions "aligned_alloc", "alloca", "calloc",
5835 "malloc", and "realloc". Because the behavior of these functions
5836 when called with a zero size differs among implementations (and in
5837 the case of "realloc" has been deprecated) relying on it may result
5838 in subtle portability bugs and should be avoided.
5839
5840 -Walloc-size-larger-than=byte-size
5841 Warn about calls to functions decorated with attribute "alloc_size"
5842 that attempt to allocate objects larger than the specified number
5843 of bytes, or where the result of the size computation in an integer
5844 type with infinite precision would exceed the value of PTRDIFF_MAX
5845 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
5846 default. Warnings controlled by the option can be disabled either
5847 by specifying byte-size of SIZE_MAX or more or by
5848 -Wno-alloc-size-larger-than.
5849
5850 -Wno-alloc-size-larger-than
5851 Disable -Walloc-size-larger-than= warnings. The option is
5852 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
5853
5854 -Walloca
5855 This option warns on all uses of "alloca" in the source.
5856
5857 -Walloca-larger-than=byte-size
5858 This option warns on calls to "alloca" with an integer argument
5859 whose value is either zero, or that is not bounded by a controlling
5860 predicate that limits its value to at most byte-size. It also
5861 warns for calls to "alloca" where the bound value is unknown.
5862 Arguments of non-integer types are considered unbounded even if
5863 they appear to be constrained to the expected range.
5864
5865 For example, a bounded case of "alloca" could be:
5866
5867 void func (size_t n)
5868 {
5869 void *p;
5870 if (n <= 1000)
5871 p = alloca (n);
5872 else
5873 p = malloc (n);
5874 f (p);
5875 }
5876
5877 In the above example, passing "-Walloca-larger-than=1000" would not
5878 issue a warning because the call to "alloca" is known to be at most
5879 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
5880 the compiler would emit a warning.
5881
5882 Unbounded uses, on the other hand, are uses of "alloca" with no
5883 controlling predicate constraining its integer argument. For
5884 example:
5885
5886 void func ()
5887 {
5888 void *p = alloca (n);
5889 f (p);
5890 }
5891
5892 If "-Walloca-larger-than=500" were passed, the above would trigger
5893 a warning, but this time because of the lack of bounds checking.
5894
5895 Note, that even seemingly correct code involving signed integers
5896 could cause a warning:
5897
5898 void func (signed int n)
5899 {
5900 if (n < 500)
5901 {
5902 p = alloca (n);
5903 f (p);
5904 }
5905 }
5906
5907 In the above example, n could be negative, causing a larger than
5908 expected argument to be implicitly cast into the "alloca" call.
5909
5910 This option also warns when "alloca" is used in a loop.
5911
5912 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
5913 usually only effective when -ftree-vrp is active (default for -O2
5914 and above).
5915
5916 See also -Wvla-larger-than=byte-size.
5917
5918 -Wno-alloca-larger-than
5919 Disable -Walloca-larger-than= warnings. The option is equivalent
5920 to -Walloca-larger-than=SIZE_MAX or larger.
5921
5922 -Warith-conversion
5923 Do warn about implicit conversions from arithmetic operations even
5924 when conversion of the operands to the same type cannot change
5925 their values. This affects warnings from -Wconversion,
5926 -Wfloat-conversion, and -Wsign-conversion.
5927
5928 void f (char c, int i)
5929 {
5930 c = c + i; // warns with B<-Wconversion>
5931 c = c + 1; // only warns with B<-Warith-conversion>
5932 }
5933
5934 -Warray-bounds
5935 -Warray-bounds=n
5936 This option is only active when -ftree-vrp is active (default for
5937 -O2 and above). It warns about subscripts to arrays that are always
5938 out of bounds. This warning is enabled by -Wall.
5939
5940 -Warray-bounds=1
5941 This is the warning level of -Warray-bounds and is enabled by
5942 -Wall; higher levels are not, and must be explicitly requested.
5943
5944 -Warray-bounds=2
5945 This warning level also warns about out of bounds access for
5946 arrays at the end of a struct and for arrays accessed through
5947 pointers. This warning level may give a larger number of false
5948 positives and is deactivated by default.
5949
5950 -Warray-parameter
5951 -Warray-parameter=n
5952 Warn about redeclarations of functions involving arguments of array
5953 or pointer types of inconsistent kinds or forms, and enable the
5954 detection of out-of-bounds accesses to such parameters by warnings
5955 such as -Warray-bounds.
5956
5957 If the first function declaration uses the array form the bound
5958 specified in the array is assumed to be the minimum number of
5959 elements expected to be provided in calls to the function and the
5960 maximum number of elements accessed by it. Failing to provide
5961 arguments of sufficient size or accessing more than the maximum
5962 number of elements may be diagnosed by warnings such as
5963 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
5964 involving array parameters declared using the "T[static N]" form.
5965
5966 For example, the warning triggers for the following redeclarations
5967 because the first one allows an array of any size to be passed to
5968 "f" while the second one with the keyword "static" specifies that
5969 the array argument must have at least four elements.
5970
5971 void f (int[static 4]);
5972 void f (int[]); // warning (inconsistent array form)
5973
5974 void g (void)
5975 {
5976 int *p = (int *)malloc (4);
5977 f (p); // warning (array too small)
5978 ...
5979 }
5980
5981 At level 2 the warning also triggers for redeclarations involving
5982 any other inconsistency in array or pointer argument forms denoting
5983 array sizes. Pointers and arrays of unspecified bound are
5984 considered equivalent and do not trigger a warning.
5985
5986 void g (int*);
5987 void g (int[]); // no warning
5988 void g (int[8]); // warning (inconsistent array bound)
5989
5990 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
5991 option triggers warnings for similar inconsistencies involving
5992 Variable Length Array arguments.
5993
5994 -Wattribute-alias=n
5995 -Wno-attribute-alias
5996 Warn about declarations using the "alias" and similar attributes
5997 whose target is incompatible with the type of the alias.
5998
5999 -Wattribute-alias=1
6000 The default warning level of the -Wattribute-alias option
6001 diagnoses incompatibilities between the type of the alias
6002 declaration and that of its target. Such incompatibilities are
6003 typically indicative of bugs.
6004
6005 -Wattribute-alias=2
6006 At this level -Wattribute-alias also diagnoses cases where the
6007 attributes of the alias declaration are more restrictive than
6008 the attributes applied to its target. These mismatches can
6009 potentially result in incorrect code generation. In other
6010 cases they may be benign and could be resolved simply by adding
6011 the missing attribute to the target. For comparison, see the
6012 -Wmissing-attributes option, which controls diagnostics when
6013 the alias declaration is less restrictive than the target,
6014 rather than more restrictive.
6015
6016 Attributes considered include "alloc_align", "alloc_size",
6017 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6018 "noreturn", "nothrow", "pure", "returns_nonnull", and
6019 "returns_twice".
6020
6021 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6022 the default. You can disable these warnings with either
6023 -Wno-attribute-alias or -Wattribute-alias=0.
6024
6025 -Wbool-compare
6026 Warn about boolean expression compared with an integer value
6027 different from "true"/"false". For instance, the following
6028 comparison is always false:
6029
6030 int n = 5;
6031 ...
6032 if ((n > 1) == 2) { ... }
6033
6034 This warning is enabled by -Wall.
6035
6036 -Wbool-operation
6037 Warn about suspicious operations on expressions of a boolean type.
6038 For instance, bitwise negation of a boolean is very likely a bug in
6039 the program. For C, this warning also warns about incrementing or
6040 decrementing a boolean, which rarely makes sense. (In C++,
6041 decrementing a boolean is always invalid. Incrementing a boolean
6042 is invalid in C++17, and deprecated otherwise.)
6043
6044 This warning is enabled by -Wall.
6045
6046 -Wduplicated-branches
6047 Warn when an if-else has identical branches. This warning detects
6048 cases like
6049
6050 if (p != NULL)
6051 return 0;
6052 else
6053 return 0;
6054
6055 It doesn't warn when both branches contain just a null statement.
6056 This warning also warn for conditional operators:
6057
6058 int i = x ? *p : *p;
6059
6060 -Wduplicated-cond
6061 Warn about duplicated conditions in an if-else-if chain. For
6062 instance, warn for the following code:
6063
6064 if (p->q != NULL) { ... }
6065 else if (p->q != NULL) { ... }
6066
6067 -Wframe-address
6068 Warn when the __builtin_frame_address or __builtin_return_address
6069 is called with an argument greater than 0. Such calls may return
6070 indeterminate values or crash the program. The warning is included
6071 in -Wall.
6072
6073 -Wno-discarded-qualifiers (C and Objective-C only)
6074 Do not warn if type qualifiers on pointers are being discarded.
6075 Typically, the compiler warns if a "const char *" variable is
6076 passed to a function that takes a "char *" parameter. This option
6077 can be used to suppress such a warning.
6078
6079 -Wno-discarded-array-qualifiers (C and Objective-C only)
6080 Do not warn if type qualifiers on arrays which are pointer targets
6081 are being discarded. Typically, the compiler warns if a "const int
6082 (*)[]" variable is passed to a function that takes a "int (*)[]"
6083 parameter. This option can be used to suppress such a warning.
6084
6085 -Wno-incompatible-pointer-types (C and Objective-C only)
6086 Do not warn when there is a conversion between pointers that have
6087 incompatible types. This warning is for cases not covered by
6088 -Wno-pointer-sign, which warns for pointer argument passing or
6089 assignment with different signedness.
6090
6091 -Wno-int-conversion (C and Objective-C only)
6092 Do not warn about incompatible integer to pointer and pointer to
6093 integer conversions. This warning is about implicit conversions;
6094 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6095 -Wno-pointer-to-int-cast may be used.
6096
6097 -Wzero-length-bounds
6098 Warn about accesses to elements of zero-length array members that
6099 might overlap other members of the same object. Declaring interior
6100 zero-length arrays is discouraged because accesses to them are
6101 undefined. See
6102
6103 For example, the first two stores in function "bad" are diagnosed
6104 because the array elements overlap the subsequent members "b" and
6105 "c". The third store is diagnosed by -Warray-bounds because it is
6106 beyond the bounds of the enclosing object.
6107
6108 struct X { int a[0]; int b, c; };
6109 struct X x;
6110
6111 void bad (void)
6112 {
6113 x.a[0] = 0; // -Wzero-length-bounds
6114 x.a[1] = 1; // -Wzero-length-bounds
6115 x.a[2] = 2; // -Warray-bounds
6116 }
6117
6118 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6119
6120 -Wno-div-by-zero
6121 Do not warn about compile-time integer division by zero. Floating-
6122 point division by zero is not warned about, as it can be a
6123 legitimate way of obtaining infinities and NaNs.
6124
6125 -Wsystem-headers
6126 Print warning messages for constructs found in system header files.
6127 Warnings from system headers are normally suppressed, on the
6128 assumption that they usually do not indicate real problems and
6129 would only make the compiler output harder to read. Using this
6130 command-line option tells GCC to emit warnings from system headers
6131 as if they occurred in user code. However, note that using -Wall
6132 in conjunction with this option does not warn about unknown pragmas
6133 in system headers---for that, -Wunknown-pragmas must also be used.
6134
6135 -Wtautological-compare
6136 Warn if a self-comparison always evaluates to true or false. This
6137 warning detects various mistakes such as:
6138
6139 int i = 1;
6140 ...
6141 if (i > i) { ... }
6142
6143 This warning also warns about bitwise comparisons that always
6144 evaluate to true or false, for instance:
6145
6146 if ((a & 16) == 10) { ... }
6147
6148 will always be false.
6149
6150 This warning is enabled by -Wall.
6151
6152 -Wtrampolines
6153 Warn about trampolines generated for pointers to nested functions.
6154 A trampoline is a small piece of data or code that is created at
6155 run time on the stack when the address of a nested function is
6156 taken, and is used to call the nested function indirectly. For
6157 some targets, it is made up of data only and thus requires no
6158 special treatment. But, for most targets, it is made up of code
6159 and thus requires the stack to be made executable in order for the
6160 program to work properly.
6161
6162 -Wfloat-equal
6163 Warn if floating-point values are used in equality comparisons.
6164
6165 The idea behind this is that sometimes it is convenient (for the
6166 programmer) to consider floating-point values as approximations to
6167 infinitely precise real numbers. If you are doing this, then you
6168 need to compute (by analyzing the code, or in some other way) the
6169 maximum or likely maximum error that the computation introduces,
6170 and allow for it when performing comparisons (and when producing
6171 output, but that's a different problem). In particular, instead of
6172 testing for equality, you should check to see whether the two
6173 values have ranges that overlap; and this is done with the
6174 relational operators, so equality comparisons are probably
6175 mistaken.
6176
6177 -Wtraditional (C and Objective-C only)
6178 Warn about certain constructs that behave differently in
6179 traditional and ISO C. Also warn about ISO C constructs that have
6180 no traditional C equivalent, and/or problematic constructs that
6181 should be avoided.
6182
6183 * Macro parameters that appear within string literals in the
6184 macro body. In traditional C macro replacement takes place
6185 within string literals, but in ISO C it does not.
6186
6187 * In traditional C, some preprocessor directives did not exist.
6188 Traditional preprocessors only considered a line to be a
6189 directive if the # appeared in column 1 on the line. Therefore
6190 -Wtraditional warns about directives that traditional C
6191 understands but ignores because the # does not appear as the
6192 first character on the line. It also suggests you hide
6193 directives like "#pragma" not understood by traditional C by
6194 indenting them. Some traditional implementations do not
6195 recognize "#elif", so this option suggests avoiding it
6196 altogether.
6197
6198 * A function-like macro that appears without arguments.
6199
6200 * The unary plus operator.
6201
6202 * The U integer constant suffix, or the F or L floating-point
6203 constant suffixes. (Traditional C does support the L suffix on
6204 integer constants.) Note, these suffixes appear in macros
6205 defined in the system headers of most modern systems, e.g. the
6206 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6207 code might normally lead to spurious warnings, however GCC's
6208 integrated preprocessor has enough context to avoid warning in
6209 these cases.
6210
6211 * A function declared external in one block and then used after
6212 the end of the block.
6213
6214 * A "switch" statement has an operand of type "long".
6215
6216 * A non-"static" function declaration follows a "static" one.
6217 This construct is not accepted by some traditional C compilers.
6218
6219 * The ISO type of an integer constant has a different width or
6220 signedness from its traditional type. This warning is only
6221 issued if the base of the constant is ten. I.e. hexadecimal or
6222 octal values, which typically represent bit patterns, are not
6223 warned about.
6224
6225 * Usage of ISO string concatenation is detected.
6226
6227 * Initialization of automatic aggregates.
6228
6229 * Identifier conflicts with labels. Traditional C lacks a
6230 separate namespace for labels.
6231
6232 * Initialization of unions. If the initializer is zero, the
6233 warning is omitted. This is done under the assumption that the
6234 zero initializer in user code appears conditioned on e.g.
6235 "__STDC__" to avoid missing initializer warnings and relies on
6236 default initialization to zero in the traditional C case.
6237
6238 * Conversions by prototypes between fixed/floating-point values
6239 and vice versa. The absence of these prototypes when compiling
6240 with traditional C causes serious problems. This is a subset
6241 of the possible conversion warnings; for the full set use
6242 -Wtraditional-conversion.
6243
6244 * Use of ISO C style function definitions. This warning
6245 intentionally is not issued for prototype declarations or
6246 variadic functions because these ISO C features appear in your
6247 code when using libiberty's traditional C compatibility macros,
6248 "PARAMS" and "VPARAMS". This warning is also bypassed for
6249 nested functions because that feature is already a GCC
6250 extension and thus not relevant to traditional C compatibility.
6251
6252 -Wtraditional-conversion (C and Objective-C only)
6253 Warn if a prototype causes a type conversion that is different from
6254 what would happen to the same argument in the absence of a
6255 prototype. This includes conversions of fixed point to floating
6256 and vice versa, and conversions changing the width or signedness of
6257 a fixed-point argument except when the same as the default
6258 promotion.
6259
6260 -Wdeclaration-after-statement (C and Objective-C only)
6261 Warn when a declaration is found after a statement in a block.
6262 This construct, known from C++, was introduced with ISO C99 and is
6263 by default allowed in GCC. It is not supported by ISO C90.
6264
6265 -Wshadow
6266 Warn whenever a local variable or type declaration shadows another
6267 variable, parameter, type, class member (in C++), or instance
6268 variable (in Objective-C) or whenever a built-in function is
6269 shadowed. Note that in C++, the compiler warns if a local variable
6270 shadows an explicit typedef, but not if it shadows a
6271 struct/class/enum. If this warning is enabled, it includes also
6272 all instances of local shadowing. This means that
6273 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6274 -Wshadow is used. Same as -Wshadow=global.
6275
6276 -Wno-shadow-ivar (Objective-C only)
6277 Do not warn whenever a local variable shadows an instance variable
6278 in an Objective-C method.
6279
6280 -Wshadow=global
6281 Warn for any shadowing. Same as -Wshadow.
6282
6283 -Wshadow=local
6284 Warn when a local variable shadows another local variable or
6285 parameter.
6286
6287 -Wshadow=compatible-local
6288 Warn when a local variable shadows another local variable or
6289 parameter whose type is compatible with that of the shadowing
6290 variable. In C++, type compatibility here means the type of the
6291 shadowing variable can be converted to that of the shadowed
6292 variable. The creation of this flag (in addition to
6293 -Wshadow=local) is based on the idea that when a local variable
6294 shadows another one of incompatible type, it is most likely
6295 intentional, not a bug or typo, as shown in the following example:
6296
6297 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6298 {
6299 for (int i = 0; i < N; ++i)
6300 {
6301 ...
6302 }
6303 ...
6304 }
6305
6306 Since the two variable "i" in the example above have incompatible
6307 types, enabling only -Wshadow=compatible-local does not emit a
6308 warning. Because their types are incompatible, if a programmer
6309 accidentally uses one in place of the other, type checking is
6310 expected to catch that and emit an error or warning. Use of this
6311 flag instead of -Wshadow=local can possibly reduce the number of
6312 warnings triggered by intentional shadowing. Note that this also
6313 means that shadowing "const char *i" by "char *i" does not emit a
6314 warning.
6315
6316 This warning is also enabled by -Wshadow=local.
6317
6318 -Wlarger-than=byte-size
6319 Warn whenever an object is defined whose size exceeds byte-size.
6320 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6321 controlled by the option can be disabled either by specifying byte-
6322 size of SIZE_MAX or more or by -Wno-larger-than.
6323
6324 Also warn for calls to bounded functions such as "memchr" or
6325 "strnlen" that specify a bound greater than the largest possible
6326 object, which is PTRDIFF_MAX bytes by default. These warnings can
6327 only be disabled by -Wno-larger-than.
6328
6329 -Wno-larger-than
6330 Disable -Wlarger-than= warnings. The option is equivalent to
6331 -Wlarger-than=SIZE_MAX or larger.
6332
6333 -Wframe-larger-than=byte-size
6334 Warn if the size of a function frame exceeds byte-size. The
6335 computation done to determine the stack frame size is approximate
6336 and not conservative. The actual requirements may be somewhat
6337 greater than byte-size even if you do not get a warning. In
6338 addition, any space allocated via "alloca", variable-length arrays,
6339 or related constructs is not included by the compiler when
6340 determining whether or not to issue a warning.
6341 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6342 controlled by the option can be disabled either by specifying byte-
6343 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6344
6345 -Wno-frame-larger-than
6346 Disable -Wframe-larger-than= warnings. The option is equivalent to
6347 -Wframe-larger-than=SIZE_MAX or larger.
6348
6349 -Wno-free-nonheap-object
6350 Warn when attempting to deallocate an object that was either not
6351 allocated on the heap, or by using a pointer that was not returned
6352 from a prior call to the corresponding allocation function. For
6353 example, because the call to "stpcpy" returns a pointer to the
6354 terminating nul character and not to the begginning of the object,
6355 the call to "free" below is diagnosed.
6356
6357 void f (char *p)
6358 {
6359 p = stpcpy (p, "abc");
6360 // ...
6361 free (p); // warning
6362 }
6363
6364 -Wfree-nonheap-object is enabled by default.
6365
6366 -Wstack-usage=byte-size
6367 Warn if the stack usage of a function might exceed byte-size. The
6368 computation done to determine the stack usage is conservative. Any
6369 space allocated via "alloca", variable-length arrays, or related
6370 constructs is included by the compiler when determining whether or
6371 not to issue a warning.
6372
6373 The message is in keeping with the output of -fstack-usage.
6374
6375 * If the stack usage is fully static but exceeds the specified
6376 amount, it's:
6377
6378 warning: stack usage is 1120 bytes
6379
6380 * If the stack usage is (partly) dynamic but bounded, it's:
6381
6382 warning: stack usage might be 1648 bytes
6383
6384 * If the stack usage is (partly) dynamic and not bounded, it's:
6385
6386 warning: stack usage might be unbounded
6387
6388 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
6389 controlled by the option can be disabled either by specifying byte-
6390 size of SIZE_MAX or more or by -Wno-stack-usage.
6391
6392 -Wno-stack-usage
6393 Disable -Wstack-usage= warnings. The option is equivalent to
6394 -Wstack-usage=SIZE_MAX or larger.
6395
6396 -Wunsafe-loop-optimizations
6397 Warn if the loop cannot be optimized because the compiler cannot
6398 assume anything on the bounds of the loop indices. With
6399 -funsafe-loop-optimizations warn if the compiler makes such
6400 assumptions.
6401
6402 -Wno-pedantic-ms-format (MinGW targets only)
6403 When used in combination with -Wformat and -pedantic without GNU
6404 extensions, this option disables the warnings about non-ISO
6405 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
6406 used on Windows targets, which depend on the MS runtime.
6407
6408 -Wpointer-arith
6409 Warn about anything that depends on the "size of" a function type
6410 or of "void". GNU C assigns these types a size of 1, for
6411 convenience in calculations with "void *" pointers and pointers to
6412 functions. In C++, warn also when an arithmetic operation involves
6413 "NULL". This warning is also enabled by -Wpedantic.
6414
6415 -Wno-pointer-compare
6416 Do not warn if a pointer is compared with a zero character
6417 constant. This usually means that the pointer was meant to be
6418 dereferenced. For example:
6419
6420 const char *p = foo ();
6421 if (p == '\0')
6422 return 42;
6423
6424 Note that the code above is invalid in C++11.
6425
6426 This warning is enabled by default.
6427
6428 -Wtsan
6429 Warn about unsupported features in ThreadSanitizer.
6430
6431 ThreadSanitizer does not support "std::atomic_thread_fence" and can
6432 report false positives.
6433
6434 This warning is enabled by default.
6435
6436 -Wtype-limits
6437 Warn if a comparison is always true or always false due to the
6438 limited range of the data type, but do not warn for constant
6439 expressions. For example, warn if an unsigned variable is compared
6440 against zero with "<" or ">=". This warning is also enabled by
6441 -Wextra.
6442
6443 -Wabsolute-value (C and Objective-C only)
6444 Warn for calls to standard functions that compute the absolute
6445 value of an argument when a more appropriate standard function is
6446 available. For example, calling "abs(3.14)" triggers the warning
6447 because the appropriate function to call to compute the absolute
6448 value of a double argument is "fabs". The option also triggers
6449 warnings when the argument in a call to such a function has an
6450 unsigned type. This warning can be suppressed with an explicit
6451 type cast and it is also enabled by -Wextra.
6452
6453 -Wcomment
6454 -Wcomments
6455 Warn whenever a comment-start sequence /* appears in a /* comment,
6456 or whenever a backslash-newline appears in a // comment. This
6457 warning is enabled by -Wall.
6458
6459 -Wtrigraphs
6460 Warn if any trigraphs are encountered that might change the meaning
6461 of the program. Trigraphs within comments are not warned about,
6462 except those that would form escaped newlines.
6463
6464 This option is implied by -Wall. If -Wall is not given, this
6465 option is still enabled unless trigraphs are enabled. To get
6466 trigraph conversion without warnings, but get the other -Wall
6467 warnings, use -trigraphs -Wall -Wno-trigraphs.
6468
6469 -Wundef
6470 Warn if an undefined identifier is evaluated in an "#if" directive.
6471 Such identifiers are replaced with zero.
6472
6473 -Wexpansion-to-defined
6474 Warn whenever defined is encountered in the expansion of a macro
6475 (including the case where the macro is expanded by an #if
6476 directive). Such usage is not portable. This warning is also
6477 enabled by -Wpedantic and -Wextra.
6478
6479 -Wunused-macros
6480 Warn about macros defined in the main file that are unused. A
6481 macro is used if it is expanded or tested for existence at least
6482 once. The preprocessor also warns if the macro has not been used
6483 at the time it is redefined or undefined.
6484
6485 Built-in macros, macros defined on the command line, and macros
6486 defined in include files are not warned about.
6487
6488 Note: If a macro is actually used, but only used in skipped
6489 conditional blocks, then the preprocessor reports it as unused. To
6490 avoid the warning in such a case, you might improve the scope of
6491 the macro's definition by, for example, moving it into the first
6492 skipped block. Alternatively, you could provide a dummy use with
6493 something like:
6494
6495 #if defined the_macro_causing_the_warning
6496 #endif
6497
6498 -Wno-endif-labels
6499 Do not warn whenever an "#else" or an "#endif" are followed by
6500 text. This sometimes happens in older programs with code of the
6501 form
6502
6503 #if FOO
6504 ...
6505 #else FOO
6506 ...
6507 #endif FOO
6508
6509 The second and third "FOO" should be in comments. This warning is
6510 on by default.
6511
6512 -Wbad-function-cast (C and Objective-C only)
6513 Warn when a function call is cast to a non-matching type. For
6514 example, warn if a call to a function returning an integer type is
6515 cast to a pointer type.
6516
6517 -Wc90-c99-compat (C and Objective-C only)
6518 Warn about features not present in ISO C90, but present in ISO C99.
6519 For instance, warn about use of variable length arrays, "long long"
6520 type, "bool" type, compound literals, designated initializers, and
6521 so on. This option is independent of the standards mode. Warnings
6522 are disabled in the expression that follows "__extension__".
6523
6524 -Wc99-c11-compat (C and Objective-C only)
6525 Warn about features not present in ISO C99, but present in ISO C11.
6526 For instance, warn about use of anonymous structures and unions,
6527 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
6528 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
6529 so on. This option is independent of the standards mode. Warnings
6530 are disabled in the expression that follows "__extension__".
6531
6532 -Wc11-c2x-compat (C and Objective-C only)
6533 Warn about features not present in ISO C11, but present in ISO C2X.
6534 For instance, warn about omitting the string in "_Static_assert",
6535 use of [[]] syntax for attributes, use of decimal floating-point
6536 types, and so on. This option is independent of the standards
6537 mode. Warnings are disabled in the expression that follows
6538 "__extension__".
6539
6540 -Wc++-compat (C and Objective-C only)
6541 Warn about ISO C constructs that are outside of the common subset
6542 of ISO C and ISO C++, e.g. request for implicit conversion from
6543 "void *" to a pointer to non-"void" type.
6544
6545 -Wc++11-compat (C++ and Objective-C++ only)
6546 Warn about C++ constructs whose meaning differs between ISO C++
6547 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
6548 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
6549 enabled by -Wall.
6550
6551 -Wc++14-compat (C++ and Objective-C++ only)
6552 Warn about C++ constructs whose meaning differs between ISO C++
6553 2011 and ISO C++ 2014. This warning is enabled by -Wall.
6554
6555 -Wc++17-compat (C++ and Objective-C++ only)
6556 Warn about C++ constructs whose meaning differs between ISO C++
6557 2014 and ISO C++ 2017. This warning is enabled by -Wall.
6558
6559 -Wc++20-compat (C++ and Objective-C++ only)
6560 Warn about C++ constructs whose meaning differs between ISO C++
6561 2017 and ISO C++ 2020. This warning is enabled by -Wall.
6562
6563 -Wcast-qual
6564 Warn whenever a pointer is cast so as to remove a type qualifier
6565 from the target type. For example, warn if a "const char *" is
6566 cast to an ordinary "char *".
6567
6568 Also warn when making a cast that introduces a type qualifier in an
6569 unsafe way. For example, casting "char **" to "const char **" is
6570 unsafe, as in this example:
6571
6572 /* p is char ** value. */
6573 const char **q = (const char **) p;
6574 /* Assignment of readonly string to const char * is OK. */
6575 *q = "string";
6576 /* Now char** pointer points to read-only memory. */
6577 **p = 'b';
6578
6579 -Wcast-align
6580 Warn whenever a pointer is cast such that the required alignment of
6581 the target is increased. For example, warn if a "char *" is cast
6582 to an "int *" on machines where integers can only be accessed at
6583 two- or four-byte boundaries.
6584
6585 -Wcast-align=strict
6586 Warn whenever a pointer is cast such that the required alignment of
6587 the target is increased. For example, warn if a "char *" is cast
6588 to an "int *" regardless of the target machine.
6589
6590 -Wcast-function-type
6591 Warn when a function pointer is cast to an incompatible function
6592 pointer. In a cast involving function types with a variable
6593 argument list only the types of initial arguments that are provided
6594 are considered. Any parameter of pointer-type matches any other
6595 pointer-type. Any benign differences in integral types are
6596 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
6597 qualifiers are ignored. The function type "void (*) (void)" is
6598 special and matches everything, which can be used to suppress this
6599 warning. In a cast involving pointer to member types this warning
6600 warns whenever the type cast is changing the pointer to member
6601 type. This warning is enabled by -Wextra.
6602
6603 -Wwrite-strings
6604 When compiling C, give string constants the type "const
6605 char[length]" so that copying the address of one into a non-"const"
6606 "char *" pointer produces a warning. These warnings help you find
6607 at compile time code that can try to write into a string constant,
6608 but only if you have been very careful about using "const" in
6609 declarations and prototypes. Otherwise, it is just a nuisance.
6610 This is why we did not make -Wall request these warnings.
6611
6612 When compiling C++, warn about the deprecated conversion from
6613 string literals to "char *". This warning is enabled by default
6614 for C++ programs.
6615
6616 -Wclobbered
6617 Warn for variables that might be changed by "longjmp" or "vfork".
6618 This warning is also enabled by -Wextra.
6619
6620 -Wconversion
6621 Warn for implicit conversions that may alter a value. This includes
6622 conversions between real and integer, like "abs (x)" when "x" is
6623 "double"; conversions between signed and unsigned, like "unsigned
6624 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
6625 not warn for explicit casts like "abs ((int) x)" and "ui =
6626 (unsigned) -1", or if the value is not changed by the conversion
6627 like in "abs (2.0)". Warnings about conversions between signed and
6628 unsigned integers can be disabled by using -Wno-sign-conversion.
6629
6630 For C++, also warn for confusing overload resolution for user-
6631 defined conversions; and conversions that never use a type
6632 conversion operator: conversions to "void", the same type, a base
6633 class or a reference to them. Warnings about conversions between
6634 signed and unsigned integers are disabled by default in C++ unless
6635 -Wsign-conversion is explicitly enabled.
6636
6637 Warnings about conversion from arithmetic on a small type back to
6638 that type are only given with -Warith-conversion.
6639
6640 -Wdangling-else
6641 Warn about constructions where there may be confusion to which "if"
6642 statement an "else" branch belongs. Here is an example of such a
6643 case:
6644
6645 {
6646 if (a)
6647 if (b)
6648 foo ();
6649 else
6650 bar ();
6651 }
6652
6653 In C/C++, every "else" branch belongs to the innermost possible
6654 "if" statement, which in this example is "if (b)". This is often
6655 not what the programmer expected, as illustrated in the above
6656 example by indentation the programmer chose. When there is the
6657 potential for this confusion, GCC issues a warning when this flag
6658 is specified. To eliminate the warning, add explicit braces around
6659 the innermost "if" statement so there is no way the "else" can
6660 belong to the enclosing "if". The resulting code looks like this:
6661
6662 {
6663 if (a)
6664 {
6665 if (b)
6666 foo ();
6667 else
6668 bar ();
6669 }
6670 }
6671
6672 This warning is enabled by -Wparentheses.
6673
6674 -Wdate-time
6675 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
6676 encountered as they might prevent bit-wise-identical reproducible
6677 compilations.
6678
6679 -Wempty-body
6680 Warn if an empty body occurs in an "if", "else" or "do while"
6681 statement. This warning is also enabled by -Wextra.
6682
6683 -Wno-endif-labels
6684 Do not warn about stray tokens after "#else" and "#endif".
6685
6686 -Wenum-compare
6687 Warn about a comparison between values of different enumerated
6688 types. In C++ enumerated type mismatches in conditional
6689 expressions are also diagnosed and the warning is enabled by
6690 default. In C this warning is enabled by -Wall.
6691
6692 -Wenum-conversion
6693 Warn when a value of enumerated type is implicitly converted to a
6694 different enumerated type. This warning is enabled by -Wextra in
6695 C.
6696
6697 -Wjump-misses-init (C, Objective-C only)
6698 Warn if a "goto" statement or a "switch" statement jumps forward
6699 across the initialization of a variable, or jumps backward to a
6700 label after the variable has been initialized. This only warns
6701 about variables that are initialized when they are declared. This
6702 warning is only supported for C and Objective-C; in C++ this sort
6703 of branch is an error in any case.
6704
6705 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
6706 with the -Wno-jump-misses-init option.
6707
6708 -Wsign-compare
6709 Warn when a comparison between signed and unsigned values could
6710 produce an incorrect result when the signed value is converted to
6711 unsigned. In C++, this warning is also enabled by -Wall. In C, it
6712 is also enabled by -Wextra.
6713
6714 -Wsign-conversion
6715 Warn for implicit conversions that may change the sign of an
6716 integer value, like assigning a signed integer expression to an
6717 unsigned integer variable. An explicit cast silences the warning.
6718 In C, this option is enabled also by -Wconversion.
6719
6720 -Wfloat-conversion
6721 Warn for implicit conversions that reduce the precision of a real
6722 value. This includes conversions from real to integer, and from
6723 higher precision real to lower precision real values. This option
6724 is also enabled by -Wconversion.
6725
6726 -Wno-scalar-storage-order
6727 Do not warn on suspicious constructs involving reverse scalar
6728 storage order.
6729
6730 -Wsizeof-array-div
6731 Warn about divisions of two sizeof operators when the first one is
6732 applied to an array and the divisor does not equal the size of the
6733 array element. In such a case, the computation will not yield the
6734 number of elements in the array, which is likely what the user
6735 intended. This warning warns e.g. about
6736
6737 int fn ()
6738 {
6739 int arr[10];
6740 return sizeof (arr) / sizeof (short);
6741 }
6742
6743 This warning is enabled by -Wall.
6744
6745 -Wsizeof-pointer-div
6746 Warn for suspicious divisions of two sizeof expressions that divide
6747 the pointer size by the element size, which is the usual way to
6748 compute the array size but won't work out correctly with pointers.
6749 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
6750 "ptr" is not an array, but a pointer. This warning is enabled by
6751 -Wall.
6752
6753 -Wsizeof-pointer-memaccess
6754 Warn for suspicious length parameters to certain string and memory
6755 built-in functions if the argument uses "sizeof". This warning
6756 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
6757 is not an array, but a pointer, and suggests a possible fix, or
6758 about "memcpy (&foo, ptr, sizeof (&foo));".
6759 -Wsizeof-pointer-memaccess also warns about calls to bounded string
6760 copy functions like "strncat" or "strncpy" that specify as the
6761 bound a "sizeof" expression of the source array. For example, in
6762 the following function the call to "strncat" specifies the size of
6763 the source string as the bound. That is almost certainly a mistake
6764 and so the call is diagnosed.
6765
6766 void make_file (const char *name)
6767 {
6768 char path[PATH_MAX];
6769 strncpy (path, name, sizeof path - 1);
6770 strncat (path, ".text", sizeof ".text");
6771 ...
6772 }
6773
6774 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
6775
6776 -Wno-sizeof-array-argument
6777 Do not warn when the "sizeof" operator is applied to a parameter
6778 that is declared as an array in a function definition. This
6779 warning is enabled by default for C and C++ programs.
6780
6781 -Wmemset-elt-size
6782 Warn for suspicious calls to the "memset" built-in function, if the
6783 first argument references an array, and the third argument is a
6784 number equal to the number of elements, but not equal to the size
6785 of the array in memory. This indicates that the user has omitted a
6786 multiplication by the element size. This warning is enabled by
6787 -Wall.
6788
6789 -Wmemset-transposed-args
6790 Warn for suspicious calls to the "memset" built-in function where
6791 the second argument is not zero and the third argument is zero.
6792 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
6793 because "memset (buf, 0, sizeof buf)" was meant instead. The
6794 diagnostic is only emitted if the third argument is a literal zero.
6795 Otherwise, if it is an expression that is folded to zero, or a cast
6796 of zero to some type, it is far less likely that the arguments have
6797 been mistakenly transposed and no warning is emitted. This warning
6798 is enabled by -Wall.
6799
6800 -Waddress
6801 Warn about suspicious uses of memory addresses. These include using
6802 the address of a function in a conditional expression, such as
6803 "void func(void); if (func)", and comparisons against the memory
6804 address of a string literal, such as "if (x == "abc")". Such uses
6805 typically indicate a programmer error: the address of a function
6806 always evaluates to true, so their use in a conditional usually
6807 indicate that the programmer forgot the parentheses in a function
6808 call; and comparisons against string literals result in unspecified
6809 behavior and are not portable in C, so they usually indicate that
6810 the programmer intended to use "strcmp". This warning is enabled
6811 by -Wall.
6812
6813 -Wno-address-of-packed-member
6814 Do not warn when the address of packed member of struct or union is
6815 taken, which usually results in an unaligned pointer value. This
6816 is enabled by default.
6817
6818 -Wlogical-op
6819 Warn about suspicious uses of logical operators in expressions.
6820 This includes using logical operators in contexts where a bit-wise
6821 operator is likely to be expected. Also warns when the operands of
6822 a logical operator are the same:
6823
6824 extern int a;
6825 if (a < 0 && a < 0) { ... }
6826
6827 -Wlogical-not-parentheses
6828 Warn about logical not used on the left hand side operand of a
6829 comparison. This option does not warn if the right operand is
6830 considered to be a boolean expression. Its purpose is to detect
6831 suspicious code like the following:
6832
6833 int a;
6834 ...
6835 if (!a > 1) { ... }
6836
6837 It is possible to suppress the warning by wrapping the LHS into
6838 parentheses:
6839
6840 if ((!a) > 1) { ... }
6841
6842 This warning is enabled by -Wall.
6843
6844 -Waggregate-return
6845 Warn if any functions that return structures or unions are defined
6846 or called. (In languages where you can return an array, this also
6847 elicits a warning.)
6848
6849 -Wno-aggressive-loop-optimizations
6850 Warn if in a loop with constant number of iterations the compiler
6851 detects undefined behavior in some statement during one or more of
6852 the iterations.
6853
6854 -Wno-attributes
6855 Do not warn if an unexpected "__attribute__" is used, such as
6856 unrecognized attributes, function attributes applied to variables,
6857 etc. This does not stop errors for incorrect use of supported
6858 attributes.
6859
6860 -Wno-builtin-declaration-mismatch
6861 Warn if a built-in function is declared with an incompatible
6862 signature or as a non-function, or when a built-in function
6863 declared with a type that does not include a prototype is called
6864 with arguments whose promoted types do not match those expected by
6865 the function. When -Wextra is specified, also warn when a built-in
6866 function that takes arguments is declared without a prototype. The
6867 -Wbuiltin-declaration-mismatch warning is enabled by default. To
6868 avoid the warning include the appropriate header to bring the
6869 prototypes of built-in functions into scope.
6870
6871 For example, the call to "memset" below is diagnosed by the warning
6872 because the function expects a value of type "size_t" as its
6873 argument but the type of 32 is "int". With -Wextra, the
6874 declaration of the function is diagnosed as well.
6875
6876 extern void* memset ();
6877 void f (void *d)
6878 {
6879 memset (d, '\0', 32);
6880 }
6881
6882 -Wno-builtin-macro-redefined
6883 Do not warn if certain built-in macros are redefined. This
6884 suppresses warnings for redefinition of "__TIMESTAMP__",
6885 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
6886
6887 -Wstrict-prototypes (C and Objective-C only)
6888 Warn if a function is declared or defined without specifying the
6889 argument types. (An old-style function definition is permitted
6890 without a warning if preceded by a declaration that specifies the
6891 argument types.)
6892
6893 -Wold-style-declaration (C and Objective-C only)
6894 Warn for obsolescent usages, according to the C Standard, in a
6895 declaration. For example, warn if storage-class specifiers like
6896 "static" are not the first things in a declaration. This warning
6897 is also enabled by -Wextra.
6898
6899 -Wold-style-definition (C and Objective-C only)
6900 Warn if an old-style function definition is used. A warning is
6901 given even if there is a previous prototype. A definition using ()
6902 is not considered an old-style definition in C2X mode, because it
6903 is equivalent to (void) in that case, but is considered an old-
6904 style definition for older standards.
6905
6906 -Wmissing-parameter-type (C and Objective-C only)
6907 A function parameter is declared without a type specifier in
6908 K&R-style functions:
6909
6910 void foo(bar) { }
6911
6912 This warning is also enabled by -Wextra.
6913
6914 -Wmissing-prototypes (C and Objective-C only)
6915 Warn if a global function is defined without a previous prototype
6916 declaration. This warning is issued even if the definition itself
6917 provides a prototype. Use this option to detect global functions
6918 that do not have a matching prototype declaration in a header file.
6919 This option is not valid for C++ because all function declarations
6920 provide prototypes and a non-matching declaration declares an
6921 overload rather than conflict with an earlier declaration. Use
6922 -Wmissing-declarations to detect missing declarations in C++.
6923
6924 -Wmissing-declarations
6925 Warn if a global function is defined without a previous
6926 declaration. Do so even if the definition itself provides a
6927 prototype. Use this option to detect global functions that are not
6928 declared in header files. In C, no warnings are issued for
6929 functions with previous non-prototype declarations; use
6930 -Wmissing-prototypes to detect missing prototypes. In C++, no
6931 warnings are issued for function templates, or for inline
6932 functions, or for functions in anonymous namespaces.
6933
6934 -Wmissing-field-initializers
6935 Warn if a structure's initializer has some fields missing. For
6936 example, the following code causes such a warning, because "x.h" is
6937 implicitly zero:
6938
6939 struct s { int f, g, h; };
6940 struct s x = { 3, 4 };
6941
6942 This option does not warn about designated initializers, so the
6943 following modification does not trigger a warning:
6944
6945 struct s { int f, g, h; };
6946 struct s x = { .f = 3, .g = 4 };
6947
6948 In C this option does not warn about the universal zero initializer
6949 { 0 }:
6950
6951 struct s { int f, g, h; };
6952 struct s x = { 0 };
6953
6954 Likewise, in C++ this option does not warn about the empty { }
6955 initializer, for example:
6956
6957 struct s { int f, g, h; };
6958 s x = { };
6959
6960 This warning is included in -Wextra. To get other -Wextra warnings
6961 without this one, use -Wextra -Wno-missing-field-initializers.
6962
6963 -Wno-multichar
6964 Do not warn if a multicharacter constant ('FOOF') is used. Usually
6965 they indicate a typo in the user's code, as they have
6966 implementation-defined values, and should not be used in portable
6967 code.
6968
6969 -Wnormalized=[none|id|nfc|nfkc]
6970 In ISO C and ISO C++, two identifiers are different if they are
6971 different sequences of characters. However, sometimes when
6972 characters outside the basic ASCII character set are used, you can
6973 have two different character sequences that look the same. To
6974 avoid confusion, the ISO 10646 standard sets out some normalization
6975 rules which when applied ensure that two sequences that look the
6976 same are turned into the same sequence. GCC can warn you if you
6977 are using identifiers that have not been normalized; this option
6978 controls that warning.
6979
6980 There are four levels of warning supported by GCC. The default is
6981 -Wnormalized=nfc, which warns about any identifier that is not in
6982 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
6983 form for most uses. It is equivalent to -Wnormalized.
6984
6985 Unfortunately, there are some characters allowed in identifiers by
6986 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6987 identifiers. That is, there's no way to use these symbols in
6988 portable ISO C or C++ and have all your identifiers in NFC.
6989 -Wnormalized=id suppresses the warning for these characters. It is
6990 hoped that future versions of the standards involved will correct
6991 this, which is why this option is not the default.
6992
6993 You can switch the warning off for all characters by writing
6994 -Wnormalized=none or -Wno-normalized. You should only do this if
6995 you are using some other normalization scheme (like "D"), because
6996 otherwise you can easily create bugs that are literally impossible
6997 to see.
6998
6999 Some characters in ISO 10646 have distinct meanings but look
7000 identical in some fonts or display methodologies, especially once
7001 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7002 LATIN SMALL LETTER N", displays just like a regular "n" that has
7003 been placed in a superscript. ISO 10646 defines the NFKC
7004 normalization scheme to convert all these into a standard form as
7005 well, and GCC warns if your code is not in NFKC if you use
7006 -Wnormalized=nfkc. This warning is comparable to warning about
7007 every identifier that contains the letter O because it might be
7008 confused with the digit 0, and so is not the default, but may be
7009 useful as a local coding convention if the programming environment
7010 cannot be fixed to display these characters distinctly.
7011
7012 -Wno-attribute-warning
7013 Do not warn about usage of functions declared with "warning"
7014 attribute. By default, this warning is enabled.
7015 -Wno-attribute-warning can be used to disable the warning or
7016 -Wno-error=attribute-warning can be used to disable the error when
7017 compiled with -Werror flag.
7018
7019 -Wno-deprecated
7020 Do not warn about usage of deprecated features.
7021
7022 -Wno-deprecated-declarations
7023 Do not warn about uses of functions, variables, and types marked as
7024 deprecated by using the "deprecated" attribute.
7025
7026 -Wno-overflow
7027 Do not warn about compile-time overflow in constant expressions.
7028
7029 -Wno-odr
7030 Warn about One Definition Rule violations during link-time
7031 optimization. Enabled by default.
7032
7033 -Wopenmp-simd
7034 Warn if the vectorizer cost model overrides the OpenMP simd
7035 directive set by user. The -fsimd-cost-model=unlimited option can
7036 be used to relax the cost model.
7037
7038 -Woverride-init (C and Objective-C only)
7039 Warn if an initialized field without side effects is overridden
7040 when using designated initializers.
7041
7042 This warning is included in -Wextra. To get other -Wextra warnings
7043 without this one, use -Wextra -Wno-override-init.
7044
7045 -Wno-override-init-side-effects (C and Objective-C only)
7046 Do not warn if an initialized field with side effects is overridden
7047 when using designated initializers. This warning is enabled by
7048 default.
7049
7050 -Wpacked
7051 Warn if a structure is given the packed attribute, but the packed
7052 attribute has no effect on the layout or size of the structure.
7053 Such structures may be mis-aligned for little benefit. For
7054 instance, in this code, the variable "f.x" in "struct bar" is
7055 misaligned even though "struct bar" does not itself have the packed
7056 attribute:
7057
7058 struct foo {
7059 int x;
7060 char a, b, c, d;
7061 } __attribute__((packed));
7062 struct bar {
7063 char z;
7064 struct foo f;
7065 };
7066
7067 -Wnopacked-bitfield-compat
7068 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7069 bit-fields of type "char". This was fixed in GCC 4.4 but the
7070 change can lead to differences in the structure layout. GCC
7071 informs you when the offset of such a field has changed in GCC 4.4.
7072 For example there is no longer a 4-bit padding between field "a"
7073 and "b" in this structure:
7074
7075 struct foo
7076 {
7077 char a:4;
7078 char b:8;
7079 } __attribute__ ((packed));
7080
7081 This warning is enabled by default. Use
7082 -Wno-packed-bitfield-compat to disable this warning.
7083
7084 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7085 Warn if a structure field with explicitly specified alignment in a
7086 packed struct or union is misaligned. For example, a warning will
7087 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7088 is less than 8", in this code:
7089
7090 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7091 struct __attribute__ ((packed)) S {
7092 struct S8 s8;
7093 };
7094
7095 This warning is enabled by -Wall.
7096
7097 -Wpadded
7098 Warn if padding is included in a structure, either to align an
7099 element of the structure or to align the whole structure.
7100 Sometimes when this happens it is possible to rearrange the fields
7101 of the structure to reduce the padding and so make the structure
7102 smaller.
7103
7104 -Wredundant-decls
7105 Warn if anything is declared more than once in the same scope, even
7106 in cases where multiple declaration is valid and changes nothing.
7107
7108 -Wrestrict
7109 Warn when an object referenced by a "restrict"-qualified parameter
7110 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7111 another argument, or when copies between such objects overlap. For
7112 example, the call to the "strcpy" function below attempts to
7113 truncate the string by replacing its initial characters with the
7114 last four. However, because the call writes the terminating NUL
7115 into "a[4]", the copies overlap and the call is diagnosed.
7116
7117 void foo (void)
7118 {
7119 char a[] = "abcd1234";
7120 strcpy (a, a + 4);
7121 ...
7122 }
7123
7124 The -Wrestrict option detects some instances of simple overlap even
7125 without optimization but works best at -O2 and above. It is
7126 included in -Wall.
7127
7128 -Wnested-externs (C and Objective-C only)
7129 Warn if an "extern" declaration is encountered within a function.
7130
7131 -Winline
7132 Warn if a function that is declared as inline cannot be inlined.
7133 Even with this option, the compiler does not warn about failures to
7134 inline functions declared in system headers.
7135
7136 The compiler uses a variety of heuristics to determine whether or
7137 not to inline a function. For example, the compiler takes into
7138 account the size of the function being inlined and the amount of
7139 inlining that has already been done in the current function.
7140 Therefore, seemingly insignificant changes in the source program
7141 can cause the warnings produced by -Winline to appear or disappear.
7142
7143 -Wint-in-bool-context
7144 Warn for suspicious use of integer values where boolean values are
7145 expected, such as conditional expressions (?:) using non-boolean
7146 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7147 Or left shifting of signed integers in boolean context, like "for
7148 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7149 regardless of the data type. This warning is enabled by -Wall.
7150
7151 -Wno-int-to-pointer-cast
7152 Suppress warnings from casts to pointer type of an integer of a
7153 different size. In C++, casting to a pointer type of smaller size
7154 is an error. Wint-to-pointer-cast is enabled by default.
7155
7156 -Wno-pointer-to-int-cast (C and Objective-C only)
7157 Suppress warnings from casts from a pointer to an integer type of a
7158 different size.
7159
7160 -Winvalid-pch
7161 Warn if a precompiled header is found in the search path but cannot
7162 be used.
7163
7164 -Wlong-long
7165 Warn if "long long" type is used. This is enabled by either
7166 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
7167 the warning messages, use -Wno-long-long.
7168
7169 -Wvariadic-macros
7170 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7171 alternate syntax is used in ISO C99 mode. This is enabled by
7172 either -Wpedantic or -Wtraditional. To inhibit the warning
7173 messages, use -Wno-variadic-macros.
7174
7175 -Wno-varargs
7176 Do not warn upon questionable usage of the macros used to handle
7177 variable arguments like "va_start". These warnings are enabled by
7178 default.
7179
7180 -Wvector-operation-performance
7181 Warn if vector operation is not implemented via SIMD capabilities
7182 of the architecture. Mainly useful for the performance tuning.
7183 Vector operation can be implemented "piecewise", which means that
7184 the scalar operation is performed on every vector element; "in
7185 parallel", which means that the vector operation is implemented
7186 using scalars of wider type, which normally is more performance
7187 efficient; and "as a single scalar", which means that vector fits
7188 into a scalar type.
7189
7190 -Wvla
7191 Warn if a variable-length array is used in the code. -Wno-vla
7192 prevents the -Wpedantic warning of the variable-length array.
7193
7194 -Wvla-larger-than=byte-size
7195 If this option is used, the compiler warns for declarations of
7196 variable-length arrays whose size is either unbounded, or bounded
7197 by an argument that allows the array size to exceed byte-size
7198 bytes. This is similar to how -Walloca-larger-than=byte-size
7199 works, but with variable-length arrays.
7200
7201 Note that GCC may optimize small variable-length arrays of a known
7202 value into plain arrays, so this warning may not get triggered for
7203 such arrays.
7204
7205 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
7206 typically only effective when -ftree-vrp is active (default for -O2
7207 and above).
7208
7209 See also -Walloca-larger-than=byte-size.
7210
7211 -Wno-vla-larger-than
7212 Disable -Wvla-larger-than= warnings. The option is equivalent to
7213 -Wvla-larger-than=SIZE_MAX or larger.
7214
7215 -Wvla-parameter
7216 Warn about redeclarations of functions involving arguments of
7217 Variable Length Array types of inconsistent kinds or forms, and
7218 enable the detection of out-of-bounds accesses to such parameters
7219 by warnings such as -Warray-bounds.
7220
7221 If the first function declaration uses the VLA form the bound
7222 specified in the array is assumed to be the minimum number of
7223 elements expected to be provided in calls to the function and the
7224 maximum number of elements accessed by it. Failing to provide
7225 arguments of sufficient size or accessing more than the maximum
7226 number of elements may be diagnosed.
7227
7228 For example, the warning triggers for the following redeclarations
7229 because the first one allows an array of any size to be passed to
7230 "f" while the second one specifies that the array argument must
7231 have at least "n" elements. In addition, calling "f" with the
7232 assotiated VLA bound parameter in excess of the actual VLA bound
7233 triggers a warning as well.
7234
7235 void f (int n, int[n]);
7236 void f (int, int[]); // warning: argument 2 previously declared as a VLA
7237
7238 void g (int n)
7239 {
7240 if (n > 4)
7241 return;
7242 int a[n];
7243 f (sizeof a, a); // warning: access to a by f may be out of bounds
7244 ...
7245 }
7246
7247 -Wvla-parameter is included in -Wall. The -Warray-parameter option
7248 triggers warnings for similar problems involving ordinary array
7249 arguments.
7250
7251 -Wvolatile-register-var
7252 Warn if a register variable is declared volatile. The volatile
7253 modifier does not inhibit all optimizations that may eliminate
7254 reads and/or writes to register variables. This warning is enabled
7255 by -Wall.
7256
7257 -Wdisabled-optimization
7258 Warn if a requested optimization pass is disabled. This warning
7259 does not generally indicate that there is anything wrong with your
7260 code; it merely indicates that GCC's optimizers are unable to
7261 handle the code effectively. Often, the problem is that your code
7262 is too big or too complex; GCC refuses to optimize programs when
7263 the optimization itself is likely to take inordinate amounts of
7264 time.
7265
7266 -Wpointer-sign (C and Objective-C only)
7267 Warn for pointer argument passing or assignment with different
7268 signedness. This option is only supported for C and Objective-C.
7269 It is implied by -Wall and by -Wpedantic, which can be disabled
7270 with -Wno-pointer-sign.
7271
7272 -Wstack-protector
7273 This option is only active when -fstack-protector is active. It
7274 warns about functions that are not protected against stack
7275 smashing.
7276
7277 -Woverlength-strings
7278 Warn about string constants that are longer than the "minimum
7279 maximum" length specified in the C standard. Modern compilers
7280 generally allow string constants that are much longer than the
7281 standard's minimum limit, but very portable programs should avoid
7282 using longer strings.
7283
7284 The limit applies after string constant concatenation, and does not
7285 count the trailing NUL. In C90, the limit was 509 characters; in
7286 C99, it was raised to 4095. C++98 does not specify a normative
7287 minimum maximum, so we do not diagnose overlength strings in C++.
7288
7289 This option is implied by -Wpedantic, and can be disabled with
7290 -Wno-overlength-strings.
7291
7292 -Wunsuffixed-float-constants (C and Objective-C only)
7293 Issue a warning for any floating constant that does not have a
7294 suffix. When used together with -Wsystem-headers it warns about
7295 such constants in system header files. This can be useful when
7296 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
7297 the decimal floating-point extension to C99.
7298
7299 -Wno-lto-type-mismatch
7300 During the link-time optimization, do not warn about type
7301 mismatches in global declarations from different compilation units.
7302 Requires -flto to be enabled. Enabled by default.
7303
7304 -Wno-designated-init (C and Objective-C only)
7305 Suppress warnings when a positional initializer is used to
7306 initialize a structure that has been marked with the
7307 "designated_init" attribute.
7308
7309 Options That Control Static Analysis
7310 -fanalyzer
7311 This option enables an static analysis of program flow which looks
7312 for "interesting" interprocedural paths through the code, and
7313 issues warnings for problems found on them.
7314
7315 This analysis is much more expensive than other GCC warnings.
7316
7317 Enabling this option effectively enables the following warnings:
7318
7319 -Wanalyzer-double-fclose -Wanalyzer-double-free
7320 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
7321 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
7322 -Wanalyzer-mismatching-deallocation
7323 -Wanalyzer-possible-null-argument
7324 -Wanalyzer-possible-null-dereference -Wanalyzer-null-argument
7325 -Wanalyzer-null-dereference -Wanalyzer-shift-count-negative
7326 -Wanalyzer-shift-count-overflow -Wanalyzer-stale-setjmp-buffer
7327 -Wanalyzer-tainted-array-index
7328 -Wanalyzer-unsafe-call-within-signal-handler
7329 -Wanalyzer-use-after-free
7330 -Wanalyzer-use-of-pointer-in-stale-stack-frame
7331 -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal
7332
7333 This option is only available if GCC was configured with analyzer
7334 support enabled.
7335
7336 -Wanalyzer-too-complex
7337 If -fanalyzer is enabled, the analyzer uses various heuristics to
7338 attempt to explore the control flow and data flow in the program,
7339 but these can be defeated by sufficiently complicated code.
7340
7341 By default, the analysis silently stops if the code is too
7342 complicated for the analyzer to fully explore and it reaches an
7343 internal limit. The -Wanalyzer-too-complex option warns if this
7344 occurs.
7345
7346 -Wno-analyzer-double-fclose
7347 This warning requires -fanalyzer, which enables it; use
7348 -Wno-analyzer-double-fclose to disable it.
7349
7350 This diagnostic warns for paths through the code in which a "FILE
7351 *" can have "fclose" called on it more than once.
7352
7353 -Wno-analyzer-double-free
7354 This warning requires -fanalyzer, which enables it; use
7355 -Wno-analyzer-double-free to disable it.
7356
7357 This diagnostic warns for paths through the code in which a pointer
7358 can have a deallocator called on it more than once, either "free",
7359 or a deallocator referenced by attribute "malloc".
7360
7361 -Wno-analyzer-exposure-through-output-file
7362 This warning requires -fanalyzer, which enables it; use
7363 -Wno-analyzer-exposure-through-output-file to disable it.
7364
7365 This diagnostic warns for paths through the code in which a
7366 security-sensitive value is written to an output file (such as
7367 writing a password to a log file).
7368
7369 -Wno-analyzer-file-leak
7370 This warning requires -fanalyzer, which enables it; use
7371 -Wno-analyzer-file-leak to disable it.
7372
7373 This diagnostic warns for paths through the code in which a
7374 "<stdio.h>" "FILE *" stream object is leaked.
7375
7376 -Wno-analyzer-free-of-non-heap
7377 This warning requires -fanalyzer, which enables it; use
7378 -Wno-analyzer-free-of-non-heap to disable it.
7379
7380 This diagnostic warns for paths through the code in which "free" is
7381 called on a non-heap pointer (e.g. an on-stack buffer, or a
7382 global).
7383
7384 -Wno-analyzer-malloc-leak
7385 This warning requires -fanalyzer, which enables it; use
7386 -Wno-analyzer-malloc-leak to disable it.
7387
7388 This diagnostic warns for paths through the code in which a pointer
7389 allocated via an allocator is leaked: either "malloc", or a
7390 function marked with attribute "malloc".
7391
7392 -Wno-analyzer-mismatching-deallocation
7393 This warning requires -fanalyzer, which enables it; use
7394 -Wno-analyzer-mismatching-deallocation to disable it.
7395
7396 This diagnostic warns for paths through the code in which the wrong
7397 deallocation function is called on a pointer value, based on which
7398 function was used to allocate the pointer value. The diagnostic
7399 will warn about mismatches between "free", scalar "delete" and
7400 vector "delete[]", and those marked as allocator/deallocator pairs
7401 using attribute "malloc".
7402
7403 -Wno-analyzer-possible-null-argument
7404 This warning requires -fanalyzer, which enables it; use
7405 -Wno-analyzer-possible-null-argument to disable it.
7406
7407 This diagnostic warns for paths through the code in which a
7408 possibly-NULL value is passed to a function argument marked with
7409 "__attribute__((nonnull))" as requiring a non-NULL value.
7410
7411 -Wno-analyzer-possible-null-dereference
7412 This warning requires -fanalyzer, which enables it; use
7413 -Wno-analyzer-possible-null-dereference to disable it.
7414
7415 This diagnostic warns for paths through the code in which a
7416 possibly-NULL value is dereferenced.
7417
7418 -Wno-analyzer-null-argument
7419 This warning requires -fanalyzer, which enables it; use
7420 -Wno-analyzer-null-argument to disable it.
7421
7422 This diagnostic warns for paths through the code in which a value
7423 known to be NULL is passed to a function argument marked with
7424 "__attribute__((nonnull))" as requiring a non-NULL value.
7425
7426 -Wno-analyzer-null-dereference
7427 This warning requires -fanalyzer, which enables it; use
7428 -Wno-analyzer-null-dereference to disable it.
7429
7430 This diagnostic warns for paths through the code in which a value
7431 known to be NULL is dereferenced.
7432
7433 -Wno-analyzer-shift-count-negative
7434 This warning requires -fanalyzer, which enables it; use
7435 -Wno-analyzer-shift-count-negative to disable it.
7436
7437 This diagnostic warns for paths through the code in which a shift
7438 is attempted with a negative count. It is analogous to the
7439 -Wshift-count-negative diagnostic implemented in the C/C++ front
7440 ends, but is implemented based on analyzing interprocedural paths,
7441 rather than merely parsing the syntax tree. However, the analyzer
7442 does not prioritize detection of such paths, so false negatives are
7443 more likely relative to other warnings.
7444
7445 -Wno-analyzer-shift-count-overflow
7446 This warning requires -fanalyzer, which enables it; use
7447 -Wno-analyzer-shift-count-overflow to disable it.
7448
7449 This diagnostic warns for paths through the code in which a shift
7450 is attempted with a count greater than or equal to the precision of
7451 the operand's type. It is analogous to the -Wshift-count-overflow
7452 diagnostic implemented in the C/C++ front ends, but is implemented
7453 based on analyzing interprocedural paths, rather than merely
7454 parsing the syntax tree. However, the analyzer does not prioritize
7455 detection of such paths, so false negatives are more likely
7456 relative to other warnings.
7457
7458 -Wno-analyzer-stale-setjmp-buffer
7459 This warning requires -fanalyzer, which enables it; use
7460 -Wno-analyzer-stale-setjmp-buffer to disable it.
7461
7462 This diagnostic warns for paths through the code in which "longjmp"
7463 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
7464 function that has returned.
7465
7466 When "setjmp" is called on a "jmp_buf" to record a rewind location,
7467 it records the stack frame. The stack frame becomes invalid when
7468 the function containing the "setjmp" call returns. Attempting to
7469 rewind to it via "longjmp" would reference a stack frame that no
7470 longer exists, and likely lead to a crash (or worse).
7471
7472 -Wno-analyzer-tainted-array-index
7473 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7474 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
7475
7476 This diagnostic warns for paths through the code in which a value
7477 that could be under an attacker's control is used as the index of
7478 an array access without being sanitized.
7479
7480 -Wno-analyzer-unsafe-call-within-signal-handler
7481 This warning requires -fanalyzer, which enables it; use
7482 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
7483
7484 This diagnostic warns for paths through the code in which a
7485 function known to be async-signal-unsafe (such as "fprintf") is
7486 called from a signal handler.
7487
7488 -Wno-analyzer-use-after-free
7489 This warning requires -fanalyzer, which enables it; use
7490 -Wno-analyzer-use-after-free to disable it.
7491
7492 This diagnostic warns for paths through the code in which a pointer
7493 is used after a deallocator is called on it: either "free", or a
7494 deallocator referenced by attribute "malloc".
7495
7496 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
7497 This warning requires -fanalyzer, which enables it; use
7498 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
7499
7500 This diagnostic warns for paths through the code in which a pointer
7501 is dereferenced that points to a variable in a stale stack frame.
7502
7503 -Wno-analyzer-write-to-const
7504 This warning requires -fanalyzer, which enables it; use
7505 -Wno-analyzer-write-to-const to disable it.
7506
7507 This diagnostic warns for paths through the code in which the
7508 analyzer detects an attempt to write through a pointer to a "const"
7509 object. However, the analyzer does not prioritize detection of
7510 such paths, so false negatives are more likely relative to other
7511 warnings.
7512
7513 -Wno-analyzer-write-to-string-literal
7514 This warning requires -fanalyzer, which enables it; use
7515 -Wno-analyzer-write-to-string-literal to disable it.
7516
7517 This diagnostic warns for paths through the code in which the
7518 analyzer detects an attempt to write through a pointer to a string
7519 literal. However, the analyzer does not prioritize detection of
7520 such paths, so false negatives are more likely relative to other
7521 warnings.
7522
7523 Pertinent parameters for controlling the exploration are: --param
7524 analyzer-bb-explosion-factor=value, --param
7525 analyzer-max-enodes-per-program-point=value, --param
7526 analyzer-max-recursion-depth=value, and --param
7527 analyzer-min-snodes-for-call-summary=value.
7528
7529 The following options control the analyzer.
7530
7531 -fanalyzer-call-summaries
7532 Simplify interprocedural analysis by computing the effect of
7533 certain calls, rather than exploring all paths through the function
7534 from callsite to each possible return.
7535
7536 If enabled, call summaries are only used for functions with more
7537 than one call site, and that are sufficiently complicated (as per
7538 --param analyzer-min-snodes-for-call-summary=value).
7539
7540 -fanalyzer-checker=name
7541 Restrict the analyzer to run just the named checker, and enable it.
7542
7543 Some checkers are disabled by default (even with -fanalyzer), such
7544 as the "taint" checker that implements
7545 -Wanalyzer-tainted-array-index, and this option is required to
7546 enable them.
7547
7548 -fno-analyzer-feasibility
7549 This option is intended for analyzer developers.
7550
7551 By default the analyzer verifies that there is a feasible control
7552 flow path for each diagnostic it emits: that the conditions that
7553 hold are not mutually exclusive. Diagnostics for which no feasible
7554 path can be found are rejected. This filtering can be suppressed
7555 with -fno-analyzer-feasibility, for debugging issues in this code.
7556
7557 -fanalyzer-fine-grained
7558 This option is intended for analyzer developers.
7559
7560 Internally the analyzer builds an "exploded graph" that combines
7561 control flow graphs with data flow information.
7562
7563 By default, an edge in this graph can contain the effects of a run
7564 of multiple statements within a basic block. With
7565 -fanalyzer-fine-grained, each statement gets its own edge.
7566
7567 -fanalyzer-show-duplicate-count
7568 This option is intended for analyzer developers: if multiple
7569 diagnostics have been detected as being duplicates of each other,
7570 it emits a note when reporting the best diagnostic, giving the
7571 number of additional diagnostics that were suppressed by the
7572 deduplication logic.
7573
7574 -fno-analyzer-state-merge
7575 This option is intended for analyzer developers.
7576
7577 By default the analyzer attempts to simplify analysis by merging
7578 sufficiently similar states at each program point as it builds its
7579 "exploded graph". With -fno-analyzer-state-merge this merging can
7580 be suppressed, for debugging state-handling issues.
7581
7582 -fno-analyzer-state-purge
7583 This option is intended for analyzer developers.
7584
7585 By default the analyzer attempts to simplify analysis by purging
7586 aspects of state at a program point that appear to no longer be
7587 relevant e.g. the values of locals that aren't accessed later in
7588 the function and which aren't relevant to leak analysis.
7589
7590 With -fno-analyzer-state-purge this purging of state can be
7591 suppressed, for debugging state-handling issues.
7592
7593 -fanalyzer-transitivity
7594 This option enables transitivity of constraints within the
7595 analyzer.
7596
7597 -fanalyzer-verbose-edges
7598 This option is intended for analyzer developers. It enables more
7599 verbose, lower-level detail in the descriptions of control flow
7600 within diagnostic paths.
7601
7602 -fanalyzer-verbose-state-changes
7603 This option is intended for analyzer developers. It enables more
7604 verbose, lower-level detail in the descriptions of events relating
7605 to state machines within diagnostic paths.
7606
7607 -fanalyzer-verbosity=level
7608 This option controls the complexity of the control flow paths that
7609 are emitted for analyzer diagnostics.
7610
7611 The level can be one of:
7612
7613 0 At this level, interprocedural call and return events are
7614 displayed, along with the most pertinent state-change events
7615 relating to a diagnostic. For example, for a double-"free"
7616 diagnostic, both calls to "free" will be shown.
7617
7618 1 As per the previous level, but also show events for the entry
7619 to each function.
7620
7621 2 As per the previous level, but also show events relating to
7622 control flow that are significant to triggering the issue (e.g.
7623 "true path taken" at a conditional).
7624
7625 This level is the default.
7626
7627 3 As per the previous level, but show all control flow events,
7628 not just significant ones.
7629
7630 4 This level is intended for analyzer developers; it adds various
7631 other events intended for debugging the analyzer.
7632
7633 -fdump-analyzer
7634 Dump internal details about what the analyzer is doing to
7635 file.analyzer.txt. This option is overridden by
7636 -fdump-analyzer-stderr.
7637
7638 -fdump-analyzer-stderr
7639 Dump internal details about what the analyzer is doing to stderr.
7640 This option overrides -fdump-analyzer.
7641
7642 -fdump-analyzer-callgraph
7643 Dump a representation of the call graph suitable for viewing with
7644 GraphViz to file.callgraph.dot.
7645
7646 -fdump-analyzer-exploded-graph
7647 Dump a representation of the "exploded graph" suitable for viewing
7648 with GraphViz to file.eg.dot. Nodes are color-coded based on
7649 state-machine states to emphasize state changes.
7650
7651 -fdump-analyzer-exploded-nodes
7652 Emit diagnostics showing where nodes in the "exploded graph" are in
7653 relation to the program source.
7654
7655 -fdump-analyzer-exploded-nodes-2
7656 Dump a textual representation of the "exploded graph" to
7657 file.eg.txt.
7658
7659 -fdump-analyzer-exploded-nodes-3
7660 Dump a textual representation of the "exploded graph" to one dump
7661 file per node, to file.eg-id.txt. This is typically a large number
7662 of dump files.
7663
7664 -fdump-analyzer-feasibility
7665 Dump internal details about the analyzer's search for feasible
7666 paths. The details are written in a form suitable for viewing with
7667 GraphViz to filenames of the form file.*.fg.dot and file.*.tg.dot.
7668
7669 -fdump-analyzer-json
7670 Dump a compressed JSON representation of analyzer internals to
7671 file.analyzer.json.gz. The precise format is subject to change.
7672
7673 -fdump-analyzer-state-purge
7674 As per -fdump-analyzer-supergraph, dump a representation of the
7675 "supergraph" suitable for viewing with GraphViz, but annotate the
7676 graph with information on what state will be purged at each node.
7677 The graph is written to file.state-purge.dot.
7678
7679 -fdump-analyzer-supergraph
7680 Dump representations of the "supergraph" suitable for viewing with
7681 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
7682 These show all of the control flow graphs in the program, with
7683 interprocedural edges for calls and returns. The second dump
7684 contains annotations showing nodes in the "exploded graph" and
7685 diagnostics associated with them.
7686
7687 Options for Debugging Your Program
7688 To tell GCC to emit extra information for use by a debugger, in almost
7689 all cases you need only to add -g to your other options.
7690
7691 GCC allows you to use -g with -O. The shortcuts taken by optimized
7692 code may occasionally be surprising: some variables you declared may
7693 not exist at all; flow of control may briefly move where you did not
7694 expect it; some statements may not be executed because they compute
7695 constant results or their values are already at hand; some statements
7696 may execute in different places because they have been moved out of
7697 loops. Nevertheless it is possible to debug optimized output. This
7698 makes it reasonable to use the optimizer for programs that might have
7699 bugs.
7700
7701 If you are not using some other optimization option, consider using -Og
7702 with -g. With no -O option at all, some compiler passes that collect
7703 information useful for debugging do not run at all, so that -Og may
7704 result in a better debugging experience.
7705
7706 -g Produce debugging information in the operating system's native
7707 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
7708 debugging information.
7709
7710 On most systems that use stabs format, -g enables use of extra
7711 debugging information that only GDB can use; this extra information
7712 makes debugging work better in GDB but probably makes other
7713 debuggers crash or refuse to read the program. If you want to
7714 control for certain whether to generate the extra information, use
7715 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
7716
7717 -ggdb
7718 Produce debugging information for use by GDB. This means to use
7719 the most expressive format available (DWARF, stabs, or the native
7720 format if neither of those are supported), including GDB extensions
7721 if at all possible.
7722
7723 -gdwarf
7724 -gdwarf-version
7725 Produce debugging information in DWARF format (if that is
7726 supported). The value of version may be either 2, 3, 4 or 5; the
7727 default version for most targets is 5 (with the exception of
7728 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
7729 AIX, which defaults to version 4).
7730
7731 Note that with DWARF Version 2, some ports require and always use
7732 some non-conflicting DWARF 3 extensions in the unwind tables.
7733
7734 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
7735 maximum benefit. Version 5 requires GDB 8.0 or higher.
7736
7737 GCC no longer supports DWARF Version 1, which is substantially
7738 different than Version 2 and later. For historical reasons, some
7739 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
7740 reference to DWARF Version 2 in their names, but apply to all
7741 currently-supported versions of DWARF.
7742
7743 -gstabs
7744 Produce debugging information in stabs format (if that is
7745 supported), without GDB extensions. This is the format used by DBX
7746 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
7747 this option produces stabs debugging output that is not understood
7748 by DBX. On System V Release 4 systems this option requires the GNU
7749 assembler.
7750
7751 -gstabs+
7752 Produce debugging information in stabs format (if that is
7753 supported), using GNU extensions understood only by the GNU
7754 debugger (GDB). The use of these extensions is likely to make
7755 other debuggers crash or refuse to read the program.
7756
7757 -gxcoff
7758 Produce debugging information in XCOFF format (if that is
7759 supported). This is the format used by the DBX debugger on IBM
7760 RS/6000 systems.
7761
7762 -gxcoff+
7763 Produce debugging information in XCOFF format (if that is
7764 supported), using GNU extensions understood only by the GNU
7765 debugger (GDB). The use of these extensions is likely to make
7766 other debuggers crash or refuse to read the program, and may cause
7767 assemblers other than the GNU assembler (GAS) to fail with an
7768 error.
7769
7770 -gvms
7771 Produce debugging information in Alpha/VMS debug format (if that is
7772 supported). This is the format used by DEBUG on Alpha/VMS systems.
7773
7774 -glevel
7775 -ggdblevel
7776 -gstabslevel
7777 -gxcofflevel
7778 -gvmslevel
7779 Request debugging information and also use level to specify how
7780 much information. The default level is 2.
7781
7782 Level 0 produces no debug information at all. Thus, -g0 negates
7783 -g.
7784
7785 Level 1 produces minimal information, enough for making backtraces
7786 in parts of the program that you don't plan to debug. This
7787 includes descriptions of functions and external variables, and line
7788 number tables, but no information about local variables.
7789
7790 Level 3 includes extra information, such as all the macro
7791 definitions present in the program. Some debuggers support macro
7792 expansion when you use -g3.
7793
7794 If you use multiple -g options, with or without level numbers, the
7795 last such option is the one that is effective.
7796
7797 -gdwarf does not accept a concatenated debug level, to avoid
7798 confusion with -gdwarf-level. Instead use an additional -glevel
7799 option to change the debug level for DWARF.
7800
7801 -fno-eliminate-unused-debug-symbols
7802 By default, no debug information is produced for symbols that are
7803 not actually used. Use this option if you want debug information
7804 for all symbols.
7805
7806 -femit-class-debug-always
7807 Instead of emitting debugging information for a C++ class in only
7808 one object file, emit it in all object files using the class. This
7809 option should be used only with debuggers that are unable to handle
7810 the way GCC normally emits debugging information for classes
7811 because using this option increases the size of debugging
7812 information by as much as a factor of two.
7813
7814 -fno-merge-debug-strings
7815 Direct the linker to not merge together strings in the debugging
7816 information that are identical in different object files. Merging
7817 is not supported by all assemblers or linkers. Merging decreases
7818 the size of the debug information in the output file at the cost of
7819 increasing link processing time. Merging is enabled by default.
7820
7821 -fdebug-prefix-map=old=new
7822 When compiling files residing in directory old, record debugging
7823 information describing them as if the files resided in directory
7824 new instead. This can be used to replace a build-time path with an
7825 install-time path in the debug info. It can also be used to change
7826 an absolute path to a relative path by using . for new. This can
7827 give more reproducible builds, which are location independent, but
7828 may require an extra command to tell GDB where to find the source
7829 files. See also -ffile-prefix-map.
7830
7831 -fvar-tracking
7832 Run variable tracking pass. It computes where variables are stored
7833 at each position in code. Better debugging information is then
7834 generated (if the debugging information format supports this
7835 information).
7836
7837 It is enabled by default when compiling with optimization (-Os, -O,
7838 -O2, ...), debugging information (-g) and the debug info format
7839 supports it.
7840
7841 -fvar-tracking-assignments
7842 Annotate assignments to user variables early in the compilation and
7843 attempt to carry the annotations over throughout the compilation
7844 all the way to the end, in an attempt to improve debug information
7845 while optimizing. Use of -gdwarf-4 is recommended along with it.
7846
7847 It can be enabled even if var-tracking is disabled, in which case
7848 annotations are created and maintained, but discarded at the end.
7849 By default, this flag is enabled together with -fvar-tracking,
7850 except when selective scheduling is enabled.
7851
7852 -gsplit-dwarf
7853 If DWARF debugging information is enabled, separate as much
7854 debugging information as possible into a separate output file with
7855 the extension .dwo. This option allows the build system to avoid
7856 linking files with debug information. To be useful, this option
7857 requires a debugger capable of reading .dwo files.
7858
7859 -gdwarf32
7860 -gdwarf64
7861 If DWARF debugging information is enabled, the -gdwarf32 selects
7862 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
7863 format. The default is target specific, on most targets it is
7864 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
7865 support more than 2GiB of debug information in any of the DWARF
7866 debug information sections. The 64-bit DWARF format allows larger
7867 debug information and might not be well supported by all consumers
7868 yet.
7869
7870 -gdescribe-dies
7871 Add description attributes to some DWARF DIEs that have no name
7872 attribute, such as artificial variables, external references and
7873 call site parameter DIEs.
7874
7875 -gpubnames
7876 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
7877
7878 -ggnu-pubnames
7879 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
7880 format suitable for conversion into a GDB index. This option is
7881 only useful with a linker that can produce GDB index version 7.
7882
7883 -fdebug-types-section
7884 When using DWARF Version 4 or higher, type DIEs can be put into
7885 their own ".debug_types" section instead of making them part of the
7886 ".debug_info" section. It is more efficient to put them in a
7887 separate comdat section since the linker can then remove
7888 duplicates. But not all DWARF consumers support ".debug_types"
7889 sections yet and on some objects ".debug_types" produces larger
7890 instead of smaller debugging information.
7891
7892 -grecord-gcc-switches
7893 -gno-record-gcc-switches
7894 This switch causes the command-line options used to invoke the
7895 compiler that may affect code generation to be appended to the
7896 DW_AT_producer attribute in DWARF debugging information. The
7897 options are concatenated with spaces separating them from each
7898 other and from the compiler version. It is enabled by default.
7899 See also -frecord-gcc-switches for another way of storing compiler
7900 options into the object file.
7901
7902 -gstrict-dwarf
7903 Disallow using extensions of later DWARF standard version than
7904 selected with -gdwarf-version. On most targets using non-
7905 conflicting DWARF extensions from later standard versions is
7906 allowed.
7907
7908 -gno-strict-dwarf
7909 Allow using extensions of later DWARF standard version than
7910 selected with -gdwarf-version.
7911
7912 -gas-loc-support
7913 Inform the compiler that the assembler supports ".loc" directives.
7914 It may then use them for the assembler to generate DWARF2+ line
7915 number tables.
7916
7917 This is generally desirable, because assembler-generated line-
7918 number tables are a lot more compact than those the compiler can
7919 generate itself.
7920
7921 This option will be enabled by default if, at GCC configure time,
7922 the assembler was found to support such directives.
7923
7924 -gno-as-loc-support
7925 Force GCC to generate DWARF2+ line number tables internally, if
7926 DWARF2+ line number tables are to be generated.
7927
7928 -gas-locview-support
7929 Inform the compiler that the assembler supports "view" assignment
7930 and reset assertion checking in ".loc" directives.
7931
7932 This option will be enabled by default if, at GCC configure time,
7933 the assembler was found to support them.
7934
7935 -gno-as-locview-support
7936 Force GCC to assign view numbers internally, if
7937 -gvariable-location-views are explicitly requested.
7938
7939 -gcolumn-info
7940 -gno-column-info
7941 Emit location column information into DWARF debugging information,
7942 rather than just file and line. This option is enabled by default.
7943
7944 -gstatement-frontiers
7945 -gno-statement-frontiers
7946 This option causes GCC to create markers in the internal
7947 representation at the beginning of statements, and to keep them
7948 roughly in place throughout compilation, using them to guide the
7949 output of "is_stmt" markers in the line number table. This is
7950 enabled by default when compiling with optimization (-Os, -O, -O2,
7951 ...), and outputting DWARF 2 debug information at the normal level.
7952
7953 -gvariable-location-views
7954 -gvariable-location-views=incompat5
7955 -gno-variable-location-views
7956 Augment variable location lists with progressive view numbers
7957 implied from the line number table. This enables debug information
7958 consumers to inspect state at certain points of the program, even
7959 if no instructions associated with the corresponding source
7960 locations are present at that point. If the assembler lacks
7961 support for view numbers in line number tables, this will cause the
7962 compiler to emit the line number table, which generally makes them
7963 somewhat less compact. The augmented line number tables and
7964 location lists are fully backward-compatible, so they can be
7965 consumed by debug information consumers that are not aware of these
7966 augmentations, but they won't derive any benefit from them either.
7967
7968 This is enabled by default when outputting DWARF 2 debug
7969 information at the normal level, as long as there is assembler
7970 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
7971 is not. When assembler support is not available, this may still be
7972 enabled, but it will force GCC to output internal line number
7973 tables, and if -ginternal-reset-location-views is not enabled, that
7974 will most certainly lead to silently mismatching location views.
7975
7976 There is a proposed representation for view numbers that is not
7977 backward compatible with the location list format introduced in
7978 DWARF 5, that can be enabled with
7979 -gvariable-location-views=incompat5. This option may be removed in
7980 the future, is only provided as a reference implementation of the
7981 proposed representation. Debug information consumers are not
7982 expected to support this extended format, and they would be
7983 rendered unable to decode location lists using it.
7984
7985 -ginternal-reset-location-views
7986 -gno-internal-reset-location-views
7987 Attempt to determine location views that can be omitted from
7988 location view lists. This requires the compiler to have very
7989 accurate insn length estimates, which isn't always the case, and it
7990 may cause incorrect view lists to be generated silently when using
7991 an assembler that does not support location view lists. The GNU
7992 assembler will flag any such error as a "view number mismatch".
7993 This is only enabled on ports that define a reliable estimation
7994 function.
7995
7996 -ginline-points
7997 -gno-inline-points
7998 Generate extended debug information for inlined functions.
7999 Location view tracking markers are inserted at inlined entry
8000 points, so that address and view numbers can be computed and output
8001 in debug information. This can be enabled independently of
8002 location views, in which case the view numbers won't be output, but
8003 it can only be enabled along with statement frontiers, and it is
8004 only enabled by default if location views are enabled.
8005
8006 -gz[=type]
8007 Produce compressed debug sections in DWARF format, if that is
8008 supported. If type is not given, the default type depends on the
8009 capabilities of the assembler and linker used. type may be one of
8010 none (don't compress debug sections), zlib (use zlib compression in
8011 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8012 GNU format). If the linker doesn't support writing compressed
8013 debug sections, the option is rejected. Otherwise, if the
8014 assembler does not support them, -gz is silently ignored when
8015 producing object files.
8016
8017 -femit-struct-debug-baseonly
8018 Emit debug information for struct-like types only when the base
8019 name of the compilation source file matches the base name of file
8020 in which the struct is defined.
8021
8022 This option substantially reduces the size of debugging
8023 information, but at significant potential loss in type information
8024 to the debugger. See -femit-struct-debug-reduced for a less
8025 aggressive option. See -femit-struct-debug-detailed for more
8026 detailed control.
8027
8028 This option works only with DWARF debug output.
8029
8030 -femit-struct-debug-reduced
8031 Emit debug information for struct-like types only when the base
8032 name of the compilation source file matches the base name of file
8033 in which the type is defined, unless the struct is a template or
8034 defined in a system header.
8035
8036 This option significantly reduces the size of debugging
8037 information, with some potential loss in type information to the
8038 debugger. See -femit-struct-debug-baseonly for a more aggressive
8039 option. See -femit-struct-debug-detailed for more detailed
8040 control.
8041
8042 This option works only with DWARF debug output.
8043
8044 -femit-struct-debug-detailed[=spec-list]
8045 Specify the struct-like types for which the compiler generates
8046 debug information. The intent is to reduce duplicate struct debug
8047 information between different object files within the same program.
8048
8049 This option is a detailed version of -femit-struct-debug-reduced
8050 and -femit-struct-debug-baseonly, which serves for most needs.
8051
8052 A specification has the
8053 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8054
8055 The optional first word limits the specification to structs that
8056 are used directly (dir:) or used indirectly (ind:). A struct type
8057 is used directly when it is the type of a variable, member.
8058 Indirect uses arise through pointers to structs. That is, when use
8059 of an incomplete struct is valid, the use is indirect. An example
8060 is struct one direct; struct two * indirect;.
8061
8062 The optional second word limits the specification to ordinary
8063 structs (ord:) or generic structs (gen:). Generic structs are a
8064 bit complicated to explain. For C++, these are non-explicit
8065 specializations of template classes, or non-template classes within
8066 the above. Other programming languages have generics, but
8067 -femit-struct-debug-detailed does not yet implement them.
8068
8069 The third word specifies the source files for those structs for
8070 which the compiler should emit debug information. The values none
8071 and any have the normal meaning. The value base means that the
8072 base of name of the file in which the type declaration appears must
8073 match the base of the name of the main compilation file. In
8074 practice, this means that when compiling foo.c, debug information
8075 is generated for types declared in that file and foo.h, but not
8076 other header files. The value sys means those types satisfying
8077 base or declared in system or compiler headers.
8078
8079 You may need to experiment to determine the best settings for your
8080 application.
8081
8082 The default is -femit-struct-debug-detailed=all.
8083
8084 This option works only with DWARF debug output.
8085
8086 -fno-dwarf2-cfi-asm
8087 Emit DWARF unwind info as compiler generated ".eh_frame" section
8088 instead of using GAS ".cfi_*" directives.
8089
8090 -fno-eliminate-unused-debug-types
8091 Normally, when producing DWARF output, GCC avoids producing debug
8092 symbol output for types that are nowhere used in the source file
8093 being compiled. Sometimes it is useful to have GCC emit debugging
8094 information for all types declared in a compilation unit,
8095 regardless of whether or not they are actually used in that
8096 compilation unit, for example if, in the debugger, you want to cast
8097 a value to a type that is not actually used in your program (but is
8098 declared). More often, however, this results in a significant
8099 amount of wasted space.
8100
8101 Options That Control Optimization
8102 These options control various sorts of optimizations.
8103
8104 Without any optimization option, the compiler's goal is to reduce the
8105 cost of compilation and to make debugging produce the expected results.
8106 Statements are independent: if you stop the program with a breakpoint
8107 between statements, you can then assign a new value to any variable or
8108 change the program counter to any other statement in the function and
8109 get exactly the results you expect from the source code.
8110
8111 Turning on optimization flags makes the compiler attempt to improve the
8112 performance and/or code size at the expense of compilation time and
8113 possibly the ability to debug the program.
8114
8115 The compiler performs optimization based on the knowledge it has of the
8116 program. Compiling multiple files at once to a single output file mode
8117 allows the compiler to use information gained from all of the files
8118 when compiling each of them.
8119
8120 Not all optimizations are controlled directly by a flag. Only
8121 optimizations that have a flag are listed in this section.
8122
8123 Most optimizations are completely disabled at -O0 or if an -O level is
8124 not set on the command line, even if individual optimization flags are
8125 specified. Similarly, -Og suppresses many optimization passes.
8126
8127 Depending on the target and how GCC was configured, a slightly
8128 different set of optimizations may be enabled at each -O level than
8129 those listed here. You can invoke GCC with -Q --help=optimizers to
8130 find out the exact set of optimizations that are enabled at each level.
8131
8132 -O
8133 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8134 lot more memory for a large function.
8135
8136 With -O, the compiler tries to reduce code size and execution time,
8137 without performing any optimizations that take a great deal of
8138 compilation time.
8139
8140 -O turns on the following optimization flags:
8141
8142 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8143 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8144 -fdse -fforward-propagate -fguess-branch-probability
8145 -fif-conversion -fif-conversion2 -finline-functions-called-once
8146 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8147 -fipa-reference-addressable -fmerge-constants
8148 -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks
8149 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types
8150 -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch
8151 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
8152 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
8153 -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr
8154 -ftree-sra -ftree-ter -funit-at-a-time
8155
8156 -O2 Optimize even more. GCC performs nearly all supported
8157 optimizations that do not involve a space-speed tradeoff. As
8158 compared to -O, this option increases both compilation time and the
8159 performance of the generated code.
8160
8161 -O2 turns on all optimization flags specified by -O. It also turns
8162 on the following optimization flags:
8163
8164 -falign-functions -falign-jumps -falign-labels -falign-loops
8165 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8166 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8167 -fdevirtualize-speculatively -fexpensive-optimizations
8168 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8169 -finline-functions -finline-small-functions -findirect-inlining
8170 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8171 -fisolate-erroneous-paths-dereference -flra-remat
8172 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8173 -fpeephole2 -freorder-blocks-algorithm=stc
8174 -freorder-blocks-and-partition -freorder-functions
8175 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8176 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8177 -fthread-jumps -ftree-builtin-call-dce -ftree-pre
8178 -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
8179
8180 Please note the warning under -fgcse about invoking -O2 on programs
8181 that use computed gotos.
8182
8183 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8184 and also turns on the following optimization flags:
8185
8186 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8187 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8188 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8189 -ftree-loop-vectorize -ftree-partial-pre -ftree-slp-vectorize
8190 -funswitch-loops -fvect-cost-model -fvect-cost-model=dynamic
8191 -fversion-loops-for-strides
8192
8193 -O0 Reduce compilation time and make debugging produce the expected
8194 results. This is the default.
8195
8196 -Os Optimize for size. -Os enables all -O2 optimizations except those
8197 that often increase code size:
8198
8199 -falign-functions -falign-jumps -falign-labels -falign-loops
8200 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8201
8202 It also enables -finline-functions, causes the compiler to tune for
8203 code size rather than execution speed, and performs further
8204 optimizations designed to reduce code size.
8205
8206 -Ofast
8207 Disregard strict standards compliance. -Ofast enables all -O3
8208 optimizations. It also enables optimizations that are not valid
8209 for all standard-compliant programs. It turns on -ffast-math,
8210 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8211 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8212
8213 -Og Optimize debugging experience. -Og should be the optimization
8214 level of choice for the standard edit-compile-debug cycle, offering
8215 a reasonable level of optimization while maintaining fast
8216 compilation and a good debugging experience. It is a better choice
8217 than -O0 for producing debuggable code because some compiler passes
8218 that collect debug information are disabled at -O0.
8219
8220 Like -O0, -Og completely disables a number of optimization passes
8221 so that individual options controlling them have no effect.
8222 Otherwise -Og enables all -O1 optimization flags except for those
8223 that may interfere with debugging:
8224
8225 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8226 -fif-conversion2 -finline-functions-called-once
8227 -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-dse
8228 -ftree-pta -ftree-sra
8229
8230 If you use multiple -O options, with or without level numbers, the last
8231 such option is the one that is effective.
8232
8233 Options of the form -fflag specify machine-independent flags. Most
8234 flags have both positive and negative forms; the negative form of -ffoo
8235 is -fno-foo. In the table below, only one of the forms is listed---the
8236 one you typically use. You can figure out the other form by either
8237 removing no- or adding it.
8238
8239 The following options control specific optimizations. They are either
8240 activated by -O options or are related to ones that are. You can use
8241 the following flags in the rare cases when "fine-tuning" of
8242 optimizations to be performed is desired.
8243
8244 -fno-defer-pop
8245 For machines that must pop arguments after a function call, always
8246 pop the arguments as soon as each function returns. At levels -O1
8247 and higher, -fdefer-pop is the default; this allows the compiler to
8248 let arguments accumulate on the stack for several function calls
8249 and pop them all at once.
8250
8251 -fforward-propagate
8252 Perform a forward propagation pass on RTL. The pass tries to
8253 combine two instructions and checks if the result can be
8254 simplified. If loop unrolling is active, two passes are performed
8255 and the second is scheduled after loop unrolling.
8256
8257 This option is enabled by default at optimization levels -O, -O2,
8258 -O3, -Os.
8259
8260 -ffp-contract=style
8261 -ffp-contract=off disables floating-point expression contraction.
8262 -ffp-contract=fast enables floating-point expression contraction
8263 such as forming of fused multiply-add operations if the target has
8264 native support for them. -ffp-contract=on enables floating-point
8265 expression contraction if allowed by the language standard. This
8266 is currently not implemented and treated equal to
8267 -ffp-contract=off.
8268
8269 The default is -ffp-contract=fast.
8270
8271 -fomit-frame-pointer
8272 Omit the frame pointer in functions that don't need one. This
8273 avoids the instructions to save, set up and restore the frame
8274 pointer; on many targets it also makes an extra register available.
8275
8276 On some targets this flag has no effect because the standard
8277 calling sequence always uses a frame pointer, so it cannot be
8278 omitted.
8279
8280 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8281 pointer is used in all functions. Several targets always omit the
8282 frame pointer in leaf functions.
8283
8284 Enabled by default at -O and higher.
8285
8286 -foptimize-sibling-calls
8287 Optimize sibling and tail recursive calls.
8288
8289 Enabled at levels -O2, -O3, -Os.
8290
8291 -foptimize-strlen
8292 Optimize various standard C string functions (e.g. "strlen",
8293 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8294 faster alternatives.
8295
8296 Enabled at levels -O2, -O3.
8297
8298 -fno-inline
8299 Do not expand any functions inline apart from those marked with the
8300 "always_inline" attribute. This is the default when not
8301 optimizing.
8302
8303 Single functions can be exempted from inlining by marking them with
8304 the "noinline" attribute.
8305
8306 -finline-small-functions
8307 Integrate functions into their callers when their body is smaller
8308 than expected function call code (so overall size of program gets
8309 smaller). The compiler heuristically decides which functions are
8310 simple enough to be worth integrating in this way. This inlining
8311 applies to all functions, even those not declared inline.
8312
8313 Enabled at levels -O2, -O3, -Os.
8314
8315 -findirect-inlining
8316 Inline also indirect calls that are discovered to be known at
8317 compile time thanks to previous inlining. This option has any
8318 effect only when inlining itself is turned on by the
8319 -finline-functions or -finline-small-functions options.
8320
8321 Enabled at levels -O2, -O3, -Os.
8322
8323 -finline-functions
8324 Consider all functions for inlining, even if they are not declared
8325 inline. The compiler heuristically decides which functions are
8326 worth integrating in this way.
8327
8328 If all calls to a given function are integrated, and the function
8329 is declared "static", then the function is normally not output as
8330 assembler code in its own right.
8331
8332 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8333 -fauto-profile.
8334
8335 -finline-functions-called-once
8336 Consider all "static" functions called once for inlining into their
8337 caller even if they are not marked "inline". If a call to a given
8338 function is integrated, then the function is not output as
8339 assembler code in its own right.
8340
8341 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8342
8343 -fearly-inlining
8344 Inline functions marked by "always_inline" and functions whose body
8345 seems smaller than the function call overhead early before doing
8346 -fprofile-generate instrumentation and real inlining pass. Doing
8347 so makes profiling significantly cheaper and usually inlining
8348 faster on programs having large chains of nested wrapper functions.
8349
8350 Enabled by default.
8351
8352 -fipa-sra
8353 Perform interprocedural scalar replacement of aggregates, removal
8354 of unused parameters and replacement of parameters passed by
8355 reference by parameters passed by value.
8356
8357 Enabled at levels -O2, -O3 and -Os.
8358
8359 -finline-limit=n
8360 By default, GCC limits the size of functions that can be inlined.
8361 This flag allows coarse control of this limit. n is the size of
8362 functions that can be inlined in number of pseudo instructions.
8363
8364 Inlining is actually controlled by a number of parameters, which
8365 may be specified individually by using --param name=value. The
8366 -finline-limit=n option sets some of these parameters as follows:
8367
8368 max-inline-insns-single
8369 is set to n/2.
8370
8371 max-inline-insns-auto
8372 is set to n/2.
8373
8374 See below for a documentation of the individual parameters
8375 controlling inlining and for the defaults of these parameters.
8376
8377 Note: there may be no value to -finline-limit that results in
8378 default behavior.
8379
8380 Note: pseudo instruction represents, in this particular context, an
8381 abstract measurement of function's size. In no way does it
8382 represent a count of assembly instructions and as such its exact
8383 meaning might change from one release to an another.
8384
8385 -fno-keep-inline-dllexport
8386 This is a more fine-grained version of -fkeep-inline-functions,
8387 which applies only to functions that are declared using the
8388 "dllexport" attribute or declspec.
8389
8390 -fkeep-inline-functions
8391 In C, emit "static" functions that are declared "inline" into the
8392 object file, even if the function has been inlined into all of its
8393 callers. This switch does not affect functions using the "extern
8394 inline" extension in GNU C90. In C++, emit any and all inline
8395 functions into the object file.
8396
8397 -fkeep-static-functions
8398 Emit "static" functions into the object file, even if the function
8399 is never used.
8400
8401 -fkeep-static-consts
8402 Emit variables declared "static const" when optimization isn't
8403 turned on, even if the variables aren't referenced.
8404
8405 GCC enables this option by default. If you want to force the
8406 compiler to check if a variable is referenced, regardless of
8407 whether or not optimization is turned on, use the
8408 -fno-keep-static-consts option.
8409
8410 -fmerge-constants
8411 Attempt to merge identical constants (string constants and
8412 floating-point constants) across compilation units.
8413
8414 This option is the default for optimized compilation if the
8415 assembler and linker support it. Use -fno-merge-constants to
8416 inhibit this behavior.
8417
8418 Enabled at levels -O, -O2, -O3, -Os.
8419
8420 -fmerge-all-constants
8421 Attempt to merge identical constants and identical variables.
8422
8423 This option implies -fmerge-constants. In addition to
8424 -fmerge-constants this considers e.g. even constant initialized
8425 arrays or initialized constant variables with integral or floating-
8426 point types. Languages like C or C++ require each variable,
8427 including multiple instances of the same variable in recursive
8428 calls, to have distinct locations, so using this option results in
8429 non-conforming behavior.
8430
8431 -fmodulo-sched
8432 Perform swing modulo scheduling immediately before the first
8433 scheduling pass. This pass looks at innermost loops and reorders
8434 their instructions by overlapping different iterations.
8435
8436 -fmodulo-sched-allow-regmoves
8437 Perform more aggressive SMS-based modulo scheduling with register
8438 moves allowed. By setting this flag certain anti-dependences edges
8439 are deleted, which triggers the generation of reg-moves based on
8440 the life-range analysis. This option is effective only with
8441 -fmodulo-sched enabled.
8442
8443 -fno-branch-count-reg
8444 Disable the optimization pass that scans for opportunities to use
8445 "decrement and branch" instructions on a count register instead of
8446 instruction sequences that decrement a register, compare it against
8447 zero, and then branch based upon the result. This option is only
8448 meaningful on architectures that support such instructions, which
8449 include x86, PowerPC, IA-64 and S/390. Note that the
8450 -fno-branch-count-reg option doesn't remove the decrement and
8451 branch instructions from the generated instruction stream
8452 introduced by other optimization passes.
8453
8454 The default is -fbranch-count-reg at -O1 and higher, except for
8455 -Og.
8456
8457 -fno-function-cse
8458 Do not put function addresses in registers; make each instruction
8459 that calls a constant function contain the function's address
8460 explicitly.
8461
8462 This option results in less efficient code, but some strange hacks
8463 that alter the assembler output may be confused by the
8464 optimizations performed when this option is not used.
8465
8466 The default is -ffunction-cse
8467
8468 -fno-zero-initialized-in-bss
8469 If the target supports a BSS section, GCC by default puts variables
8470 that are initialized to zero into BSS. This can save space in the
8471 resulting code.
8472
8473 This option turns off this behavior because some programs
8474 explicitly rely on variables going to the data section---e.g., so
8475 that the resulting executable can find the beginning of that
8476 section and/or make assumptions based on that.
8477
8478 The default is -fzero-initialized-in-bss.
8479
8480 -fthread-jumps
8481 Perform optimizations that check to see if a jump branches to a
8482 location where another comparison subsumed by the first is found.
8483 If so, the first branch is redirected to either the destination of
8484 the second branch or a point immediately following it, depending on
8485 whether the condition is known to be true or false.
8486
8487 Enabled at levels -O2, -O3, -Os.
8488
8489 -fsplit-wide-types
8490 When using a type that occupies multiple registers, such as "long
8491 long" on a 32-bit system, split the registers apart and allocate
8492 them independently. This normally generates better code for those
8493 types, but may make debugging more difficult.
8494
8495 Enabled at levels -O, -O2, -O3, -Os.
8496
8497 -fsplit-wide-types-early
8498 Fully split wide types early, instead of very late. This option
8499 has no effect unless -fsplit-wide-types is turned on.
8500
8501 This is the default on some targets.
8502
8503 -fcse-follow-jumps
8504 In common subexpression elimination (CSE), scan through jump
8505 instructions when the target of the jump is not reached by any
8506 other path. For example, when CSE encounters an "if" statement
8507 with an "else" clause, CSE follows the jump when the condition
8508 tested is false.
8509
8510 Enabled at levels -O2, -O3, -Os.
8511
8512 -fcse-skip-blocks
8513 This is similar to -fcse-follow-jumps, but causes CSE to follow
8514 jumps that conditionally skip over blocks. When CSE encounters a
8515 simple "if" statement with no else clause, -fcse-skip-blocks causes
8516 CSE to follow the jump around the body of the "if".
8517
8518 Enabled at levels -O2, -O3, -Os.
8519
8520 -frerun-cse-after-loop
8521 Re-run common subexpression elimination after loop optimizations
8522 are performed.
8523
8524 Enabled at levels -O2, -O3, -Os.
8525
8526 -fgcse
8527 Perform a global common subexpression elimination pass. This pass
8528 also performs global constant and copy propagation.
8529
8530 Note: When compiling a program using computed gotos, a GCC
8531 extension, you may get better run-time performance if you disable
8532 the global common subexpression elimination pass by adding
8533 -fno-gcse to the command line.
8534
8535 Enabled at levels -O2, -O3, -Os.
8536
8537 -fgcse-lm
8538 When -fgcse-lm is enabled, global common subexpression elimination
8539 attempts to move loads that are only killed by stores into
8540 themselves. This allows a loop containing a load/store sequence to
8541 be changed to a load outside the loop, and a copy/store within the
8542 loop.
8543
8544 Enabled by default when -fgcse is enabled.
8545
8546 -fgcse-sm
8547 When -fgcse-sm is enabled, a store motion pass is run after global
8548 common subexpression elimination. This pass attempts to move
8549 stores out of loops. When used in conjunction with -fgcse-lm,
8550 loops containing a load/store sequence can be changed to a load
8551 before the loop and a store after the loop.
8552
8553 Not enabled at any optimization level.
8554
8555 -fgcse-las
8556 When -fgcse-las is enabled, the global common subexpression
8557 elimination pass eliminates redundant loads that come after stores
8558 to the same memory location (both partial and full redundancies).
8559
8560 Not enabled at any optimization level.
8561
8562 -fgcse-after-reload
8563 When -fgcse-after-reload is enabled, a redundant load elimination
8564 pass is performed after reload. The purpose of this pass is to
8565 clean up redundant spilling.
8566
8567 Enabled by -fprofile-use and -fauto-profile.
8568
8569 -faggressive-loop-optimizations
8570 This option tells the loop optimizer to use language constraints to
8571 derive bounds for the number of iterations of a loop. This assumes
8572 that loop code does not invoke undefined behavior by for example
8573 causing signed integer overflows or out-of-bound array accesses.
8574 The bounds for the number of iterations of a loop are used to guide
8575 loop unrolling and peeling and loop exit test optimizations. This
8576 option is enabled by default.
8577
8578 -funconstrained-commons
8579 This option tells the compiler that variables declared in common
8580 blocks (e.g. Fortran) may later be overridden with longer trailing
8581 arrays. This prevents certain optimizations that depend on knowing
8582 the array bounds.
8583
8584 -fcrossjumping
8585 Perform cross-jumping transformation. This transformation unifies
8586 equivalent code and saves code size. The resulting code may or may
8587 not perform better than without cross-jumping.
8588
8589 Enabled at levels -O2, -O3, -Os.
8590
8591 -fauto-inc-dec
8592 Combine increments or decrements of addresses with memory accesses.
8593 This pass is always skipped on architectures that do not have
8594 instructions to support this. Enabled by default at -O and higher
8595 on architectures that support this.
8596
8597 -fdce
8598 Perform dead code elimination (DCE) on RTL. Enabled by default at
8599 -O and higher.
8600
8601 -fdse
8602 Perform dead store elimination (DSE) on RTL. Enabled by default at
8603 -O and higher.
8604
8605 -fif-conversion
8606 Attempt to transform conditional jumps into branch-less
8607 equivalents. This includes use of conditional moves, min, max, set
8608 flags and abs instructions, and some tricks doable by standard
8609 arithmetics. The use of conditional execution on chips where it is
8610 available is controlled by -fif-conversion2.
8611
8612 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8613
8614 -fif-conversion2
8615 Use conditional execution (where available) to transform
8616 conditional jumps into branch-less equivalents.
8617
8618 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8619
8620 -fdeclone-ctor-dtor
8621 The C++ ABI requires multiple entry points for constructors and
8622 destructors: one for a base subobject, one for a complete object,
8623 and one for a virtual destructor that calls operator delete
8624 afterwards. For a hierarchy with virtual bases, the base and
8625 complete variants are clones, which means two copies of the
8626 function. With this option, the base and complete variants are
8627 changed to be thunks that call a common implementation.
8628
8629 Enabled by -Os.
8630
8631 -fdelete-null-pointer-checks
8632 Assume that programs cannot safely dereference null pointers, and
8633 that no code or data element resides at address zero. This option
8634 enables simple constant folding optimizations at all optimization
8635 levels. In addition, other optimization passes in GCC use this
8636 flag to control global dataflow analyses that eliminate useless
8637 checks for null pointers; these assume that a memory access to
8638 address zero always results in a trap, so that if a pointer is
8639 checked after it has already been dereferenced, it cannot be null.
8640
8641 Note however that in some environments this assumption is not true.
8642 Use -fno-delete-null-pointer-checks to disable this optimization
8643 for programs that depend on that behavior.
8644
8645 This option is enabled by default on most targets. On Nios II ELF,
8646 it defaults to off. On AVR, CR16, and MSP430, this option is
8647 completely disabled.
8648
8649 Passes that use the dataflow information are enabled independently
8650 at different optimization levels.
8651
8652 -fdevirtualize
8653 Attempt to convert calls to virtual functions to direct calls.
8654 This is done both within a procedure and interprocedurally as part
8655 of indirect inlining (-findirect-inlining) and interprocedural
8656 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
8657
8658 -fdevirtualize-speculatively
8659 Attempt to convert calls to virtual functions to speculative direct
8660 calls. Based on the analysis of the type inheritance graph,
8661 determine for a given call the set of likely targets. If the set is
8662 small, preferably of size 1, change the call into a conditional
8663 deciding between direct and indirect calls. The speculative calls
8664 enable more optimizations, such as inlining. When they seem
8665 useless after further optimization, they are converted back into
8666 original form.
8667
8668 -fdevirtualize-at-ltrans
8669 Stream extra information needed for aggressive devirtualization
8670 when running the link-time optimizer in local transformation mode.
8671 This option enables more devirtualization but significantly
8672 increases the size of streamed data. For this reason it is disabled
8673 by default.
8674
8675 -fexpensive-optimizations
8676 Perform a number of minor optimizations that are relatively
8677 expensive.
8678
8679 Enabled at levels -O2, -O3, -Os.
8680
8681 -free
8682 Attempt to remove redundant extension instructions. This is
8683 especially helpful for the x86-64 architecture, which implicitly
8684 zero-extends in 64-bit registers after writing to their lower
8685 32-bit half.
8686
8687 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
8688
8689 -fno-lifetime-dse
8690 In C++ the value of an object is only affected by changes within
8691 its lifetime: when the constructor begins, the object has an
8692 indeterminate value, and any changes during the lifetime of the
8693 object are dead when the object is destroyed. Normally dead store
8694 elimination will take advantage of this; if your code relies on the
8695 value of the object storage persisting beyond the lifetime of the
8696 object, you can use this flag to disable this optimization. To
8697 preserve stores before the constructor starts (e.g. because your
8698 operator new clears the object storage) but still treat the object
8699 as dead after the destructor, you can use -flifetime-dse=1. The
8700 default behavior can be explicitly selected with -flifetime-dse=2.
8701 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
8702
8703 -flive-range-shrinkage
8704 Attempt to decrease register pressure through register live range
8705 shrinkage. This is helpful for fast processors with small or
8706 moderate size register sets.
8707
8708 -fira-algorithm=algorithm
8709 Use the specified coloring algorithm for the integrated register
8710 allocator. The algorithm argument can be priority, which specifies
8711 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
8712 coloring. Chaitin-Briggs coloring is not implemented for all
8713 architectures, but for those targets that do support it, it is the
8714 default because it generates better code.
8715
8716 -fira-region=region
8717 Use specified regions for the integrated register allocator. The
8718 region argument should be one of the following:
8719
8720 all Use all loops as register allocation regions. This can give
8721 the best results for machines with a small and/or irregular
8722 register set.
8723
8724 mixed
8725 Use all loops except for loops with small register pressure as
8726 the regions. This value usually gives the best results in most
8727 cases and for most architectures, and is enabled by default
8728 when compiling with optimization for speed (-O, -O2, ...).
8729
8730 one Use all functions as a single region. This typically results
8731 in the smallest code size, and is enabled by default for -Os or
8732 -O0.
8733
8734 -fira-hoist-pressure
8735 Use IRA to evaluate register pressure in the code hoisting pass for
8736 decisions to hoist expressions. This option usually results in
8737 smaller code, but it can slow the compiler down.
8738
8739 This option is enabled at level -Os for all targets.
8740
8741 -fira-loop-pressure
8742 Use IRA to evaluate register pressure in loops for decisions to
8743 move loop invariants. This option usually results in generation of
8744 faster and smaller code on machines with large register files (>=
8745 32 registers), but it can slow the compiler down.
8746
8747 This option is enabled at level -O3 for some targets.
8748
8749 -fno-ira-share-save-slots
8750 Disable sharing of stack slots used for saving call-used hard
8751 registers living through a call. Each hard register gets a
8752 separate stack slot, and as a result function stack frames are
8753 larger.
8754
8755 -fno-ira-share-spill-slots
8756 Disable sharing of stack slots allocated for pseudo-registers.
8757 Each pseudo-register that does not get a hard register gets a
8758 separate stack slot, and as a result function stack frames are
8759 larger.
8760
8761 -flra-remat
8762 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8763 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8764 values if it is profitable.
8765
8766 Enabled at levels -O2, -O3, -Os.
8767
8768 -fdelayed-branch
8769 If supported for the target machine, attempt to reorder
8770 instructions to exploit instruction slots available after delayed
8771 branch instructions.
8772
8773 Enabled at levels -O, -O2, -O3, -Os, but not at -Og.
8774
8775 -fschedule-insns
8776 If supported for the target machine, attempt to reorder
8777 instructions to eliminate execution stalls due to required data
8778 being unavailable. This helps machines that have slow floating
8779 point or memory load instructions by allowing other instructions to
8780 be issued until the result of the load or floating-point
8781 instruction is required.
8782
8783 Enabled at levels -O2, -O3.
8784
8785 -fschedule-insns2
8786 Similar to -fschedule-insns, but requests an additional pass of
8787 instruction scheduling after register allocation has been done.
8788 This is especially useful on machines with a relatively small
8789 number of registers and where memory load instructions take more
8790 than one cycle.
8791
8792 Enabled at levels -O2, -O3, -Os.
8793
8794 -fno-sched-interblock
8795 Disable instruction scheduling across basic blocks, which is
8796 normally enabled when scheduling before register allocation, i.e.
8797 with -fschedule-insns or at -O2 or higher.
8798
8799 -fno-sched-spec
8800 Disable speculative motion of non-load instructions, which is
8801 normally enabled when scheduling before register allocation, i.e.
8802 with -fschedule-insns or at -O2 or higher.
8803
8804 -fsched-pressure
8805 Enable register pressure sensitive insn scheduling before register
8806 allocation. This only makes sense when scheduling before register
8807 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
8808 higher. Usage of this option can improve the generated code and
8809 decrease its size by preventing register pressure increase above
8810 the number of available hard registers and subsequent spills in
8811 register allocation.
8812
8813 -fsched-spec-load
8814 Allow speculative motion of some load instructions. This only
8815 makes sense when scheduling before register allocation, i.e. with
8816 -fschedule-insns or at -O2 or higher.
8817
8818 -fsched-spec-load-dangerous
8819 Allow speculative motion of more load instructions. This only
8820 makes sense when scheduling before register allocation, i.e. with
8821 -fschedule-insns or at -O2 or higher.
8822
8823 -fsched-stalled-insns
8824 -fsched-stalled-insns=n
8825 Define how many insns (if any) can be moved prematurely from the
8826 queue of stalled insns into the ready list during the second
8827 scheduling pass. -fno-sched-stalled-insns means that no insns are
8828 moved prematurely, -fsched-stalled-insns=0 means there is no limit
8829 on how many queued insns can be moved prematurely.
8830 -fsched-stalled-insns without a value is equivalent to
8831 -fsched-stalled-insns=1.
8832
8833 -fsched-stalled-insns-dep
8834 -fsched-stalled-insns-dep=n
8835 Define how many insn groups (cycles) are examined for a dependency
8836 on a stalled insn that is a candidate for premature removal from
8837 the queue of stalled insns. This has an effect only during the
8838 second scheduling pass, and only if -fsched-stalled-insns is used.
8839 -fno-sched-stalled-insns-dep is equivalent to
8840 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
8841 value is equivalent to -fsched-stalled-insns-dep=1.
8842
8843 -fsched2-use-superblocks
8844 When scheduling after register allocation, use superblock
8845 scheduling. This allows motion across basic block boundaries,
8846 resulting in faster schedules. This option is experimental, as not
8847 all machine descriptions used by GCC model the CPU closely enough
8848 to avoid unreliable results from the algorithm.
8849
8850 This only makes sense when scheduling after register allocation,
8851 i.e. with -fschedule-insns2 or at -O2 or higher.
8852
8853 -fsched-group-heuristic
8854 Enable the group heuristic in the scheduler. This heuristic favors
8855 the instruction that belongs to a schedule group. This is enabled
8856 by default when scheduling is enabled, i.e. with -fschedule-insns
8857 or -fschedule-insns2 or at -O2 or higher.
8858
8859 -fsched-critical-path-heuristic
8860 Enable the critical-path heuristic in the scheduler. This
8861 heuristic favors instructions on the critical path. This is
8862 enabled by default when scheduling is enabled, i.e. with
8863 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
8864
8865 -fsched-spec-insn-heuristic
8866 Enable the speculative instruction heuristic in the scheduler.
8867 This heuristic favors speculative instructions with greater
8868 dependency weakness. This is enabled by default when scheduling is
8869 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8870 or higher.
8871
8872 -fsched-rank-heuristic
8873 Enable the rank heuristic in the scheduler. This heuristic favors
8874 the instruction belonging to a basic block with greater size or
8875 frequency. This is enabled by default when scheduling is enabled,
8876 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
8877 higher.
8878
8879 -fsched-last-insn-heuristic
8880 Enable the last-instruction heuristic in the scheduler. This
8881 heuristic favors the instruction that is less dependent on the last
8882 instruction scheduled. This is enabled by default when scheduling
8883 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
8884 -O2 or higher.
8885
8886 -fsched-dep-count-heuristic
8887 Enable the dependent-count heuristic in the scheduler. This
8888 heuristic favors the instruction that has more instructions
8889 depending on it. This is enabled by default when scheduling is
8890 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8891 or higher.
8892
8893 -freschedule-modulo-scheduled-loops
8894 Modulo scheduling is performed before traditional scheduling. If a
8895 loop is modulo scheduled, later scheduling passes may change its
8896 schedule. Use this option to control that behavior.
8897
8898 -fselective-scheduling
8899 Schedule instructions using selective scheduling algorithm.
8900 Selective scheduling runs instead of the first scheduler pass.
8901
8902 -fselective-scheduling2
8903 Schedule instructions using selective scheduling algorithm.
8904 Selective scheduling runs instead of the second scheduler pass.
8905
8906 -fsel-sched-pipelining
8907 Enable software pipelining of innermost loops during selective
8908 scheduling. This option has no effect unless one of
8909 -fselective-scheduling or -fselective-scheduling2 is turned on.
8910
8911 -fsel-sched-pipelining-outer-loops
8912 When pipelining loops during selective scheduling, also pipeline
8913 outer loops. This option has no effect unless
8914 -fsel-sched-pipelining is turned on.
8915
8916 -fsemantic-interposition
8917 Some object formats, like ELF, allow interposing of symbols by the
8918 dynamic linker. This means that for symbols exported from the DSO,
8919 the compiler cannot perform interprocedural propagation, inlining
8920 and other optimizations in anticipation that the function or
8921 variable in question may change. While this feature is useful, for
8922 example, to rewrite memory allocation functions by a debugging
8923 implementation, it is expensive in the terms of code quality. With
8924 -fno-semantic-interposition the compiler assumes that if
8925 interposition happens for functions the overwriting function will
8926 have precisely the same semantics (and side effects). Similarly if
8927 interposition happens for variables, the constructor of the
8928 variable will be the same. The flag has no effect for functions
8929 explicitly declared inline (where it is never allowed for
8930 interposition to change semantics) and for symbols explicitly
8931 declared weak.
8932
8933 -fshrink-wrap
8934 Emit function prologues only before parts of the function that need
8935 it, rather than at the top of the function. This flag is enabled
8936 by default at -O and higher.
8937
8938 -fshrink-wrap-separate
8939 Shrink-wrap separate parts of the prologue and epilogue separately,
8940 so that those parts are only executed when needed. This option is
8941 on by default, but has no effect unless -fshrink-wrap is also
8942 turned on and the target supports this.
8943
8944 -fcaller-saves
8945 Enable allocation of values to registers that are clobbered by
8946 function calls, by emitting extra instructions to save and restore
8947 the registers around such calls. Such allocation is done only when
8948 it seems to result in better code.
8949
8950 This option is always enabled by default on certain machines,
8951 usually those which have no call-preserved registers to use
8952 instead.
8953
8954 Enabled at levels -O2, -O3, -Os.
8955
8956 -fcombine-stack-adjustments
8957 Tracks stack adjustments (pushes and pops) and stack memory
8958 references and then tries to find ways to combine them.
8959
8960 Enabled by default at -O1 and higher.
8961
8962 -fipa-ra
8963 Use caller save registers for allocation if those registers are not
8964 used by any called function. In that case it is not necessary to
8965 save and restore them around calls. This is only possible if
8966 called functions are part of same compilation unit as current
8967 function and they are compiled before it.
8968
8969 Enabled at levels -O2, -O3, -Os, however the option is disabled if
8970 generated code will be instrumented for profiling (-p, or -pg) or
8971 if callee's register usage cannot be known exactly (this happens on
8972 targets that do not expose prologues and epilogues in RTL).
8973
8974 -fconserve-stack
8975 Attempt to minimize stack usage. The compiler attempts to use less
8976 stack space, even if that makes the program slower. This option
8977 implies setting the large-stack-frame parameter to 100 and the
8978 large-stack-frame-growth parameter to 400.
8979
8980 -ftree-reassoc
8981 Perform reassociation on trees. This flag is enabled by default at
8982 -O and higher.
8983
8984 -fcode-hoisting
8985 Perform code hoisting. Code hoisting tries to move the evaluation
8986 of expressions executed on all paths to the function exit as early
8987 as possible. This is especially useful as a code size
8988 optimization, but it often helps for code speed as well. This flag
8989 is enabled by default at -O2 and higher.
8990
8991 -ftree-pre
8992 Perform partial redundancy elimination (PRE) on trees. This flag
8993 is enabled by default at -O2 and -O3.
8994
8995 -ftree-partial-pre
8996 Make partial redundancy elimination (PRE) more aggressive. This
8997 flag is enabled by default at -O3.
8998
8999 -ftree-forwprop
9000 Perform forward propagation on trees. This flag is enabled by
9001 default at -O and higher.
9002
9003 -ftree-fre
9004 Perform full redundancy elimination (FRE) on trees. The difference
9005 between FRE and PRE is that FRE only considers expressions that are
9006 computed on all paths leading to the redundant computation. This
9007 analysis is faster than PRE, though it exposes fewer redundancies.
9008 This flag is enabled by default at -O and higher.
9009
9010 -ftree-phiprop
9011 Perform hoisting of loads from conditional pointers on trees. This
9012 pass is enabled by default at -O and higher.
9013
9014 -fhoist-adjacent-loads
9015 Speculatively hoist loads from both branches of an if-then-else if
9016 the loads are from adjacent locations in the same structure and the
9017 target architecture has a conditional move instruction. This flag
9018 is enabled by default at -O2 and higher.
9019
9020 -ftree-copy-prop
9021 Perform copy propagation on trees. This pass eliminates
9022 unnecessary copy operations. This flag is enabled by default at -O
9023 and higher.
9024
9025 -fipa-pure-const
9026 Discover which functions are pure or constant. Enabled by default
9027 at -O and higher.
9028
9029 -fipa-reference
9030 Discover which static variables do not escape the compilation unit.
9031 Enabled by default at -O and higher.
9032
9033 -fipa-reference-addressable
9034 Discover read-only, write-only and non-addressable static
9035 variables. Enabled by default at -O and higher.
9036
9037 -fipa-stack-alignment
9038 Reduce stack alignment on call sites if possible. Enabled by
9039 default.
9040
9041 -fipa-pta
9042 Perform interprocedural pointer analysis and interprocedural
9043 modification and reference analysis. This option can cause
9044 excessive memory and compile-time usage on large compilation units.
9045 It is not enabled by default at any optimization level.
9046
9047 -fipa-profile
9048 Perform interprocedural profile propagation. The functions called
9049 only from cold functions are marked as cold. Also functions
9050 executed once (such as "cold", "noreturn", static constructors or
9051 destructors) are identified. Cold functions and loop less parts of
9052 functions executed once are then optimized for size. Enabled by
9053 default at -O and higher.
9054
9055 -fipa-modref
9056 Perform interprocedural mod/ref analysis. This optimization
9057 analyzes the side effects of functions (memory locations that are
9058 modified or referenced) and enables better optimization across the
9059 function call boundary. This flag is enabled by default at -O and
9060 higher.
9061
9062 -fipa-cp
9063 Perform interprocedural constant propagation. This optimization
9064 analyzes the program to determine when values passed to functions
9065 are constants and then optimizes accordingly. This optimization
9066 can substantially increase performance if the application has
9067 constants passed to functions. This flag is enabled by default at
9068 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9069 -fauto-profile.
9070
9071 -fipa-cp-clone
9072 Perform function cloning to make interprocedural constant
9073 propagation stronger. When enabled, interprocedural constant
9074 propagation performs function cloning when externally visible
9075 function can be called with constant arguments. Because this
9076 optimization can create multiple copies of functions, it may
9077 significantly increase code size (see --param
9078 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9079 It is also enabled by -fprofile-use and -fauto-profile.
9080
9081 -fipa-bit-cp
9082 When enabled, perform interprocedural bitwise constant propagation.
9083 This flag is enabled by default at -O2 and by -fprofile-use and
9084 -fauto-profile. It requires that -fipa-cp is enabled.
9085
9086 -fipa-vrp
9087 When enabled, perform interprocedural propagation of value ranges.
9088 This flag is enabled by default at -O2. It requires that -fipa-cp
9089 is enabled.
9090
9091 -fipa-icf
9092 Perform Identical Code Folding for functions and read-only
9093 variables. The optimization reduces code size and may disturb
9094 unwind stacks by replacing a function by equivalent one with a
9095 different name. The optimization works more effectively with link-
9096 time optimization enabled.
9097
9098 Although the behavior is similar to the Gold Linker's ICF
9099 optimization, GCC ICF works on different levels and thus the
9100 optimizations are not same - there are equivalences that are found
9101 only by GCC and equivalences found only by Gold.
9102
9103 This flag is enabled by default at -O2 and -Os.
9104
9105 -flive-patching=level
9106 Control GCC's optimizations to produce output suitable for live-
9107 patching.
9108
9109 If the compiler's optimization uses a function's body or
9110 information extracted from its body to optimize/change another
9111 function, the latter is called an impacted function of the former.
9112 If a function is patched, its impacted functions should be patched
9113 too.
9114
9115 The impacted functions are determined by the compiler's
9116 interprocedural optimizations. For example, a caller is impacted
9117 when inlining a function into its caller, cloning a function and
9118 changing its caller to call this new clone, or extracting a
9119 function's pureness/constness information to optimize its direct or
9120 indirect callers, etc.
9121
9122 Usually, the more IPA optimizations enabled, the larger the number
9123 of impacted functions for each function. In order to control the
9124 number of impacted functions and more easily compute the list of
9125 impacted function, IPA optimizations can be partially enabled at
9126 two different levels.
9127
9128 The level argument should be one of the following:
9129
9130 inline-clone
9131 Only enable inlining and cloning optimizations, which includes
9132 inlining, cloning, interprocedural scalar replacement of
9133 aggregates and partial inlining. As a result, when patching a
9134 function, all its callers and its clones' callers are impacted,
9135 therefore need to be patched as well.
9136
9137 -flive-patching=inline-clone disables the following
9138 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9139 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9140 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9141 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9142
9143 inline-only-static
9144 Only enable inlining of static functions. As a result, when
9145 patching a static function, all its callers are impacted and so
9146 need to be patched as well.
9147
9148 In addition to all the flags that -flive-patching=inline-clone
9149 disables, -flive-patching=inline-only-static disables the
9150 following additional optimization flags: -fipa-cp-clone
9151 -fipa-sra -fpartial-inlining -fipa-cp
9152
9153 When -flive-patching is specified without any value, the default
9154 value is inline-clone.
9155
9156 This flag is disabled by default.
9157
9158 Note that -flive-patching is not supported with link-time
9159 optimization (-flto).
9160
9161 -fisolate-erroneous-paths-dereference
9162 Detect paths that trigger erroneous or undefined behavior due to
9163 dereferencing a null pointer. Isolate those paths from the main
9164 control flow and turn the statement with erroneous or undefined
9165 behavior into a trap. This flag is enabled by default at -O2 and
9166 higher and depends on -fdelete-null-pointer-checks also being
9167 enabled.
9168
9169 -fisolate-erroneous-paths-attribute
9170 Detect paths that trigger erroneous or undefined behavior due to a
9171 null value being used in a way forbidden by a "returns_nonnull" or
9172 "nonnull" attribute. Isolate those paths from the main control
9173 flow and turn the statement with erroneous or undefined behavior
9174 into a trap. This is not currently enabled, but may be enabled by
9175 -O2 in the future.
9176
9177 -ftree-sink
9178 Perform forward store motion on trees. This flag is enabled by
9179 default at -O and higher.
9180
9181 -ftree-bit-ccp
9182 Perform sparse conditional bit constant propagation on trees and
9183 propagate pointer alignment information. This pass only operates
9184 on local scalar variables and is enabled by default at -O1 and
9185 higher, except for -Og. It requires that -ftree-ccp is enabled.
9186
9187 -ftree-ccp
9188 Perform sparse conditional constant propagation (CCP) on trees.
9189 This pass only operates on local scalar variables and is enabled by
9190 default at -O and higher.
9191
9192 -fssa-backprop
9193 Propagate information about uses of a value up the definition chain
9194 in order to simplify the definitions. For example, this pass
9195 strips sign operations if the sign of a value never matters. The
9196 flag is enabled by default at -O and higher.
9197
9198 -fssa-phiopt
9199 Perform pattern matching on SSA PHI nodes to optimize conditional
9200 code. This pass is enabled by default at -O1 and higher, except
9201 for -Og.
9202
9203 -ftree-switch-conversion
9204 Perform conversion of simple initializations in a switch to
9205 initializations from a scalar array. This flag is enabled by
9206 default at -O2 and higher.
9207
9208 -ftree-tail-merge
9209 Look for identical code sequences. When found, replace one with a
9210 jump to the other. This optimization is known as tail merging or
9211 cross jumping. This flag is enabled by default at -O2 and higher.
9212 The compilation time in this pass can be limited using max-tail-
9213 merge-comparisons parameter and max-tail-merge-iterations
9214 parameter.
9215
9216 -ftree-dce
9217 Perform dead code elimination (DCE) on trees. This flag is enabled
9218 by default at -O and higher.
9219
9220 -ftree-builtin-call-dce
9221 Perform conditional dead code elimination (DCE) for calls to built-
9222 in functions that may set "errno" but are otherwise free of side
9223 effects. This flag is enabled by default at -O2 and higher if -Os
9224 is not also specified.
9225
9226 -ffinite-loops
9227 Assume that a loop with an exit will eventually take the exit and
9228 not loop indefinitely. This allows the compiler to remove loops
9229 that otherwise have no side-effects, not considering eventual
9230 endless looping as such.
9231
9232 This option is enabled by default at -O2 for C++ with -std=c++11 or
9233 higher.
9234
9235 -ftree-dominator-opts
9236 Perform a variety of simple scalar cleanups (constant/copy
9237 propagation, redundancy elimination, range propagation and
9238 expression simplification) based on a dominator tree traversal.
9239 This also performs jump threading (to reduce jumps to jumps). This
9240 flag is enabled by default at -O and higher.
9241
9242 -ftree-dse
9243 Perform dead store elimination (DSE) on trees. A dead store is a
9244 store into a memory location that is later overwritten by another
9245 store without any intervening loads. In this case the earlier
9246 store can be deleted. This flag is enabled by default at -O and
9247 higher.
9248
9249 -ftree-ch
9250 Perform loop header copying on trees. This is beneficial since it
9251 increases effectiveness of code motion optimizations. It also
9252 saves one jump. This flag is enabled by default at -O and higher.
9253 It is not enabled for -Os, since it usually increases code size.
9254
9255 -ftree-loop-optimize
9256 Perform loop optimizations on trees. This flag is enabled by
9257 default at -O and higher.
9258
9259 -ftree-loop-linear
9260 -floop-strip-mine
9261 -floop-block
9262 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9263 use this code transformation, GCC has to be configured with
9264 --with-isl to enable the Graphite loop transformation
9265 infrastructure.
9266
9267 -fgraphite-identity
9268 Enable the identity transformation for graphite. For every SCoP we
9269 generate the polyhedral representation and transform it back to
9270 gimple. Using -fgraphite-identity we can check the costs or
9271 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9272 minimal optimizations are also performed by the code generator isl,
9273 like index splitting and dead code elimination in loops.
9274
9275 -floop-nest-optimize
9276 Enable the isl based loop nest optimizer. This is a generic loop
9277 nest optimizer based on the Pluto optimization algorithms. It
9278 calculates a loop structure optimized for data-locality and
9279 parallelism. This option is experimental.
9280
9281 -floop-parallelize-all
9282 Use the Graphite data dependence analysis to identify loops that
9283 can be parallelized. Parallelize all the loops that can be
9284 analyzed to not contain loop carried dependences without checking
9285 that it is profitable to parallelize the loops.
9286
9287 -ftree-coalesce-vars
9288 While transforming the program out of the SSA representation,
9289 attempt to reduce copying by coalescing versions of different user-
9290 defined variables, instead of just compiler temporaries. This may
9291 severely limit the ability to debug an optimized program compiled
9292 with -fno-var-tracking-assignments. In the negated form, this flag
9293 prevents SSA coalescing of user variables. This option is enabled
9294 by default if optimization is enabled, and it does very little
9295 otherwise.
9296
9297 -ftree-loop-if-convert
9298 Attempt to transform conditional jumps in the innermost loops to
9299 branch-less equivalents. The intent is to remove control-flow from
9300 the innermost loops in order to improve the ability of the
9301 vectorization pass to handle these loops. This is enabled by
9302 default if vectorization is enabled.
9303
9304 -ftree-loop-distribution
9305 Perform loop distribution. This flag can improve cache performance
9306 on big loop bodies and allow further loop optimizations, like
9307 parallelization or vectorization, to take place. For example, the
9308 loop
9309
9310 DO I = 1, N
9311 A(I) = B(I) + C
9312 D(I) = E(I) * F
9313 ENDDO
9314
9315 is transformed to
9316
9317 DO I = 1, N
9318 A(I) = B(I) + C
9319 ENDDO
9320 DO I = 1, N
9321 D(I) = E(I) * F
9322 ENDDO
9323
9324 This flag is enabled by default at -O3. It is also enabled by
9325 -fprofile-use and -fauto-profile.
9326
9327 -ftree-loop-distribute-patterns
9328 Perform loop distribution of patterns that can be code generated
9329 with calls to a library. This flag is enabled by default at -O2
9330 and higher, and by -fprofile-use and -fauto-profile.
9331
9332 This pass distributes the initialization loops and generates a call
9333 to memset zero. For example, the loop
9334
9335 DO I = 1, N
9336 A(I) = 0
9337 B(I) = A(I) + I
9338 ENDDO
9339
9340 is transformed to
9341
9342 DO I = 1, N
9343 A(I) = 0
9344 ENDDO
9345 DO I = 1, N
9346 B(I) = A(I) + I
9347 ENDDO
9348
9349 and the initialization loop is transformed into a call to memset
9350 zero. This flag is enabled by default at -O3. It is also enabled
9351 by -fprofile-use and -fauto-profile.
9352
9353 -floop-interchange
9354 Perform loop interchange outside of graphite. This flag can
9355 improve cache performance on loop nest and allow further loop
9356 optimizations, like vectorization, to take place. For example, the
9357 loop
9358
9359 for (int i = 0; i < N; i++)
9360 for (int j = 0; j < N; j++)
9361 for (int k = 0; k < N; k++)
9362 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9363
9364 is transformed to
9365
9366 for (int i = 0; i < N; i++)
9367 for (int k = 0; k < N; k++)
9368 for (int j = 0; j < N; j++)
9369 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9370
9371 This flag is enabled by default at -O3. It is also enabled by
9372 -fprofile-use and -fauto-profile.
9373
9374 -floop-unroll-and-jam
9375 Apply unroll and jam transformations on feasible loops. In a loop
9376 nest this unrolls the outer loop by some factor and fuses the
9377 resulting multiple inner loops. This flag is enabled by default at
9378 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9379
9380 -ftree-loop-im
9381 Perform loop invariant motion on trees. This pass moves only
9382 invariants that are hard to handle at RTL level (function calls,
9383 operations that expand to nontrivial sequences of insns). With
9384 -funswitch-loops it also moves operands of conditions that are
9385 invariant out of the loop, so that we can use just trivial
9386 invariantness analysis in loop unswitching. The pass also includes
9387 store motion.
9388
9389 -ftree-loop-ivcanon
9390 Create a canonical counter for number of iterations in loops for
9391 which determining number of iterations requires complicated
9392 analysis. Later optimizations then may determine the number
9393 easily. Useful especially in connection with unrolling.
9394
9395 -ftree-scev-cprop
9396 Perform final value replacement. If a variable is modified in a
9397 loop in such a way that its value when exiting the loop can be
9398 determined using only its initial value and the number of loop
9399 iterations, replace uses of the final value by such a computation,
9400 provided it is sufficiently cheap. This reduces data dependencies
9401 and may allow further simplifications. Enabled by default at -O
9402 and higher.
9403
9404 -fivopts
9405 Perform induction variable optimizations (strength reduction,
9406 induction variable merging and induction variable elimination) on
9407 trees.
9408
9409 -ftree-parallelize-loops=n
9410 Parallelize loops, i.e., split their iteration space to run in n
9411 threads. This is only possible for loops whose iterations are
9412 independent and can be arbitrarily reordered. The optimization is
9413 only profitable on multiprocessor machines, for loops that are CPU-
9414 intensive, rather than constrained e.g. by memory bandwidth. This
9415 option implies -pthread, and thus is only supported on targets that
9416 have support for -pthread.
9417
9418 -ftree-pta
9419 Perform function-local points-to analysis on trees. This flag is
9420 enabled by default at -O1 and higher, except for -Og.
9421
9422 -ftree-sra
9423 Perform scalar replacement of aggregates. This pass replaces
9424 structure references with scalars to prevent committing structures
9425 to memory too early. This flag is enabled by default at -O1 and
9426 higher, except for -Og.
9427
9428 -fstore-merging
9429 Perform merging of narrow stores to consecutive memory addresses.
9430 This pass merges contiguous stores of immediate values narrower
9431 than a word into fewer wider stores to reduce the number of
9432 instructions. This is enabled by default at -O2 and higher as well
9433 as -Os.
9434
9435 -ftree-ter
9436 Perform temporary expression replacement during the SSA->normal
9437 phase. Single use/single def temporaries are replaced at their use
9438 location with their defining expression. This results in non-
9439 GIMPLE code, but gives the expanders much more complex trees to
9440 work on resulting in better RTL generation. This is enabled by
9441 default at -O and higher.
9442
9443 -ftree-slsr
9444 Perform straight-line strength reduction on trees. This recognizes
9445 related expressions involving multiplications and replaces them by
9446 less expensive calculations when possible. This is enabled by
9447 default at -O and higher.
9448
9449 -ftree-vectorize
9450 Perform vectorization on trees. This flag enables
9451 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
9452 specified.
9453
9454 -ftree-loop-vectorize
9455 Perform loop vectorization on trees. This flag is enabled by
9456 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9457 -fauto-profile.
9458
9459 -ftree-slp-vectorize
9460 Perform basic block vectorization on trees. This flag is enabled by
9461 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9462 -fauto-profile.
9463
9464 -fvect-cost-model=model
9465 Alter the cost model used for vectorization. The model argument
9466 should be one of unlimited, dynamic, cheap or very-cheap. With the
9467 unlimited model the vectorized code-path is assumed to be
9468 profitable while with the dynamic model a runtime check guards the
9469 vectorized code-path to enable it only for iteration counts that
9470 will likely execute faster than when executing the original scalar
9471 loop. The cheap model disables vectorization of loops where doing
9472 so would be cost prohibitive for example due to required runtime
9473 checks for data dependence or alignment but otherwise is equal to
9474 the dynamic model. The very-cheap model only allows vectorization
9475 if the vector code would entirely replace the scalar code that is
9476 being vectorized. For example, if each iteration of a vectorized
9477 loop would only be able to handle exactly four iterations of the
9478 scalar loop, the very-cheap model would only allow vectorization if
9479 the scalar iteration count is known to be a multiple of four.
9480
9481 The default cost model depends on other optimization flags and is
9482 either dynamic or cheap.
9483
9484 -fsimd-cost-model=model
9485 Alter the cost model used for vectorization of loops marked with
9486 the OpenMP simd directive. The model argument should be one of
9487 unlimited, dynamic, cheap. All values of model have the same
9488 meaning as described in -fvect-cost-model and by default a cost
9489 model defined with -fvect-cost-model is used.
9490
9491 -ftree-vrp
9492 Perform Value Range Propagation on trees. This is similar to the
9493 constant propagation pass, but instead of values, ranges of values
9494 are propagated. This allows the optimizers to remove unnecessary
9495 range checks like array bound checks and null pointer checks. This
9496 is enabled by default at -O2 and higher. Null pointer check
9497 elimination is only done if -fdelete-null-pointer-checks is
9498 enabled.
9499
9500 -fsplit-paths
9501 Split paths leading to loop backedges. This can improve dead code
9502 elimination and common subexpression elimination. This is enabled
9503 by default at -O3 and above.
9504
9505 -fsplit-ivs-in-unroller
9506 Enables expression of values of induction variables in later
9507 iterations of the unrolled loop using the value in the first
9508 iteration. This breaks long dependency chains, thus improving
9509 efficiency of the scheduling passes.
9510
9511 A combination of -fweb and CSE is often sufficient to obtain the
9512 same effect. However, that is not reliable in cases where the loop
9513 body is more complicated than a single basic block. It also does
9514 not work at all on some architectures due to restrictions in the
9515 CSE pass.
9516
9517 This optimization is enabled by default.
9518
9519 -fvariable-expansion-in-unroller
9520 With this option, the compiler creates multiple copies of some
9521 local variables when unrolling a loop, which can result in superior
9522 code.
9523
9524 This optimization is enabled by default for PowerPC targets, but
9525 disabled by default otherwise.
9526
9527 -fpartial-inlining
9528 Inline parts of functions. This option has any effect only when
9529 inlining itself is turned on by the -finline-functions or
9530 -finline-small-functions options.
9531
9532 Enabled at levels -O2, -O3, -Os.
9533
9534 -fpredictive-commoning
9535 Perform predictive commoning optimization, i.e., reusing
9536 computations (especially memory loads and stores) performed in
9537 previous iterations of loops.
9538
9539 This option is enabled at level -O3. It is also enabled by
9540 -fprofile-use and -fauto-profile.
9541
9542 -fprefetch-loop-arrays
9543 If supported by the target machine, generate instructions to
9544 prefetch memory to improve the performance of loops that access
9545 large arrays.
9546
9547 This option may generate better or worse code; results are highly
9548 dependent on the structure of loops within the source code.
9549
9550 Disabled at level -Os.
9551
9552 -fno-printf-return-value
9553 Do not substitute constants for known return value of formatted
9554 output functions such as "sprintf", "snprintf", "vsprintf", and
9555 "vsnprintf" (but not "printf" of "fprintf"). This transformation
9556 allows GCC to optimize or even eliminate branches based on the
9557 known return value of these functions called with arguments that
9558 are either constant, or whose values are known to be in a range
9559 that makes determining the exact return value possible. For
9560 example, when -fprintf-return-value is in effect, both the branch
9561 and the body of the "if" statement (but not the call to "snprint")
9562 can be optimized away when "i" is a 32-bit or smaller integer
9563 because the return value is guaranteed to be at most 8.
9564
9565 char buf[9];
9566 if (snprintf (buf, "%08x", i) >= sizeof buf)
9567 ...
9568
9569 The -fprintf-return-value option relies on other optimizations and
9570 yields best results with -O2 and above. It works in tandem with
9571 the -Wformat-overflow and -Wformat-truncation options. The
9572 -fprintf-return-value option is enabled by default.
9573
9574 -fno-peephole
9575 -fno-peephole2
9576 Disable any machine-specific peephole optimizations. The
9577 difference between -fno-peephole and -fno-peephole2 is in how they
9578 are implemented in the compiler; some targets use one, some use the
9579 other, a few use both.
9580
9581 -fpeephole is enabled by default. -fpeephole2 enabled at levels
9582 -O2, -O3, -Os.
9583
9584 -fno-guess-branch-probability
9585 Do not guess branch probabilities using heuristics.
9586
9587 GCC uses heuristics to guess branch probabilities if they are not
9588 provided by profiling feedback (-fprofile-arcs). These heuristics
9589 are based on the control flow graph. If some branch probabilities
9590 are specified by "__builtin_expect", then the heuristics are used
9591 to guess branch probabilities for the rest of the control flow
9592 graph, taking the "__builtin_expect" info into account. The
9593 interactions between the heuristics and "__builtin_expect" can be
9594 complex, and in some cases, it may be useful to disable the
9595 heuristics so that the effects of "__builtin_expect" are easier to
9596 understand.
9597
9598 It is also possible to specify expected probability of the
9599 expression with "__builtin_expect_with_probability" built-in
9600 function.
9601
9602 The default is -fguess-branch-probability at levels -O, -O2, -O3,
9603 -Os.
9604
9605 -freorder-blocks
9606 Reorder basic blocks in the compiled function in order to reduce
9607 number of taken branches and improve code locality.
9608
9609 Enabled at levels -O, -O2, -O3, -Os.
9610
9611 -freorder-blocks-algorithm=algorithm
9612 Use the specified algorithm for basic block reordering. The
9613 algorithm argument can be simple, which does not increase code size
9614 (except sometimes due to secondary effects like alignment), or stc,
9615 the "software trace cache" algorithm, which tries to put all often
9616 executed code together, minimizing the number of branches executed
9617 by making extra copies of code.
9618
9619 The default is simple at levels -O, -Os, and stc at levels -O2,
9620 -O3.
9621
9622 -freorder-blocks-and-partition
9623 In addition to reordering basic blocks in the compiled function, in
9624 order to reduce number of taken branches, partitions hot and cold
9625 basic blocks into separate sections of the assembly and .o files,
9626 to improve paging and cache locality performance.
9627
9628 This optimization is automatically turned off in the presence of
9629 exception handling or unwind tables (on targets using
9630 setjump/longjump or target specific scheme), for linkonce sections,
9631 for functions with a user-defined section attribute and on any
9632 architecture that does not support named sections. When
9633 -fsplit-stack is used this option is not enabled by default (to
9634 avoid linker errors), but may be enabled explicitly (if using a
9635 working linker).
9636
9637 Enabled for x86 at levels -O2, -O3, -Os.
9638
9639 -freorder-functions
9640 Reorder functions in the object file in order to improve code
9641 locality. This is implemented by using special subsections
9642 ".text.hot" for most frequently executed functions and
9643 ".text.unlikely" for unlikely executed functions. Reordering is
9644 done by the linker so object file format must support named
9645 sections and linker must place them in a reasonable way.
9646
9647 This option isn't effective unless you either provide profile
9648 feedback (see -fprofile-arcs for details) or manually annotate
9649 functions with "hot" or "cold" attributes.
9650
9651 Enabled at levels -O2, -O3, -Os.
9652
9653 -fstrict-aliasing
9654 Allow the compiler to assume the strictest aliasing rules
9655 applicable to the language being compiled. For C (and C++), this
9656 activates optimizations based on the type of expressions. In
9657 particular, an object of one type is assumed never to reside at the
9658 same address as an object of a different type, unless the types are
9659 almost the same. For example, an "unsigned int" can alias an
9660 "int", but not a "void*" or a "double". A character type may alias
9661 any other type.
9662
9663 Pay special attention to code like this:
9664
9665 union a_union {
9666 int i;
9667 double d;
9668 };
9669
9670 int f() {
9671 union a_union t;
9672 t.d = 3.0;
9673 return t.i;
9674 }
9675
9676 The practice of reading from a different union member than the one
9677 most recently written to (called "type-punning") is common. Even
9678 with -fstrict-aliasing, type-punning is allowed, provided the
9679 memory is accessed through the union type. So, the code above
9680 works as expected. However, this code might not:
9681
9682 int f() {
9683 union a_union t;
9684 int* ip;
9685 t.d = 3.0;
9686 ip = &t.i;
9687 return *ip;
9688 }
9689
9690 Similarly, access by taking the address, casting the resulting
9691 pointer and dereferencing the result has undefined behavior, even
9692 if the cast uses a union type, e.g.:
9693
9694 int f() {
9695 double d = 3.0;
9696 return ((union a_union *) &d)->i;
9697 }
9698
9699 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
9700
9701 -falign-functions
9702 -falign-functions=n
9703 -falign-functions=n:m
9704 -falign-functions=n:m:n2
9705 -falign-functions=n:m:n2:m2
9706 Align the start of functions to the next power-of-two greater than
9707 or equal to n, skipping up to m-1 bytes. This ensures that at
9708 least the first m bytes of the function can be fetched by the CPU
9709 without crossing an n-byte alignment boundary.
9710
9711 If m is not specified, it defaults to n.
9712
9713 Examples: -falign-functions=32 aligns functions to the next 32-byte
9714 boundary, -falign-functions=24 aligns to the next 32-byte boundary
9715 only if this can be done by skipping 23 bytes or less,
9716 -falign-functions=32:7 aligns to the next 32-byte boundary only if
9717 this can be done by skipping 6 bytes or less.
9718
9719 The second pair of n2:m2 values allows you to specify a secondary
9720 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
9721 boundary if this can be done by skipping 6 bytes or less, otherwise
9722 aligns to the next 32-byte boundary if this can be done by skipping
9723 2 bytes or less. If m2 is not specified, it defaults to n2.
9724
9725 Some assemblers only support this flag when n is a power of two; in
9726 that case, it is rounded up.
9727
9728 -fno-align-functions and -falign-functions=1 are equivalent and
9729 mean that functions are not aligned.
9730
9731 If n is not specified or is zero, use a machine-dependent default.
9732 The maximum allowed n option value is 65536.
9733
9734 Enabled at levels -O2, -O3.
9735
9736 -flimit-function-alignment
9737 If this option is enabled, the compiler tries to avoid
9738 unnecessarily overaligning functions. It attempts to instruct the
9739 assembler to align by the amount specified by -falign-functions,
9740 but not to skip more bytes than the size of the function.
9741
9742 -falign-labels
9743 -falign-labels=n
9744 -falign-labels=n:m
9745 -falign-labels=n:m:n2
9746 -falign-labels=n:m:n2:m2
9747 Align all branch targets to a power-of-two boundary.
9748
9749 Parameters of this option are analogous to the -falign-functions
9750 option. -fno-align-labels and -falign-labels=1 are equivalent and
9751 mean that labels are not aligned.
9752
9753 If -falign-loops or -falign-jumps are applicable and are greater
9754 than this value, then their values are used instead.
9755
9756 If n is not specified or is zero, use a machine-dependent default
9757 which is very likely to be 1, meaning no alignment. The maximum
9758 allowed n option value is 65536.
9759
9760 Enabled at levels -O2, -O3.
9761
9762 -falign-loops
9763 -falign-loops=n
9764 -falign-loops=n:m
9765 -falign-loops=n:m:n2
9766 -falign-loops=n:m:n2:m2
9767 Align loops to a power-of-two boundary. If the loops are executed
9768 many times, this makes up for any execution of the dummy padding
9769 instructions.
9770
9771 If -falign-labels is greater than this value, then its value is
9772 used instead.
9773
9774 Parameters of this option are analogous to the -falign-functions
9775 option. -fno-align-loops and -falign-loops=1 are equivalent and
9776 mean that loops are not aligned. The maximum allowed n option
9777 value is 65536.
9778
9779 If n is not specified or is zero, use a machine-dependent default.
9780
9781 Enabled at levels -O2, -O3.
9782
9783 -falign-jumps
9784 -falign-jumps=n
9785 -falign-jumps=n:m
9786 -falign-jumps=n:m:n2
9787 -falign-jumps=n:m:n2:m2
9788 Align branch targets to a power-of-two boundary, for branch targets
9789 where the targets can only be reached by jumping. In this case, no
9790 dummy operations need be executed.
9791
9792 If -falign-labels is greater than this value, then its value is
9793 used instead.
9794
9795 Parameters of this option are analogous to the -falign-functions
9796 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
9797 mean that loops are not aligned.
9798
9799 If n is not specified or is zero, use a machine-dependent default.
9800 The maximum allowed n option value is 65536.
9801
9802 Enabled at levels -O2, -O3.
9803
9804 -fno-allocation-dce
9805 Do not remove unused C++ allocations in dead code elimination.
9806
9807 -fallow-store-data-races
9808 Allow the compiler to perform optimizations that may introduce new
9809 data races on stores, without proving that the variable cannot be
9810 concurrently accessed by other threads. Does not affect
9811 optimization of local data. It is safe to use this option if it is
9812 known that global data will not be accessed by multiple threads.
9813
9814 Examples of optimizations enabled by -fallow-store-data-races
9815 include hoisting or if-conversions that may cause a value that was
9816 already in memory to be re-written with that same value. Such re-
9817 writing is safe in a single threaded context but may be unsafe in a
9818 multi-threaded context. Note that on some processors, if-
9819 conversions may be required in order to enable vectorization.
9820
9821 Enabled at level -Ofast.
9822
9823 -funit-at-a-time
9824 This option is left for compatibility reasons. -funit-at-a-time has
9825 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
9826 and -fno-section-anchors.
9827
9828 Enabled by default.
9829
9830 -fno-toplevel-reorder
9831 Do not reorder top-level functions, variables, and "asm"
9832 statements. Output them in the same order that they appear in the
9833 input file. When this option is used, unreferenced static
9834 variables are not removed. This option is intended to support
9835 existing code that relies on a particular ordering. For new code,
9836 it is better to use attributes when possible.
9837
9838 -ftoplevel-reorder is the default at -O1 and higher, and also at
9839 -O0 if -fsection-anchors is explicitly requested. Additionally
9840 -fno-toplevel-reorder implies -fno-section-anchors.
9841
9842 -fweb
9843 Constructs webs as commonly used for register allocation purposes
9844 and assign each web individual pseudo register. This allows the
9845 register allocation pass to operate on pseudos directly, but also
9846 strengthens several other optimization passes, such as CSE, loop
9847 optimizer and trivial dead code remover. It can, however, make
9848 debugging impossible, since variables no longer stay in a "home
9849 register".
9850
9851 Enabled by default with -funroll-loops.
9852
9853 -fwhole-program
9854 Assume that the current compilation unit represents the whole
9855 program being compiled. All public functions and variables with
9856 the exception of "main" and those merged by attribute
9857 "externally_visible" become static functions and in effect are
9858 optimized more aggressively by interprocedural optimizers.
9859
9860 This option should not be used in combination with -flto. Instead
9861 relying on a linker plugin should provide safer and more precise
9862 information.
9863
9864 -flto[=n]
9865 This option runs the standard link-time optimizer. When invoked
9866 with source code, it generates GIMPLE (one of GCC's internal
9867 representations) and writes it to special ELF sections in the
9868 object file. When the object files are linked together, all the
9869 function bodies are read from these ELF sections and instantiated
9870 as if they had been part of the same translation unit.
9871
9872 To use the link-time optimizer, -flto and optimization options
9873 should be specified at compile time and during the final link. It
9874 is recommended that you compile all the files participating in the
9875 same link with the same options and also specify those options at
9876 link time. For example:
9877
9878 gcc -c -O2 -flto foo.c
9879 gcc -c -O2 -flto bar.c
9880 gcc -o myprog -flto -O2 foo.o bar.o
9881
9882 The first two invocations to GCC save a bytecode representation of
9883 GIMPLE into special ELF sections inside foo.o and bar.o. The final
9884 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
9885 the two files into a single internal image, and compiles the result
9886 as usual. Since both foo.o and bar.o are merged into a single
9887 image, this causes all the interprocedural analyses and
9888 optimizations in GCC to work across the two files as if they were a
9889 single one. This means, for example, that the inliner is able to
9890 inline functions in bar.o into functions in foo.o and vice-versa.
9891
9892 Another (simpler) way to enable link-time optimization is:
9893
9894 gcc -o myprog -flto -O2 foo.c bar.c
9895
9896 The above generates bytecode for foo.c and bar.c, merges them
9897 together into a single GIMPLE representation and optimizes them as
9898 usual to produce myprog.
9899
9900 The important thing to keep in mind is that to enable link-time
9901 optimizations you need to use the GCC driver to perform the link
9902 step. GCC automatically performs link-time optimization if any of
9903 the objects involved were compiled with the -flto command-line
9904 option. You can always override the automatic decision to do link-
9905 time optimization by passing -fno-lto to the link command.
9906
9907 To make whole program optimization effective, it is necessary to
9908 make certain whole program assumptions. The compiler needs to know
9909 what functions and variables can be accessed by libraries and
9910 runtime outside of the link-time optimized unit. When supported by
9911 the linker, the linker plugin (see -fuse-linker-plugin) passes
9912 information to the compiler about used and externally visible
9913 symbols. When the linker plugin is not available, -fwhole-program
9914 should be used to allow the compiler to make these assumptions,
9915 which leads to more aggressive optimization decisions.
9916
9917 When a file is compiled with -flto without -fuse-linker-plugin, the
9918 generated object file is larger than a regular object file because
9919 it contains GIMPLE bytecodes and the usual final code (see
9920 -ffat-lto-objects). This means that object files with LTO
9921 information can be linked as normal object files; if -fno-lto is
9922 passed to the linker, no interprocedural optimizations are applied.
9923 Note that when -fno-fat-lto-objects is enabled the compile stage is
9924 faster but you cannot perform a regular, non-LTO link on them.
9925
9926 When producing the final binary, GCC only applies link-time
9927 optimizations to those files that contain bytecode. Therefore, you
9928 can mix and match object files and libraries with GIMPLE bytecodes
9929 and final object code. GCC automatically selects which files to
9930 optimize in LTO mode and which files to link without further
9931 processing.
9932
9933 Generally, options specified at link time override those specified
9934 at compile time, although in some cases GCC attempts to infer link-
9935 time options from the settings used to compile the input files.
9936
9937 If you do not specify an optimization level option -O at link time,
9938 then GCC uses the highest optimization level used when compiling
9939 the object files. Note that it is generally ineffective to specify
9940 an optimization level option only at link time and not at compile
9941 time, for two reasons. First, compiling without optimization
9942 suppresses compiler passes that gather information needed for
9943 effective optimization at link time. Second, some early
9944 optimization passes can be performed only at compile time and not
9945 at link time.
9946
9947 There are some code generation flags preserved by GCC when
9948 generating bytecodes, as they need to be used during the final
9949 link. Currently, the following options and their settings are
9950 taken from the first object file that explicitly specifies them:
9951 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
9952 -m target flags.
9953
9954 The following options -fPIC, -fpic, -fpie and -fPIE are combined
9955 based on the following scheme:
9956
9957 B<-fPIC> + B<-fpic> = B<-fpic>
9958 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
9959 B<-fpic/-fPIC> + (no option) = (no option)
9960 B<-fPIC> + B<-fPIE> = B<-fPIE>
9961 B<-fpic> + B<-fPIE> = B<-fpie>
9962 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
9963
9964 Certain ABI-changing flags are required to match in all compilation
9965 units, and trying to override this at link time with a conflicting
9966 value is ignored. This includes options such as
9967 -freg-struct-return and -fpcc-struct-return.
9968
9969 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
9970 -fno-trapv or -fno-strict-aliasing are passed through to the link
9971 stage and merged conservatively for conflicting translation units.
9972 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
9973 precedence; and for example -ffp-contract=off takes precedence over
9974 -ffp-contract=fast. You can override them at link time.
9975
9976 Diagnostic options such as -Wstringop-overflow are passed through
9977 to the link stage and their setting matches that of the compile-
9978 step at function granularity. Note that this matters only for
9979 diagnostics emitted during optimization. Note that code transforms
9980 such as inlining can lead to warnings being enabled or disabled for
9981 regions if code not consistent with the setting at compile time.
9982
9983 When you need to pass options to the assembler via -Wa or
9984 -Xassembler make sure to either compile such translation units with
9985 -fno-lto or consistently use the same assembler options on all
9986 translation units. You can alternatively also specify assembler
9987 options at LTO link time.
9988
9989 To enable debug info generation you need to supply -g at compile
9990 time. If any of the input files at link time were built with debug
9991 info generation enabled the link will enable debug info generation
9992 as well. Any elaborate debug info settings like the dwarf level
9993 -gdwarf-5 need to be explicitly repeated at the linker command line
9994 and mixing different settings in different translation units is
9995 discouraged.
9996
9997 If LTO encounters objects with C linkage declared with incompatible
9998 types in separate translation units to be linked together
9999 (undefined behavior according to ISO C99 6.2.7), a non-fatal
10000 diagnostic may be issued. The behavior is still undefined at run
10001 time. Similar diagnostics may be raised for other languages.
10002
10003 Another feature of LTO is that it is possible to apply
10004 interprocedural optimizations on files written in different
10005 languages:
10006
10007 gcc -c -flto foo.c
10008 g++ -c -flto bar.cc
10009 gfortran -c -flto baz.f90
10010 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10011
10012 Notice that the final link is done with g++ to get the C++ runtime
10013 libraries and -lgfortran is added to get the Fortran runtime
10014 libraries. In general, when mixing languages in LTO mode, you
10015 should use the same link command options as when mixing languages
10016 in a regular (non-LTO) compilation.
10017
10018 If object files containing GIMPLE bytecode are stored in a library
10019 archive, say libfoo.a, it is possible to extract and use them in an
10020 LTO link if you are using a linker with plugin support. To create
10021 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10022 instead of ar and ranlib; to show the symbols of object files with
10023 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10024 ranlib and nm have been compiled with plugin support. At link
10025 time, use the flag -fuse-linker-plugin to ensure that the library
10026 participates in the LTO optimization process:
10027
10028 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10029
10030 With the linker plugin enabled, the linker extracts the needed
10031 GIMPLE files from libfoo.a and passes them on to the running GCC to
10032 make them part of the aggregated GIMPLE image to be optimized.
10033
10034 If you are not using a linker with plugin support and/or do not
10035 enable the linker plugin, then the objects inside libfoo.a are
10036 extracted and linked as usual, but they do not participate in the
10037 LTO optimization process. In order to make a static library
10038 suitable for both LTO optimization and usual linkage, compile its
10039 object files with -flto -ffat-lto-objects.
10040
10041 Link-time optimizations do not require the presence of the whole
10042 program to operate. If the program does not require any symbols to
10043 be exported, it is possible to combine -flto and -fwhole-program to
10044 allow the interprocedural optimizers to use more aggressive
10045 assumptions which may lead to improved optimization opportunities.
10046 Use of -fwhole-program is not needed when linker plugin is active
10047 (see -fuse-linker-plugin).
10048
10049 The current implementation of LTO makes no attempt to generate
10050 bytecode that is portable between different types of hosts. The
10051 bytecode files are versioned and there is a strict version check,
10052 so bytecode files generated in one version of GCC do not work with
10053 an older or newer version of GCC.
10054
10055 Link-time optimization does not work well with generation of
10056 debugging information on systems other than those using a
10057 combination of ELF and DWARF.
10058
10059 If you specify the optional n, the optimization and code generation
10060 done at link time is executed in parallel using n parallel jobs by
10061 utilizing an installed make program. The environment variable MAKE
10062 may be used to override the program used.
10063
10064 You can also specify -flto=jobserver to use GNU make's job server
10065 mode to determine the number of parallel jobs. This is useful when
10066 the Makefile calling GCC is already executing in parallel. You
10067 must prepend a + to the command recipe in the parent Makefile for
10068 this to work. This option likely only works if MAKE is GNU make.
10069 Even without the option value, GCC tries to automatically detect a
10070 running GNU make's job server.
10071
10072 Use -flto=auto to use GNU make's job server, if available, or
10073 otherwise fall back to autodetection of the number of CPU threads
10074 present in your system.
10075
10076 -flto-partition=alg
10077 Specify the partitioning algorithm used by the link-time optimizer.
10078 The value is either 1to1 to specify a partitioning mirroring the
10079 original source files or balanced to specify partitioning into
10080 equally sized chunks (whenever possible) or max to create new
10081 partition for every symbol where possible. Specifying none as an
10082 algorithm disables partitioning and streaming completely. The
10083 default value is balanced. While 1to1 can be used as an workaround
10084 for various code ordering issues, the max partitioning is intended
10085 for internal testing only. The value one specifies that exactly
10086 one partition should be used while the value none bypasses
10087 partitioning and executes the link-time optimization step directly
10088 from the WPA phase.
10089
10090 -flto-compression-level=n
10091 This option specifies the level of compression used for
10092 intermediate language written to LTO object files, and is only
10093 meaningful in conjunction with LTO mode (-flto). GCC currently
10094 supports two LTO compression algorithms. For zstd, valid values are
10095 0 (no compression) to 19 (maximum compression), while zlib supports
10096 values from 0 to 9. Values outside this range are clamped to
10097 either minimum or maximum of the supported values. If the option
10098 is not given, a default balanced compression setting is used.
10099
10100 -fuse-linker-plugin
10101 Enables the use of a linker plugin during link-time optimization.
10102 This option relies on plugin support in the linker, which is
10103 available in gold or in GNU ld 2.21 or newer.
10104
10105 This option enables the extraction of object files with GIMPLE
10106 bytecode out of library archives. This improves the quality of
10107 optimization by exposing more code to the link-time optimizer.
10108 This information specifies what symbols can be accessed externally
10109 (by non-LTO object or during dynamic linking). Resulting code
10110 quality improvements on binaries (and shared libraries that use
10111 hidden visibility) are similar to -fwhole-program. See -flto for a
10112 description of the effect of this flag and how to use it.
10113
10114 This option is enabled by default when LTO support in GCC is
10115 enabled and GCC was configured for use with a linker supporting
10116 plugins (GNU ld 2.21 or newer or gold).
10117
10118 -ffat-lto-objects
10119 Fat LTO objects are object files that contain both the intermediate
10120 language and the object code. This makes them usable for both LTO
10121 linking and normal linking. This option is effective only when
10122 compiling with -flto and is ignored at link time.
10123
10124 -fno-fat-lto-objects improves compilation time over plain LTO, but
10125 requires the complete toolchain to be aware of LTO. It requires a
10126 linker with linker plugin support for basic functionality.
10127 Additionally, nm, ar and ranlib need to support linker plugins to
10128 allow a full-featured build environment (capable of building static
10129 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10130 wrappers to pass the right options to these tools. With non fat LTO
10131 makefiles need to be modified to use them.
10132
10133 Note that modern binutils provide plugin auto-load mechanism.
10134 Installing the linker plugin into $libdir/bfd-plugins has the same
10135 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10136 ranlib).
10137
10138 The default is -fno-fat-lto-objects on targets with linker plugin
10139 support.
10140
10141 -fcompare-elim
10142 After register allocation and post-register allocation instruction
10143 splitting, identify arithmetic instructions that compute processor
10144 flags similar to a comparison operation based on that arithmetic.
10145 If possible, eliminate the explicit comparison operation.
10146
10147 This pass only applies to certain targets that cannot explicitly
10148 represent the comparison operation before register allocation is
10149 complete.
10150
10151 Enabled at levels -O, -O2, -O3, -Os.
10152
10153 -fcprop-registers
10154 After register allocation and post-register allocation instruction
10155 splitting, perform a copy-propagation pass to try to reduce
10156 scheduling dependencies and occasionally eliminate the copy.
10157
10158 Enabled at levels -O, -O2, -O3, -Os.
10159
10160 -fprofile-correction
10161 Profiles collected using an instrumented binary for multi-threaded
10162 programs may be inconsistent due to missed counter updates. When
10163 this option is specified, GCC uses heuristics to correct or smooth
10164 out such inconsistencies. By default, GCC emits an error message
10165 when an inconsistent profile is detected.
10166
10167 This option is enabled by -fauto-profile.
10168
10169 -fprofile-partial-training
10170 With "-fprofile-use" all portions of programs not executed during
10171 train run are optimized agressively for size rather than speed. In
10172 some cases it is not practical to train all possible hot paths in
10173 the program. (For example, program may contain functions specific
10174 for a given hardware and trianing may not cover all hardware
10175 configurations program is run on.) With
10176 "-fprofile-partial-training" profile feedback will be ignored for
10177 all functions not executed during the train run leading them to be
10178 optimized as if they were compiled without profile feedback. This
10179 leads to better performance when train run is not representative
10180 but also leads to significantly bigger code.
10181
10182 -fprofile-use
10183 -fprofile-use=path
10184 Enable profile feedback-directed optimizations, and the following
10185 optimizations, many of which are generally profitable only with
10186 profile feedback available:
10187
10188 -fbranch-probabilities -fprofile-values -funroll-loops
10189 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10190 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10191 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10192 -ftree-slp-vectorize -fvect-cost-model=dynamic
10193 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10194
10195 Before you can use this option, you must first generate profiling
10196 information.
10197
10198 By default, GCC emits an error message if the feedback profiles do
10199 not match the source code. This error can be turned into a warning
10200 by using -Wno-error=coverage-mismatch. Note this may result in
10201 poorly optimized code. Additionally, by default, GCC also emits a
10202 warning message if the feedback profiles do not exist (see
10203 -Wmissing-profile).
10204
10205 If path is specified, GCC looks at the path to find the profile
10206 feedback data files. See -fprofile-dir.
10207
10208 -fauto-profile
10209 -fauto-profile=path
10210 Enable sampling-based feedback-directed optimizations, and the
10211 following optimizations, many of which are generally profitable
10212 only with profile feedback available:
10213
10214 -fbranch-probabilities -fprofile-values -funroll-loops
10215 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10216 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10217 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10218 -ftree-slp-vectorize -fvect-cost-model=dynamic
10219 -ftree-loop-distribute-patterns -fprofile-correction
10220
10221 path is the name of a file containing AutoFDO profile information.
10222 If omitted, it defaults to fbdata.afdo in the current directory.
10223
10224 Producing an AutoFDO profile data file requires running your
10225 program with the perf utility on a supported GNU/Linux target
10226 system. For more information, see <https://perf.wiki.kernel.org/>.
10227
10228 E.g.
10229
10230 perf record -e br_inst_retired:near_taken -b -o perf.data \
10231 -- your_program
10232
10233 Then use the create_gcov tool to convert the raw profile data to a
10234 format that can be used by GCC. You must also supply the
10235 unstripped binary for your program to this tool. See
10236 <https://github.com/google/autofdo>.
10237
10238 E.g.
10239
10240 create_gcov --binary=your_program.unstripped --profile=perf.data \
10241 --gcov=profile.afdo
10242
10243 The following options control compiler behavior regarding floating-
10244 point arithmetic. These options trade off between speed and
10245 correctness. All must be specifically enabled.
10246
10247 -ffloat-store
10248 Do not store floating-point variables in registers, and inhibit
10249 other options that might change whether a floating-point value is
10250 taken from a register or memory.
10251
10252 This option prevents undesirable excess precision on machines such
10253 as the 68000 where the floating registers (of the 68881) keep more
10254 precision than a "double" is supposed to have. Similarly for the
10255 x86 architecture. For most programs, the excess precision does
10256 only good, but a few programs rely on the precise definition of
10257 IEEE floating point. Use -ffloat-store for such programs, after
10258 modifying them to store all pertinent intermediate computations
10259 into variables.
10260
10261 -fexcess-precision=style
10262 This option allows further control over excess precision on
10263 machines where floating-point operations occur in a format with
10264 more precision or range than the IEEE standard and interchange
10265 floating-point types. By default, -fexcess-precision=fast is in
10266 effect; this means that operations may be carried out in a wider
10267 precision than the types specified in the source if that would
10268 result in faster code, and it is unpredictable when rounding to the
10269 types specified in the source code takes place. When compiling C,
10270 if -fexcess-precision=standard is specified then excess precision
10271 follows the rules specified in ISO C99; in particular, both casts
10272 and assignments cause values to be rounded to their semantic types
10273 (whereas -ffloat-store only affects assignments). This option is
10274 enabled by default for C if a strict conformance option such as
10275 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10276 default regardless of whether a strict conformance option is used.
10277
10278 -fexcess-precision=standard is not implemented for languages other
10279 than C. On the x86, it has no effect if -mfpmath=sse or
10280 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10281 apply without excess precision, and in the latter, rounding is
10282 unpredictable.
10283
10284 -ffast-math
10285 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10286 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10287 -fcx-limited-range and -fexcess-precision=fast.
10288
10289 This option causes the preprocessor macro "__FAST_MATH__" to be
10290 defined.
10291
10292 This option is not turned on by any -O option besides -Ofast since
10293 it can result in incorrect output for programs that depend on an
10294 exact implementation of IEEE or ISO rules/specifications for math
10295 functions. It may, however, yield faster code for programs that do
10296 not require the guarantees of these specifications.
10297
10298 -fno-math-errno
10299 Do not set "errno" after calling math functions that are executed
10300 with a single instruction, e.g., "sqrt". A program that relies on
10301 IEEE exceptions for math error handling may want to use this flag
10302 for speed while maintaining IEEE arithmetic compatibility.
10303
10304 This option is not turned on by any -O option since it can result
10305 in incorrect output for programs that depend on an exact
10306 implementation of IEEE or ISO rules/specifications for math
10307 functions. It may, however, yield faster code for programs that do
10308 not require the guarantees of these specifications.
10309
10310 The default is -fmath-errno.
10311
10312 On Darwin systems, the math library never sets "errno". There is
10313 therefore no reason for the compiler to consider the possibility
10314 that it might, and -fno-math-errno is the default.
10315
10316 -funsafe-math-optimizations
10317 Allow optimizations for floating-point arithmetic that (a) assume
10318 that arguments and results are valid and (b) may violate IEEE or
10319 ANSI standards. When used at link time, it may include libraries
10320 or startup files that change the default FPU control word or other
10321 similar optimizations.
10322
10323 This option is not turned on by any -O option since it can result
10324 in incorrect output for programs that depend on an exact
10325 implementation of IEEE or ISO rules/specifications for math
10326 functions. It may, however, yield faster code for programs that do
10327 not require the guarantees of these specifications. Enables
10328 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10329 -freciprocal-math.
10330
10331 The default is -fno-unsafe-math-optimizations.
10332
10333 -fassociative-math
10334 Allow re-association of operands in series of floating-point
10335 operations. This violates the ISO C and C++ language standard by
10336 possibly changing computation result. NOTE: re-ordering may change
10337 the sign of zero as well as ignore NaNs and inhibit or create
10338 underflow or overflow (and thus cannot be used on code that relies
10339 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10340 floating-point comparisons and thus may not be used when ordered
10341 comparisons are required. This option requires that both
10342 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10343 it doesn't make much sense with -frounding-math. For Fortran the
10344 option is automatically enabled when both -fno-signed-zeros and
10345 -fno-trapping-math are in effect.
10346
10347 The default is -fno-associative-math.
10348
10349 -freciprocal-math
10350 Allow the reciprocal of a value to be used instead of dividing by
10351 the value if this enables optimizations. For example "x / y" can
10352 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10353 to common subexpression elimination. Note that this loses
10354 precision and increases the number of flops operating on the value.
10355
10356 The default is -fno-reciprocal-math.
10357
10358 -ffinite-math-only
10359 Allow optimizations for floating-point arithmetic that assume that
10360 arguments and results are not NaNs or +-Infs.
10361
10362 This option is not turned on by any -O option since it can result
10363 in incorrect output for programs that depend on an exact
10364 implementation of IEEE or ISO rules/specifications for math
10365 functions. It may, however, yield faster code for programs that do
10366 not require the guarantees of these specifications.
10367
10368 The default is -fno-finite-math-only.
10369
10370 -fno-signed-zeros
10371 Allow optimizations for floating-point arithmetic that ignore the
10372 signedness of zero. IEEE arithmetic specifies the behavior of
10373 distinct +0.0 and -0.0 values, which then prohibits simplification
10374 of expressions such as x+0.0 or 0.0*x (even with
10375 -ffinite-math-only). This option implies that the sign of a zero
10376 result isn't significant.
10377
10378 The default is -fsigned-zeros.
10379
10380 -fno-trapping-math
10381 Compile code assuming that floating-point operations cannot
10382 generate user-visible traps. These traps include division by zero,
10383 overflow, underflow, inexact result and invalid operation. This
10384 option requires that -fno-signaling-nans be in effect. Setting
10385 this option may allow faster code if one relies on "non-stop" IEEE
10386 arithmetic, for example.
10387
10388 This option should never be turned on by any -O option since it can
10389 result in incorrect output for programs that depend on an exact
10390 implementation of IEEE or ISO rules/specifications for math
10391 functions.
10392
10393 The default is -ftrapping-math.
10394
10395 -frounding-math
10396 Disable transformations and optimizations that assume default
10397 floating-point rounding behavior. This is round-to-zero for all
10398 floating point to integer conversions, and round-to-nearest for all
10399 other arithmetic truncations. This option should be specified for
10400 programs that change the FP rounding mode dynamically, or that may
10401 be executed with a non-default rounding mode. This option disables
10402 constant folding of floating-point expressions at compile time
10403 (which may be affected by rounding mode) and arithmetic
10404 transformations that are unsafe in the presence of sign-dependent
10405 rounding modes.
10406
10407 The default is -fno-rounding-math.
10408
10409 This option is experimental and does not currently guarantee to
10410 disable all GCC optimizations that are affected by rounding mode.
10411 Future versions of GCC may provide finer control of this setting
10412 using C99's "FENV_ACCESS" pragma. This command-line option will be
10413 used to specify the default state for "FENV_ACCESS".
10414
10415 -fsignaling-nans
10416 Compile code assuming that IEEE signaling NaNs may generate user-
10417 visible traps during floating-point operations. Setting this
10418 option disables optimizations that may change the number of
10419 exceptions visible with signaling NaNs. This option implies
10420 -ftrapping-math.
10421
10422 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
10423 defined.
10424
10425 The default is -fno-signaling-nans.
10426
10427 This option is experimental and does not currently guarantee to
10428 disable all GCC optimizations that affect signaling NaN behavior.
10429
10430 -fno-fp-int-builtin-inexact
10431 Do not allow the built-in functions "ceil", "floor", "round" and
10432 "trunc", and their "float" and "long double" variants, to generate
10433 code that raises the "inexact" floating-point exception for
10434 noninteger arguments. ISO C99 and C11 allow these functions to
10435 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
10436 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
10437 allow these functions to do so.
10438
10439 The default is -ffp-int-builtin-inexact, allowing the exception to
10440 be raised, unless C2X or a later C standard is selected. This
10441 option does nothing unless -ftrapping-math is in effect.
10442
10443 Even if -fno-fp-int-builtin-inexact is used, if the functions
10444 generate a call to a library function then the "inexact" exception
10445 may be raised if the library implementation does not follow TS
10446 18661.
10447
10448 -fsingle-precision-constant
10449 Treat floating-point constants as single precision instead of
10450 implicitly converting them to double-precision constants.
10451
10452 -fcx-limited-range
10453 When enabled, this option states that a range reduction step is not
10454 needed when performing complex division. Also, there is no
10455 checking whether the result of a complex multiplication or division
10456 is "NaN + I*NaN", with an attempt to rescue the situation in that
10457 case. The default is -fno-cx-limited-range, but is enabled by
10458 -ffast-math.
10459
10460 This option controls the default setting of the ISO C99
10461 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
10462 languages.
10463
10464 -fcx-fortran-rules
10465 Complex multiplication and division follow Fortran rules. Range
10466 reduction is done as part of complex division, but there is no
10467 checking whether the result of a complex multiplication or division
10468 is "NaN + I*NaN", with an attempt to rescue the situation in that
10469 case.
10470
10471 The default is -fno-cx-fortran-rules.
10472
10473 The following options control optimizations that may improve
10474 performance, but are not enabled by any -O options. This section
10475 includes experimental options that may produce broken code.
10476
10477 -fbranch-probabilities
10478 After running a program compiled with -fprofile-arcs, you can
10479 compile it a second time using -fbranch-probabilities, to improve
10480 optimizations based on the number of times each branch was taken.
10481 When a program compiled with -fprofile-arcs exits, it saves arc
10482 execution counts to a file called sourcename.gcda for each source
10483 file. The information in this data file is very dependent on the
10484 structure of the generated code, so you must use the same source
10485 code and the same optimization options for both compilations.
10486
10487 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
10488 JUMP_INSN and CALL_INSN. These can be used to improve
10489 optimization. Currently, they are only used in one place: in
10490 reorg.c, instead of guessing which path a branch is most likely to
10491 take, the REG_BR_PROB values are used to exactly determine which
10492 path is taken more often.
10493
10494 Enabled by -fprofile-use and -fauto-profile.
10495
10496 -fprofile-values
10497 If combined with -fprofile-arcs, it adds code so that some data
10498 about values of expressions in the program is gathered.
10499
10500 With -fbranch-probabilities, it reads back the data gathered from
10501 profiling values of expressions for usage in optimizations.
10502
10503 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
10504
10505 -fprofile-reorder-functions
10506 Function reordering based on profile instrumentation collects first
10507 time of execution of a function and orders these functions in
10508 ascending order.
10509
10510 Enabled with -fprofile-use.
10511
10512 -fvpt
10513 If combined with -fprofile-arcs, this option instructs the compiler
10514 to add code to gather information about values of expressions.
10515
10516 With -fbranch-probabilities, it reads back the data gathered and
10517 actually performs the optimizations based on them. Currently the
10518 optimizations include specialization of division operations using
10519 the knowledge about the value of the denominator.
10520
10521 Enabled with -fprofile-use and -fauto-profile.
10522
10523 -frename-registers
10524 Attempt to avoid false dependencies in scheduled code by making use
10525 of registers left over after register allocation. This
10526 optimization most benefits processors with lots of registers.
10527 Depending on the debug information format adopted by the target,
10528 however, it can make debugging impossible, since variables no
10529 longer stay in a "home register".
10530
10531 Enabled by default with -funroll-loops.
10532
10533 -fschedule-fusion
10534 Performs a target dependent pass over the instruction stream to
10535 schedule instructions of same type together because target machine
10536 can execute them more efficiently if they are adjacent to each
10537 other in the instruction flow.
10538
10539 Enabled at levels -O2, -O3, -Os.
10540
10541 -ftracer
10542 Perform tail duplication to enlarge superblock size. This
10543 transformation simplifies the control flow of the function allowing
10544 other optimizations to do a better job.
10545
10546 Enabled by -fprofile-use and -fauto-profile.
10547
10548 -funroll-loops
10549 Unroll loops whose number of iterations can be determined at
10550 compile time or upon entry to the loop. -funroll-loops implies
10551 -frerun-cse-after-loop, -fweb and -frename-registers. It also
10552 turns on complete loop peeling (i.e. complete removal of loops with
10553 a small constant number of iterations). This option makes code
10554 larger, and may or may not make it run faster.
10555
10556 Enabled by -fprofile-use and -fauto-profile.
10557
10558 -funroll-all-loops
10559 Unroll all loops, even if their number of iterations is uncertain
10560 when the loop is entered. This usually makes programs run more
10561 slowly. -funroll-all-loops implies the same options as
10562 -funroll-loops.
10563
10564 -fpeel-loops
10565 Peels loops for which there is enough information that they do not
10566 roll much (from profile feedback or static analysis). It also
10567 turns on complete loop peeling (i.e. complete removal of loops with
10568 small constant number of iterations).
10569
10570 Enabled by -O3, -fprofile-use, and -fauto-profile.
10571
10572 -fmove-loop-invariants
10573 Enables the loop invariant motion pass in the RTL loop optimizer.
10574 Enabled at level -O1 and higher, except for -Og.
10575
10576 -fsplit-loops
10577 Split a loop into two if it contains a condition that's always true
10578 for one side of the iteration space and false for the other.
10579
10580 Enabled by -fprofile-use and -fauto-profile.
10581
10582 -funswitch-loops
10583 Move branches with loop invariant conditions out of the loop, with
10584 duplicates of the loop on both branches (modified according to
10585 result of the condition).
10586
10587 Enabled by -fprofile-use and -fauto-profile.
10588
10589 -fversion-loops-for-strides
10590 If a loop iterates over an array with a variable stride, create
10591 another version of the loop that assumes the stride is always one.
10592 For example:
10593
10594 for (int i = 0; i < n; ++i)
10595 x[i * stride] = ...;
10596
10597 becomes:
10598
10599 if (stride == 1)
10600 for (int i = 0; i < n; ++i)
10601 x[i] = ...;
10602 else
10603 for (int i = 0; i < n; ++i)
10604 x[i * stride] = ...;
10605
10606 This is particularly useful for assumed-shape arrays in Fortran
10607 where (for example) it allows better vectorization assuming
10608 contiguous accesses. This flag is enabled by default at -O3. It
10609 is also enabled by -fprofile-use and -fauto-profile.
10610
10611 -ffunction-sections
10612 -fdata-sections
10613 Place each function or data item into its own section in the output
10614 file if the target supports arbitrary sections. The name of the
10615 function or the name of the data item determines the section's name
10616 in the output file.
10617
10618 Use these options on systems where the linker can perform
10619 optimizations to improve locality of reference in the instruction
10620 space. Most systems using the ELF object format have linkers with
10621 such optimizations. On AIX, the linker rearranges sections
10622 (CSECTs) based on the call graph. The performance impact varies.
10623
10624 Together with a linker garbage collection (linker --gc-sections
10625 option) these options may lead to smaller statically-linked
10626 executables (after stripping).
10627
10628 On ELF/DWARF systems these options do not degenerate the quality of
10629 the debug information. There could be issues with other object
10630 files/debug info formats.
10631
10632 Only use these options when there are significant benefits from
10633 doing so. When you specify these options, the assembler and linker
10634 create larger object and executable files and are also slower.
10635 These options affect code generation. They prevent optimizations
10636 by the compiler and assembler using relative locations inside a
10637 translation unit since the locations are unknown until link time.
10638 An example of such an optimization is relaxing calls to short call
10639 instructions.
10640
10641 -fstdarg-opt
10642 Optimize the prologue of variadic argument functions with respect
10643 to usage of those arguments.
10644
10645 -fsection-anchors
10646 Try to reduce the number of symbolic address calculations by using
10647 shared "anchor" symbols to address nearby objects. This
10648 transformation can help to reduce the number of GOT entries and GOT
10649 accesses on some targets.
10650
10651 For example, the implementation of the following function "foo":
10652
10653 static int a, b, c;
10654 int foo (void) { return a + b + c; }
10655
10656 usually calculates the addresses of all three variables, but if you
10657 compile it with -fsection-anchors, it accesses the variables from a
10658 common anchor point instead. The effect is similar to the
10659 following pseudocode (which isn't valid C):
10660
10661 int foo (void)
10662 {
10663 register int *xr = &x;
10664 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10665 }
10666
10667 Not all targets support this option.
10668
10669 -fzero-call-used-regs=choice
10670 Zero call-used registers at function return to increase program
10671 security by either mitigating Return-Oriented Programming (ROP)
10672 attacks or preventing information leakage through registers.
10673
10674 The possible values of choice are the same as for the
10675 "zero_call_used_regs" attribute. The default is skip.
10676
10677 You can control this behavior for a specific function by using the
10678 function attribute "zero_call_used_regs".
10679
10680 --param name=value
10681 In some places, GCC uses various constants to control the amount of
10682 optimization that is done. For example, GCC does not inline
10683 functions that contain more than a certain number of instructions.
10684 You can control some of these constants on the command line using
10685 the --param option.
10686
10687 The names of specific parameters, and the meaning of the values,
10688 are tied to the internals of the compiler, and are subject to
10689 change without notice in future releases.
10690
10691 In order to get minimal, maximal and default value of a parameter,
10692 one can use --help=param -Q options.
10693
10694 In each case, the value is an integer. The following choices of
10695 name are recognized for all targets:
10696
10697 predictable-branch-outcome
10698 When branch is predicted to be taken with probability lower
10699 than this threshold (in percent), then it is considered well
10700 predictable.
10701
10702 max-rtl-if-conversion-insns
10703 RTL if-conversion tries to remove conditional branches around a
10704 block and replace them with conditionally executed
10705 instructions. This parameter gives the maximum number of
10706 instructions in a block which should be considered for if-
10707 conversion. The compiler will also use other heuristics to
10708 decide whether if-conversion is likely to be profitable.
10709
10710 max-rtl-if-conversion-predictable-cost
10711 RTL if-conversion will try to remove conditional branches
10712 around a block and replace them with conditionally executed
10713 instructions. These parameters give the maximum permissible
10714 cost for the sequence that would be generated by if-conversion
10715 depending on whether the branch is statically determined to be
10716 predictable or not. The units for this parameter are the same
10717 as those for the GCC internal seq_cost metric. The compiler
10718 will try to provide a reasonable default for this parameter
10719 using the BRANCH_COST target macro.
10720
10721 max-crossjump-edges
10722 The maximum number of incoming edges to consider for cross-
10723 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
10724 number of edges incoming to each block. Increasing values mean
10725 more aggressive optimization, making the compilation time
10726 increase with probably small improvement in executable size.
10727
10728 min-crossjump-insns
10729 The minimum number of instructions that must be matched at the
10730 end of two blocks before cross-jumping is performed on them.
10731 This value is ignored in the case where all instructions in the
10732 block being cross-jumped from are matched.
10733
10734 max-grow-copy-bb-insns
10735 The maximum code size expansion factor when copying basic
10736 blocks instead of jumping. The expansion is relative to a jump
10737 instruction.
10738
10739 max-goto-duplication-insns
10740 The maximum number of instructions to duplicate to a block that
10741 jumps to a computed goto. To avoid O(N^2) behavior in a number
10742 of passes, GCC factors computed gotos early in the compilation
10743 process, and unfactors them as late as possible. Only computed
10744 jumps at the end of a basic blocks with no more than max-goto-
10745 duplication-insns are unfactored.
10746
10747 max-delay-slot-insn-search
10748 The maximum number of instructions to consider when looking for
10749 an instruction to fill a delay slot. If more than this
10750 arbitrary number of instructions are searched, the time savings
10751 from filling the delay slot are minimal, so stop searching.
10752 Increasing values mean more aggressive optimization, making the
10753 compilation time increase with probably small improvement in
10754 execution time.
10755
10756 max-delay-slot-live-search
10757 When trying to fill delay slots, the maximum number of
10758 instructions to consider when searching for a block with valid
10759 live register information. Increasing this arbitrarily chosen
10760 value means more aggressive optimization, increasing the
10761 compilation time. This parameter should be removed when the
10762 delay slot code is rewritten to maintain the control-flow
10763 graph.
10764
10765 max-gcse-memory
10766 The approximate maximum amount of memory in "kB" that can be
10767 allocated in order to perform the global common subexpression
10768 elimination optimization. If more memory than specified is
10769 required, the optimization is not done.
10770
10771 max-gcse-insertion-ratio
10772 If the ratio of expression insertions to deletions is larger
10773 than this value for any expression, then RTL PRE inserts or
10774 removes the expression and thus leaves partially redundant
10775 computations in the instruction stream.
10776
10777 max-pending-list-length
10778 The maximum number of pending dependencies scheduling allows
10779 before flushing the current state and starting over. Large
10780 functions with few branches or calls can create excessively
10781 large lists which needlessly consume memory and resources.
10782
10783 max-modulo-backtrack-attempts
10784 The maximum number of backtrack attempts the scheduler should
10785 make when modulo scheduling a loop. Larger values can
10786 exponentially increase compilation time.
10787
10788 max-inline-insns-single
10789 Several parameters control the tree inliner used in GCC. This
10790 number sets the maximum number of instructions (counted in
10791 GCC's internal representation) in a single function that the
10792 tree inliner considers for inlining. This only affects
10793 functions declared inline and methods implemented in a class
10794 declaration (C++).
10795
10796 max-inline-insns-auto
10797 When you use -finline-functions (included in -O3), a lot of
10798 functions that would otherwise not be considered for inlining
10799 by the compiler are investigated. To those functions, a
10800 different (more restrictive) limit compared to functions
10801 declared inline can be applied (--param max-inline-insns-auto).
10802
10803 max-inline-insns-small
10804 This is bound applied to calls which are considered relevant
10805 with -finline-small-functions.
10806
10807 max-inline-insns-size
10808 This is bound applied to calls which are optimized for size.
10809 Small growth may be desirable to anticipate optimization
10810 oppurtunities exposed by inlining.
10811
10812 uninlined-function-insns
10813 Number of instructions accounted by inliner for function
10814 overhead such as function prologue and epilogue.
10815
10816 uninlined-function-time
10817 Extra time accounted by inliner for function overhead such as
10818 time needed to execute function prologue and epilogue
10819
10820 inline-heuristics-hint-percent
10821 The scale (in percents) applied to inline-insns-single,
10822 inline-insns-single-O2, inline-insns-auto when inline
10823 heuristics hints that inlining is very profitable (will enable
10824 later optimizations).
10825
10826 uninlined-thunk-insns
10827 uninlined-thunk-time
10828 Same as --param uninlined-function-insns and --param uninlined-
10829 function-time but applied to function thunks
10830
10831 inline-min-speedup
10832 When estimated performance improvement of caller + callee
10833 runtime exceeds this threshold (in percent), the function can
10834 be inlined regardless of the limit on --param max-inline-insns-
10835 single and --param max-inline-insns-auto.
10836
10837 large-function-insns
10838 The limit specifying really large functions. For functions
10839 larger than this limit after inlining, inlining is constrained
10840 by --param large-function-growth. This parameter is useful
10841 primarily to avoid extreme compilation time caused by non-
10842 linear algorithms used by the back end.
10843
10844 large-function-growth
10845 Specifies maximal growth of large function caused by inlining
10846 in percents. For example, parameter value 100 limits large
10847 function growth to 2.0 times the original size.
10848
10849 large-unit-insns
10850 The limit specifying large translation unit. Growth caused by
10851 inlining of units larger than this limit is limited by --param
10852 inline-unit-growth. For small units this might be too tight.
10853 For example, consider a unit consisting of function A that is
10854 inline and B that just calls A three times. If B is small
10855 relative to A, the growth of unit is 300\% and yet such
10856 inlining is very sane. For very large units consisting of
10857 small inlineable functions, however, the overall unit growth
10858 limit is needed to avoid exponential explosion of code size.
10859 Thus for smaller units, the size is increased to --param large-
10860 unit-insns before applying --param inline-unit-growth.
10861
10862 lazy-modules
10863 Maximum number of concurrently open C++ module files when lazy
10864 loading.
10865
10866 inline-unit-growth
10867 Specifies maximal overall growth of the compilation unit caused
10868 by inlining. For example, parameter value 20 limits unit
10869 growth to 1.2 times the original size. Cold functions (either
10870 marked cold via an attribute or by profile feedback) are not
10871 accounted into the unit size.
10872
10873 ipa-cp-unit-growth
10874 Specifies maximal overall growth of the compilation unit caused
10875 by interprocedural constant propagation. For example,
10876 parameter value 10 limits unit growth to 1.1 times the original
10877 size.
10878
10879 ipa-cp-large-unit-insns
10880 The size of translation unit that IPA-CP pass considers large.
10881
10882 large-stack-frame
10883 The limit specifying large stack frames. While inlining the
10884 algorithm is trying to not grow past this limit too much.
10885
10886 large-stack-frame-growth
10887 Specifies maximal growth of large stack frames caused by
10888 inlining in percents. For example, parameter value 1000 limits
10889 large stack frame growth to 11 times the original size.
10890
10891 max-inline-insns-recursive
10892 max-inline-insns-recursive-auto
10893 Specifies the maximum number of instructions an out-of-line
10894 copy of a self-recursive inline function can grow into by
10895 performing recursive inlining.
10896
10897 --param max-inline-insns-recursive applies to functions
10898 declared inline. For functions not declared inline, recursive
10899 inlining happens only when -finline-functions (included in -O3)
10900 is enabled; --param max-inline-insns-recursive-auto applies
10901 instead.
10902
10903 max-inline-recursive-depth
10904 max-inline-recursive-depth-auto
10905 Specifies the maximum recursion depth used for recursive
10906 inlining.
10907
10908 --param max-inline-recursive-depth applies to functions
10909 declared inline. For functions not declared inline, recursive
10910 inlining happens only when -finline-functions (included in -O3)
10911 is enabled; --param max-inline-recursive-depth-auto applies
10912 instead.
10913
10914 min-inline-recursive-probability
10915 Recursive inlining is profitable only for function having deep
10916 recursion in average and can hurt for function having little
10917 recursion depth by increasing the prologue size or complexity
10918 of function body to other optimizers.
10919
10920 When profile feedback is available (see -fprofile-generate) the
10921 actual recursion depth can be guessed from the probability that
10922 function recurses via a given call expression. This parameter
10923 limits inlining only to call expressions whose probability
10924 exceeds the given threshold (in percents).
10925
10926 early-inlining-insns
10927 Specify growth that the early inliner can make. In effect it
10928 increases the amount of inlining for code having a large
10929 abstraction penalty.
10930
10931 max-early-inliner-iterations
10932 Limit of iterations of the early inliner. This basically
10933 bounds the number of nested indirect calls the early inliner
10934 can resolve. Deeper chains are still handled by late inlining.
10935
10936 comdat-sharing-probability
10937 Probability (in percent) that C++ inline function with comdat
10938 visibility are shared across multiple compilation units.
10939
10940 modref-max-bases
10941 modref-max-refs
10942 modref-max-accesses
10943 Specifies the maximal number of base pointers, references and
10944 accesses stored for a single function by mod/ref analysis.
10945
10946 modref-max-tests
10947 Specifies the maxmal number of tests alias oracle can perform
10948 to disambiguate memory locations using the mod/ref information.
10949 This parameter ought to be bigger than --param modref-max-bases
10950 and --param modref-max-refs.
10951
10952 modref-max-depth
10953 Specifies the maximum depth of DFS walk used by modref escape
10954 analysis. Setting to 0 disables the analysis completely.
10955
10956 modref-max-escape-points
10957 Specifies the maximum number of escape points tracked by modref
10958 per SSA-name.
10959
10960 profile-func-internal-id
10961 A parameter to control whether to use function internal id in
10962 profile database lookup. If the value is 0, the compiler uses
10963 an id that is based on function assembler name and filename,
10964 which makes old profile data more tolerant to source changes
10965 such as function reordering etc.
10966
10967 min-vect-loop-bound
10968 The minimum number of iterations under which loops are not
10969 vectorized when -ftree-vectorize is used. The number of
10970 iterations after vectorization needs to be greater than the
10971 value specified by this option to allow vectorization.
10972
10973 gcse-cost-distance-ratio
10974 Scaling factor in calculation of maximum distance an expression
10975 can be moved by GCSE optimizations. This is currently
10976 supported only in the code hoisting pass. The bigger the
10977 ratio, the more aggressive code hoisting is with simple
10978 expressions, i.e., the expressions that have cost less than
10979 gcse-unrestricted-cost. Specifying 0 disables hoisting of
10980 simple expressions.
10981
10982 gcse-unrestricted-cost
10983 Cost, roughly measured as the cost of a single typical machine
10984 instruction, at which GCSE optimizations do not constrain the
10985 distance an expression can travel. This is currently supported
10986 only in the code hoisting pass. The lesser the cost, the more
10987 aggressive code hoisting is. Specifying 0 allows all
10988 expressions to travel unrestricted distances.
10989
10990 max-hoist-depth
10991 The depth of search in the dominator tree for expressions to
10992 hoist. This is used to avoid quadratic behavior in hoisting
10993 algorithm. The value of 0 does not limit on the search, but
10994 may slow down compilation of huge functions.
10995
10996 max-tail-merge-comparisons
10997 The maximum amount of similar bbs to compare a bb with. This
10998 is used to avoid quadratic behavior in tree tail merging.
10999
11000 max-tail-merge-iterations
11001 The maximum amount of iterations of the pass over the function.
11002 This is used to limit compilation time in tree tail merging.
11003
11004 store-merging-allow-unaligned
11005 Allow the store merging pass to introduce unaligned stores if
11006 it is legal to do so.
11007
11008 max-stores-to-merge
11009 The maximum number of stores to attempt to merge into wider
11010 stores in the store merging pass.
11011
11012 max-store-chains-to-track
11013 The maximum number of store chains to track at the same time in
11014 the attempt to merge them into wider stores in the store
11015 merging pass.
11016
11017 max-stores-to-track
11018 The maximum number of stores to track at the same time in the
11019 attemt to to merge them into wider stores in the store merging
11020 pass.
11021
11022 max-unrolled-insns
11023 The maximum number of instructions that a loop may have to be
11024 unrolled. If a loop is unrolled, this parameter also
11025 determines how many times the loop code is unrolled.
11026
11027 max-average-unrolled-insns
11028 The maximum number of instructions biased by probabilities of
11029 their execution that a loop may have to be unrolled. If a loop
11030 is unrolled, this parameter also determines how many times the
11031 loop code is unrolled.
11032
11033 max-unroll-times
11034 The maximum number of unrollings of a single loop.
11035
11036 max-peeled-insns
11037 The maximum number of instructions that a loop may have to be
11038 peeled. If a loop is peeled, this parameter also determines
11039 how many times the loop code is peeled.
11040
11041 max-peel-times
11042 The maximum number of peelings of a single loop.
11043
11044 max-peel-branches
11045 The maximum number of branches on the hot path through the
11046 peeled sequence.
11047
11048 max-completely-peeled-insns
11049 The maximum number of insns of a completely peeled loop.
11050
11051 max-completely-peel-times
11052 The maximum number of iterations of a loop to be suitable for
11053 complete peeling.
11054
11055 max-completely-peel-loop-nest-depth
11056 The maximum depth of a loop nest suitable for complete peeling.
11057
11058 max-unswitch-insns
11059 The maximum number of insns of an unswitched loop.
11060
11061 max-unswitch-level
11062 The maximum number of branches unswitched in a single loop.
11063
11064 lim-expensive
11065 The minimum cost of an expensive expression in the loop
11066 invariant motion.
11067
11068 min-loop-cond-split-prob
11069 When FDO profile information is available, min-loop-cond-split-
11070 prob specifies minimum threshold for probability of semi-
11071 invariant condition statement to trigger loop split.
11072
11073 iv-consider-all-candidates-bound
11074 Bound on number of candidates for induction variables, below
11075 which all candidates are considered for each use in induction
11076 variable optimizations. If there are more candidates than
11077 this, only the most relevant ones are considered to avoid
11078 quadratic time complexity.
11079
11080 iv-max-considered-uses
11081 The induction variable optimizations give up on loops that
11082 contain more induction variable uses.
11083
11084 iv-always-prune-cand-set-bound
11085 If the number of candidates in the set is smaller than this
11086 value, always try to remove unnecessary ivs from the set when
11087 adding a new one.
11088
11089 avg-loop-niter
11090 Average number of iterations of a loop.
11091
11092 dse-max-object-size
11093 Maximum size (in bytes) of objects tracked bytewise by dead
11094 store elimination. Larger values may result in larger
11095 compilation times.
11096
11097 dse-max-alias-queries-per-store
11098 Maximum number of queries into the alias oracle per store.
11099 Larger values result in larger compilation times and may result
11100 in more removed dead stores.
11101
11102 scev-max-expr-size
11103 Bound on size of expressions used in the scalar evolutions
11104 analyzer. Large expressions slow the analyzer.
11105
11106 scev-max-expr-complexity
11107 Bound on the complexity of the expressions in the scalar
11108 evolutions analyzer. Complex expressions slow the analyzer.
11109
11110 max-tree-if-conversion-phi-args
11111 Maximum number of arguments in a PHI supported by TREE if
11112 conversion unless the loop is marked with simd pragma.
11113
11114 vect-max-version-for-alignment-checks
11115 The maximum number of run-time checks that can be performed
11116 when doing loop versioning for alignment in the vectorizer.
11117
11118 vect-max-version-for-alias-checks
11119 The maximum number of run-time checks that can be performed
11120 when doing loop versioning for alias in the vectorizer.
11121
11122 vect-max-peeling-for-alignment
11123 The maximum number of loop peels to enhance access alignment
11124 for vectorizer. Value -1 means no limit.
11125
11126 max-iterations-to-track
11127 The maximum number of iterations of a loop the brute-force
11128 algorithm for analysis of the number of iterations of the loop
11129 tries to evaluate.
11130
11131 hot-bb-count-fraction
11132 The denominator n of fraction 1/n of the maximal execution
11133 count of a basic block in the entire program that a basic block
11134 needs to at least have in order to be considered hot. The
11135 default is 10000, which means that a basic block is considered
11136 hot if its execution count is greater than 1/10000 of the
11137 maximal execution count. 0 means that it is never considered
11138 hot. Used in non-LTO mode.
11139
11140 hot-bb-count-ws-permille
11141 The number of most executed permilles, ranging from 0 to 1000,
11142 of the profiled execution of the entire program to which the
11143 execution count of a basic block must be part of in order to be
11144 considered hot. The default is 990, which means that a basic
11145 block is considered hot if its execution count contributes to
11146 the upper 990 permilles, or 99.0%, of the profiled execution of
11147 the entire program. 0 means that it is never considered hot.
11148 Used in LTO mode.
11149
11150 hot-bb-frequency-fraction
11151 The denominator n of fraction 1/n of the execution frequency of
11152 the entry block of a function that a basic block of this
11153 function needs to at least have in order to be considered hot.
11154 The default is 1000, which means that a basic block is
11155 considered hot in a function if it is executed more frequently
11156 than 1/1000 of the frequency of the entry block of the
11157 function. 0 means that it is never considered hot.
11158
11159 unlikely-bb-count-fraction
11160 The denominator n of fraction 1/n of the number of profiled
11161 runs of the entire program below which the execution count of a
11162 basic block must be in order for the basic block to be
11163 considered unlikely executed. The default is 20, which means
11164 that a basic block is considered unlikely executed if it is
11165 executed in fewer than 1/20, or 5%, of the runs of the program.
11166 0 means that it is always considered unlikely executed.
11167
11168 max-predicted-iterations
11169 The maximum number of loop iterations we predict statically.
11170 This is useful in cases where a function contains a single loop
11171 with known bound and another loop with unknown bound. The
11172 known number of iterations is predicted correctly, while the
11173 unknown number of iterations average to roughly 10. This means
11174 that the loop without bounds appears artificially cold relative
11175 to the other one.
11176
11177 builtin-expect-probability
11178 Control the probability of the expression having the specified
11179 value. This parameter takes a percentage (i.e. 0 ... 100) as
11180 input.
11181
11182 builtin-string-cmp-inline-length
11183 The maximum length of a constant string for a builtin string
11184 cmp call eligible for inlining.
11185
11186 align-threshold
11187 Select fraction of the maximal frequency of executions of a
11188 basic block in a function to align the basic block.
11189
11190 align-loop-iterations
11191 A loop expected to iterate at least the selected number of
11192 iterations is aligned.
11193
11194 tracer-dynamic-coverage
11195 tracer-dynamic-coverage-feedback
11196 This value is used to limit superblock formation once the given
11197 percentage of executed instructions is covered. This limits
11198 unnecessary code size expansion.
11199
11200 The tracer-dynamic-coverage-feedback parameter is used only
11201 when profile feedback is available. The real profiles (as
11202 opposed to statically estimated ones) are much less balanced
11203 allowing the threshold to be larger value.
11204
11205 tracer-max-code-growth
11206 Stop tail duplication once code growth has reached given
11207 percentage. This is a rather artificial limit, as most of the
11208 duplicates are eliminated later in cross jumping, so it may be
11209 set to much higher values than is the desired code growth.
11210
11211 tracer-min-branch-ratio
11212 Stop reverse growth when the reverse probability of best edge
11213 is less than this threshold (in percent).
11214
11215 tracer-min-branch-probability
11216 tracer-min-branch-probability-feedback
11217 Stop forward growth if the best edge has probability lower than
11218 this threshold.
11219
11220 Similarly to tracer-dynamic-coverage two parameters are
11221 provided. tracer-min-branch-probability-feedback is used for
11222 compilation with profile feedback and tracer-min-branch-
11223 probability compilation without. The value for compilation
11224 with profile feedback needs to be more conservative (higher) in
11225 order to make tracer effective.
11226
11227 stack-clash-protection-guard-size
11228 Specify the size of the operating system provided stack guard
11229 as 2 raised to num bytes. Higher values may reduce the number
11230 of explicit probes, but a value larger than the operating
11231 system provided guard will leave code vulnerable to stack clash
11232 style attacks.
11233
11234 stack-clash-protection-probe-interval
11235 Stack clash protection involves probing stack space as it is
11236 allocated. This param controls the maximum distance between
11237 probes into the stack as 2 raised to num bytes. Higher values
11238 may reduce the number of explicit probes, but a value larger
11239 than the operating system provided guard will leave code
11240 vulnerable to stack clash style attacks.
11241
11242 max-cse-path-length
11243 The maximum number of basic blocks on path that CSE considers.
11244
11245 max-cse-insns
11246 The maximum number of instructions CSE processes before
11247 flushing.
11248
11249 ggc-min-expand
11250 GCC uses a garbage collector to manage its own memory
11251 allocation. This parameter specifies the minimum percentage by
11252 which the garbage collector's heap should be allowed to expand
11253 between collections. Tuning this may improve compilation
11254 speed; it has no effect on code generation.
11255
11256 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11257 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11258 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11259 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11260 particular platform, the lower bound of 30% is used. Setting
11261 this parameter and ggc-min-heapsize to zero causes a full
11262 collection to occur at every opportunity. This is extremely
11263 slow, but can be useful for debugging.
11264
11265 ggc-min-heapsize
11266 Minimum size of the garbage collector's heap before it begins
11267 bothering to collect garbage. The first collection occurs
11268 after the heap expands by ggc-min-expand% beyond ggc-min-
11269 heapsize. Again, tuning this may improve compilation speed,
11270 and has no effect on code generation.
11271
11272 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11273 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11274 exceeded, but with a lower bound of 4096 (four megabytes) and
11275 an upper bound of 131072 (128 megabytes). If GCC is not able
11276 to calculate RAM on a particular platform, the lower bound is
11277 used. Setting this parameter very large effectively disables
11278 garbage collection. Setting this parameter and ggc-min-expand
11279 to zero causes a full collection to occur at every opportunity.
11280
11281 max-reload-search-insns
11282 The maximum number of instruction reload should look backward
11283 for equivalent register. Increasing values mean more
11284 aggressive optimization, making the compilation time increase
11285 with probably slightly better performance.
11286
11287 max-cselib-memory-locations
11288 The maximum number of memory locations cselib should take into
11289 account. Increasing values mean more aggressive optimization,
11290 making the compilation time increase with probably slightly
11291 better performance.
11292
11293 max-sched-ready-insns
11294 The maximum number of instructions ready to be issued the
11295 scheduler should consider at any given time during the first
11296 scheduling pass. Increasing values mean more thorough
11297 searches, making the compilation time increase with probably
11298 little benefit.
11299
11300 max-sched-region-blocks
11301 The maximum number of blocks in a region to be considered for
11302 interblock scheduling.
11303
11304 max-pipeline-region-blocks
11305 The maximum number of blocks in a region to be considered for
11306 pipelining in the selective scheduler.
11307
11308 max-sched-region-insns
11309 The maximum number of insns in a region to be considered for
11310 interblock scheduling.
11311
11312 max-pipeline-region-insns
11313 The maximum number of insns in a region to be considered for
11314 pipelining in the selective scheduler.
11315
11316 min-spec-prob
11317 The minimum probability (in percents) of reaching a source
11318 block for interblock speculative scheduling.
11319
11320 max-sched-extend-regions-iters
11321 The maximum number of iterations through CFG to extend regions.
11322 A value of 0 disables region extensions.
11323
11324 max-sched-insn-conflict-delay
11325 The maximum conflict delay for an insn to be considered for
11326 speculative motion.
11327
11328 sched-spec-prob-cutoff
11329 The minimal probability of speculation success (in percents),
11330 so that speculative insns are scheduled.
11331
11332 sched-state-edge-prob-cutoff
11333 The minimum probability an edge must have for the scheduler to
11334 save its state across it.
11335
11336 sched-mem-true-dep-cost
11337 Minimal distance (in CPU cycles) between store and load
11338 targeting same memory locations.
11339
11340 selsched-max-lookahead
11341 The maximum size of the lookahead window of selective
11342 scheduling. It is a depth of search for available
11343 instructions.
11344
11345 selsched-max-sched-times
11346 The maximum number of times that an instruction is scheduled
11347 during selective scheduling. This is the limit on the number
11348 of iterations through which the instruction may be pipelined.
11349
11350 selsched-insns-to-rename
11351 The maximum number of best instructions in the ready list that
11352 are considered for renaming in the selective scheduler.
11353
11354 sms-min-sc
11355 The minimum value of stage count that swing modulo scheduler
11356 generates.
11357
11358 max-last-value-rtl
11359 The maximum size measured as number of RTLs that can be
11360 recorded in an expression in combiner for a pseudo register as
11361 last known value of that register.
11362
11363 max-combine-insns
11364 The maximum number of instructions the RTL combiner tries to
11365 combine.
11366
11367 integer-share-limit
11368 Small integer constants can use a shared data structure,
11369 reducing the compiler's memory usage and increasing its speed.
11370 This sets the maximum value of a shared integer constant.
11371
11372 ssp-buffer-size
11373 The minimum size of buffers (i.e. arrays) that receive stack
11374 smashing protection when -fstack-protection is used.
11375
11376 min-size-for-stack-sharing
11377 The minimum size of variables taking part in stack slot sharing
11378 when not optimizing.
11379
11380 max-jump-thread-duplication-stmts
11381 Maximum number of statements allowed in a block that needs to
11382 be duplicated when threading jumps.
11383
11384 max-fields-for-field-sensitive
11385 Maximum number of fields in a structure treated in a field
11386 sensitive manner during pointer analysis.
11387
11388 prefetch-latency
11389 Estimate on average number of instructions that are executed
11390 before prefetch finishes. The distance prefetched ahead is
11391 proportional to this constant. Increasing this number may also
11392 lead to less streams being prefetched (see simultaneous-
11393 prefetches).
11394
11395 simultaneous-prefetches
11396 Maximum number of prefetches that can run at the same time.
11397
11398 l1-cache-line-size
11399 The size of cache line in L1 data cache, in bytes.
11400
11401 l1-cache-size
11402 The size of L1 data cache, in kilobytes.
11403
11404 l2-cache-size
11405 The size of L2 data cache, in kilobytes.
11406
11407 prefetch-dynamic-strides
11408 Whether the loop array prefetch pass should issue software
11409 prefetch hints for strides that are non-constant. In some
11410 cases this may be beneficial, though the fact the stride is
11411 non-constant may make it hard to predict when there is clear
11412 benefit to issuing these hints.
11413
11414 Set to 1 if the prefetch hints should be issued for non-
11415 constant strides. Set to 0 if prefetch hints should be issued
11416 only for strides that are known to be constant and below
11417 prefetch-minimum-stride.
11418
11419 prefetch-minimum-stride
11420 Minimum constant stride, in bytes, to start using prefetch
11421 hints for. If the stride is less than this threshold, prefetch
11422 hints will not be issued.
11423
11424 This setting is useful for processors that have hardware
11425 prefetchers, in which case there may be conflicts between the
11426 hardware prefetchers and the software prefetchers. If the
11427 hardware prefetchers have a maximum stride they can handle, it
11428 should be used here to improve the use of software prefetchers.
11429
11430 A value of -1 means we don't have a threshold and therefore
11431 prefetch hints can be issued for any constant stride.
11432
11433 This setting is only useful for strides that are known and
11434 constant.
11435
11436 loop-interchange-max-num-stmts
11437 The maximum number of stmts in a loop to be interchanged.
11438
11439 loop-interchange-stride-ratio
11440 The minimum ratio between stride of two loops for interchange
11441 to be profitable.
11442
11443 min-insn-to-prefetch-ratio
11444 The minimum ratio between the number of instructions and the
11445 number of prefetches to enable prefetching in a loop.
11446
11447 prefetch-min-insn-to-mem-ratio
11448 The minimum ratio between the number of instructions and the
11449 number of memory references to enable prefetching in a loop.
11450
11451 use-canonical-types
11452 Whether the compiler should use the "canonical" type system.
11453 Should always be 1, which uses a more efficient internal
11454 mechanism for comparing types in C++ and Objective-C++.
11455 However, if bugs in the canonical type system are causing
11456 compilation failures, set this value to 0 to disable canonical
11457 types.
11458
11459 switch-conversion-max-branch-ratio
11460 Switch initialization conversion refuses to create arrays that
11461 are bigger than switch-conversion-max-branch-ratio times the
11462 number of branches in the switch.
11463
11464 max-partial-antic-length
11465 Maximum length of the partial antic set computed during the
11466 tree partial redundancy elimination optimization (-ftree-pre)
11467 when optimizing at -O3 and above. For some sorts of source
11468 code the enhanced partial redundancy elimination optimization
11469 can run away, consuming all of the memory available on the host
11470 machine. This parameter sets a limit on the length of the sets
11471 that are computed, which prevents the runaway behavior.
11472 Setting a value of 0 for this parameter allows an unlimited set
11473 length.
11474
11475 rpo-vn-max-loop-depth
11476 Maximum loop depth that is value-numbered optimistically. When
11477 the limit hits the innermost rpo-vn-max-loop-depth loops and
11478 the outermost loop in the loop nest are value-numbered
11479 optimistically and the remaining ones not.
11480
11481 sccvn-max-alias-queries-per-access
11482 Maximum number of alias-oracle queries we perform when looking
11483 for redundancies for loads and stores. If this limit is hit
11484 the search is aborted and the load or store is not considered
11485 redundant. The number of queries is algorithmically limited to
11486 the number of stores on all paths from the load to the function
11487 entry.
11488
11489 ira-max-loops-num
11490 IRA uses regional register allocation by default. If a
11491 function contains more loops than the number given by this
11492 parameter, only at most the given number of the most
11493 frequently-executed loops form regions for regional register
11494 allocation.
11495
11496 ira-max-conflict-table-size
11497 Although IRA uses a sophisticated algorithm to compress the
11498 conflict table, the table can still require excessive amounts
11499 of memory for huge functions. If the conflict table for a
11500 function could be more than the size in MB given by this
11501 parameter, the register allocator instead uses a faster,
11502 simpler, and lower-quality algorithm that does not require
11503 building a pseudo-register conflict table.
11504
11505 ira-loop-reserved-regs
11506 IRA can be used to evaluate more accurate register pressure in
11507 loops for decisions to move loop invariants (see -O3). The
11508 number of available registers reserved for some other purposes
11509 is given by this parameter. Default of the parameter is the
11510 best found from numerous experiments.
11511
11512 lra-inheritance-ebb-probability-cutoff
11513 LRA tries to reuse values reloaded in registers in subsequent
11514 insns. This optimization is called inheritance. EBB is used
11515 as a region to do this optimization. The parameter defines a
11516 minimal fall-through edge probability in percentage used to add
11517 BB to inheritance EBB in LRA. The default value was chosen
11518 from numerous runs of SPEC2000 on x86-64.
11519
11520 loop-invariant-max-bbs-in-loop
11521 Loop invariant motion can be very expensive, both in
11522 compilation time and in amount of needed compile-time memory,
11523 with very large loops. Loops with more basic blocks than this
11524 parameter won't have loop invariant motion optimization
11525 performed on them.
11526
11527 loop-max-datarefs-for-datadeps
11528 Building data dependencies is expensive for very large loops.
11529 This parameter limits the number of data references in loops
11530 that are considered for data dependence analysis. These large
11531 loops are no handled by the optimizations using loop data
11532 dependencies.
11533
11534 max-vartrack-size
11535 Sets a maximum number of hash table slots to use during
11536 variable tracking dataflow analysis of any function. If this
11537 limit is exceeded with variable tracking at assignments
11538 enabled, analysis for that function is retried without it,
11539 after removing all debug insns from the function. If the limit
11540 is exceeded even without debug insns, var tracking analysis is
11541 completely disabled for the function. Setting the parameter to
11542 zero makes it unlimited.
11543
11544 max-vartrack-expr-depth
11545 Sets a maximum number of recursion levels when attempting to
11546 map variable names or debug temporaries to value expressions.
11547 This trades compilation time for more complete debug
11548 information. If this is set too low, value expressions that
11549 are available and could be represented in debug information may
11550 end up not being used; setting this higher may enable the
11551 compiler to find more complex debug expressions, but compile
11552 time and memory use may grow.
11553
11554 max-debug-marker-count
11555 Sets a threshold on the number of debug markers (e.g. begin
11556 stmt markers) to avoid complexity explosion at inlining or
11557 expanding to RTL. If a function has more such gimple stmts
11558 than the set limit, such stmts will be dropped from the inlined
11559 copy of a function, and from its RTL expansion.
11560
11561 min-nondebug-insn-uid
11562 Use uids starting at this parameter for nondebug insns. The
11563 range below the parameter is reserved exclusively for debug
11564 insns created by -fvar-tracking-assignments, but debug insns
11565 may get (non-overlapping) uids above it if the reserved range
11566 is exhausted.
11567
11568 ipa-sra-ptr-growth-factor
11569 IPA-SRA replaces a pointer to an aggregate with one or more new
11570 parameters only when their cumulative size is less or equal to
11571 ipa-sra-ptr-growth-factor times the size of the original
11572 pointer parameter.
11573
11574 ipa-sra-max-replacements
11575 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11576 consequence, it is also the maximum number of replacements of a
11577 formal parameter.
11578
11579 sra-max-scalarization-size-Ospeed
11580 sra-max-scalarization-size-Osize
11581 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
11582 aim to replace scalar parts of aggregates with uses of
11583 independent scalar variables. These parameters control the
11584 maximum size, in storage units, of aggregate which is
11585 considered for replacement when compiling for speed (sra-max-
11586 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
11587 Osize) respectively.
11588
11589 sra-max-propagations
11590 The maximum number of artificial accesses that Scalar
11591 Replacement of Aggregates (SRA) will track, per one local
11592 variable, in order to facilitate copy propagation.
11593
11594 tm-max-aggregate-size
11595 When making copies of thread-local variables in a transaction,
11596 this parameter specifies the size in bytes after which
11597 variables are saved with the logging functions as opposed to
11598 save/restore code sequence pairs. This option only applies
11599 when using -fgnu-tm.
11600
11601 graphite-max-nb-scop-params
11602 To avoid exponential effects in the Graphite loop transforms,
11603 the number of parameters in a Static Control Part (SCoP) is
11604 bounded. A value of zero can be used to lift the bound. A
11605 variable whose value is unknown at compilation time and defined
11606 outside a SCoP is a parameter of the SCoP.
11607
11608 loop-block-tile-size
11609 Loop blocking or strip mining transforms, enabled with
11610 -floop-block or -floop-strip-mine, strip mine each loop in the
11611 loop nest by a given number of iterations. The strip length
11612 can be changed using the loop-block-tile-size parameter.
11613
11614 ipa-jump-function-lookups
11615 Specifies number of statements visited during jump function
11616 offset discovery.
11617
11618 ipa-cp-value-list-size
11619 IPA-CP attempts to track all possible values and types passed
11620 to a function's parameter in order to propagate them and
11621 perform devirtualization. ipa-cp-value-list-size is the
11622 maximum number of values and types it stores per one formal
11623 parameter of a function.
11624
11625 ipa-cp-eval-threshold
11626 IPA-CP calculates its own score of cloning profitability
11627 heuristics and performs those cloning opportunities with scores
11628 that exceed ipa-cp-eval-threshold.
11629
11630 ipa-cp-max-recursive-depth
11631 Maximum depth of recursive cloning for self-recursive function.
11632
11633 ipa-cp-min-recursive-probability
11634 Recursive cloning only when the probability of call being
11635 executed exceeds the parameter.
11636
11637 ipa-cp-recursion-penalty
11638 Percentage penalty the recursive functions will receive when
11639 they are evaluated for cloning.
11640
11641 ipa-cp-single-call-penalty
11642 Percentage penalty functions containing a single call to
11643 another function will receive when they are evaluated for
11644 cloning.
11645
11646 ipa-max-agg-items
11647 IPA-CP is also capable to propagate a number of scalar values
11648 passed in an aggregate. ipa-max-agg-items controls the maximum
11649 number of such values per one parameter.
11650
11651 ipa-cp-loop-hint-bonus
11652 When IPA-CP determines that a cloning candidate would make the
11653 number of iterations of a loop known, it adds a bonus of ipa-
11654 cp-loop-hint-bonus to the profitability score of the candidate.
11655
11656 ipa-max-loop-predicates
11657 The maximum number of different predicates IPA will use to
11658 describe when loops in a function have known properties.
11659
11660 ipa-max-aa-steps
11661 During its analysis of function bodies, IPA-CP employs alias
11662 analysis in order to track values pointed to by function
11663 parameters. In order not spend too much time analyzing huge
11664 functions, it gives up and consider all memory clobbered after
11665 examining ipa-max-aa-steps statements modifying memory.
11666
11667 ipa-max-switch-predicate-bounds
11668 Maximal number of boundary endpoints of case ranges of switch
11669 statement. For switch exceeding this limit, IPA-CP will not
11670 construct cloning cost predicate, which is used to estimate
11671 cloning benefit, for default case of the switch statement.
11672
11673 ipa-max-param-expr-ops
11674 IPA-CP will analyze conditional statement that references some
11675 function parameter to estimate benefit for cloning upon certain
11676 constant value. But if number of operations in a parameter
11677 expression exceeds ipa-max-param-expr-ops, the expression is
11678 treated as complicated one, and is not handled by IPA analysis.
11679
11680 lto-partitions
11681 Specify desired number of partitions produced during WHOPR
11682 compilation. The number of partitions should exceed the number
11683 of CPUs used for compilation.
11684
11685 lto-min-partition
11686 Size of minimal partition for WHOPR (in estimated
11687 instructions). This prevents expenses of splitting very small
11688 programs into too many partitions.
11689
11690 lto-max-partition
11691 Size of max partition for WHOPR (in estimated instructions).
11692 to provide an upper bound for individual size of partition.
11693 Meant to be used only with balanced partitioning.
11694
11695 lto-max-streaming-parallelism
11696 Maximal number of parallel processes used for LTO streaming.
11697
11698 cxx-max-namespaces-for-diagnostic-help
11699 The maximum number of namespaces to consult for suggestions
11700 when C++ name lookup fails for an identifier.
11701
11702 sink-frequency-threshold
11703 The maximum relative execution frequency (in percents) of the
11704 target block relative to a statement's original block to allow
11705 statement sinking of a statement. Larger numbers result in
11706 more aggressive statement sinking. A small positive adjustment
11707 is applied for statements with memory operands as those are
11708 even more profitable so sink.
11709
11710 max-stores-to-sink
11711 The maximum number of conditional store pairs that can be sunk.
11712 Set to 0 if either vectorization (-ftree-vectorize) or if-
11713 conversion (-ftree-loop-if-convert) is disabled.
11714
11715 case-values-threshold
11716 The smallest number of different values for which it is best to
11717 use a jump-table instead of a tree of conditional branches. If
11718 the value is 0, use the default for the machine.
11719
11720 jump-table-max-growth-ratio-for-size
11721 The maximum code size growth ratio when expanding into a jump
11722 table (in percent). The parameter is used when optimizing for
11723 size.
11724
11725 jump-table-max-growth-ratio-for-speed
11726 The maximum code size growth ratio when expanding into a jump
11727 table (in percent). The parameter is used when optimizing for
11728 speed.
11729
11730 tree-reassoc-width
11731 Set the maximum number of instructions executed in parallel in
11732 reassociated tree. This parameter overrides target dependent
11733 heuristics used by default if has non zero value.
11734
11735 sched-pressure-algorithm
11736 Choose between the two available implementations of
11737 -fsched-pressure. Algorithm 1 is the original implementation
11738 and is the more likely to prevent instructions from being
11739 reordered. Algorithm 2 was designed to be a compromise between
11740 the relatively conservative approach taken by algorithm 1 and
11741 the rather aggressive approach taken by the default scheduler.
11742 It relies more heavily on having a regular register file and
11743 accurate register pressure classes. See haifa-sched.c in the
11744 GCC sources for more details.
11745
11746 The default choice depends on the target.
11747
11748 max-slsr-cand-scan
11749 Set the maximum number of existing candidates that are
11750 considered when seeking a basis for a new straight-line
11751 strength reduction candidate.
11752
11753 asan-globals
11754 Enable buffer overflow detection for global objects. This kind
11755 of protection is enabled by default if you are using
11756 -fsanitize=address option. To disable global objects
11757 protection use --param asan-globals=0.
11758
11759 asan-stack
11760 Enable buffer overflow detection for stack objects. This kind
11761 of protection is enabled by default when using
11762 -fsanitize=address. To disable stack protection use --param
11763 asan-stack=0 option.
11764
11765 asan-instrument-reads
11766 Enable buffer overflow detection for memory reads. This kind
11767 of protection is enabled by default when using
11768 -fsanitize=address. To disable memory reads protection use
11769 --param asan-instrument-reads=0.
11770
11771 asan-instrument-writes
11772 Enable buffer overflow detection for memory writes. This kind
11773 of protection is enabled by default when using
11774 -fsanitize=address. To disable memory writes protection use
11775 --param asan-instrument-writes=0 option.
11776
11777 asan-memintrin
11778 Enable detection for built-in functions. This kind of
11779 protection is enabled by default when using -fsanitize=address.
11780 To disable built-in functions protection use --param
11781 asan-memintrin=0.
11782
11783 asan-use-after-return
11784 Enable detection of use-after-return. This kind of protection
11785 is enabled by default when using the -fsanitize=address option.
11786 To disable it use --param asan-use-after-return=0.
11787
11788 Note: By default the check is disabled at run time. To enable
11789 it, add "detect_stack_use_after_return=1" to the environment
11790 variable ASAN_OPTIONS.
11791
11792 asan-instrumentation-with-call-threshold
11793 If number of memory accesses in function being instrumented is
11794 greater or equal to this number, use callbacks instead of
11795 inline checks. E.g. to disable inline code use --param
11796 asan-instrumentation-with-call-threshold=0.
11797
11798 hwasan-instrument-stack
11799 Enable hwasan instrumentation of statically sized stack-
11800 allocated variables. This kind of instrumentation is enabled
11801 by default when using -fsanitize=hwaddress and disabled by
11802 default when using -fsanitize=kernel-hwaddress. To disable
11803 stack instrumentation use --param hwasan-instrument-stack=0,
11804 and to enable it use --param hwasan-instrument-stack=1.
11805
11806 hwasan-random-frame-tag
11807 When using stack instrumentation, decide tags for stack
11808 variables using a deterministic sequence beginning at a random
11809 tag for each frame. With this parameter unset tags are chosen
11810 using the same sequence but beginning from 1. This is enabled
11811 by default for -fsanitize=hwaddress and unavailable for
11812 -fsanitize=kernel-hwaddress. To disable it use --param
11813 hwasan-random-frame-tag=0.
11814
11815 hwasan-instrument-allocas
11816 Enable hwasan instrumentation of dynamically sized stack-
11817 allocated variables. This kind of instrumentation is enabled
11818 by default when using -fsanitize=hwaddress and disabled by
11819 default when using -fsanitize=kernel-hwaddress. To disable
11820 instrumentation of such variables use --param
11821 hwasan-instrument-allocas=0, and to enable it use --param
11822 hwasan-instrument-allocas=1.
11823
11824 hwasan-instrument-reads
11825 Enable hwasan checks on memory reads. Instrumentation of reads
11826 is enabled by default for both -fsanitize=hwaddress and
11827 -fsanitize=kernel-hwaddress. To disable checking memory reads
11828 use --param hwasan-instrument-reads=0.
11829
11830 hwasan-instrument-writes
11831 Enable hwasan checks on memory writes. Instrumentation of
11832 writes is enabled by default for both -fsanitize=hwaddress and
11833 -fsanitize=kernel-hwaddress. To disable checking memory writes
11834 use --param hwasan-instrument-writes=0.
11835
11836 hwasan-instrument-mem-intrinsics
11837 Enable hwasan instrumentation of builtin functions.
11838 Instrumentation of these builtin functions is enabled by
11839 default for both -fsanitize=hwaddress and
11840 -fsanitize=kernel-hwaddress. To disable instrumentation of
11841 builtin functions use --param
11842 hwasan-instrument-mem-intrinsics=0.
11843
11844 use-after-scope-direct-emission-threshold
11845 If the size of a local variable in bytes is smaller or equal to
11846 this number, directly poison (or unpoison) shadow memory
11847 instead of using run-time callbacks.
11848
11849 tsan-distinguish-volatile
11850 Emit special instrumentation for accesses to volatiles.
11851
11852 tsan-instrument-func-entry-exit
11853 Emit instrumentation calls to __tsan_func_entry() and
11854 __tsan_func_exit().
11855
11856 max-fsm-thread-path-insns
11857 Maximum number of instructions to copy when duplicating blocks
11858 on a finite state automaton jump thread path.
11859
11860 max-fsm-thread-length
11861 Maximum number of basic blocks on a finite state automaton jump
11862 thread path.
11863
11864 max-fsm-thread-paths
11865 Maximum number of new jump thread paths to create for a finite
11866 state automaton.
11867
11868 parloops-chunk-size
11869 Chunk size of omp schedule for loops parallelized by parloops.
11870
11871 parloops-schedule
11872 Schedule type of omp schedule for loops parallelized by
11873 parloops (static, dynamic, guided, auto, runtime).
11874
11875 parloops-min-per-thread
11876 The minimum number of iterations per thread of an innermost
11877 parallelized loop for which the parallelized variant is
11878 preferred over the single threaded one. Note that for a
11879 parallelized loop nest the minimum number of iterations of the
11880 outermost loop per thread is two.
11881
11882 max-ssa-name-query-depth
11883 Maximum depth of recursion when querying properties of SSA
11884 names in things like fold routines. One level of recursion
11885 corresponds to following a use-def chain.
11886
11887 max-speculative-devirt-maydefs
11888 The maximum number of may-defs we analyze when looking for a
11889 must-def specifying the dynamic type of an object that invokes
11890 a virtual call we may be able to devirtualize speculatively.
11891
11892 max-vrp-switch-assertions
11893 The maximum number of assertions to add along the default edge
11894 of a switch statement during VRP.
11895
11896 evrp-mode
11897 Specifies the mode Early VRP should operate in.
11898
11899 unroll-jam-min-percent
11900 The minimum percentage of memory references that must be
11901 optimized away for the unroll-and-jam transformation to be
11902 considered profitable.
11903
11904 unroll-jam-max-unroll
11905 The maximum number of times the outer loop should be unrolled
11906 by the unroll-and-jam transformation.
11907
11908 max-rtl-if-conversion-unpredictable-cost
11909 Maximum permissible cost for the sequence that would be
11910 generated by the RTL if-conversion pass for a branch that is
11911 considered unpredictable.
11912
11913 max-variable-expansions-in-unroller
11914 If -fvariable-expansion-in-unroller is used, the maximum number
11915 of times that an individual variable will be expanded during
11916 loop unrolling.
11917
11918 tracer-min-branch-probability-feedback
11919 Stop forward growth if the probability of best edge is less
11920 than this threshold (in percent). Used when profile feedback is
11921 available.
11922
11923 partial-inlining-entry-probability
11924 Maximum probability of the entry BB of split region (in percent
11925 relative to entry BB of the function) to make partial inlining
11926 happen.
11927
11928 max-tracked-strlens
11929 Maximum number of strings for which strlen optimization pass
11930 will track string lengths.
11931
11932 gcse-after-reload-partial-fraction
11933 The threshold ratio for performing partial redundancy
11934 elimination after reload.
11935
11936 gcse-after-reload-critical-fraction
11937 The threshold ratio of critical edges execution count that
11938 permit performing redundancy elimination after reload.
11939
11940 max-loop-header-insns
11941 The maximum number of insns in loop header duplicated by the
11942 copy loop headers pass.
11943
11944 vect-epilogues-nomask
11945 Enable loop epilogue vectorization using smaller vector size.
11946
11947 vect-partial-vector-usage
11948 Controls when the loop vectorizer considers using partial
11949 vector loads and stores as an alternative to falling back to
11950 scalar code. 0 stops the vectorizer from ever using partial
11951 vector loads and stores. 1 allows partial vector loads and
11952 stores if vectorization removes the need for the code to
11953 iterate. 2 allows partial vector loads and stores in all
11954 loops. The parameter only has an effect on targets that
11955 support partial vector loads and stores.
11956
11957 avoid-fma-max-bits
11958 Maximum number of bits for which we avoid creating FMAs.
11959
11960 sms-loop-average-count-threshold
11961 A threshold on the average loop count considered by the swing
11962 modulo scheduler.
11963
11964 sms-dfa-history
11965 The number of cycles the swing modulo scheduler considers when
11966 checking conflicts using DFA.
11967
11968 max-inline-insns-recursive-auto
11969 The maximum number of instructions non-inline function can grow
11970 to via recursive inlining.
11971
11972 graphite-allow-codegen-errors
11973 Whether codegen errors should be ICEs when -fchecking.
11974
11975 sms-max-ii-factor
11976 A factor for tuning the upper bound that swing modulo scheduler
11977 uses for scheduling a loop.
11978
11979 lra-max-considered-reload-pseudos
11980 The max number of reload pseudos which are considered during
11981 spilling a non-reload pseudo.
11982
11983 max-pow-sqrt-depth
11984 Maximum depth of sqrt chains to use when synthesizing
11985 exponentiation by a real constant.
11986
11987 max-dse-active-local-stores
11988 Maximum number of active local stores in RTL dead store
11989 elimination.
11990
11991 asan-instrument-allocas
11992 Enable asan allocas/VLAs protection.
11993
11994 max-iterations-computation-cost
11995 Bound on the cost of an expression to compute the number of
11996 iterations.
11997
11998 max-isl-operations
11999 Maximum number of isl operations, 0 means unlimited.
12000
12001 graphite-max-arrays-per-scop
12002 Maximum number of arrays per scop.
12003
12004 max-vartrack-reverse-op-size
12005 Max. size of loc list for which reverse ops should be added.
12006
12007 tracer-dynamic-coverage-feedback
12008 The percentage of function, weighted by execution frequency,
12009 that must be covered by trace formation. Used when profile
12010 feedback is available.
12011
12012 max-inline-recursive-depth-auto
12013 The maximum depth of recursive inlining for non-inline
12014 functions.
12015
12016 fsm-scale-path-stmts
12017 Scale factor to apply to the number of statements in a
12018 threading path when comparing to the number of (scaled) blocks.
12019
12020 fsm-maximum-phi-arguments
12021 Maximum number of arguments a PHI may have before the FSM
12022 threader will not try to thread through its block.
12023
12024 uninit-control-dep-attempts
12025 Maximum number of nested calls to search for control
12026 dependencies during uninitialized variable analysis.
12027
12028 sra-max-scalarization-size-Osize
12029 Maximum size, in storage units, of an aggregate which should be
12030 considered for scalarization when compiling for size.
12031
12032 fsm-scale-path-blocks
12033 Scale factor to apply to the number of blocks in a threading
12034 path when comparing to the number of (scaled) statements.
12035
12036 sched-autopref-queue-depth
12037 Hardware autoprefetcher scheduler model control flag. Number
12038 of lookahead cycles the model looks into; at ' ' only enable
12039 instruction sorting heuristic.
12040
12041 loop-versioning-max-inner-insns
12042 The maximum number of instructions that an inner loop can have
12043 before the loop versioning pass considers it too big to copy.
12044
12045 loop-versioning-max-outer-insns
12046 The maximum number of instructions that an outer loop can have
12047 before the loop versioning pass considers it too big to copy,
12048 discounting any instructions in inner loops that directly
12049 benefit from versioning.
12050
12051 ssa-name-def-chain-limit
12052 The maximum number of SSA_NAME assignments to follow in
12053 determining a property of a variable such as its value. This
12054 limits the number of iterations or recursive calls GCC performs
12055 when optimizing certain statements or when determining their
12056 validity prior to issuing diagnostics.
12057
12058 store-merging-max-size
12059 Maximum size of a single store merging region in bytes.
12060
12061 hash-table-verification-limit
12062 The number of elements for which hash table verification is
12063 done for each searched element.
12064
12065 max-find-base-term-values
12066 Maximum number of VALUEs handled during a single find_base_term
12067 call.
12068
12069 analyzer-max-enodes-per-program-point
12070 The maximum number of exploded nodes per program point within
12071 the analyzer, before terminating analysis of that point.
12072
12073 analyzer-max-constraints
12074 The maximum number of constraints per state.
12075
12076 analyzer-min-snodes-for-call-summary
12077 The minimum number of supernodes within a function for the
12078 analyzer to consider summarizing its effects at call sites.
12079
12080 analyzer-max-enodes-for-full-dump
12081 The maximum depth of exploded nodes that should appear in a dot
12082 dump before switching to a less verbose format.
12083
12084 analyzer-max-recursion-depth
12085 The maximum number of times a callsite can appear in a call
12086 stack within the analyzer, before terminating analysis of a
12087 call that would recurse deeper.
12088
12089 analyzer-max-svalue-depth
12090 The maximum depth of a symbolic value, before approximating the
12091 value as unknown.
12092
12093 analyzer-max-infeasible-edges
12094 The maximum number of infeasible edges to reject before
12095 declaring a diagnostic as infeasible.
12096
12097 gimple-fe-computed-hot-bb-threshold
12098 The number of executions of a basic block which is considered
12099 hot. The parameter is used only in GIMPLE FE.
12100
12101 analyzer-bb-explosion-factor
12102 The maximum number of 'after supernode' exploded nodes within
12103 the analyzer per supernode, before terminating analysis.
12104
12105 ranger-logical-depth
12106 Maximum depth of logical expression evaluation ranger will look
12107 through when evaluating outgoing edge ranges.
12108
12109 openacc-kernels
12110 Specify mode of OpenACC `kernels' constructs handling. With
12111 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12112 are decomposed into parts, a sequence of compute constructs,
12113 each then handled individually. This is work in progress.
12114 With --param=openacc-kernels=parloops, OpenACC `kernels'
12115 constructs are handled by the parloops pass, en bloc. This is
12116 the current default.
12117
12118 The following choices of name are available on AArch64 targets:
12119
12120 aarch64-sve-compare-costs
12121 When vectorizing for SVE, consider using "unpacked" vectors for
12122 smaller elements and use the cost model to pick the cheapest
12123 approach. Also use the cost model to choose between SVE and
12124 Advanced SIMD vectorization.
12125
12126 Using unpacked vectors includes storing smaller elements in
12127 larger containers and accessing elements with extending loads
12128 and truncating stores.
12129
12130 aarch64-float-recp-precision
12131 The number of Newton iterations for calculating the reciprocal
12132 for float type. The precision of division is proportional to
12133 this param when division approximation is enabled. The default
12134 value is 1.
12135
12136 aarch64-double-recp-precision
12137 The number of Newton iterations for calculating the reciprocal
12138 for double type. The precision of division is propotional to
12139 this param when division approximation is enabled. The default
12140 value is 2.
12141
12142 aarch64-autovec-preference
12143 Force an ISA selection strategy for auto-vectorization.
12144 Accepts values from 0 to 4, inclusive.
12145
12146 0 Use the default heuristics.
12147
12148 1 Use only Advanced SIMD for auto-vectorization.
12149
12150 2 Use only SVE for auto-vectorization.
12151
12152 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12153 the costs are deemed equal.
12154
12155 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12156 are deemed equal.
12157
12158 The default value is 0.
12159
12160 aarch64-loop-vect-issue-rate-niters
12161 The tuning for some AArch64 CPUs tries to take both latencies
12162 and issue rates into account when deciding whether a loop
12163 should be vectorized using SVE, vectorized using Advanced SIMD,
12164 or not vectorized at all. If this parameter is set to n, GCC
12165 will not use this heuristic for loops that are known to execute
12166 in fewer than n Advanced SIMD iterations.
12167
12168 Program Instrumentation Options
12169 GCC supports a number of command-line options that control adding run-
12170 time instrumentation to the code it normally generates. For example,
12171 one purpose of instrumentation is collect profiling statistics for use
12172 in finding program hot spots, code coverage analysis, or profile-guided
12173 optimizations. Another class of program instrumentation is adding run-
12174 time checking to detect programming errors like invalid pointer
12175 dereferences or out-of-bounds array accesses, as well as deliberately
12176 hostile attacks such as stack smashing or C++ vtable hijacking. There
12177 is also a general hook which can be used to implement other forms of
12178 tracing or function-level instrumentation for debug or program analysis
12179 purposes.
12180
12181 -p
12182 -pg Generate extra code to write profile information suitable for the
12183 analysis program prof (for -p) or gprof (for -pg). You must use
12184 this option when compiling the source files you want data about,
12185 and you must also use it when linking.
12186
12187 You can use the function attribute "no_instrument_function" to
12188 suppress profiling of individual functions when compiling with
12189 these options.
12190
12191 -fprofile-arcs
12192 Add code so that program flow arcs are instrumented. During
12193 execution the program records how many times each branch and call
12194 is executed and how many times it is taken or returns. On targets
12195 that support constructors with priority support, profiling properly
12196 handles constructors, destructors and C++ constructors (and
12197 destructors) of classes which are used as a type of a global
12198 variable.
12199
12200 When the compiled program exits it saves this data to a file called
12201 auxname.gcda for each source file. The data may be used for
12202 profile-directed optimizations (-fbranch-probabilities), or for
12203 test coverage analysis (-ftest-coverage). Each object file's
12204 auxname is generated from the name of the output file, if
12205 explicitly specified and it is not the final executable, otherwise
12206 it is the basename of the source file. In both cases any suffix is
12207 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12208 for output file specified as -o dir/foo.o).
12209
12210 --coverage
12211 This option is used to compile and link code instrumented for
12212 coverage analysis. The option is a synonym for -fprofile-arcs
12213 -ftest-coverage (when compiling) and -lgcov (when linking). See
12214 the documentation for those options for more details.
12215
12216 * Compile the source files with -fprofile-arcs plus optimization
12217 and code generation options. For test coverage analysis, use
12218 the additional -ftest-coverage option. You do not need to
12219 profile every source file in a program.
12220
12221 * Compile the source files additionally with -fprofile-abs-path
12222 to create absolute path names in the .gcno files. This allows
12223 gcov to find the correct sources in projects where compilations
12224 occur with different working directories.
12225
12226 * Link your object files with -lgcov or -fprofile-arcs (the
12227 latter implies the former).
12228
12229 * Run the program on a representative workload to generate the
12230 arc profile information. This may be repeated any number of
12231 times. You can run concurrent instances of your program, and
12232 provided that the file system supports locking, the data files
12233 will be correctly updated. Unless a strict ISO C dialect
12234 option is in effect, "fork" calls are detected and correctly
12235 handled without double counting.
12236
12237 * For profile-directed optimizations, compile the source files
12238 again with the same optimization and code generation options
12239 plus -fbranch-probabilities.
12240
12241 * For test coverage analysis, use gcov to produce human readable
12242 information from the .gcno and .gcda files. Refer to the gcov
12243 documentation for further information.
12244
12245 With -fprofile-arcs, for each function of your program GCC creates
12246 a program flow graph, then finds a spanning tree for the graph.
12247 Only arcs that are not on the spanning tree have to be
12248 instrumented: the compiler adds code to count the number of times
12249 that these arcs are executed. When an arc is the only exit or only
12250 entrance to a block, the instrumentation code can be added to the
12251 block; otherwise, a new basic block must be created to hold the
12252 instrumentation code.
12253
12254 -ftest-coverage
12255 Produce a notes file that the gcov code-coverage utility can use to
12256 show program coverage. Each source file's note file is called
12257 auxname.gcno. Refer to the -fprofile-arcs option above for a
12258 description of auxname and instructions on how to generate test
12259 coverage data. Coverage data matches the source files more closely
12260 if you do not optimize.
12261
12262 -fprofile-abs-path
12263 Automatically convert relative source file names to absolute path
12264 names in the .gcno files. This allows gcov to find the correct
12265 sources in projects where compilations occur with different working
12266 directories.
12267
12268 -fprofile-dir=path
12269 Set the directory to search for the profile data files in to path.
12270 This option affects only the profile data generated by
12271 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12272 -fprofile-use and -fbranch-probabilities and its related options.
12273 Both absolute and relative paths can be used. By default, GCC uses
12274 the current directory as path, thus the profile data file appears
12275 in the same directory as the object file. In order to prevent the
12276 file name clashing, if the object file name is not an absolute
12277 path, we mangle the absolute path of the sourcename.gcda file and
12278 use it as the file name of a .gcda file. See similar option
12279 -fprofile-note.
12280
12281 When an executable is run in a massive parallel environment, it is
12282 recommended to save profile to different folders. That can be done
12283 with variables in path that are exported during run-time:
12284
12285 %p process ID.
12286
12287 %q{VAR}
12288 value of environment variable VAR
12289
12290 -fprofile-generate
12291 -fprofile-generate=path
12292 Enable options usually used for instrumenting application to
12293 produce profile useful for later recompilation with profile
12294 feedback based optimization. You must use -fprofile-generate both
12295 when compiling and when linking your program.
12296
12297 The following options are enabled: -fprofile-arcs,
12298 -fprofile-values, -finline-functions, and -fipa-bit-cp.
12299
12300 If path is specified, GCC looks at the path to find the profile
12301 feedback data files. See -fprofile-dir.
12302
12303 To optimize the program based on the collected profile information,
12304 use -fprofile-use.
12305
12306 -fprofile-info-section
12307 -fprofile-info-section=name
12308 Register the profile information in the specified section instead
12309 of using a constructor/destructor. The section name is name if it
12310 is specified, otherwise the section name defaults to ".gcov_info".
12311 A pointer to the profile information generated by -fprofile-arcs or
12312 -ftest-coverage is placed in the specified section for each
12313 translation unit. This option disables the profile information
12314 registration through a constructor and it disables the profile
12315 information processing through a destructor. This option is not
12316 intended to be used in hosted environments such as GNU/Linux. It
12317 targets systems with limited resources which do not support
12318 constructors and destructors. The linker could collect the input
12319 sections in a continuous memory block and define start and end
12320 symbols. The runtime support could dump the profiling information
12321 registered in this linker set during program termination to a
12322 serial line for example. A GNU linker script example which defines
12323 a linker output section follows:
12324
12325 .gcov_info :
12326 {
12327 PROVIDE (__gcov_info_start = .);
12328 KEEP (*(.gcov_info))
12329 PROVIDE (__gcov_info_end = .);
12330 }
12331
12332 -fprofile-note=path
12333 If path is specified, GCC saves .gcno file into path location. If
12334 you combine the option with multiple source files, the .gcno file
12335 will be overwritten.
12336
12337 -fprofile-prefix-path=path
12338 This option can be used in combination with
12339 profile-generate=profile_dir and profile-use=profile_dir to inform
12340 GCC where is the base directory of built source tree. By default
12341 profile_dir will contain files with mangled absolute paths of all
12342 object files in the built project. This is not desirable when
12343 directory used to build the instrumented binary differs from the
12344 directory used to build the binary optimized with profile feedback
12345 because the profile data will not be found during the optimized
12346 build. In such setups -fprofile-prefix-path=path with path
12347 pointing to the base directory of the build can be used to strip
12348 the irrelevant part of the path and keep all file names relative to
12349 the main build directory.
12350
12351 -fprofile-update=method
12352 Alter the update method for an application instrumented for profile
12353 feedback based optimization. The method argument should be one of
12354 single, atomic or prefer-atomic. The first one is useful for
12355 single-threaded applications, while the second one prevents profile
12356 corruption by emitting thread-safe code.
12357
12358 Warning: When an application does not properly join all threads (or
12359 creates an detached thread), a profile file can be still corrupted.
12360
12361 Using prefer-atomic would be transformed either to atomic, when
12362 supported by a target, or to single otherwise. The GCC driver
12363 automatically selects prefer-atomic when -pthread is present in the
12364 command line.
12365
12366 -fprofile-filter-files=regex
12367 Instrument only functions from files whose name matches any of the
12368 regular expressions (separated by semi-colons).
12369
12370 For example, -fprofile-filter-files=main\.c;module.*\.c will
12371 instrument only main.c and all C files starting with 'module'.
12372
12373 -fprofile-exclude-files=regex
12374 Instrument only functions from files whose name does not match any
12375 of the regular expressions (separated by semi-colons).
12376
12377 For example, -fprofile-exclude-files=/usr/.* will prevent
12378 instrumentation of all files that are located in the /usr/ folder.
12379
12380 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
12381 Control level of reproducibility of profile gathered by
12382 "-fprofile-generate". This makes it possible to rebuild program
12383 with same outcome which is useful, for example, for distribution
12384 packages.
12385
12386 With -fprofile-reproducible=serial the profile gathered by
12387 -fprofile-generate is reproducible provided the trained program
12388 behaves the same at each invocation of the train run, it is not
12389 multi-threaded and profile data streaming is always done in the
12390 same order. Note that profile streaming happens at the end of
12391 program run but also before "fork" function is invoked.
12392
12393 Note that it is quite common that execution counts of some part of
12394 programs depends, for example, on length of temporary file names or
12395 memory space randomization (that may affect hash-table collision
12396 rate). Such non-reproducible part of programs may be annotated by
12397 "no_instrument_function" function attribute. gcov-dump with -l can
12398 be used to dump gathered data and verify that they are indeed
12399 reproducible.
12400
12401 With -fprofile-reproducible=parallel-runs collected profile stays
12402 reproducible regardless the order of streaming of the data into
12403 gcda files. This setting makes it possible to run multiple
12404 instances of instrumented program in parallel (such as with "make
12405 -j"). This reduces quality of gathered data, in particular of
12406 indirect call profiling.
12407
12408 -fsanitize=address
12409 Enable AddressSanitizer, a fast memory error detector. Memory
12410 access instructions are instrumented to detect out-of-bounds and
12411 use-after-free bugs. The option enables
12412 -fsanitize-address-use-after-scope. See
12413 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
12414 more details. The run-time behavior can be influenced using the
12415 ASAN_OPTIONS environment variable. When set to "help=1", the
12416 available options are shown at startup of the instrumented program.
12417 See
12418 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
12419 for a list of supported options. The option cannot be combined
12420 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
12421 target -fsanitize=hwaddress is currently supported on is AArch64.
12422
12423 -fsanitize=kernel-address
12424 Enable AddressSanitizer for Linux kernel. See
12425 <https://github.com/google/kasan> for more details.
12426
12427 -fsanitize=hwaddress
12428 Enable Hardware-assisted AddressSanitizer, which uses a hardware
12429 ability to ignore the top byte of a pointer to allow the detection
12430 of memory errors with a low memory overhead. Memory access
12431 instructions are instrumented to detect out-of-bounds and use-
12432 after-free bugs. The option enables
12433 -fsanitize-address-use-after-scope. See
12434 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
12435 for more details. The run-time behavior can be influenced using
12436 the HWASAN_OPTIONS environment variable. When set to "help=1", the
12437 available options are shown at startup of the instrumented program.
12438 The option cannot be combined with -fsanitize=thread or
12439 -fsanitize=address, and is currently only available on AArch64.
12440
12441 -fsanitize=kernel-hwaddress
12442 Enable Hardware-assisted AddressSanitizer for compilation of the
12443 Linux kernel. Similar to -fsanitize=kernel-address but using an
12444 alternate instrumentation method, and similar to
12445 -fsanitize=hwaddress but with instrumentation differences necessary
12446 for compiling the Linux kernel. These differences are to avoid
12447 hwasan library initialization calls and to account for the stack
12448 pointer having a different value in its top byte.
12449
12450 Note: This option has different defaults to the
12451 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
12452 not on by default but are still possible by specifying the command-
12453 line options --param hwasan-instrument-stack=1 and --param
12454 hwasan-instrument-allocas=1 respectively. Using a random frame tag
12455 is not implemented for kernel instrumentation.
12456
12457 -fsanitize=pointer-compare
12458 Instrument comparison operation (<, <=, >, >=) with pointer
12459 operands. The option must be combined with either
12460 -fsanitize=kernel-address or -fsanitize=address The option cannot
12461 be combined with -fsanitize=thread. Note: By default the check is
12462 disabled at run time. To enable it, add
12463 "detect_invalid_pointer_pairs=2" to the environment variable
12464 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
12465 invalid operation only when both pointers are non-null.
12466
12467 -fsanitize=pointer-subtract
12468 Instrument subtraction with pointer operands. The option must be
12469 combined with either -fsanitize=kernel-address or
12470 -fsanitize=address The option cannot be combined with
12471 -fsanitize=thread. Note: By default the check is disabled at run
12472 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
12473 environment variable ASAN_OPTIONS. Using
12474 "detect_invalid_pointer_pairs=1" detects invalid operation only
12475 when both pointers are non-null.
12476
12477 -fsanitize=thread
12478 Enable ThreadSanitizer, a fast data race detector. Memory access
12479 instructions are instrumented to detect data race bugs. See
12480 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
12481 more details. The run-time behavior can be influenced using the
12482 TSAN_OPTIONS environment variable; see
12483 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
12484 for a list of supported options. The option cannot be combined
12485 with -fsanitize=address, -fsanitize=leak.
12486
12487 Note that sanitized atomic builtins cannot throw exceptions when
12488 operating on invalid memory addresses with non-call exceptions
12489 (-fnon-call-exceptions).
12490
12491 -fsanitize=leak
12492 Enable LeakSanitizer, a memory leak detector. This option only
12493 matters for linking of executables and the executable is linked
12494 against a library that overrides "malloc" and other allocator
12495 functions. See
12496 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
12497 for more details. The run-time behavior can be influenced using
12498 the LSAN_OPTIONS environment variable. The option cannot be
12499 combined with -fsanitize=thread.
12500
12501 -fsanitize=undefined
12502 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
12503 detector. Various computations are instrumented to detect
12504 undefined behavior at runtime. Current suboptions are:
12505
12506 -fsanitize=shift
12507 This option enables checking that the result of a shift
12508 operation is not undefined. Note that what exactly is
12509 considered undefined differs slightly between C and C++, as
12510 well as between ISO C90 and C99, etc. This option has two
12511 suboptions, -fsanitize=shift-base and
12512 -fsanitize=shift-exponent.
12513
12514 -fsanitize=shift-exponent
12515 This option enables checking that the second argument of a
12516 shift operation is not negative and is smaller than the
12517 precision of the promoted first argument.
12518
12519 -fsanitize=shift-base
12520 If the second argument of a shift operation is within range,
12521 check that the result of a shift operation is not undefined.
12522 Note that what exactly is considered undefined differs slightly
12523 between C and C++, as well as between ISO C90 and C99, etc.
12524
12525 -fsanitize=integer-divide-by-zero
12526 Detect integer division by zero as well as "INT_MIN / -1"
12527 division.
12528
12529 -fsanitize=unreachable
12530 With this option, the compiler turns the
12531 "__builtin_unreachable" call into a diagnostics message call
12532 instead. When reaching the "__builtin_unreachable" call, the
12533 behavior is undefined.
12534
12535 -fsanitize=vla-bound
12536 This option instructs the compiler to check that the size of a
12537 variable length array is positive.
12538
12539 -fsanitize=null
12540 This option enables pointer checking. Particularly, the
12541 application built with this option turned on will issue an
12542 error message when it tries to dereference a NULL pointer, or
12543 if a reference (possibly an rvalue reference) is bound to a
12544 NULL pointer, or if a method is invoked on an object pointed by
12545 a NULL pointer.
12546
12547 -fsanitize=return
12548 This option enables return statement checking. Programs built
12549 with this option turned on will issue an error message when the
12550 end of a non-void function is reached without actually
12551 returning a value. This option works in C++ only.
12552
12553 -fsanitize=signed-integer-overflow
12554 This option enables signed integer overflow checking. We check
12555 that the result of "+", "*", and both unary and binary "-" does
12556 not overflow in the signed arithmetics. Note, integer
12557 promotion rules must be taken into account. That is, the
12558 following is not an overflow:
12559
12560 signed char a = SCHAR_MAX;
12561 a++;
12562
12563 -fsanitize=bounds
12564 This option enables instrumentation of array bounds. Various
12565 out of bounds accesses are detected. Flexible array members,
12566 flexible array member-like arrays, and initializers of
12567 variables with static storage are not instrumented.
12568
12569 -fsanitize=bounds-strict
12570 This option enables strict instrumentation of array bounds.
12571 Most out of bounds accesses are detected, including flexible
12572 array members and flexible array member-like arrays.
12573 Initializers of variables with static storage are not
12574 instrumented.
12575
12576 -fsanitize=alignment
12577 This option enables checking of alignment of pointers when they
12578 are dereferenced, or when a reference is bound to
12579 insufficiently aligned target, or when a method or constructor
12580 is invoked on insufficiently aligned object.
12581
12582 -fsanitize=object-size
12583 This option enables instrumentation of memory references using
12584 the "__builtin_object_size" function. Various out of bounds
12585 pointer accesses are detected.
12586
12587 -fsanitize=float-divide-by-zero
12588 Detect floating-point division by zero. Unlike other similar
12589 options, -fsanitize=float-divide-by-zero is not enabled by
12590 -fsanitize=undefined, since floating-point division by zero can
12591 be a legitimate way of obtaining infinities and NaNs.
12592
12593 -fsanitize=float-cast-overflow
12594 This option enables floating-point type to integer conversion
12595 checking. We check that the result of the conversion does not
12596 overflow. Unlike other similar options,
12597 -fsanitize=float-cast-overflow is not enabled by
12598 -fsanitize=undefined. This option does not work well with
12599 "FE_INVALID" exceptions enabled.
12600
12601 -fsanitize=nonnull-attribute
12602 This option enables instrumentation of calls, checking whether
12603 null values are not passed to arguments marked as requiring a
12604 non-null value by the "nonnull" function attribute.
12605
12606 -fsanitize=returns-nonnull-attribute
12607 This option enables instrumentation of return statements in
12608 functions marked with "returns_nonnull" function attribute, to
12609 detect returning of null values from such functions.
12610
12611 -fsanitize=bool
12612 This option enables instrumentation of loads from bool. If a
12613 value other than 0/1 is loaded, a run-time error is issued.
12614
12615 -fsanitize=enum
12616 This option enables instrumentation of loads from an enum type.
12617 If a value outside the range of values for the enum type is
12618 loaded, a run-time error is issued.
12619
12620 -fsanitize=vptr
12621 This option enables instrumentation of C++ member function
12622 calls, member accesses and some conversions between pointers to
12623 base and derived classes, to verify the referenced object has
12624 the correct dynamic type.
12625
12626 -fsanitize=pointer-overflow
12627 This option enables instrumentation of pointer arithmetics. If
12628 the pointer arithmetics overflows, a run-time error is issued.
12629
12630 -fsanitize=builtin
12631 This option enables instrumentation of arguments to selected
12632 builtin functions. If an invalid value is passed to such
12633 arguments, a run-time error is issued. E.g. passing 0 as the
12634 argument to "__builtin_ctz" or "__builtin_clz" invokes
12635 undefined behavior and is diagnosed by this option.
12636
12637 While -ftrapv causes traps for signed overflows to be emitted,
12638 -fsanitize=undefined gives a diagnostic message. This currently
12639 works only for the C family of languages.
12640
12641 -fno-sanitize=all
12642 This option disables all previously enabled sanitizers.
12643 -fsanitize=all is not allowed, as some sanitizers cannot be used
12644 together.
12645
12646 -fasan-shadow-offset=number
12647 This option forces GCC to use custom shadow offset in
12648 AddressSanitizer checks. It is useful for experimenting with
12649 different shadow memory layouts in Kernel AddressSanitizer.
12650
12651 -fsanitize-sections=s1,s2,...
12652 Sanitize global variables in selected user-defined sections. si
12653 may contain wildcards.
12654
12655 -fsanitize-recover[=opts]
12656 -fsanitize-recover= controls error recovery mode for sanitizers
12657 mentioned in comma-separated list of opts. Enabling this option
12658 for a sanitizer component causes it to attempt to continue running
12659 the program as if no error happened. This means multiple runtime
12660 errors can be reported in a single program run, and the exit code
12661 of the program may indicate success even when errors have been
12662 reported. The -fno-sanitize-recover= option can be used to alter
12663 this behavior: only the first detected error is reported and
12664 program then exits with a non-zero exit code.
12665
12666 Currently this feature only works for -fsanitize=undefined (and its
12667 suboptions except for -fsanitize=unreachable and
12668 -fsanitize=return), -fsanitize=float-cast-overflow,
12669 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
12670 -fsanitize=kernel-address and -fsanitize=address. For these
12671 sanitizers error recovery is turned on by default, except
12672 -fsanitize=address, for which this feature is experimental.
12673 -fsanitize-recover=all and -fno-sanitize-recover=all is also
12674 accepted, the former enables recovery for all sanitizers that
12675 support it, the latter disables recovery for all sanitizers that
12676 support it.
12677
12678 Even if a recovery mode is turned on the compiler side, it needs to
12679 be also enabled on the runtime library side, otherwise the failures
12680 are still fatal. The runtime library defaults to "halt_on_error=0"
12681 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
12682 value for AddressSanitizer is "halt_on_error=1". This can be
12683 overridden through setting the "halt_on_error" flag in the
12684 corresponding environment variable.
12685
12686 Syntax without an explicit opts parameter is deprecated. It is
12687 equivalent to specifying an opts list of:
12688
12689 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12690
12691 -fsanitize-address-use-after-scope
12692 Enable sanitization of local variables to detect use-after-scope
12693 bugs. The option sets -fstack-reuse to none.
12694
12695 -fsanitize-undefined-trap-on-error
12696 The -fsanitize-undefined-trap-on-error option instructs the
12697 compiler to report undefined behavior using "__builtin_trap" rather
12698 than a "libubsan" library routine. The advantage of this is that
12699 the "libubsan" library is not needed and is not linked in, so this
12700 is usable even in freestanding environments.
12701
12702 -fsanitize-coverage=trace-pc
12703 Enable coverage-guided fuzzing code instrumentation. Inserts a
12704 call to "__sanitizer_cov_trace_pc" into every basic block.
12705
12706 -fsanitize-coverage=trace-cmp
12707 Enable dataflow guided fuzzing code instrumentation. Inserts a
12708 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
12709 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
12710 integral comparison with both operands variable or
12711 "__sanitizer_cov_trace_const_cmp1",
12712 "__sanitizer_cov_trace_const_cmp2",
12713 "__sanitizer_cov_trace_const_cmp4" or
12714 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
12715 operand constant, "__sanitizer_cov_trace_cmpf" or
12716 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
12717 "__sanitizer_cov_trace_switch" for switch statements.
12718
12719 -fcf-protection=[full|branch|return|none|check]
12720 Enable code instrumentation of control-flow transfers to increase
12721 program security by checking that target addresses of control-flow
12722 transfer instructions (such as indirect function call, function
12723 return, indirect jump) are valid. This prevents diverting the flow
12724 of control to an unexpected target. This is intended to protect
12725 against such threats as Return-oriented Programming (ROP), and
12726 similarly call/jmp-oriented programming (COP/JOP).
12727
12728 The value "branch" tells the compiler to implement checking of
12729 validity of control-flow transfer at the point of indirect branch
12730 instructions, i.e. call/jmp instructions. The value "return"
12731 implements checking of validity at the point of returning from a
12732 function. The value "full" is an alias for specifying both
12733 "branch" and "return". The value "none" turns off instrumentation.
12734
12735 The value "check" is used for the final link with link-time
12736 optimization (LTO). An error is issued if LTO object files are
12737 compiled with different -fcf-protection values. The value "check"
12738 is ignored at the compile time.
12739
12740 The macro "__CET__" is defined when -fcf-protection is used. The
12741 first bit of "__CET__" is set to 1 for the value "branch" and the
12742 second bit of "__CET__" is set to 1 for the "return".
12743
12744 You can also use the "nocf_check" attribute to identify which
12745 functions and calls should be skipped from instrumentation.
12746
12747 Currently the x86 GNU/Linux target provides an implementation based
12748 on Intel Control-flow Enforcement Technology (CET).
12749
12750 -fstack-protector
12751 Emit extra code to check for buffer overflows, such as stack
12752 smashing attacks. This is done by adding a guard variable to
12753 functions with vulnerable objects. This includes functions that
12754 call "alloca", and functions with buffers larger than or equal to 8
12755 bytes. The guards are initialized when a function is entered and
12756 then checked when the function exits. If a guard check fails, an
12757 error message is printed and the program exits. Only variables
12758 that are actually allocated on the stack are considered, optimized
12759 away variables or variables allocated in registers don't count.
12760
12761 -fstack-protector-all
12762 Like -fstack-protector except that all functions are protected.
12763
12764 -fstack-protector-strong
12765 Like -fstack-protector but includes additional functions to be
12766 protected --- those that have local array definitions, or have
12767 references to local frame addresses. Only variables that are
12768 actually allocated on the stack are considered, optimized away
12769 variables or variables allocated in registers don't count.
12770
12771 -fstack-protector-explicit
12772 Like -fstack-protector but only protects those functions which have
12773 the "stack_protect" attribute.
12774
12775 -fstack-check
12776 Generate code to verify that you do not go beyond the boundary of
12777 the stack. You should specify this flag if you are running in an
12778 environment with multiple threads, but you only rarely need to
12779 specify it in a single-threaded environment since stack overflow is
12780 automatically detected on nearly all systems if there is only one
12781 stack.
12782
12783 Note that this switch does not actually cause checking to be done;
12784 the operating system or the language runtime must do that. The
12785 switch causes generation of code to ensure that they see the stack
12786 being extended.
12787
12788 You can additionally specify a string parameter: no means no
12789 checking, generic means force the use of old-style checking,
12790 specific means use the best checking method and is equivalent to
12791 bare -fstack-check.
12792
12793 Old-style checking is a generic mechanism that requires no specific
12794 target support in the compiler but comes with the following
12795 drawbacks:
12796
12797 1. Modified allocation strategy for large objects: they are always
12798 allocated dynamically if their size exceeds a fixed threshold.
12799 Note this may change the semantics of some code.
12800
12801 2. Fixed limit on the size of the static frame of functions: when
12802 it is topped by a particular function, stack checking is not
12803 reliable and a warning is issued by the compiler.
12804
12805 3. Inefficiency: because of both the modified allocation strategy
12806 and the generic implementation, code performance is hampered.
12807
12808 Note that old-style stack checking is also the fallback method for
12809 specific if no target support has been added in the compiler.
12810
12811 -fstack-check= is designed for Ada's needs to detect infinite
12812 recursion and stack overflows. specific is an excellent choice
12813 when compiling Ada code. It is not generally sufficient to protect
12814 against stack-clash attacks. To protect against those you want
12815 -fstack-clash-protection.
12816
12817 -fstack-clash-protection
12818 Generate code to prevent stack clash style attacks. When this
12819 option is enabled, the compiler will only allocate one page of
12820 stack space at a time and each page is accessed immediately after
12821 allocation. Thus, it prevents allocations from jumping over any
12822 stack guard page provided by the operating system.
12823
12824 Most targets do not fully support stack clash protection. However,
12825 on those targets -fstack-clash-protection will protect dynamic
12826 stack allocations. -fstack-clash-protection may also provide
12827 limited protection for static stack allocations if the target
12828 supports -fstack-check=specific.
12829
12830 -fstack-limit-register=reg
12831 -fstack-limit-symbol=sym
12832 -fno-stack-limit
12833 Generate code to ensure that the stack does not grow beyond a
12834 certain value, either the value of a register or the address of a
12835 symbol. If a larger stack is required, a signal is raised at run
12836 time. For most targets, the signal is raised before the stack
12837 overruns the boundary, so it is possible to catch the signal
12838 without taking special precautions.
12839
12840 For instance, if the stack starts at absolute address 0x80000000
12841 and grows downwards, you can use the flags
12842 -fstack-limit-symbol=__stack_limit and
12843 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
12844 128KB. Note that this may only work with the GNU linker.
12845
12846 You can locally override stack limit checking by using the
12847 "no_stack_limit" function attribute.
12848
12849 -fsplit-stack
12850 Generate code to automatically split the stack before it overflows.
12851 The resulting program has a discontiguous stack which can only
12852 overflow if the program is unable to allocate any more memory.
12853 This is most useful when running threaded programs, as it is no
12854 longer necessary to calculate a good stack size to use for each
12855 thread. This is currently only implemented for the x86 targets
12856 running GNU/Linux.
12857
12858 When code compiled with -fsplit-stack calls code compiled without
12859 -fsplit-stack, there may not be much stack space available for the
12860 latter code to run. If compiling all code, including library code,
12861 with -fsplit-stack is not an option, then the linker can fix up
12862 these calls so that the code compiled without -fsplit-stack always
12863 has a large stack. Support for this is implemented in the gold
12864 linker in GNU binutils release 2.21 and later.
12865
12866 -fvtable-verify=[std|preinit|none]
12867 This option is only available when compiling C++ code. It turns on
12868 (or off, if using -fvtable-verify=none) the security feature that
12869 verifies at run time, for every virtual call, that the vtable
12870 pointer through which the call is made is valid for the type of the
12871 object, and has not been corrupted or overwritten. If an invalid
12872 vtable pointer is detected at run time, an error is reported and
12873 execution of the program is immediately halted.
12874
12875 This option causes run-time data structures to be built at program
12876 startup, which are used for verifying the vtable pointers. The
12877 options std and preinit control the timing of when these data
12878 structures are built. In both cases the data structures are built
12879 before execution reaches "main". Using -fvtable-verify=std causes
12880 the data structures to be built after shared libraries have been
12881 loaded and initialized. -fvtable-verify=preinit causes them to be
12882 built before shared libraries have been loaded and initialized.
12883
12884 If this option appears multiple times in the command line with
12885 different values specified, none takes highest priority over both
12886 std and preinit; preinit takes priority over std.
12887
12888 -fvtv-debug
12889 When used in conjunction with -fvtable-verify=std or
12890 -fvtable-verify=preinit, causes debug versions of the runtime
12891 functions for the vtable verification feature to be called. This
12892 flag also causes the compiler to log information about which vtable
12893 pointers it finds for each class. This information is written to a
12894 file named vtv_set_ptr_data.log in the directory named by the
12895 environment variable VTV_LOGS_DIR if that is defined or the current
12896 working directory otherwise.
12897
12898 Note: This feature appends data to the log file. If you want a
12899 fresh log file, be sure to delete any existing one.
12900
12901 -fvtv-counts
12902 This is a debugging flag. When used in conjunction with
12903 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
12904 compiler to keep track of the total number of virtual calls it
12905 encounters and the number of verifications it inserts. It also
12906 counts the number of calls to certain run-time library functions
12907 that it inserts and logs this information for each compilation
12908 unit. The compiler writes this information to a file named
12909 vtv_count_data.log in the directory named by the environment
12910 variable VTV_LOGS_DIR if that is defined or the current working
12911 directory otherwise. It also counts the size of the vtable pointer
12912 sets for each class, and writes this information to
12913 vtv_class_set_sizes.log in the same directory.
12914
12915 Note: This feature appends data to the log files. To get fresh
12916 log files, be sure to delete any existing ones.
12917
12918 -finstrument-functions
12919 Generate instrumentation calls for entry and exit to functions.
12920 Just after function entry and just before function exit, the
12921 following profiling functions are called with the address of the
12922 current function and its call site. (On some platforms,
12923 "__builtin_return_address" does not work beyond the current
12924 function, so the call site information may not be available to the
12925 profiling functions otherwise.)
12926
12927 void __cyg_profile_func_enter (void *this_fn,
12928 void *call_site);
12929 void __cyg_profile_func_exit (void *this_fn,
12930 void *call_site);
12931
12932 The first argument is the address of the start of the current
12933 function, which may be looked up exactly in the symbol table.
12934
12935 This instrumentation is also done for functions expanded inline in
12936 other functions. The profiling calls indicate where, conceptually,
12937 the inline function is entered and exited. This means that
12938 addressable versions of such functions must be available. If all
12939 your uses of a function are expanded inline, this may mean an
12940 additional expansion of code size. If you use "extern inline" in
12941 your C code, an addressable version of such functions must be
12942 provided. (This is normally the case anyway, but if you get lucky
12943 and the optimizer always expands the functions inline, you might
12944 have gotten away without providing static copies.)
12945
12946 A function may be given the attribute "no_instrument_function", in
12947 which case this instrumentation is not done. This can be used, for
12948 example, for the profiling functions listed above, high-priority
12949 interrupt routines, and any functions from which the profiling
12950 functions cannot safely be called (perhaps signal handlers, if the
12951 profiling routines generate output or allocate memory).
12952
12953 -finstrument-functions-exclude-file-list=file,file,...
12954 Set the list of functions that are excluded from instrumentation
12955 (see the description of -finstrument-functions). If the file that
12956 contains a function definition matches with one of file, then that
12957 function is not instrumented. The match is done on substrings: if
12958 the file parameter is a substring of the file name, it is
12959 considered to be a match.
12960
12961 For example:
12962
12963 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12964
12965 excludes any inline function defined in files whose pathnames
12966 contain /bits/stl or include/sys.
12967
12968 If, for some reason, you want to include letter , in one of sym,
12969 write ,. For example,
12970 -finstrument-functions-exclude-file-list=',,tmp' (note the single
12971 quote surrounding the option).
12972
12973 -finstrument-functions-exclude-function-list=sym,sym,...
12974 This is similar to -finstrument-functions-exclude-file-list, but
12975 this option sets the list of function names to be excluded from
12976 instrumentation. The function name to be matched is its user-
12977 visible name, such as "vector<int> blah(const vector<int> &)", not
12978 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
12979 match is done on substrings: if the sym parameter is a substring of
12980 the function name, it is considered to be a match. For C99 and C++
12981 extended identifiers, the function name must be given in UTF-8, not
12982 using universal character names.
12983
12984 -fpatchable-function-entry=N[,M]
12985 Generate N NOPs right at the beginning of each function, with the
12986 function entry point before the Mth NOP. If M is omitted, it
12987 defaults to 0 so the function entry points to the address just at
12988 the first NOP. The NOP instructions reserve extra space which can
12989 be used to patch in any desired instrumentation at run time,
12990 provided that the code segment is writable. The amount of space is
12991 controllable indirectly via the number of NOPs; the NOP instruction
12992 used corresponds to the instruction emitted by the internal GCC
12993 back-end interface "gen_nop". This behavior is target-specific and
12994 may also depend on the architecture variant and/or other
12995 compilation options.
12996
12997 For run-time identification, the starting addresses of these areas,
12998 which correspond to their respective function entries minus M, are
12999 additionally collected in the "__patchable_function_entries"
13000 section of the resulting binary.
13001
13002 Note that the value of "__attribute__ ((patchable_function_entry
13003 (N,M)))" takes precedence over command-line option
13004 -fpatchable-function-entry=N,M. This can be used to increase the
13005 area size or to remove it completely on a single function. If
13006 "N=0", no pad location is recorded.
13007
13008 The NOP instructions are inserted at---and maybe before, depending
13009 on M---the function entry address, even before the prologue.
13010
13011 The maximum value of N and M is 65535.
13012
13013 Options Controlling the Preprocessor
13014 These options control the C preprocessor, which is run on each C source
13015 file before actual compilation.
13016
13017 If you use the -E option, nothing is done except preprocessing. Some
13018 of these options make sense only together with -E because they cause
13019 the preprocessor output to be unsuitable for actual compilation.
13020
13021 In addition to the options listed here, there are a number of options
13022 to control search paths for include files documented in Directory
13023 Options. Options to control preprocessor diagnostics are listed in
13024 Warning Options.
13025
13026 -D name
13027 Predefine name as a macro, with definition 1.
13028
13029 -D name=definition
13030 The contents of definition are tokenized and processed as if they
13031 appeared during translation phase three in a #define directive. In
13032 particular, the definition is truncated by embedded newline
13033 characters.
13034
13035 If you are invoking the preprocessor from a shell or shell-like
13036 program you may need to use the shell's quoting syntax to protect
13037 characters such as spaces that have a meaning in the shell syntax.
13038
13039 If you wish to define a function-like macro on the command line,
13040 write its argument list with surrounding parentheses before the
13041 equals sign (if any). Parentheses are meaningful to most shells,
13042 so you should quote the option. With sh and csh,
13043 -D'name(args...)=definition' works.
13044
13045 -D and -U options are processed in the order they are given on the
13046 command line. All -imacros file and -include file options are
13047 processed after all -D and -U options.
13048
13049 -U name
13050 Cancel any previous definition of name, either built in or provided
13051 with a -D option.
13052
13053 -include file
13054 Process file as if "#include "file"" appeared as the first line of
13055 the primary source file. However, the first directory searched for
13056 file is the preprocessor's working directory instead of the
13057 directory containing the main source file. If not found there, it
13058 is searched for in the remainder of the "#include "..."" search
13059 chain as normal.
13060
13061 If multiple -include options are given, the files are included in
13062 the order they appear on the command line.
13063
13064 -imacros file
13065 Exactly like -include, except that any output produced by scanning
13066 file is thrown away. Macros it defines remain defined. This
13067 allows you to acquire all the macros from a header without also
13068 processing its declarations.
13069
13070 All files specified by -imacros are processed before all files
13071 specified by -include.
13072
13073 -undef
13074 Do not predefine any system-specific or GCC-specific macros. The
13075 standard predefined macros remain defined.
13076
13077 -pthread
13078 Define additional macros required for using the POSIX threads
13079 library. You should use this option consistently for both
13080 compilation and linking. This option is supported on GNU/Linux
13081 targets, most other Unix derivatives, and also on x86 Cygwin and
13082 MinGW targets.
13083
13084 -M Instead of outputting the result of preprocessing, output a rule
13085 suitable for make describing the dependencies of the main source
13086 file. The preprocessor outputs one make rule containing the object
13087 file name for that source file, a colon, and the names of all the
13088 included files, including those coming from -include or -imacros
13089 command-line options.
13090
13091 Unless specified explicitly (with -MT or -MQ), the object file name
13092 consists of the name of the source file with any suffix replaced
13093 with object file suffix and with any leading directory parts
13094 removed. If there are many included files then the rule is split
13095 into several lines using \-newline. The rule has no commands.
13096
13097 This option does not suppress the preprocessor's debug output, such
13098 as -dM. To avoid mixing such debug output with the dependency
13099 rules you should explicitly specify the dependency output file with
13100 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13101 Debug output is still sent to the regular output stream as normal.
13102
13103 Passing -M to the driver implies -E, and suppresses warnings with
13104 an implicit -w.
13105
13106 -MM Like -M but do not mention header files that are found in system
13107 header directories, nor header files that are included, directly or
13108 indirectly, from such a header.
13109
13110 This implies that the choice of angle brackets or double quotes in
13111 an #include directive does not in itself determine whether that
13112 header appears in -MM dependency output.
13113
13114 -MF file
13115 When used with -M or -MM, specifies a file to write the
13116 dependencies to. If no -MF switch is given the preprocessor sends
13117 the rules to the same place it would send preprocessed output.
13118
13119 When used with the driver options -MD or -MMD, -MF overrides the
13120 default dependency output file.
13121
13122 If file is -, then the dependencies are written to stdout.
13123
13124 -MG In conjunction with an option such as -M requesting dependency
13125 generation, -MG assumes missing header files are generated files
13126 and adds them to the dependency list without raising an error. The
13127 dependency filename is taken directly from the "#include" directive
13128 without prepending any path. -MG also suppresses preprocessed
13129 output, as a missing header file renders this useless.
13130
13131 This feature is used in automatic updating of makefiles.
13132
13133 -Mno-modules
13134 Disable dependency generation for compiled module interfaces.
13135
13136 -MP This option instructs CPP to add a phony target for each dependency
13137 other than the main file, causing each to depend on nothing. These
13138 dummy rules work around errors make gives if you remove header
13139 files without updating the Makefile to match.
13140
13141 This is typical output:
13142
13143 test.o: test.c test.h
13144
13145 test.h:
13146
13147 -MT target
13148 Change the target of the rule emitted by dependency generation. By
13149 default CPP takes the name of the main input file, deletes any
13150 directory components and any file suffix such as .c, and appends
13151 the platform's usual object suffix. The result is the target.
13152
13153 An -MT option sets the target to be exactly the string you specify.
13154 If you want multiple targets, you can specify them as a single
13155 argument to -MT, or use multiple -MT options.
13156
13157 For example, -MT '$(objpfx)foo.o' might give
13158
13159 $(objpfx)foo.o: foo.c
13160
13161 -MQ target
13162 Same as -MT, but it quotes any characters which are special to
13163 Make. -MQ '$(objpfx)foo.o' gives
13164
13165 $$(objpfx)foo.o: foo.c
13166
13167 The default target is automatically quoted, as if it were given
13168 with -MQ.
13169
13170 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
13171 The driver determines file based on whether an -o option is given.
13172 If it is, the driver uses its argument but with a suffix of .d,
13173 otherwise it takes the name of the input file, removes any
13174 directory components and suffix, and applies a .d suffix.
13175
13176 If -MD is used in conjunction with -E, any -o switch is understood
13177 to specify the dependency output file, but if used without -E, each
13178 -o is understood to specify a target object file.
13179
13180 Since -E is not implied, -MD can be used to generate a dependency
13181 output file as a side effect of the compilation process.
13182
13183 -MMD
13184 Like -MD except mention only user header files, not system header
13185 files.
13186
13187 -fpreprocessed
13188 Indicate to the preprocessor that the input file has already been
13189 preprocessed. This suppresses things like macro expansion,
13190 trigraph conversion, escaped newline splicing, and processing of
13191 most directives. The preprocessor still recognizes and removes
13192 comments, so that you can pass a file preprocessed with -C to the
13193 compiler without problems. In this mode the integrated
13194 preprocessor is little more than a tokenizer for the front ends.
13195
13196 -fpreprocessed is implicit if the input file has one of the
13197 extensions .i, .ii or .mi. These are the extensions that GCC uses
13198 for preprocessed files created by -save-temps.
13199
13200 -fdirectives-only
13201 When preprocessing, handle directives, but do not expand macros.
13202
13203 The option's behavior depends on the -E and -fpreprocessed options.
13204
13205 With -E, preprocessing is limited to the handling of directives
13206 such as "#define", "#ifdef", and "#error". Other preprocessor
13207 operations, such as macro expansion and trigraph conversion are not
13208 performed. In addition, the -dD option is implicitly enabled.
13209
13210 With -fpreprocessed, predefinition of command line and most builtin
13211 macros is disabled. Macros such as "__LINE__", which are
13212 contextually dependent, are handled normally. This enables
13213 compilation of files previously preprocessed with "-E
13214 -fdirectives-only".
13215
13216 With both -E and -fpreprocessed, the rules for -fpreprocessed take
13217 precedence. This enables full preprocessing of files previously
13218 preprocessed with "-E -fdirectives-only".
13219
13220 -fdollars-in-identifiers
13221 Accept $ in identifiers.
13222
13223 -fextended-identifiers
13224 Accept universal character names and extended characters in
13225 identifiers. This option is enabled by default for C99 (and later
13226 C standard versions) and C++.
13227
13228 -fno-canonical-system-headers
13229 When preprocessing, do not shorten system header paths with
13230 canonicalization.
13231
13232 -fmax-include-depth=depth
13233 Set the maximum depth of the nested #include. The default is 200.
13234
13235 -ftabstop=width
13236 Set the distance between tab stops. This helps the preprocessor
13237 report correct column numbers in warnings or errors, even if tabs
13238 appear on the line. If the value is less than 1 or greater than
13239 100, the option is ignored. The default is 8.
13240
13241 -ftrack-macro-expansion[=level]
13242 Track locations of tokens across macro expansions. This allows the
13243 compiler to emit diagnostic about the current macro expansion stack
13244 when a compilation error occurs in a macro expansion. Using this
13245 option makes the preprocessor and the compiler consume more memory.
13246 The level parameter can be used to choose the level of precision of
13247 token location tracking thus decreasing the memory consumption if
13248 necessary. Value 0 of level de-activates this option. Value 1
13249 tracks tokens locations in a degraded mode for the sake of minimal
13250 memory overhead. In this mode all tokens resulting from the
13251 expansion of an argument of a function-like macro have the same
13252 location. Value 2 tracks tokens locations completely. This value is
13253 the most memory hungry. When this option is given no argument, the
13254 default parameter value is 2.
13255
13256 Note that "-ftrack-macro-expansion=2" is activated by default.
13257
13258 -fmacro-prefix-map=old=new
13259 When preprocessing files residing in directory old, expand the
13260 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
13261 directory new instead. This can be used to change an absolute path
13262 to a relative path by using . for new which can result in more
13263 reproducible builds that are location independent. This option
13264 also affects "__builtin_FILE()" during compilation. See also
13265 -ffile-prefix-map.
13266
13267 -fexec-charset=charset
13268 Set the execution character set, used for string and character
13269 constants. The default is UTF-8. charset can be any encoding
13270 supported by the system's "iconv" library routine.
13271
13272 -fwide-exec-charset=charset
13273 Set the wide execution character set, used for wide string and
13274 character constants. The default is UTF-32 or UTF-16, whichever
13275 corresponds to the width of "wchar_t". As with -fexec-charset,
13276 charset can be any encoding supported by the system's "iconv"
13277 library routine; however, you will have problems with encodings
13278 that do not fit exactly in "wchar_t".
13279
13280 -finput-charset=charset
13281 Set the input character set, used for translation from the
13282 character set of the input file to the source character set used by
13283 GCC. If the locale does not specify, or GCC cannot get this
13284 information from the locale, the default is UTF-8. This can be
13285 overridden by either the locale or this command-line option.
13286 Currently the command-line option takes precedence if there's a
13287 conflict. charset can be any encoding supported by the system's
13288 "iconv" library routine.
13289
13290 -fpch-deps
13291 When using precompiled headers, this flag causes the dependency-
13292 output flags to also list the files from the precompiled header's
13293 dependencies. If not specified, only the precompiled header are
13294 listed and not the files that were used to create it, because those
13295 files are not consulted when a precompiled header is used.
13296
13297 -fpch-preprocess
13298 This option allows use of a precompiled header together with -E.
13299 It inserts a special "#pragma", "#pragma GCC pch_preprocess
13300 "filename"" in the output to mark the place where the precompiled
13301 header was found, and its filename. When -fpreprocessed is in use,
13302 GCC recognizes this "#pragma" and loads the PCH.
13303
13304 This option is off by default, because the resulting preprocessed
13305 output is only really suitable as input to GCC. It is switched on
13306 by -save-temps.
13307
13308 You should not write this "#pragma" in your own code, but it is
13309 safe to edit the filename if the PCH file is available in a
13310 different location. The filename may be absolute or it may be
13311 relative to GCC's current directory.
13312
13313 -fworking-directory
13314 Enable generation of linemarkers in the preprocessor output that
13315 let the compiler know the current working directory at the time of
13316 preprocessing. When this option is enabled, the preprocessor
13317 emits, after the initial linemarker, a second linemarker with the
13318 current working directory followed by two slashes. GCC uses this
13319 directory, when it's present in the preprocessed input, as the
13320 directory emitted as the current working directory in some
13321 debugging information formats. This option is implicitly enabled
13322 if debugging information is enabled, but this can be inhibited with
13323 the negated form -fno-working-directory. If the -P flag is present
13324 in the command line, this option has no effect, since no "#line"
13325 directives are emitted whatsoever.
13326
13327 -A predicate=answer
13328 Make an assertion with the predicate predicate and answer answer.
13329 This form is preferred to the older form -A predicate(answer),
13330 which is still supported, because it does not use shell special
13331 characters.
13332
13333 -A -predicate=answer
13334 Cancel an assertion with the predicate predicate and answer answer.
13335
13336 -C Do not discard comments. All comments are passed through to the
13337 output file, except for comments in processed directives, which are
13338 deleted along with the directive.
13339
13340 You should be prepared for side effects when using -C; it causes
13341 the preprocessor to treat comments as tokens in their own right.
13342 For example, comments appearing at the start of what would be a
13343 directive line have the effect of turning that line into an
13344 ordinary source line, since the first token on the line is no
13345 longer a #.
13346
13347 -CC Do not discard comments, including during macro expansion. This is
13348 like -C, except that comments contained within macros are also
13349 passed through to the output file where the macro is expanded.
13350
13351 In addition to the side effects of the -C option, the -CC option
13352 causes all C++-style comments inside a macro to be converted to
13353 C-style comments. This is to prevent later use of that macro from
13354 inadvertently commenting out the remainder of the source line.
13355
13356 The -CC option is generally used to support lint comments.
13357
13358 -P Inhibit generation of linemarkers in the output from the
13359 preprocessor. This might be useful when running the preprocessor
13360 on something that is not C code, and will be sent to a program
13361 which might be confused by the linemarkers.
13362
13363 -traditional
13364 -traditional-cpp
13365 Try to imitate the behavior of pre-standard C preprocessors, as
13366 opposed to ISO C preprocessors. See the GNU CPP manual for
13367 details.
13368
13369 Note that GCC does not otherwise attempt to emulate a pre-standard
13370 C compiler, and these options are only supported with the -E
13371 switch, or when invoking CPP explicitly.
13372
13373 -trigraphs
13374 Support ISO C trigraphs. These are three-character sequences, all
13375 starting with ??, that are defined by ISO C to stand for single
13376 characters. For example, ??/ stands for \, so '??/n' is a
13377 character constant for a newline.
13378
13379 The nine trigraphs and their replacements are
13380
13381 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
13382 Replacement: [ ] { } # \ ^ | ~
13383
13384 By default, GCC ignores trigraphs, but in standard-conforming modes
13385 it converts them. See the -std and -ansi options.
13386
13387 -remap
13388 Enable special code to work around file systems which only permit
13389 very short file names, such as MS-DOS.
13390
13391 -H Print the name of each header file used, in addition to other
13392 normal activities. Each name is indented to show how deep in the
13393 #include stack it is. Precompiled header files are also printed,
13394 even if they are found to be invalid; an invalid precompiled header
13395 file is printed with ...x and a valid one with ...! .
13396
13397 -dletters
13398 Says to make debugging dumps during compilation as specified by
13399 letters. The flags documented here are those relevant to the
13400 preprocessor. Other letters are interpreted by the compiler
13401 proper, or reserved for future versions of GCC, and so are silently
13402 ignored. If you specify letters whose behavior conflicts, the
13403 result is undefined.
13404
13405 -dM Instead of the normal output, generate a list of #define
13406 directives for all the macros defined during the execution of
13407 the preprocessor, including predefined macros. This gives you
13408 a way of finding out what is predefined in your version of the
13409 preprocessor. Assuming you have no file foo.h, the command
13410
13411 touch foo.h; cpp -dM foo.h
13412
13413 shows all the predefined macros.
13414
13415 If you use -dM without the -E option, -dM is interpreted as a
13416 synonym for -fdump-rtl-mach.
13417
13418 -dD Like -dM except in two respects: it does not include the
13419 predefined macros, and it outputs both the #define directives
13420 and the result of preprocessing. Both kinds of output go to
13421 the standard output file.
13422
13423 -dN Like -dD, but emit only the macro names, not their expansions.
13424
13425 -dI Output #include directives in addition to the result of
13426 preprocessing.
13427
13428 -dU Like -dD except that only macros that are expanded, or whose
13429 definedness is tested in preprocessor directives, are output;
13430 the output is delayed until the use or test of the macro; and
13431 #undef directives are also output for macros tested but
13432 undefined at the time.
13433
13434 -fdebug-cpp
13435 This option is only useful for debugging GCC. When used from CPP
13436 or with -E, it dumps debugging information about location maps.
13437 Every token in the output is preceded by the dump of the map its
13438 location belongs to.
13439
13440 When used from GCC without -E, this option has no effect.
13441
13442 -Wp,option
13443 You can use -Wp,option to bypass the compiler driver and pass
13444 option directly through to the preprocessor. If option contains
13445 commas, it is split into multiple options at the commas. However,
13446 many options are modified, translated or interpreted by the
13447 compiler driver before being passed to the preprocessor, and -Wp
13448 forcibly bypasses this phase. The preprocessor's direct interface
13449 is undocumented and subject to change, so whenever possible you
13450 should avoid using -Wp and let the driver handle the options
13451 instead.
13452
13453 -Xpreprocessor option
13454 Pass option as an option to the preprocessor. You can use this to
13455 supply system-specific preprocessor options that GCC does not
13456 recognize.
13457
13458 If you want to pass an option that takes an argument, you must use
13459 -Xpreprocessor twice, once for the option and once for the
13460 argument.
13461
13462 -no-integrated-cpp
13463 Perform preprocessing as a separate pass before compilation. By
13464 default, GCC performs preprocessing as an integrated part of input
13465 tokenization and parsing. If this option is provided, the
13466 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
13467 and Objective-C, respectively) is instead invoked twice, once for
13468 preprocessing only and once for actual compilation of the
13469 preprocessed input. This option may be useful in conjunction with
13470 the -B or -wrapper options to specify an alternate preprocessor or
13471 perform additional processing of the program source between normal
13472 preprocessing and compilation.
13473
13474 -flarge-source-files
13475 Adjust GCC to expect large source files, at the expense of slower
13476 compilation and higher memory usage.
13477
13478 Specifically, GCC normally tracks both column numbers and line
13479 numbers within source files and it normally prints both of these
13480 numbers in diagnostics. However, once it has processed a certain
13481 number of source lines, it stops tracking column numbers and only
13482 tracks line numbers. This means that diagnostics for later lines
13483 do not include column numbers. It also means that options like
13484 -Wmisleading-indentation cease to work at that point, although the
13485 compiler prints a note if this happens. Passing
13486 -flarge-source-files significantly increases the number of source
13487 lines that GCC can process before it stops tracking columns.
13488
13489 Passing Options to the Assembler
13490 You can pass options to the assembler.
13491
13492 -Wa,option
13493 Pass option as an option to the assembler. If option contains
13494 commas, it is split into multiple options at the commas.
13495
13496 -Xassembler option
13497 Pass option as an option to the assembler. You can use this to
13498 supply system-specific assembler options that GCC does not
13499 recognize.
13500
13501 If you want to pass an option that takes an argument, you must use
13502 -Xassembler twice, once for the option and once for the argument.
13503
13504 Options for Linking
13505 These options come into play when the compiler links object files into
13506 an executable output file. They are meaningless if the compiler is not
13507 doing a link step.
13508
13509 object-file-name
13510 A file name that does not end in a special recognized suffix is
13511 considered to name an object file or library. (Object files are
13512 distinguished from libraries by the linker according to the file
13513 contents.) If linking is done, these object files are used as
13514 input to the linker.
13515
13516 -c
13517 -S
13518 -E If any of these options is used, then the linker is not run, and
13519 object file names should not be used as arguments.
13520
13521 -flinker-output=type
13522 This option controls code generation of the link-time optimizer.
13523 By default the linker output is automatically determined by the
13524 linker plugin. For debugging the compiler and if incremental
13525 linking with a non-LTO object file is desired, it may be useful to
13526 control the type manually.
13527
13528 If type is exec, code generation produces a static binary. In this
13529 case -fpic and -fpie are both disabled.
13530
13531 If type is dyn, code generation produces a shared library. In this
13532 case -fpic or -fPIC is preserved, but not enabled automatically.
13533 This allows to build shared libraries without position-independent
13534 code on architectures where this is possible, i.e. on x86.
13535
13536 If type is pie, code generation produces an -fpie executable. This
13537 results in similar optimizations as exec except that -fpie is not
13538 disabled if specified at compilation time.
13539
13540 If type is rel, the compiler assumes that incremental linking is
13541 done. The sections containing intermediate code for link-time
13542 optimization are merged, pre-optimized, and output to the resulting
13543 object file. In addition, if -ffat-lto-objects is specified, binary
13544 code is produced for future non-LTO linking. The object file
13545 produced by incremental linking is smaller than a static library
13546 produced from the same object files. At link time the result of
13547 incremental linking also loads faster than a static library
13548 assuming that the majority of objects in the library are used.
13549
13550 Finally nolto-rel configures the compiler for incremental linking
13551 where code generation is forced, a final binary is produced, and
13552 the intermediate code for later link-time optimization is stripped.
13553 When multiple object files are linked together the resulting code
13554 is better optimized than with link-time optimizations disabled (for
13555 example, cross-module inlining happens), but most of benefits of
13556 whole program optimizations are lost.
13557
13558 During the incremental link (by -r) the linker plugin defaults to
13559 rel. With current interfaces to GNU Binutils it is however not
13560 possible to incrementally link LTO objects and non-LTO objects into
13561 a single mixed object file. If any of object files in incremental
13562 link cannot be used for link-time optimization, the linker plugin
13563 issues a warning and uses nolto-rel. To maintain whole program
13564 optimization, it is recommended to link such objects into static
13565 library instead. Alternatively it is possible to use H.J. Lu's
13566 binutils with support for mixed objects.
13567
13568 -fuse-ld=bfd
13569 Use the bfd linker instead of the default linker.
13570
13571 -fuse-ld=gold
13572 Use the gold linker instead of the default linker.
13573
13574 -fuse-ld=lld
13575 Use the LLVM lld linker instead of the default linker.
13576
13577 -llibrary
13578 -l library
13579 Search the library named library when linking. (The second
13580 alternative with the library as a separate argument is only for
13581 POSIX compliance and is not recommended.)
13582
13583 The -l option is passed directly to the linker by GCC. Refer to
13584 your linker documentation for exact details. The general
13585 description below applies to the GNU linker.
13586
13587 The linker searches a standard list of directories for the library.
13588 The directories searched include several standard system
13589 directories plus any that you specify with -L.
13590
13591 Static libraries are archives of object files, and have file names
13592 like liblibrary.a. Some targets also support shared libraries,
13593 which typically have names like liblibrary.so. If both static and
13594 shared libraries are found, the linker gives preference to linking
13595 with the shared library unless the -static option is used.
13596
13597 It makes a difference where in the command you write this option;
13598 the linker searches and processes libraries and object files in the
13599 order they are specified. Thus, foo.o -lz bar.o searches library z
13600 after file foo.o but before bar.o. If bar.o refers to functions in
13601 z, those functions may not be loaded.
13602
13603 -lobjc
13604 You need this special case of the -l option in order to link an
13605 Objective-C or Objective-C++ program.
13606
13607 -nostartfiles
13608 Do not use the standard system startup files when linking. The
13609 standard system libraries are used normally, unless -nostdlib,
13610 -nolibc, or -nodefaultlibs is used.
13611
13612 -nodefaultlibs
13613 Do not use the standard system libraries when linking. Only the
13614 libraries you specify are passed to the linker, and options
13615 specifying linkage of the system libraries, such as -static-libgcc
13616 or -shared-libgcc, are ignored. The standard startup files are
13617 used normally, unless -nostartfiles is used.
13618
13619 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13620 "memmove". These entries are usually resolved by entries in libc.
13621 These entry points should be supplied through some other mechanism
13622 when this option is specified.
13623
13624 -nolibc
13625 Do not use the C library or system libraries tightly coupled with
13626 it when linking. Still link with the startup files, libgcc or
13627 toolchain provided language support libraries such as libgnat,
13628 libgfortran or libstdc++ unless options preventing their inclusion
13629 are used as well. This typically removes -lc from the link command
13630 line, as well as system libraries that normally go with it and
13631 become meaningless when absence of a C library is assumed, for
13632 example -lpthread or -lm in some configurations. This is intended
13633 for bare-board targets when there is indeed no C library available.
13634
13635 -nostdlib
13636 Do not use the standard system startup files or libraries when
13637 linking. No startup files and only the libraries you specify are
13638 passed to the linker, and options specifying linkage of the system
13639 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
13640
13641 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13642 "memmove". These entries are usually resolved by entries in libc.
13643 These entry points should be supplied through some other mechanism
13644 when this option is specified.
13645
13646 One of the standard libraries bypassed by -nostdlib and
13647 -nodefaultlibs is libgcc.a, a library of internal subroutines which
13648 GCC uses to overcome shortcomings of particular machines, or
13649 special needs for some languages.
13650
13651 In most cases, you need libgcc.a even when you want to avoid other
13652 standard libraries. In other words, when you specify -nostdlib or
13653 -nodefaultlibs you should usually specify -lgcc as well. This
13654 ensures that you have no unresolved references to internal GCC
13655 library subroutines. (An example of such an internal subroutine is
13656 "__main", used to ensure C++ constructors are called.)
13657
13658 -e entry
13659 --entry=entry
13660 Specify that the program entry point is entry. The argument is
13661 interpreted by the linker; the GNU linker accepts either a symbol
13662 name or an address.
13663
13664 -pie
13665 Produce a dynamically linked position independent executable on
13666 targets that support it. For predictable results, you must also
13667 specify the same set of options used for compilation (-fpie, -fPIE,
13668 or model suboptions) when you specify this linker option.
13669
13670 -no-pie
13671 Don't produce a dynamically linked position independent executable.
13672
13673 -static-pie
13674 Produce a static position independent executable on targets that
13675 support it. A static position independent executable is similar to
13676 a static executable, but can be loaded at any address without a
13677 dynamic linker. For predictable results, you must also specify the
13678 same set of options used for compilation (-fpie, -fPIE, or model
13679 suboptions) when you specify this linker option.
13680
13681 -pthread
13682 Link with the POSIX threads library. This option is supported on
13683 GNU/Linux targets, most other Unix derivatives, and also on x86
13684 Cygwin and MinGW targets. On some targets this option also sets
13685 flags for the preprocessor, so it should be used consistently for
13686 both compilation and linking.
13687
13688 -r Produce a relocatable object as output. This is also known as
13689 partial linking.
13690
13691 -rdynamic
13692 Pass the flag -export-dynamic to the ELF linker, on targets that
13693 support it. This instructs the linker to add all symbols, not only
13694 used ones, to the dynamic symbol table. This option is needed for
13695 some uses of "dlopen" or to allow obtaining backtraces from within
13696 a program.
13697
13698 -s Remove all symbol table and relocation information from the
13699 executable.
13700
13701 -static
13702 On systems that support dynamic linking, this overrides -pie and
13703 prevents linking with the shared libraries. On other systems, this
13704 option has no effect.
13705
13706 -shared
13707 Produce a shared object which can then be linked with other objects
13708 to form an executable. Not all systems support this option. For
13709 predictable results, you must also specify the same set of options
13710 used for compilation (-fpic, -fPIC, or model suboptions) when you
13711 specify this linker option.[1]
13712
13713 -shared-libgcc
13714 -static-libgcc
13715 On systems that provide libgcc as a shared library, these options
13716 force the use of either the shared or static version, respectively.
13717 If no shared version of libgcc was built when the compiler was
13718 configured, these options have no effect.
13719
13720 There are several situations in which an application should use the
13721 shared libgcc instead of the static version. The most common of
13722 these is when the application wishes to throw and catch exceptions
13723 across different shared libraries. In that case, each of the
13724 libraries as well as the application itself should use the shared
13725 libgcc.
13726
13727 Therefore, the G++ driver automatically adds -shared-libgcc
13728 whenever you build a shared library or a main executable, because
13729 C++ programs typically use exceptions, so this is the right thing
13730 to do.
13731
13732 If, instead, you use the GCC driver to create shared libraries, you
13733 may find that they are not always linked with the shared libgcc.
13734 If GCC finds, at its configuration time, that you have a non-GNU
13735 linker or a GNU linker that does not support option --eh-frame-hdr,
13736 it links the shared version of libgcc into shared libraries by
13737 default. Otherwise, it takes advantage of the linker and optimizes
13738 away the linking with the shared version of libgcc, linking with
13739 the static version of libgcc by default. This allows exceptions to
13740 propagate through such shared libraries, without incurring
13741 relocation costs at library load time.
13742
13743 However, if a library or main executable is supposed to throw or
13744 catch exceptions, you must link it using the G++ driver, or using
13745 the option -shared-libgcc, such that it is linked with the shared
13746 libgcc.
13747
13748 -static-libasan
13749 When the -fsanitize=address option is used to link a program, the
13750 GCC driver automatically links against libasan. If libasan is
13751 available as a shared library, and the -static option is not used,
13752 then this links against the shared version of libasan. The
13753 -static-libasan option directs the GCC driver to link libasan
13754 statically, without necessarily linking other libraries statically.
13755
13756 -static-libtsan
13757 When the -fsanitize=thread option is used to link a program, the
13758 GCC driver automatically links against libtsan. If libtsan is
13759 available as a shared library, and the -static option is not used,
13760 then this links against the shared version of libtsan. The
13761 -static-libtsan option directs the GCC driver to link libtsan
13762 statically, without necessarily linking other libraries statically.
13763
13764 -static-liblsan
13765 When the -fsanitize=leak option is used to link a program, the GCC
13766 driver automatically links against liblsan. If liblsan is
13767 available as a shared library, and the -static option is not used,
13768 then this links against the shared version of liblsan. The
13769 -static-liblsan option directs the GCC driver to link liblsan
13770 statically, without necessarily linking other libraries statically.
13771
13772 -static-libubsan
13773 When the -fsanitize=undefined option is used to link a program, the
13774 GCC driver automatically links against libubsan. If libubsan is
13775 available as a shared library, and the -static option is not used,
13776 then this links against the shared version of libubsan. The
13777 -static-libubsan option directs the GCC driver to link libubsan
13778 statically, without necessarily linking other libraries statically.
13779
13780 -static-libstdc++
13781 When the g++ program is used to link a C++ program, it normally
13782 automatically links against libstdc++. If libstdc++ is available
13783 as a shared library, and the -static option is not used, then this
13784 links against the shared version of libstdc++. That is normally
13785 fine. However, it is sometimes useful to freeze the version of
13786 libstdc++ used by the program without going all the way to a fully
13787 static link. The -static-libstdc++ option directs the g++ driver
13788 to link libstdc++ statically, without necessarily linking other
13789 libraries statically.
13790
13791 -symbolic
13792 Bind references to global symbols when building a shared object.
13793 Warn about any unresolved references (unless overridden by the link
13794 editor option -Xlinker -z -Xlinker defs). Only a few systems
13795 support this option.
13796
13797 -T script
13798 Use script as the linker script. This option is supported by most
13799 systems using the GNU linker. On some targets, such as bare-board
13800 targets without an operating system, the -T option may be required
13801 when linking to avoid references to undefined symbols.
13802
13803 -Xlinker option
13804 Pass option as an option to the linker. You can use this to supply
13805 system-specific linker options that GCC does not recognize.
13806
13807 If you want to pass an option that takes a separate argument, you
13808 must use -Xlinker twice, once for the option and once for the
13809 argument. For example, to pass -assert definitions, you must write
13810 -Xlinker -assert -Xlinker definitions. It does not work to write
13811 -Xlinker "-assert definitions", because this passes the entire
13812 string as a single argument, which is not what the linker expects.
13813
13814 When using the GNU linker, it is usually more convenient to pass
13815 arguments to linker options using the option=value syntax than as
13816 separate arguments. For example, you can specify -Xlinker
13817 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
13818 Other linkers may not support this syntax for command-line options.
13819
13820 -Wl,option
13821 Pass option as an option to the linker. If option contains commas,
13822 it is split into multiple options at the commas. You can use this
13823 syntax to pass an argument to the option. For example,
13824 -Wl,-Map,output.map passes -Map output.map to the linker. When
13825 using the GNU linker, you can also get the same effect with
13826 -Wl,-Map=output.map.
13827
13828 -u symbol
13829 Pretend the symbol symbol is undefined, to force linking of library
13830 modules to define it. You can use -u multiple times with different
13831 symbols to force loading of additional library modules.
13832
13833 -z keyword
13834 -z is passed directly on to the linker along with the keyword
13835 keyword. See the section in the documentation of your linker for
13836 permitted values and their meanings.
13837
13838 Options for Directory Search
13839 These options specify directories to search for header files, for
13840 libraries and for parts of the compiler:
13841
13842 -I dir
13843 -iquote dir
13844 -isystem dir
13845 -idirafter dir
13846 Add the directory dir to the list of directories to be searched for
13847 header files during preprocessing. If dir begins with = or
13848 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
13849 see --sysroot and -isysroot.
13850
13851 Directories specified with -iquote apply only to the quote form of
13852 the directive, "#include "file"". Directories specified with -I,
13853 -isystem, or -idirafter apply to lookup for both the
13854 "#include "file"" and "#include <file>" directives.
13855
13856 You can specify any number or combination of these options on the
13857 command line to search for header files in several directories.
13858 The lookup order is as follows:
13859
13860 1. For the quote form of the include directive, the directory of
13861 the current file is searched first.
13862
13863 2. For the quote form of the include directive, the directories
13864 specified by -iquote options are searched in left-to-right
13865 order, as they appear on the command line.
13866
13867 3. Directories specified with -I options are scanned in left-to-
13868 right order.
13869
13870 4. Directories specified with -isystem options are scanned in
13871 left-to-right order.
13872
13873 5. Standard system directories are scanned.
13874
13875 6. Directories specified with -idirafter options are scanned in
13876 left-to-right order.
13877
13878 You can use -I to override a system header file, substituting your
13879 own version, since these directories are searched before the
13880 standard system header file directories. However, you should not
13881 use this option to add directories that contain vendor-supplied
13882 system header files; use -isystem for that.
13883
13884 The -isystem and -idirafter options also mark the directory as a
13885 system directory, so that it gets the same special treatment that
13886 is applied to the standard system directories.
13887
13888 If a standard system include directory, or a directory specified
13889 with -isystem, is also specified with -I, the -I option is ignored.
13890 The directory is still searched but as a system directory at its
13891 normal position in the system include chain. This is to ensure
13892 that GCC's procedure to fix buggy system headers and the ordering
13893 for the "#include_next" directive are not inadvertently changed.
13894 If you really need to change the search order for system
13895 directories, use the -nostdinc and/or -isystem options.
13896
13897 -I- Split the include path. This option has been deprecated. Please
13898 use -iquote instead for -I directories before the -I- and remove
13899 the -I- option.
13900
13901 Any directories specified with -I options before -I- are searched
13902 only for headers requested with "#include "file""; they are not
13903 searched for "#include <file>". If additional directories are
13904 specified with -I options after the -I-, those directories are
13905 searched for all #include directives.
13906
13907 In addition, -I- inhibits the use of the directory of the current
13908 file directory as the first search directory for "#include "file"".
13909 There is no way to override this effect of -I-.
13910
13911 -iprefix prefix
13912 Specify prefix as the prefix for subsequent -iwithprefix options.
13913 If the prefix represents a directory, you should include the final
13914 /.
13915
13916 -iwithprefix dir
13917 -iwithprefixbefore dir
13918 Append dir to the prefix specified previously with -iprefix, and
13919 add the resulting directory to the include search path.
13920 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
13921 puts it where -idirafter would.
13922
13923 -isysroot dir
13924 This option is like the --sysroot option, but applies only to
13925 header files (except for Darwin targets, where it applies to both
13926 header files and libraries). See the --sysroot option for more
13927 information.
13928
13929 -imultilib dir
13930 Use dir as a subdirectory of the directory containing target-
13931 specific C++ headers.
13932
13933 -nostdinc
13934 Do not search the standard system directories for header files.
13935 Only the directories explicitly specified with -I, -iquote,
13936 -isystem, and/or -idirafter options (and the directory of the
13937 current file, if appropriate) are searched.
13938
13939 -nostdinc++
13940 Do not search for header files in the C++-specific standard
13941 directories, but do still search the other standard directories.
13942 (This option is used when building the C++ library.)
13943
13944 -iplugindir=dir
13945 Set the directory to search for plugins that are passed by
13946 -fplugin=name instead of -fplugin=path/name.so. This option is not
13947 meant to be used by the user, but only passed by the driver.
13948
13949 -Ldir
13950 Add directory dir to the list of directories to be searched for -l.
13951
13952 -Bprefix
13953 This option specifies where to find the executables, libraries,
13954 include files, and data files of the compiler itself.
13955
13956 The compiler driver program runs one or more of the subprograms
13957 cpp, cc1, as and ld. It tries prefix as a prefix for each program
13958 it tries to run, both with and without machine/version/ for the
13959 corresponding target machine and compiler version.
13960
13961 For each subprogram to be run, the compiler driver first tries the
13962 -B prefix, if any. If that name is not found, or if -B is not
13963 specified, the driver tries two standard prefixes, /usr/lib/gcc/
13964 and /usr/local/lib/gcc/. If neither of those results in a file
13965 name that is found, the unmodified program name is searched for
13966 using the directories specified in your PATH environment variable.
13967
13968 The compiler checks to see if the path provided by -B refers to a
13969 directory, and if necessary it adds a directory separator character
13970 at the end of the path.
13971
13972 -B prefixes that effectively specify directory names also apply to
13973 libraries in the linker, because the compiler translates these
13974 options into -L options for the linker. They also apply to include
13975 files in the preprocessor, because the compiler translates these
13976 options into -isystem options for the preprocessor. In this case,
13977 the compiler appends include to the prefix.
13978
13979 The runtime support file libgcc.a can also be searched for using
13980 the -B prefix, if needed. If it is not found there, the two
13981 standard prefixes above are tried, and that is all. The file is
13982 left out of the link if it is not found by those means.
13983
13984 Another way to specify a prefix much like the -B prefix is to use
13985 the environment variable GCC_EXEC_PREFIX.
13986
13987 As a special kludge, if the path provided by -B is [dir/]stageN/,
13988 where N is a number in the range 0 to 9, then it is replaced by
13989 [dir/]include. This is to help with boot-strapping the compiler.
13990
13991 -no-canonical-prefixes
13992 Do not expand any symbolic links, resolve references to /../ or
13993 /./, or make the path absolute when generating a relative prefix.
13994
13995 --sysroot=dir
13996 Use dir as the logical root directory for headers and libraries.
13997 For example, if the compiler normally searches for headers in
13998 /usr/include and libraries in /usr/lib, it instead searches
13999 dir/usr/include and dir/usr/lib.
14000
14001 If you use both this option and the -isysroot option, then the
14002 --sysroot option applies to libraries, but the -isysroot option
14003 applies to header files.
14004
14005 The GNU linker (beginning with version 2.16) has the necessary
14006 support for this option. If your linker does not support this
14007 option, the header file aspect of --sysroot still works, but the
14008 library aspect does not.
14009
14010 --no-sysroot-suffix
14011 For some targets, a suffix is added to the root directory specified
14012 with --sysroot, depending on the other options used, so that
14013 headers may for example be found in dir/suffix/usr/include instead
14014 of dir/usr/include. This option disables the addition of such a
14015 suffix.
14016
14017 Options for Code Generation Conventions
14018 These machine-independent options control the interface conventions
14019 used in code generation.
14020
14021 Most of them have both positive and negative forms; the negative form
14022 of -ffoo is -fno-foo. In the table below, only one of the forms is
14023 listed---the one that is not the default. You can figure out the other
14024 form by either removing no- or adding it.
14025
14026 -fstack-reuse=reuse-level
14027 This option controls stack space reuse for user declared local/auto
14028 variables and compiler generated temporaries. reuse_level can be
14029 all, named_vars, or none. all enables stack reuse for all local
14030 variables and temporaries, named_vars enables the reuse only for
14031 user defined local variables with names, and none disables stack
14032 reuse completely. The default value is all. The option is needed
14033 when the program extends the lifetime of a scoped local variable or
14034 a compiler generated temporary beyond the end point defined by the
14035 language. When a lifetime of a variable ends, and if the variable
14036 lives in memory, the optimizing compiler has the freedom to reuse
14037 its stack space with other temporaries or scoped local variables
14038 whose live range does not overlap with it. Legacy code extending
14039 local lifetime is likely to break with the stack reuse
14040 optimization.
14041
14042 For example,
14043
14044 int *p;
14045 {
14046 int local1;
14047
14048 p = &local1;
14049 local1 = 10;
14050 ....
14051 }
14052 {
14053 int local2;
14054 local2 = 20;
14055 ...
14056 }
14057
14058 if (*p == 10) // out of scope use of local1
14059 {
14060
14061 }
14062
14063 Another example:
14064
14065 struct A
14066 {
14067 A(int k) : i(k), j(k) { }
14068 int i;
14069 int j;
14070 };
14071
14072 A *ap;
14073
14074 void foo(const A& ar)
14075 {
14076 ap = &ar;
14077 }
14078
14079 void bar()
14080 {
14081 foo(A(10)); // temp object's lifetime ends when foo returns
14082
14083 {
14084 A a(20);
14085 ....
14086 }
14087 ap->i+= 10; // ap references out of scope temp whose space
14088 // is reused with a. What is the value of ap->i?
14089 }
14090
14091 The lifetime of a compiler generated temporary is well defined by
14092 the C++ standard. When a lifetime of a temporary ends, and if the
14093 temporary lives in memory, the optimizing compiler has the freedom
14094 to reuse its stack space with other temporaries or scoped local
14095 variables whose live range does not overlap with it. However some
14096 of the legacy code relies on the behavior of older compilers in
14097 which temporaries' stack space is not reused, the aggressive stack
14098 reuse can lead to runtime errors. This option is used to control
14099 the temporary stack reuse optimization.
14100
14101 -ftrapv
14102 This option generates traps for signed overflow on addition,
14103 subtraction, multiplication operations. The options -ftrapv and
14104 -fwrapv override each other, so using -ftrapv -fwrapv on the
14105 command-line results in -fwrapv being effective. Note that only
14106 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14107 command-line results in -ftrapv being effective.
14108
14109 -fwrapv
14110 This option instructs the compiler to assume that signed arithmetic
14111 overflow of addition, subtraction and multiplication wraps around
14112 using twos-complement representation. This flag enables some
14113 optimizations and disables others. The options -ftrapv and -fwrapv
14114 override each other, so using -ftrapv -fwrapv on the command-line
14115 results in -fwrapv being effective. Note that only active options
14116 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14117 results in -ftrapv being effective.
14118
14119 -fwrapv-pointer
14120 This option instructs the compiler to assume that pointer
14121 arithmetic overflow on addition and subtraction wraps around using
14122 twos-complement representation. This flag disables some
14123 optimizations which assume pointer overflow is invalid.
14124
14125 -fstrict-overflow
14126 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14127 implies -fwrapv -fwrapv-pointer.
14128
14129 -fexceptions
14130 Enable exception handling. Generates extra code needed to
14131 propagate exceptions. For some targets, this implies GCC generates
14132 frame unwind information for all functions, which can produce
14133 significant data size overhead, although it does not affect
14134 execution. If you do not specify this option, GCC enables it by
14135 default for languages like C++ that normally require exception
14136 handling, and disables it for languages like C that do not normally
14137 require it. However, you may need to enable this option when
14138 compiling C code that needs to interoperate properly with exception
14139 handlers written in C++. You may also wish to disable this option
14140 if you are compiling older C++ programs that don't use exception
14141 handling.
14142
14143 -fnon-call-exceptions
14144 Generate code that allows trapping instructions to throw
14145 exceptions. Note that this requires platform-specific runtime
14146 support that does not exist everywhere. Moreover, it only allows
14147 trapping instructions to throw exceptions, i.e. memory references
14148 or floating-point instructions. It does not allow exceptions to be
14149 thrown from arbitrary signal handlers such as "SIGALRM".
14150
14151 -fdelete-dead-exceptions
14152 Consider that instructions that may throw exceptions but don't
14153 otherwise contribute to the execution of the program can be
14154 optimized away. This option is enabled by default for the Ada
14155 compiler, as permitted by the Ada language specification.
14156 Optimization passes that cause dead exceptions to be removed are
14157 enabled independently at different optimization levels.
14158
14159 -funwind-tables
14160 Similar to -fexceptions, except that it just generates any needed
14161 static data, but does not affect the generated code in any other
14162 way. You normally do not need to enable this option; instead, a
14163 language processor that needs this handling enables it on your
14164 behalf.
14165
14166 -fasynchronous-unwind-tables
14167 Generate unwind table in DWARF format, if supported by target
14168 machine. The table is exact at each instruction boundary, so it
14169 can be used for stack unwinding from asynchronous events (such as
14170 debugger or garbage collector).
14171
14172 -fno-gnu-unique
14173 On systems with recent GNU assembler and C library, the C++
14174 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
14175 definitions of template static data members and static local
14176 variables in inline functions are unique even in the presence of
14177 "RTLD_LOCAL"; this is necessary to avoid problems with a library
14178 used by two different "RTLD_LOCAL" plugins depending on a
14179 definition in one of them and therefore disagreeing with the other
14180 one about the binding of the symbol. But this causes "dlclose" to
14181 be ignored for affected DSOs; if your program relies on
14182 reinitialization of a DSO via "dlclose" and "dlopen", you can use
14183 -fno-gnu-unique.
14184
14185 -fpcc-struct-return
14186 Return "short" "struct" and "union" values in memory like longer
14187 ones, rather than in registers. This convention is less efficient,
14188 but it has the advantage of allowing intercallability between GCC-
14189 compiled files and files compiled with other compilers,
14190 particularly the Portable C Compiler (pcc).
14191
14192 The precise convention for returning structures in memory depends
14193 on the target configuration macros.
14194
14195 Short structures and unions are those whose size and alignment
14196 match that of some integer type.
14197
14198 Warning: code compiled with the -fpcc-struct-return switch is not
14199 binary compatible with code compiled with the -freg-struct-return
14200 switch. Use it to conform to a non-default application binary
14201 interface.
14202
14203 -freg-struct-return
14204 Return "struct" and "union" values in registers when possible.
14205 This is more efficient for small structures than
14206 -fpcc-struct-return.
14207
14208 If you specify neither -fpcc-struct-return nor -freg-struct-return,
14209 GCC defaults to whichever convention is standard for the target.
14210 If there is no standard convention, GCC defaults to
14211 -fpcc-struct-return, except on targets where GCC is the principal
14212 compiler. In those cases, we can choose the standard, and we chose
14213 the more efficient register return alternative.
14214
14215 Warning: code compiled with the -freg-struct-return switch is not
14216 binary compatible with code compiled with the -fpcc-struct-return
14217 switch. Use it to conform to a non-default application binary
14218 interface.
14219
14220 -fshort-enums
14221 Allocate to an "enum" type only as many bytes as it needs for the
14222 declared range of possible values. Specifically, the "enum" type
14223 is equivalent to the smallest integer type that has enough room.
14224
14225 Warning: the -fshort-enums switch causes GCC to generate code that
14226 is not binary compatible with code generated without that switch.
14227 Use it to conform to a non-default application binary interface.
14228
14229 -fshort-wchar
14230 Override the underlying type for "wchar_t" to be "short unsigned
14231 int" instead of the default for the target. This option is useful
14232 for building programs to run under WINE.
14233
14234 Warning: the -fshort-wchar switch causes GCC to generate code that
14235 is not binary compatible with code generated without that switch.
14236 Use it to conform to a non-default application binary interface.
14237
14238 -fcommon
14239 In C code, this option controls the placement of global variables
14240 defined without an initializer, known as tentative definitions in
14241 the C standard. Tentative definitions are distinct from
14242 declarations of a variable with the "extern" keyword, which do not
14243 allocate storage.
14244
14245 The default is -fno-common, which specifies that the compiler
14246 places uninitialized global variables in the BSS section of the
14247 object file. This inhibits the merging of tentative definitions by
14248 the linker so you get a multiple-definition error if the same
14249 variable is accidentally defined in more than one compilation unit.
14250
14251 The -fcommon places uninitialized global variables in a common
14252 block. This allows the linker to resolve all tentative definitions
14253 of the same variable in different compilation units to the same
14254 object, or to a non-tentative definition. This behavior is
14255 inconsistent with C++, and on many targets implies a speed and code
14256 size penalty on global variable references. It is mainly useful to
14257 enable legacy code to link without errors.
14258
14259 -fno-ident
14260 Ignore the "#ident" directive.
14261
14262 -finhibit-size-directive
14263 Don't output a ".size" assembler directive, or anything else that
14264 would cause trouble if the function is split in the middle, and the
14265 two halves are placed at locations far apart in memory. This
14266 option is used when compiling crtstuff.c; you should not need to
14267 use it for anything else.
14268
14269 -fverbose-asm
14270 Put extra commentary information in the generated assembly code to
14271 make it more readable. This option is generally only of use to
14272 those who actually need to read the generated assembly code
14273 (perhaps while debugging the compiler itself).
14274
14275 -fno-verbose-asm, the default, causes the extra information to be
14276 omitted and is useful when comparing two assembler files.
14277
14278 The added comments include:
14279
14280 * information on the compiler version and command-line options,
14281
14282 * the source code lines associated with the assembly
14283 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14284
14285 * hints on which high-level expressions correspond to the various
14286 assembly instruction operands.
14287
14288 For example, given this C source file:
14289
14290 int test (int n)
14291 {
14292 int i;
14293 int total = 0;
14294
14295 for (i = 0; i < n; i++)
14296 total += i * i;
14297
14298 return total;
14299 }
14300
14301 compiling to (x86_64) assembly via -S and emitting the result
14302 direct to stdout via -o -
14303
14304 gcc -S test.c -fverbose-asm -Os -o -
14305
14306 gives output similar to this:
14307
14308 .file "test.c"
14309 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14310 [...snip...]
14311 # options passed:
14312 [...snip...]
14313
14314 .text
14315 .globl test
14316 .type test, @function
14317 test:
14318 .LFB0:
14319 .cfi_startproc
14320 # test.c:4: int total = 0;
14321 xorl %eax, %eax # <retval>
14322 # test.c:6: for (i = 0; i < n; i++)
14323 xorl %edx, %edx # i
14324 .L2:
14325 # test.c:6: for (i = 0; i < n; i++)
14326 cmpl %edi, %edx # n, i
14327 jge .L5 #,
14328 # test.c:7: total += i * i;
14329 movl %edx, %ecx # i, tmp92
14330 imull %edx, %ecx # i, tmp92
14331 # test.c:6: for (i = 0; i < n; i++)
14332 incl %edx # i
14333 # test.c:7: total += i * i;
14334 addl %ecx, %eax # tmp92, <retval>
14335 jmp .L2 #
14336 .L5:
14337 # test.c:10: }
14338 ret
14339 .cfi_endproc
14340 .LFE0:
14341 .size test, .-test
14342 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14343 .section .note.GNU-stack,"",@progbits
14344
14345 The comments are intended for humans rather than machines and hence
14346 the precise format of the comments is subject to change.
14347
14348 -frecord-gcc-switches
14349 This switch causes the command line used to invoke the compiler to
14350 be recorded into the object file that is being created. This
14351 switch is only implemented on some targets and the exact format of
14352 the recording is target and binary file format dependent, but it
14353 usually takes the form of a section containing ASCII text. This
14354 switch is related to the -fverbose-asm switch, but that switch only
14355 records information in the assembler output file as comments, so it
14356 never reaches the object file. See also -grecord-gcc-switches for
14357 another way of storing compiler options into the object file.
14358
14359 -fpic
14360 Generate position-independent code (PIC) suitable for use in a
14361 shared library, if supported for the target machine. Such code
14362 accesses all constant addresses through a global offset table
14363 (GOT). The dynamic loader resolves the GOT entries when the
14364 program starts (the dynamic loader is not part of GCC; it is part
14365 of the operating system). If the GOT size for the linked
14366 executable exceeds a machine-specific maximum size, you get an
14367 error message from the linker indicating that -fpic does not work;
14368 in that case, recompile with -fPIC instead. (These maximums are 8k
14369 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
14370 x86 has no such limit.)
14371
14372 Position-independent code requires special support, and therefore
14373 works only on certain machines. For the x86, GCC supports PIC for
14374 System V but not for the Sun 386i. Code generated for the IBM
14375 RS/6000 is always position-independent.
14376
14377 When this flag is set, the macros "__pic__" and "__PIC__" are
14378 defined to 1.
14379
14380 -fPIC
14381 If supported for the target machine, emit position-independent
14382 code, suitable for dynamic linking and avoiding any limit on the
14383 size of the global offset table. This option makes a difference on
14384 AArch64, m68k, PowerPC and SPARC.
14385
14386 Position-independent code requires special support, and therefore
14387 works only on certain machines.
14388
14389 When this flag is set, the macros "__pic__" and "__PIC__" are
14390 defined to 2.
14391
14392 -fpie
14393 -fPIE
14394 These options are similar to -fpic and -fPIC, but the generated
14395 position-independent code can be only linked into executables.
14396 Usually these options are used to compile code that will be linked
14397 using the -pie GCC option.
14398
14399 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
14400 The macros have the value 1 for -fpie and 2 for -fPIE.
14401
14402 -fno-plt
14403 Do not use the PLT for external function calls in position-
14404 independent code. Instead, load the callee address at call sites
14405 from the GOT and branch to it. This leads to more efficient code
14406 by eliminating PLT stubs and exposing GOT loads to optimizations.
14407 On architectures such as 32-bit x86 where PLT stubs expect the GOT
14408 pointer in a specific register, this gives more register allocation
14409 freedom to the compiler. Lazy binding requires use of the PLT;
14410 with -fno-plt all external symbols are resolved at load time.
14411
14412 Alternatively, the function attribute "noplt" can be used to avoid
14413 calls through the PLT for specific external functions.
14414
14415 In position-dependent code, a few targets also convert calls to
14416 functions that are marked to not use the PLT to use the GOT
14417 instead.
14418
14419 -fno-jump-tables
14420 Do not use jump tables for switch statements even where it would be
14421 more efficient than other code generation strategies. This option
14422 is of use in conjunction with -fpic or -fPIC for building code that
14423 forms part of a dynamic linker and cannot reference the address of
14424 a jump table. On some targets, jump tables do not require a GOT
14425 and this option is not needed.
14426
14427 -fno-bit-tests
14428 Do not use bit tests for switch statements even where it would be
14429 more efficient than other code generation strategies.
14430
14431 -ffixed-reg
14432 Treat the register named reg as a fixed register; generated code
14433 should never refer to it (except perhaps as a stack pointer, frame
14434 pointer or in some other fixed role).
14435
14436 reg must be the name of a register. The register names accepted
14437 are machine-specific and are defined in the "REGISTER_NAMES" macro
14438 in the machine description macro file.
14439
14440 This flag does not have a negative form, because it specifies a
14441 three-way choice.
14442
14443 -fcall-used-reg
14444 Treat the register named reg as an allocable register that is
14445 clobbered by function calls. It may be allocated for temporaries
14446 or variables that do not live across a call. Functions compiled
14447 this way do not save and restore the register reg.
14448
14449 It is an error to use this flag with the frame pointer or stack
14450 pointer. Use of this flag for other registers that have fixed
14451 pervasive roles in the machine's execution model produces
14452 disastrous results.
14453
14454 This flag does not have a negative form, because it specifies a
14455 three-way choice.
14456
14457 -fcall-saved-reg
14458 Treat the register named reg as an allocable register saved by
14459 functions. It may be allocated even for temporaries or variables
14460 that live across a call. Functions compiled this way save and
14461 restore the register reg if they use it.
14462
14463 It is an error to use this flag with the frame pointer or stack
14464 pointer. Use of this flag for other registers that have fixed
14465 pervasive roles in the machine's execution model produces
14466 disastrous results.
14467
14468 A different sort of disaster results from the use of this flag for
14469 a register in which function values may be returned.
14470
14471 This flag does not have a negative form, because it specifies a
14472 three-way choice.
14473
14474 -fpack-struct[=n]
14475 Without a value specified, pack all structure members together
14476 without holes. When a value is specified (which must be a small
14477 power of two), pack structure members according to this value,
14478 representing the maximum alignment (that is, objects with default
14479 alignment requirements larger than this are output potentially
14480 unaligned at the next fitting location.
14481
14482 Warning: the -fpack-struct switch causes GCC to generate code that
14483 is not binary compatible with code generated without that switch.
14484 Additionally, it makes the code suboptimal. Use it to conform to a
14485 non-default application binary interface.
14486
14487 -fleading-underscore
14488 This option and its counterpart, -fno-leading-underscore, forcibly
14489 change the way C symbols are represented in the object file. One
14490 use is to help link with legacy assembly code.
14491
14492 Warning: the -fleading-underscore switch causes GCC to generate
14493 code that is not binary compatible with code generated without that
14494 switch. Use it to conform to a non-default application binary
14495 interface. Not all targets provide complete support for this
14496 switch.
14497
14498 -ftls-model=model
14499 Alter the thread-local storage model to be used. The model
14500 argument should be one of global-dynamic, local-dynamic, initial-
14501 exec or local-exec. Note that the choice is subject to
14502 optimization: the compiler may use a more efficient model for
14503 symbols not visible outside of the translation unit, or if -fpic is
14504 not given on the command line.
14505
14506 The default without -fpic is initial-exec; with -fpic the default
14507 is global-dynamic.
14508
14509 -ftrampolines
14510 For targets that normally need trampolines for nested functions,
14511 always generate them instead of using descriptors. Otherwise, for
14512 targets that do not need them, like for example HP-PA or IA-64, do
14513 nothing.
14514
14515 A trampoline is a small piece of code that is created at run time
14516 on the stack when the address of a nested function is taken, and is
14517 used to call the nested function indirectly. Therefore, it
14518 requires the stack to be made executable in order for the program
14519 to work properly.
14520
14521 -fno-trampolines is enabled by default on a language by language
14522 basis to let the compiler avoid generating them, if it computes
14523 that this is safe, and replace them with descriptors. Descriptors
14524 are made up of data only, but the generated code must be prepared
14525 to deal with them. As of this writing, -fno-trampolines is enabled
14526 by default only for Ada.
14527
14528 Moreover, code compiled with -ftrampolines and code compiled with
14529 -fno-trampolines are not binary compatible if nested functions are
14530 present. This option must therefore be used on a program-wide
14531 basis and be manipulated with extreme care.
14532
14533 -fvisibility=[default|internal|hidden|protected]
14534 Set the default ELF image symbol visibility to the specified
14535 option---all symbols are marked with this unless overridden within
14536 the code. Using this feature can very substantially improve
14537 linking and load times of shared object libraries, produce more
14538 optimized code, provide near-perfect API export and prevent symbol
14539 clashes. It is strongly recommended that you use this in any
14540 shared objects you distribute.
14541
14542 Despite the nomenclature, default always means public; i.e.,
14543 available to be linked against from outside the shared object.
14544 protected and internal are pretty useless in real-world usage so
14545 the only other commonly used option is hidden. The default if
14546 -fvisibility isn't specified is default, i.e., make every symbol
14547 public.
14548
14549 A good explanation of the benefits offered by ensuring ELF symbols
14550 have the correct visibility is given by "How To Write Shared
14551 Libraries" by Ulrich Drepper (which can be found at
14552 <https://www.akkadia.org/drepper/>)---however a superior solution
14553 made possible by this option to marking things hidden when the
14554 default is public is to make the default hidden and mark things
14555 public. This is the norm with DLLs on Windows and with
14556 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
14557 instead of "__declspec(dllexport)" you get almost identical
14558 semantics with identical syntax. This is a great boon to those
14559 working with cross-platform projects.
14560
14561 For those adding visibility support to existing code, you may find
14562 "#pragma GCC visibility" of use. This works by you enclosing the
14563 declarations you wish to set visibility for with (for example)
14564 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
14565 pop". Bear in mind that symbol visibility should be viewed as part
14566 of the API interface contract and thus all new code should always
14567 specify visibility when it is not the default; i.e., declarations
14568 only for use within the local DSO should always be marked
14569 explicitly as hidden as so to avoid PLT indirection
14570 overheads---making this abundantly clear also aids readability and
14571 self-documentation of the code. Note that due to ISO C++
14572 specification requirements, "operator new" and "operator delete"
14573 must always be of default visibility.
14574
14575 Be aware that headers from outside your project, in particular
14576 system headers and headers from any other library you use, may not
14577 be expecting to be compiled with visibility other than the default.
14578 You may need to explicitly say "#pragma GCC visibility
14579 push(default)" before including any such headers.
14580
14581 "extern" declarations are not affected by -fvisibility, so a lot of
14582 code can be recompiled with -fvisibility=hidden with no
14583 modifications. However, this means that calls to "extern"
14584 functions with no explicit visibility use the PLT, so it is more
14585 effective to use "__attribute ((visibility))" and/or "#pragma GCC
14586 visibility" to tell the compiler which "extern" declarations should
14587 be treated as hidden.
14588
14589 Note that -fvisibility does affect C++ vague linkage entities. This
14590 means that, for instance, an exception class that is be thrown
14591 between DSOs must be explicitly marked with default visibility so
14592 that the type_info nodes are unified between the DSOs.
14593
14594 An overview of these techniques, their benefits and how to use them
14595 is at <http://gcc.gnu.org/wiki/Visibility>.
14596
14597 -fstrict-volatile-bitfields
14598 This option should be used if accesses to volatile bit-fields (or
14599 other structure fields, although the compiler usually honors those
14600 types anyway) should use a single access of the width of the
14601 field's type, aligned to a natural alignment if possible. For
14602 example, targets with memory-mapped peripheral registers might
14603 require all such accesses to be 16 bits wide; with this flag you
14604 can declare all peripheral bit-fields as "unsigned short" (assuming
14605 short is 16 bits on these targets) to force GCC to use 16-bit
14606 accesses instead of, perhaps, a more efficient 32-bit access.
14607
14608 If this option is disabled, the compiler uses the most efficient
14609 instruction. In the previous example, that might be a 32-bit load
14610 instruction, even though that accesses bytes that do not contain
14611 any portion of the bit-field, or memory-mapped registers unrelated
14612 to the one being updated.
14613
14614 In some cases, such as when the "packed" attribute is applied to a
14615 structure field, it may not be possible to access the field with a
14616 single read or write that is correctly aligned for the target
14617 machine. In this case GCC falls back to generating multiple
14618 accesses rather than code that will fault or truncate the result at
14619 run time.
14620
14621 Note: Due to restrictions of the C/C++11 memory model, write
14622 accesses are not allowed to touch non bit-field members. It is
14623 therefore recommended to define all bits of the field's type as
14624 bit-field members.
14625
14626 The default value of this option is determined by the application
14627 binary interface for the target processor.
14628
14629 -fsync-libcalls
14630 This option controls whether any out-of-line instance of the
14631 "__sync" family of functions may be used to implement the C++11
14632 "__atomic" family of functions.
14633
14634 The default value of this option is enabled, thus the only useful
14635 form of the option is -fno-sync-libcalls. This option is used in
14636 the implementation of the libatomic runtime library.
14637
14638 GCC Developer Options
14639 This section describes command-line options that are primarily of
14640 interest to GCC developers, including options to support compiler
14641 testing and investigation of compiler bugs and compile-time performance
14642 problems. This includes options that produce debug dumps at various
14643 points in the compilation; that print statistics such as memory use and
14644 execution time; and that print information about GCC's configuration,
14645 such as where it searches for libraries. You should rarely need to use
14646 any of these options for ordinary compilation and linking tasks.
14647
14648 Many developer options that cause GCC to dump output to a file take an
14649 optional =filename suffix. You can specify stdout or - to dump to
14650 standard output, and stderr for standard error.
14651
14652 If =filename is omitted, a default dump file name is constructed by
14653 concatenating the base dump file name, a pass number, phase letter, and
14654 pass name. The base dump file name is the name of output file produced
14655 by the compiler if explicitly specified and not an executable;
14656 otherwise it is the source file name. The pass number is determined by
14657 the order passes are registered with the compiler's pass manager. This
14658 is generally the same as the order of execution, but passes registered
14659 by plugins, target-specific passes, or passes that are otherwise
14660 registered late are numbered higher than the pass named final, even if
14661 they are executed earlier. The phase letter is one of i (inter-
14662 procedural analysis), l (language-specific), r (RTL), or t (tree). The
14663 files are created in the directory of the output file.
14664
14665 -fcallgraph-info
14666 -fcallgraph-info=MARKERS
14667 Makes the compiler output callgraph information for the program, on
14668 a per-object-file basis. The information is generated in the
14669 common VCG format. It can be decorated with additional, per-node
14670 and/or per-edge information, if a list of comma-separated markers
14671 is additionally specified. When the "su" marker is specified, the
14672 callgraph is decorated with stack usage information; it is
14673 equivalent to -fstack-usage. When the "da" marker is specified,
14674 the callgraph is decorated with information about dynamically
14675 allocated objects.
14676
14677 When compiling with -flto, no callgraph information is output along
14678 with the object file. At LTO link time, -fcallgraph-info may
14679 generate multiple callgraph information files next to intermediate
14680 LTO output files.
14681
14682 -dletters
14683 -fdump-rtl-pass
14684 -fdump-rtl-pass=filename
14685 Says to make debugging dumps during compilation at times specified
14686 by letters. This is used for debugging the RTL-based passes of the
14687 compiler.
14688
14689 Some -dletters switches have different meaning when -E is used for
14690 preprocessing.
14691
14692 Debug dumps can be enabled with a -fdump-rtl switch or some -d
14693 option letters. Here are the possible letters for use in pass and
14694 letters, and their meanings:
14695
14696 -fdump-rtl-alignments
14697 Dump after branch alignments have been computed.
14698
14699 -fdump-rtl-asmcons
14700 Dump after fixing rtl statements that have unsatisfied in/out
14701 constraints.
14702
14703 -fdump-rtl-auto_inc_dec
14704 Dump after auto-inc-dec discovery. This pass is only run on
14705 architectures that have auto inc or auto dec instructions.
14706
14707 -fdump-rtl-barriers
14708 Dump after cleaning up the barrier instructions.
14709
14710 -fdump-rtl-bbpart
14711 Dump after partitioning hot and cold basic blocks.
14712
14713 -fdump-rtl-bbro
14714 Dump after block reordering.
14715
14716 -fdump-rtl-btl1
14717 -fdump-rtl-btl2
14718 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
14719 two branch target load optimization passes.
14720
14721 -fdump-rtl-bypass
14722 Dump after jump bypassing and control flow optimizations.
14723
14724 -fdump-rtl-combine
14725 Dump after the RTL instruction combination pass.
14726
14727 -fdump-rtl-compgotos
14728 Dump after duplicating the computed gotos.
14729
14730 -fdump-rtl-ce1
14731 -fdump-rtl-ce2
14732 -fdump-rtl-ce3
14733 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
14734 dumping after the three if conversion passes.
14735
14736 -fdump-rtl-cprop_hardreg
14737 Dump after hard register copy propagation.
14738
14739 -fdump-rtl-csa
14740 Dump after combining stack adjustments.
14741
14742 -fdump-rtl-cse1
14743 -fdump-rtl-cse2
14744 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
14745 two common subexpression elimination passes.
14746
14747 -fdump-rtl-dce
14748 Dump after the standalone dead code elimination passes.
14749
14750 -fdump-rtl-dbr
14751 Dump after delayed branch scheduling.
14752
14753 -fdump-rtl-dce1
14754 -fdump-rtl-dce2
14755 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
14756 two dead store elimination passes.
14757
14758 -fdump-rtl-eh
14759 Dump after finalization of EH handling code.
14760
14761 -fdump-rtl-eh_ranges
14762 Dump after conversion of EH handling range regions.
14763
14764 -fdump-rtl-expand
14765 Dump after RTL generation.
14766
14767 -fdump-rtl-fwprop1
14768 -fdump-rtl-fwprop2
14769 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
14770 the two forward propagation passes.
14771
14772 -fdump-rtl-gcse1
14773 -fdump-rtl-gcse2
14774 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
14775 global common subexpression elimination.
14776
14777 -fdump-rtl-init-regs
14778 Dump after the initialization of the registers.
14779
14780 -fdump-rtl-initvals
14781 Dump after the computation of the initial value sets.
14782
14783 -fdump-rtl-into_cfglayout
14784 Dump after converting to cfglayout mode.
14785
14786 -fdump-rtl-ira
14787 Dump after iterated register allocation.
14788
14789 -fdump-rtl-jump
14790 Dump after the second jump optimization.
14791
14792 -fdump-rtl-loop2
14793 -fdump-rtl-loop2 enables dumping after the rtl loop
14794 optimization passes.
14795
14796 -fdump-rtl-mach
14797 Dump after performing the machine dependent reorganization
14798 pass, if that pass exists.
14799
14800 -fdump-rtl-mode_sw
14801 Dump after removing redundant mode switches.
14802
14803 -fdump-rtl-rnreg
14804 Dump after register renumbering.
14805
14806 -fdump-rtl-outof_cfglayout
14807 Dump after converting from cfglayout mode.
14808
14809 -fdump-rtl-peephole2
14810 Dump after the peephole pass.
14811
14812 -fdump-rtl-postreload
14813 Dump after post-reload optimizations.
14814
14815 -fdump-rtl-pro_and_epilogue
14816 Dump after generating the function prologues and epilogues.
14817
14818 -fdump-rtl-sched1
14819 -fdump-rtl-sched2
14820 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
14821 the basic block scheduling passes.
14822
14823 -fdump-rtl-ree
14824 Dump after sign/zero extension elimination.
14825
14826 -fdump-rtl-seqabstr
14827 Dump after common sequence discovery.
14828
14829 -fdump-rtl-shorten
14830 Dump after shortening branches.
14831
14832 -fdump-rtl-sibling
14833 Dump after sibling call optimizations.
14834
14835 -fdump-rtl-split1
14836 -fdump-rtl-split2
14837 -fdump-rtl-split3
14838 -fdump-rtl-split4
14839 -fdump-rtl-split5
14840 These options enable dumping after five rounds of instruction
14841 splitting.
14842
14843 -fdump-rtl-sms
14844 Dump after modulo scheduling. This pass is only run on some
14845 architectures.
14846
14847 -fdump-rtl-stack
14848 Dump after conversion from GCC's "flat register file" registers
14849 to the x87's stack-like registers. This pass is only run on
14850 x86 variants.
14851
14852 -fdump-rtl-subreg1
14853 -fdump-rtl-subreg2
14854 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
14855 the two subreg expansion passes.
14856
14857 -fdump-rtl-unshare
14858 Dump after all rtl has been unshared.
14859
14860 -fdump-rtl-vartrack
14861 Dump after variable tracking.
14862
14863 -fdump-rtl-vregs
14864 Dump after converting virtual registers to hard registers.
14865
14866 -fdump-rtl-web
14867 Dump after live range splitting.
14868
14869 -fdump-rtl-regclass
14870 -fdump-rtl-subregs_of_mode_init
14871 -fdump-rtl-subregs_of_mode_finish
14872 -fdump-rtl-dfinit
14873 -fdump-rtl-dfinish
14874 These dumps are defined but always produce empty files.
14875
14876 -da
14877 -fdump-rtl-all
14878 Produce all the dumps listed above.
14879
14880 -dA Annotate the assembler output with miscellaneous debugging
14881 information.
14882
14883 -dD Dump all macro definitions, at the end of preprocessing, in
14884 addition to normal output.
14885
14886 -dH Produce a core dump whenever an error occurs.
14887
14888 -dp Annotate the assembler output with a comment indicating which
14889 pattern and alternative is used. The length and cost of each
14890 instruction are also printed.
14891
14892 -dP Dump the RTL in the assembler output as a comment before each
14893 instruction. Also turns on -dp annotation.
14894
14895 -dx Just generate RTL for a function instead of compiling it.
14896 Usually used with -fdump-rtl-expand.
14897
14898 -fdump-debug
14899 Dump debugging information generated during the debug generation
14900 phase.
14901
14902 -fdump-earlydebug
14903 Dump debugging information generated during the early debug
14904 generation phase.
14905
14906 -fdump-noaddr
14907 When doing debugging dumps, suppress address output. This makes it
14908 more feasible to use diff on debugging dumps for compiler
14909 invocations with different compiler binaries and/or different text
14910 / bss / data / heap / stack / dso start locations.
14911
14912 -freport-bug
14913 Collect and dump debug information into a temporary file if an
14914 internal compiler error (ICE) occurs.
14915
14916 -fdump-unnumbered
14917 When doing debugging dumps, suppress instruction numbers and
14918 address output. This makes it more feasible to use diff on
14919 debugging dumps for compiler invocations with different options, in
14920 particular with and without -g.
14921
14922 -fdump-unnumbered-links
14923 When doing debugging dumps (see -d option above), suppress
14924 instruction numbers for the links to the previous and next
14925 instructions in a sequence.
14926
14927 -fdump-ipa-switch
14928 -fdump-ipa-switch-options
14929 Control the dumping at various stages of inter-procedural analysis
14930 language tree to a file. The file name is generated by appending a
14931 switch specific suffix to the source file name, and the file is
14932 created in the same directory as the output file. The following
14933 dumps are possible:
14934
14935 all Enables all inter-procedural analysis dumps.
14936
14937 cgraph
14938 Dumps information about call-graph optimization, unused
14939 function removal, and inlining decisions.
14940
14941 inline
14942 Dump after function inlining.
14943
14944 Additionally, the options -optimized, -missed, -note, and -all can
14945 be provided, with the same meaning as for -fopt-info, defaulting to
14946 -optimized.
14947
14948 For example, -fdump-ipa-inline-optimized-missed will emit
14949 information on callsites that were inlined, along with callsites
14950 that were not inlined.
14951
14952 By default, the dump will contain messages about successful
14953 optimizations (equivalent to -optimized) together with low-level
14954 details about the analysis.
14955
14956 -fdump-lang
14957 Dump language-specific information. The file name is made by
14958 appending .lang to the source file name.
14959
14960 -fdump-lang-all
14961 -fdump-lang-switch
14962 -fdump-lang-switch-options
14963 -fdump-lang-switch-options=filename
14964 Control the dumping of language-specific information. The options
14965 and filename portions behave as described in the -fdump-tree
14966 option. The following switch values are accepted:
14967
14968 all Enable all language-specific dumps.
14969
14970 class
14971 Dump class hierarchy information. Virtual table information is
14972 emitted unless 'slim' is specified. This option is applicable
14973 to C++ only.
14974
14975 module
14976 Dump module information. Options lineno (locations), graph
14977 (reachability), blocks (clusters), uid (serialization), alias
14978 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
14979 provide additional information. This option is applicable to
14980 C++ only.
14981
14982 raw Dump the raw internal tree data. This option is applicable to
14983 C++ only.
14984
14985 -fdump-passes
14986 Print on stderr the list of optimization passes that are turned on
14987 and off by the current command-line options.
14988
14989 -fdump-statistics-option
14990 Enable and control dumping of pass statistics in a separate file.
14991 The file name is generated by appending a suffix ending in
14992 .statistics to the source file name, and the file is created in the
14993 same directory as the output file. If the -option form is used,
14994 -stats causes counters to be summed over the whole compilation unit
14995 while -details dumps every event as the passes generate them. The
14996 default with no option is to sum counters for each function
14997 compiled.
14998
14999 -fdump-tree-all
15000 -fdump-tree-switch
15001 -fdump-tree-switch-options
15002 -fdump-tree-switch-options=filename
15003 Control the dumping at various stages of processing the
15004 intermediate language tree to a file. If the -options form is
15005 used, options is a list of - separated options which control the
15006 details of the dump. Not all options are applicable to all dumps;
15007 those that are not meaningful are ignored. The following options
15008 are available
15009
15010 address
15011 Print the address of each node. Usually this is not meaningful
15012 as it changes according to the environment and source file.
15013 Its primary use is for tying up a dump file with a debug
15014 environment.
15015
15016 asmname
15017 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15018 that in the dump instead of "DECL_NAME". Its primary use is
15019 ease of use working backward from mangled names in the assembly
15020 file.
15021
15022 slim
15023 When dumping front-end intermediate representations, inhibit
15024 dumping of members of a scope or body of a function merely
15025 because that scope has been reached. Only dump such items when
15026 they are directly reachable by some other path.
15027
15028 When dumping pretty-printed trees, this option inhibits dumping
15029 the bodies of control structures.
15030
15031 When dumping RTL, print the RTL in slim (condensed) form
15032 instead of the default LISP-like representation.
15033
15034 raw Print a raw representation of the tree. By default, trees are
15035 pretty-printed into a C-like representation.
15036
15037 details
15038 Enable more detailed dumps (not honored by every dump option).
15039 Also include information from the optimization passes.
15040
15041 stats
15042 Enable dumping various statistics about the pass (not honored
15043 by every dump option).
15044
15045 blocks
15046 Enable showing basic block boundaries (disabled in raw dumps).
15047
15048 graph
15049 For each of the other indicated dump files (-fdump-rtl-pass),
15050 dump a representation of the control flow graph suitable for
15051 viewing with GraphViz to file.passid.pass.dot. Each function
15052 in the file is pretty-printed as a subgraph, so that GraphViz
15053 can render them all in a single plot.
15054
15055 This option currently only works for RTL dumps, and the RTL is
15056 always dumped in slim form.
15057
15058 vops
15059 Enable showing virtual operands for every statement.
15060
15061 lineno
15062 Enable showing line numbers for statements.
15063
15064 uid Enable showing the unique ID ("DECL_UID") for each variable.
15065
15066 verbose
15067 Enable showing the tree dump for each statement.
15068
15069 eh Enable showing the EH region number holding each statement.
15070
15071 scev
15072 Enable showing scalar evolution analysis details.
15073
15074 optimized
15075 Enable showing optimization information (only available in
15076 certain passes).
15077
15078 missed
15079 Enable showing missed optimization information (only available
15080 in certain passes).
15081
15082 note
15083 Enable other detailed optimization information (only available
15084 in certain passes).
15085
15086 all Turn on all options, except raw, slim, verbose and lineno.
15087
15088 optall
15089 Turn on all optimization options, i.e., optimized, missed, and
15090 note.
15091
15092 To determine what tree dumps are available or find the dump for a
15093 pass of interest follow the steps below.
15094
15095 1. Invoke GCC with -fdump-passes and in the stderr output look for
15096 a code that corresponds to the pass you are interested in. For
15097 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15098 correspond to the three Value Range Propagation passes. The
15099 number at the end distinguishes distinct invocations of the
15100 same pass.
15101
15102 2. To enable the creation of the dump file, append the pass code
15103 to the -fdump- option prefix and invoke GCC with it. For
15104 example, to enable the dump from the Early Value Range
15105 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15106 Optionally, you may specify the name of the dump file. If you
15107 don't specify one, GCC creates as described below.
15108
15109 3. Find the pass dump in a file whose name is composed of three
15110 components separated by a period: the name of the source file
15111 GCC was invoked to compile, a numeric suffix indicating the
15112 pass number followed by the letter t for tree passes (and the
15113 letter r for RTL passes), and finally the pass code. For
15114 example, the Early VRP pass dump might be in a file named
15115 myfile.c.038t.evrp in the current working directory. Note that
15116 the numeric codes are not stable and may change from one
15117 version of GCC to another.
15118
15119 -fopt-info
15120 -fopt-info-options
15121 -fopt-info-options=filename
15122 Controls optimization dumps from various optimization passes. If
15123 the -options form is used, options is a list of - separated option
15124 keywords to select the dump details and optimizations.
15125
15126 The options can be divided into three groups:
15127
15128 1. options describing what kinds of messages should be emitted,
15129
15130 2. options describing the verbosity of the dump, and
15131
15132 3. options describing which optimizations should be included.
15133
15134 The options from each group can be freely mixed as they are non-
15135 overlapping. However, in case of any conflicts, the later options
15136 override the earlier options on the command line.
15137
15138 The following options control which kinds of messages should be
15139 emitted:
15140
15141 optimized
15142 Print information when an optimization is successfully applied.
15143 It is up to a pass to decide which information is relevant. For
15144 example, the vectorizer passes print the source location of
15145 loops which are successfully vectorized.
15146
15147 missed
15148 Print information about missed optimizations. Individual passes
15149 control which information to include in the output.
15150
15151 note
15152 Print verbose information about optimizations, such as certain
15153 transformations, more detailed messages about decisions etc.
15154
15155 all Print detailed optimization information. This includes
15156 optimized, missed, and note.
15157
15158 The following option controls the dump verbosity:
15159
15160 internals
15161 By default, only "high-level" messages are emitted. This option
15162 enables additional, more detailed, messages, which are likely
15163 to only be of interest to GCC developers.
15164
15165 One or more of the following option keywords can be used to
15166 describe a group of optimizations:
15167
15168 ipa Enable dumps from all interprocedural optimizations.
15169
15170 loop
15171 Enable dumps from all loop optimizations.
15172
15173 inline
15174 Enable dumps from all inlining optimizations.
15175
15176 omp Enable dumps from all OMP (Offloading and Multi Processing)
15177 optimizations.
15178
15179 vec Enable dumps from all vectorization optimizations.
15180
15181 optall
15182 Enable dumps from all optimizations. This is a superset of the
15183 optimization groups listed above.
15184
15185 If options is omitted, it defaults to optimized-optall, which means
15186 to dump messages about successful optimizations from all the
15187 passes, omitting messages that are treated as "internals".
15188
15189 If the filename is provided, then the dumps from all the applicable
15190 optimizations are concatenated into the filename. Otherwise the
15191 dump is output onto stderr. Though multiple -fopt-info options are
15192 accepted, only one of them can include a filename. If other
15193 filenames are provided then all but the first such option are
15194 ignored.
15195
15196 Note that the output filename is overwritten in case of multiple
15197 translation units. If a combined output from multiple translation
15198 units is desired, stderr should be used instead.
15199
15200 In the following example, the optimization info is output to
15201 stderr:
15202
15203 gcc -O3 -fopt-info
15204
15205 This example:
15206
15207 gcc -O3 -fopt-info-missed=missed.all
15208
15209 outputs missed optimization report from all the passes into
15210 missed.all, and this one:
15211
15212 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15213
15214 prints information about missed optimization opportunities from
15215 vectorization passes on stderr. Note that -fopt-info-vec-missed is
15216 equivalent to -fopt-info-missed-vec. The order of the optimization
15217 group names and message types listed after -fopt-info does not
15218 matter.
15219
15220 As another example,
15221
15222 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15223
15224 outputs information about missed optimizations as well as optimized
15225 locations from all the inlining passes into inline.txt.
15226
15227 Finally, consider:
15228
15229 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15230
15231 Here the two output filenames vec.miss and loop.opt are in conflict
15232 since only one output file is allowed. In this case, only the first
15233 option takes effect and the subsequent options are ignored. Thus
15234 only vec.miss is produced which contains dumps from the vectorizer
15235 about missed opportunities.
15236
15237 -fsave-optimization-record
15238 Write a SRCFILE.opt-record.json.gz file detailing what
15239 optimizations were performed, for those optimizations that support
15240 -fopt-info.
15241
15242 This option is experimental and the format of the data within the
15243 compressed JSON file is subject to change.
15244
15245 It is roughly equivalent to a machine-readable version of
15246 -fopt-info-all, as a collection of messages with source file, line
15247 number and column number, with the following additional data for
15248 each message:
15249
15250 * the execution count of the code being optimized, along with
15251 metadata about whether this was from actual profile data, or
15252 just an estimate, allowing consumers to prioritize messages by
15253 code hotness,
15254
15255 * the function name of the code being optimized, where
15256 applicable,
15257
15258 * the "inlining chain" for the code being optimized, so that when
15259 a function is inlined into several different places (which
15260 might themselves be inlined), the reader can distinguish
15261 between the copies,
15262
15263 * objects identifying those parts of the message that refer to
15264 expressions, statements or symbol-table nodes, which of these
15265 categories they are, and, when available, their source code
15266 location,
15267
15268 * the GCC pass that emitted the message, and
15269
15270 * the location in GCC's own code from which the message was
15271 emitted
15272
15273 Additionally, some messages are logically nested within other
15274 messages, reflecting implementation details of the optimization
15275 passes.
15276
15277 -fsched-verbose=n
15278 On targets that use instruction scheduling, this option controls
15279 the amount of debugging output the scheduler prints to the dump
15280 files.
15281
15282 For n greater than zero, -fsched-verbose outputs the same
15283 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
15284 greater than one, it also output basic block probabilities,
15285 detailed ready list information and unit/insn info. For n greater
15286 than two, it includes RTL at abort point, control-flow and regions
15287 info. And for n over four, -fsched-verbose also includes
15288 dependence info.
15289
15290 -fenable-kind-pass
15291 -fdisable-kind-pass=range-list
15292 This is a set of options that are used to explicitly disable/enable
15293 optimization passes. These options are intended for use for
15294 debugging GCC. Compiler users should use regular options for
15295 enabling/disabling passes instead.
15296
15297 -fdisable-ipa-pass
15298 Disable IPA pass pass. pass is the pass name. If the same pass
15299 is statically invoked in the compiler multiple times, the pass
15300 name should be appended with a sequential number starting from
15301 1.
15302
15303 -fdisable-rtl-pass
15304 -fdisable-rtl-pass=range-list
15305 Disable RTL pass pass. pass is the pass name. If the same
15306 pass is statically invoked in the compiler multiple times, the
15307 pass name should be appended with a sequential number starting
15308 from 1. range-list is a comma-separated list of function
15309 ranges or assembler names. Each range is a number pair
15310 separated by a colon. The range is inclusive in both ends. If
15311 the range is trivial, the number pair can be simplified as a
15312 single number. If the function's call graph node's uid falls
15313 within one of the specified ranges, the pass is disabled for
15314 that function. The uid is shown in the function header of a
15315 dump file, and the pass names can be dumped by using option
15316 -fdump-passes.
15317
15318 -fdisable-tree-pass
15319 -fdisable-tree-pass=range-list
15320 Disable tree pass pass. See -fdisable-rtl for the description
15321 of option arguments.
15322
15323 -fenable-ipa-pass
15324 Enable IPA pass pass. pass is the pass name. If the same pass
15325 is statically invoked in the compiler multiple times, the pass
15326 name should be appended with a sequential number starting from
15327 1.
15328
15329 -fenable-rtl-pass
15330 -fenable-rtl-pass=range-list
15331 Enable RTL pass pass. See -fdisable-rtl for option argument
15332 description and examples.
15333
15334 -fenable-tree-pass
15335 -fenable-tree-pass=range-list
15336 Enable tree pass pass. See -fdisable-rtl for the description
15337 of option arguments.
15338
15339 Here are some examples showing uses of these options.
15340
15341 # disable ccp1 for all functions
15342 -fdisable-tree-ccp1
15343 # disable complete unroll for function whose cgraph node uid is 1
15344 -fenable-tree-cunroll=1
15345 # disable gcse2 for functions at the following ranges [1,1],
15346 # [300,400], and [400,1000]
15347 # disable gcse2 for functions foo and foo2
15348 -fdisable-rtl-gcse2=foo,foo2
15349 # disable early inlining
15350 -fdisable-tree-einline
15351 # disable ipa inlining
15352 -fdisable-ipa-inline
15353 # enable tree full unroll
15354 -fenable-tree-unroll
15355
15356 -fchecking
15357 -fchecking=n
15358 Enable internal consistency checking. The default depends on the
15359 compiler configuration. -fchecking=2 enables further internal
15360 consistency checking that might affect code generation.
15361
15362 -frandom-seed=string
15363 This option provides a seed that GCC uses in place of random
15364 numbers in generating certain symbol names that have to be
15365 different in every compiled file. It is also used to place unique
15366 stamps in coverage data files and the object files that produce
15367 them. You can use the -frandom-seed option to produce reproducibly
15368 identical object files.
15369
15370 The string can either be a number (decimal, octal or hex) or an
15371 arbitrary string (in which case it's converted to a number by
15372 computing CRC32).
15373
15374 The string should be different for every file you compile.
15375
15376 -save-temps
15377 Store the usual "temporary" intermediate files permanently; name
15378 them as auxiliary output files, as specified described under
15379 -dumpbase and -dumpdir.
15380
15381 When used in combination with the -x command-line option,
15382 -save-temps is sensible enough to avoid overwriting an input source
15383 file with the same extension as an intermediate file. The
15384 corresponding intermediate file may be obtained by renaming the
15385 source file before using -save-temps.
15386
15387 -save-temps=cwd
15388 Equivalent to -save-temps -dumpdir ./.
15389
15390 -save-temps=obj
15391 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
15392 directory of the output file specified after the -o option,
15393 including any directory separators. If the -o option is not used,
15394 the -save-temps=obj switch behaves like -save-temps=cwd.
15395
15396 -time[=file]
15397 Report the CPU time taken by each subprocess in the compilation
15398 sequence. For C source files, this is the compiler proper and
15399 assembler (plus the linker if linking is done).
15400
15401 Without the specification of an output file, the output looks like
15402 this:
15403
15404 # cc1 0.12 0.01
15405 # as 0.00 0.01
15406
15407 The first number on each line is the "user time", that is time
15408 spent executing the program itself. The second number is "system
15409 time", time spent executing operating system routines on behalf of
15410 the program. Both numbers are in seconds.
15411
15412 With the specification of an output file, the output is appended to
15413 the named file, and it looks like this:
15414
15415 0.12 0.01 cc1 <options>
15416 0.00 0.01 as <options>
15417
15418 The "user time" and the "system time" are moved before the program
15419 name, and the options passed to the program are displayed, so that
15420 one can later tell what file was being compiled, and with which
15421 options.
15422
15423 -fdump-final-insns[=file]
15424 Dump the final internal representation (RTL) to file. If the
15425 optional argument is omitted (or if file is "."), the name of the
15426 dump file is determined by appending ".gkd" to the dump base name,
15427 see -dumpbase.
15428
15429 -fcompare-debug[=opts]
15430 If no error occurs during compilation, run the compiler a second
15431 time, adding opts and -fcompare-debug-second to the arguments
15432 passed to the second compilation. Dump the final internal
15433 representation in both compilations, and print an error if they
15434 differ.
15435
15436 If the equal sign is omitted, the default -gtoggle is used.
15437
15438 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
15439 and nonzero, implicitly enables -fcompare-debug. If
15440 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
15441 it is used for opts, otherwise the default -gtoggle is used.
15442
15443 -fcompare-debug=, with the equal sign but without opts, is
15444 equivalent to -fno-compare-debug, which disables the dumping of the
15445 final representation and the second compilation, preventing even
15446 GCC_COMPARE_DEBUG from taking effect.
15447
15448 To verify full coverage during -fcompare-debug testing, set
15449 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
15450 rejects as an invalid option in any actual compilation (rather than
15451 preprocessing, assembly or linking). To get just a warning,
15452 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
15453 will do.
15454
15455 -fcompare-debug-second
15456 This option is implicitly passed to the compiler for the second
15457 compilation requested by -fcompare-debug, along with options to
15458 silence warnings, and omitting other options that would cause the
15459 compiler to produce output to files or to standard output as a side
15460 effect. Dump files and preserved temporary files are renamed so as
15461 to contain the ".gk" additional extension during the second
15462 compilation, to avoid overwriting those generated by the first.
15463
15464 When this option is passed to the compiler driver, it causes the
15465 first compilation to be skipped, which makes it useful for little
15466 other than debugging the compiler proper.
15467
15468 -gtoggle
15469 Turn off generation of debug info, if leaving out this option
15470 generates it, or turn it on at level 2 otherwise. The position of
15471 this argument in the command line does not matter; it takes effect
15472 after all other options are processed, and it does so only once, no
15473 matter how many times it is given. This is mainly intended to be
15474 used with -fcompare-debug.
15475
15476 -fvar-tracking-assignments-toggle
15477 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
15478 toggles -g.
15479
15480 -Q Makes the compiler print out each function name as it is compiled,
15481 and print some statistics about each pass when it finishes.
15482
15483 -ftime-report
15484 Makes the compiler print some statistics about the time consumed by
15485 each pass when it finishes.
15486
15487 -ftime-report-details
15488 Record the time consumed by infrastructure parts separately for
15489 each pass.
15490
15491 -fira-verbose=n
15492 Control the verbosity of the dump file for the integrated register
15493 allocator. The default value is 5. If the value n is greater or
15494 equal to 10, the dump output is sent to stderr using the same
15495 format as n minus 10.
15496
15497 -flto-report
15498 Prints a report with internal details on the workings of the link-
15499 time optimizer. The contents of this report vary from version to
15500 version. It is meant to be useful to GCC developers when
15501 processing object files in LTO mode (via -flto).
15502
15503 Disabled by default.
15504
15505 -flto-report-wpa
15506 Like -flto-report, but only print for the WPA phase of link-time
15507 optimization.
15508
15509 -fmem-report
15510 Makes the compiler print some statistics about permanent memory
15511 allocation when it finishes.
15512
15513 -fmem-report-wpa
15514 Makes the compiler print some statistics about permanent memory
15515 allocation for the WPA phase only.
15516
15517 -fpre-ipa-mem-report
15518 -fpost-ipa-mem-report
15519 Makes the compiler print some statistics about permanent memory
15520 allocation before or after interprocedural optimization.
15521
15522 -fprofile-report
15523 Makes the compiler print some statistics about consistency of the
15524 (estimated) profile and effect of individual passes.
15525
15526 -fstack-usage
15527 Makes the compiler output stack usage information for the program,
15528 on a per-function basis. The filename for the dump is made by
15529 appending .su to the auxname. auxname is generated from the name
15530 of the output file, if explicitly specified and it is not an
15531 executable, otherwise it is the basename of the source file. An
15532 entry is made up of three fields:
15533
15534 * The name of the function.
15535
15536 * A number of bytes.
15537
15538 * One or more qualifiers: "static", "dynamic", "bounded".
15539
15540 The qualifier "static" means that the function manipulates the
15541 stack statically: a fixed number of bytes are allocated for the
15542 frame on function entry and released on function exit; no stack
15543 adjustments are otherwise made in the function. The second field
15544 is this fixed number of bytes.
15545
15546 The qualifier "dynamic" means that the function manipulates the
15547 stack dynamically: in addition to the static allocation described
15548 above, stack adjustments are made in the body of the function, for
15549 example to push/pop arguments around function calls. If the
15550 qualifier "bounded" is also present, the amount of these
15551 adjustments is bounded at compile time and the second field is an
15552 upper bound of the total amount of stack used by the function. If
15553 it is not present, the amount of these adjustments is not bounded
15554 at compile time and the second field only represents the bounded
15555 part.
15556
15557 -fstats
15558 Emit statistics about front-end processing at the end of the
15559 compilation. This option is supported only by the C++ front end,
15560 and the information is generally only useful to the G++ development
15561 team.
15562
15563 -fdbg-cnt-list
15564 Print the name and the counter upper bound for all debug counters.
15565
15566 -fdbg-cnt=counter-value-list
15567 Set the internal debug counter lower and upper bound. counter-
15568 value-list is a comma-separated list of
15569 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
15570 tuples which sets the name of the counter and list of closed
15571 intervals. The lower_bound is optional and is zero initialized if
15572 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
15573 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
15574 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
15575 for first 10 invocations.
15576
15577 -print-file-name=library
15578 Print the full absolute name of the library file library that would
15579 be used when linking---and don't do anything else. With this
15580 option, GCC does not compile or link anything; it just prints the
15581 file name.
15582
15583 -print-multi-directory
15584 Print the directory name corresponding to the multilib selected by
15585 any other switches present in the command line. This directory is
15586 supposed to exist in GCC_EXEC_PREFIX.
15587
15588 -print-multi-lib
15589 Print the mapping from multilib directory names to compiler
15590 switches that enable them. The directory name is separated from
15591 the switches by ;, and each switch starts with an @ instead of the
15592 -, without spaces between multiple switches. This is supposed to
15593 ease shell processing.
15594
15595 -print-multi-os-directory
15596 Print the path to OS libraries for the selected multilib, relative
15597 to some lib subdirectory. If OS libraries are present in the lib
15598 subdirectory and no multilibs are used, this is usually just ., if
15599 OS libraries are present in libsuffix sibling directories this
15600 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
15601 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
15602 or ev6.
15603
15604 -print-multiarch
15605 Print the path to OS libraries for the selected multiarch, relative
15606 to some lib subdirectory.
15607
15608 -print-prog-name=program
15609 Like -print-file-name, but searches for a program such as cpp.
15610
15611 -print-libgcc-file-name
15612 Same as -print-file-name=libgcc.a.
15613
15614 This is useful when you use -nostdlib or -nodefaultlibs but you do
15615 want to link with libgcc.a. You can do:
15616
15617 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
15618
15619 -print-search-dirs
15620 Print the name of the configured installation directory and a list
15621 of program and library directories gcc searches---and don't do
15622 anything else.
15623
15624 This is useful when gcc prints the error message installation
15625 problem, cannot exec cpp0: No such file or directory. To resolve
15626 this you either need to put cpp0 and the other compiler components
15627 where gcc expects to find them, or you can set the environment
15628 variable GCC_EXEC_PREFIX to the directory where you installed them.
15629 Don't forget the trailing /.
15630
15631 -print-sysroot
15632 Print the target sysroot directory that is used during compilation.
15633 This is the target sysroot specified either at configure time or
15634 using the --sysroot option, possibly with an extra suffix that
15635 depends on compilation options. If no target sysroot is specified,
15636 the option prints nothing.
15637
15638 -print-sysroot-headers-suffix
15639 Print the suffix added to the target sysroot when searching for
15640 headers, or give an error if the compiler is not configured with
15641 such a suffix---and don't do anything else.
15642
15643 -dumpmachine
15644 Print the compiler's target machine (for example,
15645 i686-pc-linux-gnu)---and don't do anything else.
15646
15647 -dumpversion
15648 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
15649 don't do anything else. This is the compiler version used in
15650 filesystem paths and specs. Depending on how the compiler has been
15651 configured it can be just a single number (major version), two
15652 numbers separated by a dot (major and minor version) or three
15653 numbers separated by dots (major, minor and patchlevel version).
15654
15655 -dumpfullversion
15656 Print the full compiler version---and don't do anything else. The
15657 output is always three numbers separated by dots, major, minor and
15658 patchlevel version.
15659
15660 -dumpspecs
15661 Print the compiler's built-in specs---and don't do anything else.
15662 (This is used when GCC itself is being built.)
15663
15664 Machine-Dependent Options
15665 Each target machine supported by GCC can have its own options---for
15666 example, to allow you to compile for a particular processor variant or
15667 ABI, or to control optimizations specific to that machine. By
15668 convention, the names of machine-specific options start with -m.
15669
15670 Some configurations of the compiler also support additional target-
15671 specific options, usually for compatibility with other compilers on the
15672 same platform.
15673
15674 AArch64 Options
15675
15676 These options are defined for AArch64 implementations:
15677
15678 -mabi=name
15679 Generate code for the specified data model. Permissible values are
15680 ilp32 for SysV-like data model where int, long int and pointers are
15681 32 bits, and lp64 for SysV-like data model where int is 32 bits,
15682 but long int and pointers are 64 bits.
15683
15684 The default depends on the specific target configuration. Note
15685 that the LP64 and ILP32 ABIs are not link-compatible; you must
15686 compile your entire program with the same ABI, and link with a
15687 compatible set of libraries.
15688
15689 -mbig-endian
15690 Generate big-endian code. This is the default when GCC is
15691 configured for an aarch64_be-*-* target.
15692
15693 -mgeneral-regs-only
15694 Generate code which uses only the general-purpose registers. This
15695 will prevent the compiler from using floating-point and Advanced
15696 SIMD registers but will not impose any restrictions on the
15697 assembler.
15698
15699 -mlittle-endian
15700 Generate little-endian code. This is the default when GCC is
15701 configured for an aarch64-*-* but not an aarch64_be-*-* target.
15702
15703 -mcmodel=tiny
15704 Generate code for the tiny code model. The program and its
15705 statically defined symbols must be within 1MB of each other.
15706 Programs can be statically or dynamically linked.
15707
15708 -mcmodel=small
15709 Generate code for the small code model. The program and its
15710 statically defined symbols must be within 4GB of each other.
15711 Programs can be statically or dynamically linked. This is the
15712 default code model.
15713
15714 -mcmodel=large
15715 Generate code for the large code model. This makes no assumptions
15716 about addresses and sizes of sections. Programs can be statically
15717 linked only. The -mcmodel=large option is incompatible with
15718 -mabi=ilp32, -fpic and -fPIC.
15719
15720 -mstrict-align
15721 -mno-strict-align
15722 Avoid or allow generating memory accesses that may not be aligned
15723 on a natural object boundary as described in the architecture
15724 specification.
15725
15726 -momit-leaf-frame-pointer
15727 -mno-omit-leaf-frame-pointer
15728 Omit or keep the frame pointer in leaf functions. The former
15729 behavior is the default.
15730
15731 -mstack-protector-guard=guard
15732 -mstack-protector-guard-reg=reg
15733 -mstack-protector-guard-offset=offset
15734 Generate stack protection code using canary at guard. Supported
15735 locations are global for a global canary or sysreg for a canary in
15736 an appropriate system register.
15737
15738 With the latter choice the options -mstack-protector-guard-reg=reg
15739 and -mstack-protector-guard-offset=offset furthermore specify which
15740 system register to use as base register for reading the canary, and
15741 from what offset from that base register. There is no default
15742 register or offset as this is entirely for use within the Linux
15743 kernel.
15744
15745 -mtls-dialect=desc
15746 Use TLS descriptors as the thread-local storage mechanism for
15747 dynamic accesses of TLS variables. This is the default.
15748
15749 -mtls-dialect=traditional
15750 Use traditional TLS as the thread-local storage mechanism for
15751 dynamic accesses of TLS variables.
15752
15753 -mtls-size=size
15754 Specify bit size of immediate TLS offsets. Valid values are 12,
15755 24, 32, 48. This option requires binutils 2.26 or newer.
15756
15757 -mfix-cortex-a53-835769
15758 -mno-fix-cortex-a53-835769
15759 Enable or disable the workaround for the ARM Cortex-A53 erratum
15760 number 835769. This involves inserting a NOP instruction between
15761 memory instructions and 64-bit integer multiply-accumulate
15762 instructions.
15763
15764 -mfix-cortex-a53-843419
15765 -mno-fix-cortex-a53-843419
15766 Enable or disable the workaround for the ARM Cortex-A53 erratum
15767 number 843419. This erratum workaround is made at link time and
15768 this will only pass the corresponding flag to the linker.
15769
15770 -mlow-precision-recip-sqrt
15771 -mno-low-precision-recip-sqrt
15772 Enable or disable the reciprocal square root approximation. This
15773 option only has an effect if -ffast-math or
15774 -funsafe-math-optimizations is used as well. Enabling this reduces
15775 precision of reciprocal square root results to about 16 bits for
15776 single precision and to 32 bits for double precision.
15777
15778 -mlow-precision-sqrt
15779 -mno-low-precision-sqrt
15780 Enable or disable the square root approximation. This option only
15781 has an effect if -ffast-math or -funsafe-math-optimizations is used
15782 as well. Enabling this reduces precision of square root results to
15783 about 16 bits for single precision and to 32 bits for double
15784 precision. If enabled, it implies -mlow-precision-recip-sqrt.
15785
15786 -mlow-precision-div
15787 -mno-low-precision-div
15788 Enable or disable the division approximation. This option only has
15789 an effect if -ffast-math or -funsafe-math-optimizations is used as
15790 well. Enabling this reduces precision of division results to about
15791 16 bits for single precision and to 32 bits for double precision.
15792
15793 -mtrack-speculation
15794 -mno-track-speculation
15795 Enable or disable generation of additional code to track
15796 speculative execution through conditional branches. The tracking
15797 state can then be used by the compiler when expanding calls to
15798 "__builtin_speculation_safe_copy" to permit a more efficient code
15799 sequence to be generated.
15800
15801 -moutline-atomics
15802 -mno-outline-atomics
15803 Enable or disable calls to out-of-line helpers to implement atomic
15804 operations. These helpers will, at runtime, determine if the LSE
15805 instructions from ARMv8.1-A can be used; if not, they will use the
15806 load/store-exclusive instructions that are present in the base
15807 ARMv8.0 ISA.
15808
15809 This option is only applicable when compiling for the base ARMv8.0
15810 instruction set. If using a later revision, e.g. -march=armv8.1-a
15811 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
15812 used directly. The same applies when using -mcpu= when the
15813 selected cpu supports the lse feature. This option is on by
15814 default.
15815
15816 -march=name
15817 Specify the name of the target architecture and, optionally, one or
15818 more feature modifiers. This option has the form
15819 -march=arch{+[no]feature}*.
15820
15821 The table below summarizes the permissible values for arch and the
15822 features that they enable by default:
15823
15824 arch value : Architecture : Includes by default
15825 armv8-a : Armv8-A : +fp, +simd
15826 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
15827 armv8.2-a : Armv8.2-A : armv8.1-a
15828 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
15829 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
15830 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
15831 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
15832 armv8-r : Armv8-R : armv8-r
15833
15834 The value native is available on native AArch64 GNU/Linux and
15835 causes the compiler to pick the architecture of the host system.
15836 This option has no effect if the compiler is unable to recognize
15837 the architecture of the host system,
15838
15839 The permissible values for feature are listed in the sub-section on
15840 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
15841 Where conflicting feature modifiers are specified, the right-most
15842 feature is used.
15843
15844 GCC uses name to determine what kind of instructions it can emit
15845 when generating assembly code. If -march is specified without
15846 either of -mtune or -mcpu also being specified, the code is tuned
15847 to perform well across a range of target processors implementing
15848 the target architecture.
15849
15850 -mtune=name
15851 Specify the name of the target processor for which GCC should tune
15852 the performance of the code. Permissible values for this option
15853 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
15854 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
15855 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
15856 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
15857 neoverse-e1, neoverse-n1, neoverse-n2, neoverse-v1, qdf24xx,
15858 saphira, phecda, xgene1, vulcan, octeontx, octeontx81, octeontx83,
15859 octeontx2, octeontx2t98, octeontx2t96 octeontx2t93, octeontx2f95,
15860 octeontx2f95n, octeontx2f95mm, a64fx, thunderx, thunderxt88,
15861 thunderxt88p1, thunderxt81, tsv110, thunderxt83, thunderx2t99,
15862 thunderx3t110, zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15863 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
15864 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
15865 cortex-x1, native.
15866
15867 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15868 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
15869 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
15870 should tune for a big.LITTLE system.
15871
15872 Additionally on native AArch64 GNU/Linux systems the value native
15873 tunes performance to the host system. This option has no effect if
15874 the compiler is unable to recognize the processor of the host
15875 system.
15876
15877 Where none of -mtune=, -mcpu= or -march= are specified, the code is
15878 tuned to perform well across a range of target processors.
15879
15880 This option cannot be suffixed by feature modifiers.
15881
15882 -mcpu=name
15883 Specify the name of the target processor, optionally suffixed by
15884 one or more feature modifiers. This option has the form
15885 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
15886 the same as those available for -mtune. The permissible values for
15887 feature are documented in the sub-section on
15888 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
15889 Where conflicting feature modifiers are specified, the right-most
15890 feature is used.
15891
15892 GCC uses name to determine what kind of instructions it can emit
15893 when generating assembly code (as if by -march) and to determine
15894 the target processor for which to tune for performance (as if by
15895 -mtune). Where this option is used in conjunction with -march or
15896 -mtune, those options take precedence over the appropriate part of
15897 this option.
15898
15899 -moverride=string
15900 Override tuning decisions made by the back-end in response to a
15901 -mtune= switch. The syntax, semantics, and accepted values for
15902 string in this option are not guaranteed to be consistent across
15903 releases.
15904
15905 This option is only intended to be useful when developing GCC.
15906
15907 -mverbose-cost-dump
15908 Enable verbose cost model dumping in the debug dump files. This
15909 option is provided for use in debugging the compiler.
15910
15911 -mpc-relative-literal-loads
15912 -mno-pc-relative-literal-loads
15913 Enable or disable PC-relative literal loads. With this option
15914 literal pools are accessed using a single instruction and emitted
15915 after each function. This limits the maximum size of functions to
15916 1MB. This is enabled by default for -mcmodel=tiny.
15917
15918 -msign-return-address=scope
15919 Select the function scope on which return address signing will be
15920 applied. Permissible values are none, which disables return
15921 address signing, non-leaf, which enables pointer signing for
15922 functions which are not leaf functions, and all, which enables
15923 pointer signing for all functions. The default value is none. This
15924 option has been deprecated by -mbranch-protection.
15925
15926 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
15927 Select the branch protection features to use. none is the default
15928 and turns off all types of branch protection. standard turns on
15929 all types of branch protection features. If a feature has
15930 additional tuning options, then standard sets it to its standard
15931 level. pac-ret[+leaf] turns on return address signing to its
15932 standard level: signing functions that save the return address to
15933 memory (non-leaf functions will practically always do this) using
15934 the a-key. The optional argument leaf can be used to extend the
15935 signing to include leaf functions. The optional argument b-key can
15936 be used to sign the functions with the B-key instead of the A-key.
15937 bti turns on branch target identification mechanism.
15938
15939 -mharden-sls=opts
15940 Enable compiler hardening against straight line speculation (SLS).
15941 opts is a comma-separated list of the following options:
15942
15943 retbr
15944 blr
15945
15946 In addition, -mharden-sls=all enables all SLS hardening while
15947 -mharden-sls=none disables all SLS hardening.
15948
15949 -msve-vector-bits=bits
15950 Specify the number of bits in an SVE vector register. This option
15951 only has an effect when SVE is enabled.
15952
15953 GCC supports two forms of SVE code generation: "vector-length
15954 agnostic" output that works with any size of vector register and
15955 "vector-length specific" output that allows GCC to make assumptions
15956 about the vector length when it is useful for optimization reasons.
15957 The possible values of bits are: scalable, 128, 256, 512, 1024 and
15958 2048. Specifying scalable selects vector-length agnostic output.
15959 At present -msve-vector-bits=128 also generates vector-length
15960 agnostic output for big-endian targets. All other values generate
15961 vector-length specific code. The behavior of these values may
15962 change in future releases and no value except scalable should be
15963 relied on for producing code that is portable across different
15964 hardware SVE vector lengths.
15965
15966 The default is -msve-vector-bits=scalable, which produces vector-
15967 length agnostic code.
15968
15969 -march and -mcpu Feature Modifiers
15970
15971 Feature modifiers used with -march and -mcpu can be any of the
15972 following and their inverses nofeature:
15973
15974 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
15975
15976 crypto
15977 Enable Crypto extension. This also enables Advanced SIMD and
15978 floating-point instructions.
15979
15980 fp Enable floating-point instructions. This is on by default for all
15981 possible values for options -march and -mcpu.
15982
15983 simd
15984 Enable Advanced SIMD instructions. This also enables floating-
15985 point instructions. This is on by default for all possible values
15986 for options -march and -mcpu.
15987
15988 sve Enable Scalable Vector Extension instructions. This also enables
15989 Advanced SIMD and floating-point instructions.
15990
15991 lse Enable Large System Extension instructions. This is on by default
15992 for -march=armv8.1-a.
15993
15994 rdma
15995 Enable Round Double Multiply Accumulate instructions. This is on
15996 by default for -march=armv8.1-a.
15997
15998 fp16
15999 Enable FP16 extension. This also enables floating-point
16000 instructions.
16001
16002 fp16fml
16003 Enable FP16 fmla extension. This also enables FP16 extensions and
16004 floating-point instructions. This option is enabled by default for
16005 -march=armv8.4-a. Use of this option with architectures prior to
16006 Armv8.2-A is not supported.
16007
16008 rcpc
16009 Enable the RcPc extension. This does not change code generation
16010 from GCC, but is passed on to the assembler, enabling inline asm
16011 statements to use instructions from the RcPc extension.
16012
16013 dotprod
16014 Enable the Dot Product extension. This also enables Advanced SIMD
16015 instructions.
16016
16017 aes Enable the Armv8-a aes and pmull crypto extension. This also
16018 enables Advanced SIMD instructions.
16019
16020 sha2
16021 Enable the Armv8-a sha2 crypto extension. This also enables
16022 Advanced SIMD instructions.
16023
16024 sha3
16025 Enable the sha512 and sha3 crypto extension. This also enables
16026 Advanced SIMD instructions. Use of this option with architectures
16027 prior to Armv8.2-A is not supported.
16028
16029 sm4 Enable the sm3 and sm4 crypto extension. This also enables
16030 Advanced SIMD instructions. Use of this option with architectures
16031 prior to Armv8.2-A is not supported.
16032
16033 profile
16034 Enable the Statistical Profiling extension. This option is only to
16035 enable the extension at the assembler level and does not affect
16036 code generation.
16037
16038 rng Enable the Armv8.5-a Random Number instructions. This option is
16039 only to enable the extension at the assembler level and does not
16040 affect code generation.
16041
16042 memtag
16043 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16044 with architectures prior to Armv8.5-A is not supported.
16045
16046 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16047 only to enable the extension at the assembler level and does not
16048 affect code generation. This option is enabled by default for
16049 -march=armv8.5-a.
16050
16051 ssbs
16052 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16053 option is only to enable the extension at the assembler level and
16054 does not affect code generation. This option is enabled by default
16055 for -march=armv8.5-a.
16056
16057 predres
16058 Enable the Armv8-a Execution and Data Prediction Restriction
16059 instructions. This option is only to enable the extension at the
16060 assembler level and does not affect code generation. This option
16061 is enabled by default for -march=armv8.5-a.
16062
16063 sve2
16064 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16065 SVE instructions.
16066
16067 sve2-bitperm
16068 Enable SVE2 bitperm instructions. This also enables SVE2
16069 instructions.
16070
16071 sve2-sm4
16072 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16073
16074 sve2-aes
16075 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16076
16077 sve2-sha3
16078 Enable SVE2 sha3 instructions. This also enables SVE2
16079 instructions.
16080
16081 tme Enable the Transactional Memory Extension.
16082
16083 i8mm
16084 Enable 8-bit Integer Matrix Multiply instructions. This also
16085 enables Advanced SIMD and floating-point instructions. This option
16086 is enabled by default for -march=armv8.6-a. Use of this option
16087 with architectures prior to Armv8.2-A is not supported.
16088
16089 f32mm
16090 Enable 32-bit Floating point Matrix Multiply instructions. This
16091 also enables SVE instructions. Use of this option with
16092 architectures prior to Armv8.2-A is not supported.
16093
16094 f64mm
16095 Enable 64-bit Floating point Matrix Multiply instructions. This
16096 also enables SVE instructions. Use of this option with
16097 architectures prior to Armv8.2-A is not supported.
16098
16099 bf16
16100 Enable brain half-precision floating-point instructions. This also
16101 enables Advanced SIMD and floating-point instructions. This option
16102 is enabled by default for -march=armv8.6-a. Use of this option
16103 with architectures prior to Armv8.2-A is not supported.
16104
16105 flagm
16106 Enable the Flag Manipulation instructions Extension.
16107
16108 pauth
16109 Enable the Pointer Authentication Extension.
16110
16111 Feature crypto implies aes, sha2, and simd, which implies fp.
16112 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16113 nosha2.
16114
16115 Adapteva Epiphany Options
16116
16117 These -m options are defined for Adapteva Epiphany:
16118
16119 -mhalf-reg-file
16120 Don't allocate any register in the range "r32"..."r63". That
16121 allows code to run on hardware variants that lack these registers.
16122
16123 -mprefer-short-insn-regs
16124 Preferentially allocate registers that allow short instruction
16125 generation. This can result in increased instruction count, so
16126 this may either reduce or increase overall code size.
16127
16128 -mbranch-cost=num
16129 Set the cost of branches to roughly num "simple" instructions.
16130 This cost is only a heuristic and is not guaranteed to produce
16131 consistent results across releases.
16132
16133 -mcmove
16134 Enable the generation of conditional moves.
16135
16136 -mnops=num
16137 Emit num NOPs before every other generated instruction.
16138
16139 -mno-soft-cmpsf
16140 For single-precision floating-point comparisons, emit an "fsub"
16141 instruction and test the flags. This is faster than a software
16142 comparison, but can get incorrect results in the presence of NaNs,
16143 or when two different small numbers are compared such that their
16144 difference is calculated as zero. The default is -msoft-cmpsf,
16145 which uses slower, but IEEE-compliant, software comparisons.
16146
16147 -mstack-offset=num
16148 Set the offset between the top of the stack and the stack pointer.
16149 E.g., a value of 8 means that the eight bytes in the range
16150 "sp+0...sp+7" can be used by leaf functions without stack
16151 allocation. Values other than 8 or 16 are untested and unlikely to
16152 work. Note also that this option changes the ABI; compiling a
16153 program with a different stack offset than the libraries have been
16154 compiled with generally does not work. This option can be useful
16155 if you want to evaluate if a different stack offset would give you
16156 better code, but to actually use a different stack offset to build
16157 working programs, it is recommended to configure the toolchain with
16158 the appropriate --with-stack-offset=num option.
16159
16160 -mno-round-nearest
16161 Make the scheduler assume that the rounding mode has been set to
16162 truncating. The default is -mround-nearest.
16163
16164 -mlong-calls
16165 If not otherwise specified by an attribute, assume all calls might
16166 be beyond the offset range of the "b" / "bl" instructions, and
16167 therefore load the function address into a register before
16168 performing a (otherwise direct) call. This is the default.
16169
16170 -mshort-calls
16171 If not otherwise specified by an attribute, assume all direct calls
16172 are in the range of the "b" / "bl" instructions, so use these
16173 instructions for direct calls. The default is -mlong-calls.
16174
16175 -msmall16
16176 Assume addresses can be loaded as 16-bit unsigned values. This
16177 does not apply to function addresses for which -mlong-calls
16178 semantics are in effect.
16179
16180 -mfp-mode=mode
16181 Set the prevailing mode of the floating-point unit. This
16182 determines the floating-point mode that is provided and expected at
16183 function call and return time. Making this mode match the mode you
16184 predominantly need at function start can make your programs smaller
16185 and faster by avoiding unnecessary mode switches.
16186
16187 mode can be set to one the following values:
16188
16189 caller
16190 Any mode at function entry is valid, and retained or restored
16191 when the function returns, and when it calls other functions.
16192 This mode is useful for compiling libraries or other
16193 compilation units you might want to incorporate into different
16194 programs with different prevailing FPU modes, and the
16195 convenience of being able to use a single object file outweighs
16196 the size and speed overhead for any extra mode switching that
16197 might be needed, compared with what would be needed with a more
16198 specific choice of prevailing FPU mode.
16199
16200 truncate
16201 This is the mode used for floating-point calculations with
16202 truncating (i.e. round towards zero) rounding mode. That
16203 includes conversion from floating point to integer.
16204
16205 round-nearest
16206 This is the mode used for floating-point calculations with
16207 round-to-nearest-or-even rounding mode.
16208
16209 int This is the mode used to perform integer calculations in the
16210 FPU, e.g. integer multiply, or integer multiply-and-
16211 accumulate.
16212
16213 The default is -mfp-mode=caller
16214
16215 -mno-split-lohi
16216 -mno-postinc
16217 -mno-postmodify
16218 Code generation tweaks that disable, respectively, splitting of
16219 32-bit loads, generation of post-increment addresses, and
16220 generation of post-modify addresses. The defaults are msplit-lohi,
16221 -mpost-inc, and -mpost-modify.
16222
16223 -mnovect-double
16224 Change the preferred SIMD mode to SImode. The default is
16225 -mvect-double, which uses DImode as preferred SIMD mode.
16226
16227 -max-vect-align=num
16228 The maximum alignment for SIMD vector mode types. num may be 4 or
16229 8. The default is 8. Note that this is an ABI change, even though
16230 many library function interfaces are unaffected if they don't use
16231 SIMD vector modes in places that affect size and/or alignment of
16232 relevant types.
16233
16234 -msplit-vecmove-early
16235 Split vector moves into single word moves before reload. In theory
16236 this can give better register allocation, but so far the reverse
16237 seems to be generally the case.
16238
16239 -m1reg-reg
16240 Specify a register to hold the constant -1, which makes loading
16241 small negative constants and certain bitmasks faster. Allowable
16242 values for reg are r43 and r63, which specify use of that register
16243 as a fixed register, and none, which means that no register is used
16244 for this purpose. The default is -m1reg-none.
16245
16246 AMD GCN Options
16247
16248 These options are defined specifically for the AMD GCN port.
16249
16250 -march=gpu
16251 -mtune=gpu
16252 Set architecture type or tuning for gpu. Supported values for gpu
16253 are
16254
16255 fiji
16256 Compile for GCN3 Fiji devices (gfx803).
16257
16258 gfx900
16259 Compile for GCN5 Vega 10 devices (gfx900).
16260
16261 gfx906
16262 Compile for GCN5 Vega 20 devices (gfx906).
16263
16264 -mstack-size=bytes
16265 Specify how many bytes of stack space will be requested for each
16266 GPU thread (wave-front). Beware that there may be many threads and
16267 limited memory available. The size of the stack allocation may
16268 also have an impact on run-time performance. The default is 32KB
16269 when using OpenACC or OpenMP, and 1MB otherwise.
16270
16271 ARC Options
16272
16273 The following options control the architecture variant for which code
16274 is being compiled:
16275
16276 -mbarrel-shifter
16277 Generate instructions supported by barrel shifter. This is the
16278 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
16279
16280 -mjli-always
16281 Force to call a function using jli_s instruction. This option is
16282 valid only for ARCv2 architecture.
16283
16284 -mcpu=cpu
16285 Set architecture type, register usage, and instruction scheduling
16286 parameters for cpu. There are also shortcut alias options
16287 available for backward compatibility and convenience. Supported
16288 values for cpu are
16289
16290 arc600
16291 Compile for ARC600. Aliases: -mA6, -mARC600.
16292
16293 arc601
16294 Compile for ARC601. Alias: -mARC601.
16295
16296 arc700
16297 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
16298 default when configured with --with-cpu=arc700.
16299
16300 arcem
16301 Compile for ARC EM.
16302
16303 archs
16304 Compile for ARC HS.
16305
16306 em Compile for ARC EM CPU with no hardware extensions.
16307
16308 em4 Compile for ARC EM4 CPU.
16309
16310 em4_dmips
16311 Compile for ARC EM4 DMIPS CPU.
16312
16313 em4_fpus
16314 Compile for ARC EM4 DMIPS CPU with the single-precision
16315 floating-point extension.
16316
16317 em4_fpuda
16318 Compile for ARC EM4 DMIPS CPU with single-precision floating-
16319 point and double assist instructions.
16320
16321 hs Compile for ARC HS CPU with no hardware extensions except the
16322 atomic instructions.
16323
16324 hs34
16325 Compile for ARC HS34 CPU.
16326
16327 hs38
16328 Compile for ARC HS38 CPU.
16329
16330 hs38_linux
16331 Compile for ARC HS38 CPU with all hardware extensions on.
16332
16333 arc600_norm
16334 Compile for ARC 600 CPU with "norm" instructions enabled.
16335
16336 arc600_mul32x16
16337 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
16338 instructions enabled.
16339
16340 arc600_mul64
16341 Compile for ARC 600 CPU with "norm" and "mul64"-family
16342 instructions enabled.
16343
16344 arc601_norm
16345 Compile for ARC 601 CPU with "norm" instructions enabled.
16346
16347 arc601_mul32x16
16348 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
16349 instructions enabled.
16350
16351 arc601_mul64
16352 Compile for ARC 601 CPU with "norm" and "mul64"-family
16353 instructions enabled.
16354
16355 nps400
16356 Compile for ARC 700 on NPS400 chip.
16357
16358 em_mini
16359 Compile for ARC EM minimalist configuration featuring reduced
16360 register set.
16361
16362 -mdpfp
16363 -mdpfp-compact
16364 Generate double-precision FPX instructions, tuned for the compact
16365 implementation.
16366
16367 -mdpfp-fast
16368 Generate double-precision FPX instructions, tuned for the fast
16369 implementation.
16370
16371 -mno-dpfp-lrsr
16372 Disable "lr" and "sr" instructions from using FPX extension aux
16373 registers.
16374
16375 -mea
16376 Generate extended arithmetic instructions. Currently only "divaw",
16377 "adds", "subs", and "sat16" are supported. Only valid for
16378 -mcpu=ARC700.
16379
16380 -mno-mpy
16381 Do not generate "mpy"-family instructions for ARC700. This option
16382 is deprecated.
16383
16384 -mmul32x16
16385 Generate 32x16-bit multiply and multiply-accumulate instructions.
16386
16387 -mmul64
16388 Generate "mul64" and "mulu64" instructions. Only valid for
16389 -mcpu=ARC600.
16390
16391 -mnorm
16392 Generate "norm" instructions. This is the default if -mcpu=ARC700
16393 is in effect.
16394
16395 -mspfp
16396 -mspfp-compact
16397 Generate single-precision FPX instructions, tuned for the compact
16398 implementation.
16399
16400 -mspfp-fast
16401 Generate single-precision FPX instructions, tuned for the fast
16402 implementation.
16403
16404 -msimd
16405 Enable generation of ARC SIMD instructions via target-specific
16406 builtins. Only valid for -mcpu=ARC700.
16407
16408 -msoft-float
16409 This option ignored; it is provided for compatibility purposes
16410 only. Software floating-point code is emitted by default, and this
16411 default can overridden by FPX options; -mspfp, -mspfp-compact, or
16412 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
16413 -mdpfp-fast for double precision.
16414
16415 -mswap
16416 Generate "swap" instructions.
16417
16418 -matomic
16419 This enables use of the locked load/store conditional extension to
16420 implement atomic memory built-in functions. Not available for ARC
16421 6xx or ARC EM cores.
16422
16423 -mdiv-rem
16424 Enable "div" and "rem" instructions for ARCv2 cores.
16425
16426 -mcode-density
16427 Enable code density instructions for ARC EM. This option is on by
16428 default for ARC HS.
16429
16430 -mll64
16431 Enable double load/store operations for ARC HS cores.
16432
16433 -mtp-regno=regno
16434 Specify thread pointer register number.
16435
16436 -mmpy-option=multo
16437 Compile ARCv2 code with a multiplier design option. You can
16438 specify the option using either a string or numeric value for
16439 multo. wlh1 is the default value. The recognized values are:
16440
16441 0
16442 none
16443 No multiplier available.
16444
16445 1
16446 w 16x16 multiplier, fully pipelined. The following instructions
16447 are enabled: "mpyw" and "mpyuw".
16448
16449 2
16450 wlh1
16451 32x32 multiplier, fully pipelined (1 stage). The following
16452 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16453 "mpymu", and "mpy_s".
16454
16455 3
16456 wlh2
16457 32x32 multiplier, fully pipelined (2 stages). The following
16458 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16459 "mpymu", and "mpy_s".
16460
16461 4
16462 wlh3
16463 Two 16x16 multipliers, blocking, sequential. The following
16464 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16465 "mpymu", and "mpy_s".
16466
16467 5
16468 wlh4
16469 One 16x16 multiplier, blocking, sequential. The following
16470 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16471 "mpymu", and "mpy_s".
16472
16473 6
16474 wlh5
16475 One 32x4 multiplier, blocking, sequential. The following
16476 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16477 "mpymu", and "mpy_s".
16478
16479 7
16480 plus_dmpy
16481 ARC HS SIMD support.
16482
16483 8
16484 plus_macd
16485 ARC HS SIMD support.
16486
16487 9
16488 plus_qmacw
16489 ARC HS SIMD support.
16490
16491 This option is only available for ARCv2 cores.
16492
16493 -mfpu=fpu
16494 Enables support for specific floating-point hardware extensions for
16495 ARCv2 cores. Supported values for fpu are:
16496
16497 fpus
16498 Enables support for single-precision floating-point hardware
16499 extensions.
16500
16501 fpud
16502 Enables support for double-precision floating-point hardware
16503 extensions. The single-precision floating-point extension is
16504 also enabled. Not available for ARC EM.
16505
16506 fpuda
16507 Enables support for double-precision floating-point hardware
16508 extensions using double-precision assist instructions. The
16509 single-precision floating-point extension is also enabled.
16510 This option is only available for ARC EM.
16511
16512 fpuda_div
16513 Enables support for double-precision floating-point hardware
16514 extensions using double-precision assist instructions. The
16515 single-precision floating-point, square-root, and divide
16516 extensions are also enabled. This option is only available for
16517 ARC EM.
16518
16519 fpuda_fma
16520 Enables support for double-precision floating-point hardware
16521 extensions using double-precision assist instructions. The
16522 single-precision floating-point and fused multiply and add
16523 hardware extensions are also enabled. This option is only
16524 available for ARC EM.
16525
16526 fpuda_all
16527 Enables support for double-precision floating-point hardware
16528 extensions using double-precision assist instructions. All
16529 single-precision floating-point hardware extensions are also
16530 enabled. This option is only available for ARC EM.
16531
16532 fpus_div
16533 Enables support for single-precision floating-point, square-
16534 root and divide hardware extensions.
16535
16536 fpud_div
16537 Enables support for double-precision floating-point, square-
16538 root and divide hardware extensions. This option includes
16539 option fpus_div. Not available for ARC EM.
16540
16541 fpus_fma
16542 Enables support for single-precision floating-point and fused
16543 multiply and add hardware extensions.
16544
16545 fpud_fma
16546 Enables support for double-precision floating-point and fused
16547 multiply and add hardware extensions. This option includes
16548 option fpus_fma. Not available for ARC EM.
16549
16550 fpus_all
16551 Enables support for all single-precision floating-point
16552 hardware extensions.
16553
16554 fpud_all
16555 Enables support for all single- and double-precision floating-
16556 point hardware extensions. Not available for ARC EM.
16557
16558 -mirq-ctrl-saved=register-range, blink, lp_count
16559 Specifies general-purposes registers that the processor
16560 automatically saves/restores on interrupt entry and exit.
16561 register-range is specified as two registers separated by a dash.
16562 The register range always starts with "r0", the upper limit is "fp"
16563 register. blink and lp_count are optional. This option is only
16564 valid for ARC EM and ARC HS cores.
16565
16566 -mrgf-banked-regs=number
16567 Specifies the number of registers replicated in second register
16568 bank on entry to fast interrupt. Fast interrupts are interrupts
16569 with the highest priority level P0. These interrupts save only PC
16570 and STATUS32 registers to avoid memory transactions during
16571 interrupt entry and exit sequences. Use this option when you are
16572 using fast interrupts in an ARC V2 family processor. Permitted
16573 values are 4, 8, 16, and 32.
16574
16575 -mlpc-width=width
16576 Specify the width of the "lp_count" register. Valid values for
16577 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
16578 fixed to 32 bits. If the width is less than 32, the compiler does
16579 not attempt to transform loops in your program to use the zero-
16580 delay loop mechanism unless it is known that the "lp_count"
16581 register can hold the required loop-counter value. Depending on
16582 the width specified, the compiler and run-time library might
16583 continue to use the loop mechanism for various needs. This option
16584 defines macro "__ARC_LPC_WIDTH__" with the value of width.
16585
16586 -mrf16
16587 This option instructs the compiler to generate code for a 16-entry
16588 register file. This option defines the "__ARC_RF16__" preprocessor
16589 macro.
16590
16591 -mbranch-index
16592 Enable use of "bi" or "bih" instructions to implement jump tables.
16593
16594 The following options are passed through to the assembler, and also
16595 define preprocessor macro symbols.
16596
16597 -mdsp-packa
16598 Passed down to the assembler to enable the DSP Pack A extensions.
16599 Also sets the preprocessor symbol "__Xdsp_packa". This option is
16600 deprecated.
16601
16602 -mdvbf
16603 Passed down to the assembler to enable the dual Viterbi butterfly
16604 extension. Also sets the preprocessor symbol "__Xdvbf". This
16605 option is deprecated.
16606
16607 -mlock
16608 Passed down to the assembler to enable the locked load/store
16609 conditional extension. Also sets the preprocessor symbol
16610 "__Xlock".
16611
16612 -mmac-d16
16613 Passed down to the assembler. Also sets the preprocessor symbol
16614 "__Xxmac_d16". This option is deprecated.
16615
16616 -mmac-24
16617 Passed down to the assembler. Also sets the preprocessor symbol
16618 "__Xxmac_24". This option is deprecated.
16619
16620 -mrtsc
16621 Passed down to the assembler to enable the 64-bit time-stamp
16622 counter extension instruction. Also sets the preprocessor symbol
16623 "__Xrtsc". This option is deprecated.
16624
16625 -mswape
16626 Passed down to the assembler to enable the swap byte ordering
16627 extension instruction. Also sets the preprocessor symbol
16628 "__Xswape".
16629
16630 -mtelephony
16631 Passed down to the assembler to enable dual- and single-operand
16632 instructions for telephony. Also sets the preprocessor symbol
16633 "__Xtelephony". This option is deprecated.
16634
16635 -mxy
16636 Passed down to the assembler to enable the XY memory extension.
16637 Also sets the preprocessor symbol "__Xxy".
16638
16639 The following options control how the assembly code is annotated:
16640
16641 -misize
16642 Annotate assembler instructions with estimated addresses.
16643
16644 -mannotate-align
16645 Explain what alignment considerations lead to the decision to make
16646 an instruction short or long.
16647
16648 The following options are passed through to the linker:
16649
16650 -marclinux
16651 Passed through to the linker, to specify use of the "arclinux"
16652 emulation. This option is enabled by default in tool chains built
16653 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16654 profiling is not requested.
16655
16656 -marclinux_prof
16657 Passed through to the linker, to specify use of the "arclinux_prof"
16658 emulation. This option is enabled by default in tool chains built
16659 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16660 profiling is requested.
16661
16662 The following options control the semantics of generated code:
16663
16664 -mlong-calls
16665 Generate calls as register indirect calls, thus providing access to
16666 the full 32-bit address range.
16667
16668 -mmedium-calls
16669 Don't use less than 25-bit addressing range for calls, which is the
16670 offset available for an unconditional branch-and-link instruction.
16671 Conditional execution of function calls is suppressed, to allow use
16672 of the 25-bit range, rather than the 21-bit range with conditional
16673 branch-and-link. This is the default for tool chains built for
16674 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
16675
16676 -G num
16677 Put definitions of externally-visible data in a small data section
16678 if that data is no bigger than num bytes. The default value of num
16679 is 4 for any ARC configuration, or 8 when we have double load/store
16680 operations.
16681
16682 -mno-sdata
16683 Do not generate sdata references. This is the default for tool
16684 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
16685 targets.
16686
16687 -mvolatile-cache
16688 Use ordinarily cached memory accesses for volatile references.
16689 This is the default.
16690
16691 -mno-volatile-cache
16692 Enable cache bypass for volatile references.
16693
16694 The following options fine tune code generation:
16695
16696 -malign-call
16697 Do alignment optimizations for call instructions.
16698
16699 -mauto-modify-reg
16700 Enable the use of pre/post modify with register displacement.
16701
16702 -mbbit-peephole
16703 Enable bbit peephole2.
16704
16705 -mno-brcc
16706 This option disables a target-specific pass in arc_reorg to
16707 generate compare-and-branch ("brcc") instructions. It has no
16708 effect on generation of these instructions driven by the combiner
16709 pass.
16710
16711 -mcase-vector-pcrel
16712 Use PC-relative switch case tables to enable case table shortening.
16713 This is the default for -Os.
16714
16715 -mcompact-casesi
16716 Enable compact "casesi" pattern. This is the default for -Os, and
16717 only available for ARCv1 cores. This option is deprecated.
16718
16719 -mno-cond-exec
16720 Disable the ARCompact-specific pass to generate conditional
16721 execution instructions.
16722
16723 Due to delay slot scheduling and interactions between operand
16724 numbers, literal sizes, instruction lengths, and the support for
16725 conditional execution, the target-independent pass to generate
16726 conditional execution is often lacking, so the ARC port has kept a
16727 special pass around that tries to find more conditional execution
16728 generation opportunities after register allocation, branch
16729 shortening, and delay slot scheduling have been done. This pass
16730 generally, but not always, improves performance and code size, at
16731 the cost of extra compilation time, which is why there is an option
16732 to switch it off. If you have a problem with call instructions
16733 exceeding their allowable offset range because they are
16734 conditionalized, you should consider using -mmedium-calls instead.
16735
16736 -mearly-cbranchsi
16737 Enable pre-reload use of the "cbranchsi" pattern.
16738
16739 -mexpand-adddi
16740 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
16741 "adc" etc. This option is deprecated.
16742
16743 -mindexed-loads
16744 Enable the use of indexed loads. This can be problematic because
16745 some optimizers then assume that indexed stores exist, which is not
16746 the case.
16747
16748 -mlra
16749 Enable Local Register Allocation. This is still experimental for
16750 ARC, so by default the compiler uses standard reload (i.e.
16751 -mno-lra).
16752
16753 -mlra-priority-none
16754 Don't indicate any priority for target registers.
16755
16756 -mlra-priority-compact
16757 Indicate target register priority for r0..r3 / r12..r15.
16758
16759 -mlra-priority-noncompact
16760 Reduce target register priority for r0..r3 / r12..r15.
16761
16762 -mmillicode
16763 When optimizing for size (using -Os), prologues and epilogues that
16764 have to save or restore a large number of registers are often
16765 shortened by using call to a special function in libgcc; this is
16766 referred to as a millicode call. As these calls can pose
16767 performance issues, and/or cause linking issues when linking in a
16768 nonstandard way, this option is provided to turn on or off
16769 millicode call generation.
16770
16771 -mcode-density-frame
16772 This option enable the compiler to emit "enter" and "leave"
16773 instructions. These instructions are only valid for CPUs with
16774 code-density feature.
16775
16776 -mmixed-code
16777 Tweak register allocation to help 16-bit instruction generation.
16778 This generally has the effect of decreasing the average instruction
16779 size while increasing the instruction count.
16780
16781 -mq-class
16782 Ths option is deprecated. Enable q instruction alternatives. This
16783 is the default for -Os.
16784
16785 -mRcq
16786 Enable Rcq constraint handling. Most short code generation depends
16787 on this. This is the default.
16788
16789 -mRcw
16790 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
16791 on this. This is the default.
16792
16793 -msize-level=level
16794 Fine-tune size optimization with regards to instruction lengths and
16795 alignment. The recognized values for level are:
16796
16797 0 No size optimization. This level is deprecated and treated
16798 like 1.
16799
16800 1 Short instructions are used opportunistically.
16801
16802 2 In addition, alignment of loops and of code after barriers are
16803 dropped.
16804
16805 3 In addition, optional data alignment is dropped, and the option
16806 Os is enabled.
16807
16808 This defaults to 3 when -Os is in effect. Otherwise, the behavior
16809 when this is not set is equivalent to level 1.
16810
16811 -mtune=cpu
16812 Set instruction scheduling parameters for cpu, overriding any
16813 implied by -mcpu=.
16814
16815 Supported values for cpu are
16816
16817 ARC600
16818 Tune for ARC600 CPU.
16819
16820 ARC601
16821 Tune for ARC601 CPU.
16822
16823 ARC700
16824 Tune for ARC700 CPU with standard multiplier block.
16825
16826 ARC700-xmac
16827 Tune for ARC700 CPU with XMAC block.
16828
16829 ARC725D
16830 Tune for ARC725D CPU.
16831
16832 ARC750D
16833 Tune for ARC750D CPU.
16834
16835 -mmultcost=num
16836 Cost to assume for a multiply instruction, with 4 being equal to a
16837 normal instruction.
16838
16839 -munalign-prob-threshold=probability
16840 Set probability threshold for unaligning branches. When tuning for
16841 ARC700 and optimizing for speed, branches without filled delay slot
16842 are preferably emitted unaligned and long, unless profiling
16843 indicates that the probability for the branch to be taken is below
16844 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
16845
16846 The following options are maintained for backward compatibility, but
16847 are now deprecated and will be removed in a future release:
16848
16849 -margonaut
16850 Obsolete FPX.
16851
16852 -mbig-endian
16853 -EB Compile code for big-endian targets. Use of these options is now
16854 deprecated. Big-endian code is supported by configuring GCC to
16855 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
16856 endian is the default.
16857
16858 -mlittle-endian
16859 -EL Compile code for little-endian targets. Use of these options is
16860 now deprecated. Little-endian code is supported by configuring GCC
16861 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
16862 little endian is the default.
16863
16864 -mbarrel_shifter
16865 Replaced by -mbarrel-shifter.
16866
16867 -mdpfp_compact
16868 Replaced by -mdpfp-compact.
16869
16870 -mdpfp_fast
16871 Replaced by -mdpfp-fast.
16872
16873 -mdsp_packa
16874 Replaced by -mdsp-packa.
16875
16876 -mEA
16877 Replaced by -mea.
16878
16879 -mmac_24
16880 Replaced by -mmac-24.
16881
16882 -mmac_d16
16883 Replaced by -mmac-d16.
16884
16885 -mspfp_compact
16886 Replaced by -mspfp-compact.
16887
16888 -mspfp_fast
16889 Replaced by -mspfp-fast.
16890
16891 -mtune=cpu
16892 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
16893 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
16894
16895 -multcost=num
16896 Replaced by -mmultcost.
16897
16898 ARM Options
16899
16900 These -m options are defined for the ARM port:
16901
16902 -mabi=name
16903 Generate code for the specified ABI. Permissible values are: apcs-
16904 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
16905
16906 -mapcs-frame
16907 Generate a stack frame that is compliant with the ARM Procedure
16908 Call Standard for all functions, even if this is not strictly
16909 necessary for correct execution of the code. Specifying
16910 -fomit-frame-pointer with this option causes the stack frames not
16911 to be generated for leaf functions. The default is
16912 -mno-apcs-frame. This option is deprecated.
16913
16914 -mapcs
16915 This is a synonym for -mapcs-frame and is deprecated.
16916
16917 -mthumb-interwork
16918 Generate code that supports calling between the ARM and Thumb
16919 instruction sets. Without this option, on pre-v5 architectures,
16920 the two instruction sets cannot be reliably used inside one
16921 program. The default is -mno-thumb-interwork, since slightly
16922 larger code is generated when -mthumb-interwork is specified. In
16923 AAPCS configurations this option is meaningless.
16924
16925 -mno-sched-prolog
16926 Prevent the reordering of instructions in the function prologue, or
16927 the merging of those instruction with the instructions in the
16928 function's body. This means that all functions start with a
16929 recognizable set of instructions (or in fact one of a choice from a
16930 small set of different function prologues), and this information
16931 can be used to locate the start of functions inside an executable
16932 piece of code. The default is -msched-prolog.
16933
16934 -mfloat-abi=name
16935 Specifies which floating-point ABI to use. Permissible values are:
16936 soft, softfp and hard.
16937
16938 Specifying soft causes GCC to generate output containing library
16939 calls for floating-point operations. softfp allows the generation
16940 of code using hardware floating-point instructions, but still uses
16941 the soft-float calling conventions. hard allows generation of
16942 floating-point instructions and uses FPU-specific calling
16943 conventions.
16944
16945 The default depends on the specific target configuration. Note
16946 that the hard-float and soft-float ABIs are not link-compatible;
16947 you must compile your entire program with the same ABI, and link
16948 with a compatible set of libraries.
16949
16950 -mgeneral-regs-only
16951 Generate code which uses only the general-purpose registers. This
16952 will prevent the compiler from using floating-point and Advanced
16953 SIMD registers but will not impose any restrictions on the
16954 assembler.
16955
16956 -mlittle-endian
16957 Generate code for a processor running in little-endian mode. This
16958 is the default for all standard configurations.
16959
16960 -mbig-endian
16961 Generate code for a processor running in big-endian mode; the
16962 default is to compile code for a little-endian processor.
16963
16964 -mbe8
16965 -mbe32
16966 When linking a big-endian image select between BE8 and BE32
16967 formats. The option has no effect for little-endian images and is
16968 ignored. The default is dependent on the selected target
16969 architecture. For ARMv6 and later architectures the default is
16970 BE8, for older architectures the default is BE32. BE32 format has
16971 been deprecated by ARM.
16972
16973 -march=name[+extension...]
16974 This specifies the name of the target ARM architecture. GCC uses
16975 this name to determine what kind of instructions it can emit when
16976 generating assembly code. This option can be used in conjunction
16977 with or instead of the -mcpu= option.
16978
16979 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
16980 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
16981 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
16982 armv8.6-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
16983 armv8-m.base, armv8-m.main, armv8.1-m.main, iwmmxt and iwmmxt2.
16984
16985 Additionally, the following architectures, which lack support for
16986 the Thumb execution state, are recognized but support is
16987 deprecated: armv4.
16988
16989 Many of the architectures support extensions. These can be added
16990 by appending +extension to the architecture name. Extension
16991 options are processed in order and capabilities accumulate. An
16992 extension will also enable any necessary base extensions upon which
16993 it depends. For example, the +crypto extension will always enable
16994 the +simd extension. The exception to the additive construction is
16995 for extensions that are prefixed with +no...: these extensions
16996 disable the specified option and any other extensions that may
16997 depend on the presence of that extension.
16998
16999 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
17000 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17001 disabled by the +nofp option that follows it.
17002
17003 Most extension names are generically named, but have an effect that
17004 is dependent upon the architecture to which it is applied. For
17005 example, the +simd option can be applied to both armv7-a and
17006 armv8-a architectures, but will enable the original ARMv7-A
17007 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17008 for armv8-a.
17009
17010 The table below lists the supported extensions for each
17011 architecture. Architectures not mentioned do not support any
17012 extensions.
17013
17014 armv5te
17015 armv6
17016 armv6j
17017 armv6k
17018 armv6kz
17019 armv6t2
17020 armv6z
17021 armv6zk
17022 +fp The VFPv2 floating-point instructions. The extension
17023 +vfpv2 can be used as an alias for this extension.
17024
17025 +nofp
17026 Disable the floating-point instructions.
17027
17028 armv7
17029 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17030 architectures.
17031
17032 +fp The VFPv3 floating-point instructions, with 16 double-
17033 precision registers. The extension +vfpv3-d16 can be used
17034 as an alias for this extension. Note that floating-point
17035 is not supported by the base ARMv7-M architecture, but is
17036 compatible with both the ARMv7-A and ARMv7-R architectures.
17037
17038 +nofp
17039 Disable the floating-point instructions.
17040
17041 armv7-a
17042 +mp The multiprocessing extension.
17043
17044 +sec
17045 The security extension.
17046
17047 +fp The VFPv3 floating-point instructions, with 16 double-
17048 precision registers. The extension +vfpv3-d16 can be used
17049 as an alias for this extension.
17050
17051 +simd
17052 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17053 instructions. The extensions +neon and +neon-vfpv3 can be
17054 used as aliases for this extension.
17055
17056 +vfpv3
17057 The VFPv3 floating-point instructions, with 32 double-
17058 precision registers.
17059
17060 +vfpv3-d16-fp16
17061 The VFPv3 floating-point instructions, with 16 double-
17062 precision registers and the half-precision floating-point
17063 conversion operations.
17064
17065 +vfpv3-fp16
17066 The VFPv3 floating-point instructions, with 32 double-
17067 precision registers and the half-precision floating-point
17068 conversion operations.
17069
17070 +vfpv4-d16
17071 The VFPv4 floating-point instructions, with 16 double-
17072 precision registers.
17073
17074 +vfpv4
17075 The VFPv4 floating-point instructions, with 32 double-
17076 precision registers.
17077
17078 +neon-fp16
17079 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17080 instructions, with the half-precision floating-point
17081 conversion operations.
17082
17083 +neon-vfpv4
17084 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17085 instructions.
17086
17087 +nosimd
17088 Disable the Advanced SIMD instructions (does not disable
17089 floating point).
17090
17091 +nofp
17092 Disable the floating-point and Advanced SIMD instructions.
17093
17094 armv7ve
17095 The extended version of the ARMv7-A architecture with support
17096 for virtualization.
17097
17098 +fp The VFPv4 floating-point instructions, with 16 double-
17099 precision registers. The extension +vfpv4-d16 can be used
17100 as an alias for this extension.
17101
17102 +simd
17103 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17104 instructions. The extension +neon-vfpv4 can be used as an
17105 alias for this extension.
17106
17107 +vfpv3-d16
17108 The VFPv3 floating-point instructions, with 16 double-
17109 precision registers.
17110
17111 +vfpv3
17112 The VFPv3 floating-point instructions, with 32 double-
17113 precision registers.
17114
17115 +vfpv3-d16-fp16
17116 The VFPv3 floating-point instructions, with 16 double-
17117 precision registers and the half-precision floating-point
17118 conversion operations.
17119
17120 +vfpv3-fp16
17121 The VFPv3 floating-point instructions, with 32 double-
17122 precision registers and the half-precision floating-point
17123 conversion operations.
17124
17125 +vfpv4-d16
17126 The VFPv4 floating-point instructions, with 16 double-
17127 precision registers.
17128
17129 +vfpv4
17130 The VFPv4 floating-point instructions, with 32 double-
17131 precision registers.
17132
17133 +neon
17134 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17135 instructions. The extension +neon-vfpv3 can be used as an
17136 alias for this extension.
17137
17138 +neon-fp16
17139 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17140 instructions, with the half-precision floating-point
17141 conversion operations.
17142
17143 +nosimd
17144 Disable the Advanced SIMD instructions (does not disable
17145 floating point).
17146
17147 +nofp
17148 Disable the floating-point and Advanced SIMD instructions.
17149
17150 armv8-a
17151 +crc
17152 The Cyclic Redundancy Check (CRC) instructions.
17153
17154 +simd
17155 The ARMv8-A Advanced SIMD and floating-point instructions.
17156
17157 +crypto
17158 The cryptographic instructions.
17159
17160 +nocrypto
17161 Disable the cryptographic instructions.
17162
17163 +nofp
17164 Disable the floating-point, Advanced SIMD and cryptographic
17165 instructions.
17166
17167 +sb Speculation Barrier Instruction.
17168
17169 +predres
17170 Execution and Data Prediction Restriction Instructions.
17171
17172 armv8.1-a
17173 +simd
17174 The ARMv8.1-A Advanced SIMD and floating-point
17175 instructions.
17176
17177 +crypto
17178 The cryptographic instructions. This also enables the
17179 Advanced SIMD and floating-point instructions.
17180
17181 +nocrypto
17182 Disable the cryptographic instructions.
17183
17184 +nofp
17185 Disable the floating-point, Advanced SIMD and cryptographic
17186 instructions.
17187
17188 +sb Speculation Barrier Instruction.
17189
17190 +predres
17191 Execution and Data Prediction Restriction Instructions.
17192
17193 armv8.2-a
17194 armv8.3-a
17195 +fp16
17196 The half-precision floating-point data processing
17197 instructions. This also enables the Advanced SIMD and
17198 floating-point instructions.
17199
17200 +fp16fml
17201 The half-precision floating-point fmla extension. This
17202 also enables the half-precision floating-point extension
17203 and Advanced SIMD and floating-point instructions.
17204
17205 +simd
17206 The ARMv8.1-A Advanced SIMD and floating-point
17207 instructions.
17208
17209 +crypto
17210 The cryptographic instructions. This also enables the
17211 Advanced SIMD and floating-point instructions.
17212
17213 +dotprod
17214 Enable the Dot Product extension. This also enables
17215 Advanced SIMD instructions.
17216
17217 +nocrypto
17218 Disable the cryptographic extension.
17219
17220 +nofp
17221 Disable the floating-point, Advanced SIMD and cryptographic
17222 instructions.
17223
17224 +sb Speculation Barrier Instruction.
17225
17226 +predres
17227 Execution and Data Prediction Restriction Instructions.
17228
17229 +i8mm
17230 8-bit Integer Matrix Multiply instructions. This also
17231 enables Advanced SIMD and floating-point instructions.
17232
17233 +bf16
17234 Brain half-precision floating-point instructions. This
17235 also enables Advanced SIMD and floating-point instructions.
17236
17237 armv8.4-a
17238 +fp16
17239 The half-precision floating-point data processing
17240 instructions. This also enables the Advanced SIMD and
17241 floating-point instructions as well as the Dot Product
17242 extension and the half-precision floating-point fmla
17243 extension.
17244
17245 +simd
17246 The ARMv8.3-A Advanced SIMD and floating-point instructions
17247 as well as the Dot Product extension.
17248
17249 +crypto
17250 The cryptographic instructions. This also enables the
17251 Advanced SIMD and floating-point instructions as well as
17252 the Dot Product extension.
17253
17254 +nocrypto
17255 Disable the cryptographic extension.
17256
17257 +nofp
17258 Disable the floating-point, Advanced SIMD and cryptographic
17259 instructions.
17260
17261 +sb Speculation Barrier Instruction.
17262
17263 +predres
17264 Execution and Data Prediction Restriction Instructions.
17265
17266 +i8mm
17267 8-bit Integer Matrix Multiply instructions. This also
17268 enables Advanced SIMD and floating-point instructions.
17269
17270 +bf16
17271 Brain half-precision floating-point instructions. This
17272 also enables Advanced SIMD and floating-point instructions.
17273
17274 armv8.5-a
17275 +fp16
17276 The half-precision floating-point data processing
17277 instructions. This also enables the Advanced SIMD and
17278 floating-point instructions as well as the Dot Product
17279 extension and the half-precision floating-point fmla
17280 extension.
17281
17282 +simd
17283 The ARMv8.3-A Advanced SIMD and floating-point instructions
17284 as well as the Dot Product extension.
17285
17286 +crypto
17287 The cryptographic instructions. This also enables the
17288 Advanced SIMD and floating-point instructions as well as
17289 the Dot Product extension.
17290
17291 +nocrypto
17292 Disable the cryptographic extension.
17293
17294 +nofp
17295 Disable the floating-point, Advanced SIMD and cryptographic
17296 instructions.
17297
17298 +i8mm
17299 8-bit Integer Matrix Multiply instructions. This also
17300 enables Advanced SIMD and floating-point instructions.
17301
17302 +bf16
17303 Brain half-precision floating-point instructions. This
17304 also enables Advanced SIMD and floating-point instructions.
17305
17306 armv8.6-a
17307 +fp16
17308 The half-precision floating-point data processing
17309 instructions. This also enables the Advanced SIMD and
17310 floating-point instructions as well as the Dot Product
17311 extension and the half-precision floating-point fmla
17312 extension.
17313
17314 +simd
17315 The ARMv8.3-A Advanced SIMD and floating-point instructions
17316 as well as the Dot Product extension.
17317
17318 +crypto
17319 The cryptographic instructions. This also enables the
17320 Advanced SIMD and floating-point instructions as well as
17321 the Dot Product extension.
17322
17323 +nocrypto
17324 Disable the cryptographic extension.
17325
17326 +nofp
17327 Disable the floating-point, Advanced SIMD and cryptographic
17328 instructions.
17329
17330 +i8mm
17331 8-bit Integer Matrix Multiply instructions. This also
17332 enables Advanced SIMD and floating-point instructions.
17333
17334 +bf16
17335 Brain half-precision floating-point instructions. This
17336 also enables Advanced SIMD and floating-point instructions.
17337
17338 armv7-r
17339 +fp.sp
17340 The single-precision VFPv3 floating-point instructions.
17341 The extension +vfpv3xd can be used as an alias for this
17342 extension.
17343
17344 +fp The VFPv3 floating-point instructions with 16 double-
17345 precision registers. The extension +vfpv3-d16 can be used
17346 as an alias for this extension.
17347
17348 +vfpv3xd-d16-fp16
17349 The single-precision VFPv3 floating-point instructions with
17350 16 double-precision registers and the half-precision
17351 floating-point conversion operations.
17352
17353 +vfpv3-d16-fp16
17354 The VFPv3 floating-point instructions with 16 double-
17355 precision registers and the half-precision floating-point
17356 conversion operations.
17357
17358 +nofp
17359 Disable the floating-point extension.
17360
17361 +idiv
17362 The ARM-state integer division instructions.
17363
17364 +noidiv
17365 Disable the ARM-state integer division extension.
17366
17367 armv7e-m
17368 +fp The single-precision VFPv4 floating-point instructions.
17369
17370 +fpv5
17371 The single-precision FPv5 floating-point instructions.
17372
17373 +fp.dp
17374 The single- and double-precision FPv5 floating-point
17375 instructions.
17376
17377 +nofp
17378 Disable the floating-point extensions.
17379
17380 armv8.1-m.main
17381 +dsp
17382 The DSP instructions.
17383
17384 +mve
17385 The M-Profile Vector Extension (MVE) integer instructions.
17386
17387 +mve.fp
17388 The M-Profile Vector Extension (MVE) integer and single
17389 precision floating-point instructions.
17390
17391 +fp The single-precision floating-point instructions.
17392
17393 +fp.dp
17394 The single- and double-precision floating-point
17395 instructions.
17396
17397 +nofp
17398 Disable the floating-point extension.
17399
17400 +cdecp0, +cdecp1, ... , +cdecp7
17401 Enable the Custom Datapath Extension (CDE) on selected
17402 coprocessors according to the numbers given in the options
17403 in the range 0 to 7.
17404
17405 armv8-m.main
17406 +dsp
17407 The DSP instructions.
17408
17409 +nodsp
17410 Disable the DSP extension.
17411
17412 +fp The single-precision floating-point instructions.
17413
17414 +fp.dp
17415 The single- and double-precision floating-point
17416 instructions.
17417
17418 +nofp
17419 Disable the floating-point extension.
17420
17421 +cdecp0, +cdecp1, ... , +cdecp7
17422 Enable the Custom Datapath Extension (CDE) on selected
17423 coprocessors according to the numbers given in the options
17424 in the range 0 to 7.
17425
17426 armv8-r
17427 +crc
17428 The Cyclic Redundancy Check (CRC) instructions.
17429
17430 +fp.sp
17431 The single-precision FPv5 floating-point instructions.
17432
17433 +simd
17434 The ARMv8-A Advanced SIMD and floating-point instructions.
17435
17436 +crypto
17437 The cryptographic instructions.
17438
17439 +nocrypto
17440 Disable the cryptographic instructions.
17441
17442 +nofp
17443 Disable the floating-point, Advanced SIMD and cryptographic
17444 instructions.
17445
17446 -march=native causes the compiler to auto-detect the architecture
17447 of the build computer. At present, this feature is only supported
17448 on GNU/Linux, and not all architectures are recognized. If the
17449 auto-detect is unsuccessful the option has no effect.
17450
17451 -mtune=name
17452 This option specifies the name of the target ARM processor for
17453 which GCC should tune the performance of the code. For some ARM
17454 implementations better performance can be obtained by using this
17455 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
17456 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
17457 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
17458 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
17459 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
17460 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
17461 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
17462 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
17463 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
17464 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
17465 cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78,
17466 cortex-a78ae, cortex-a78c, ares, cortex-r4, cortex-r4f, cortex-r5,
17467 cortex-r7, cortex-r8, cortex-r52, cortex-m0, cortex-m0plus,
17468 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
17469 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
17470 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
17471 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
17472 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
17473 xgene1.
17474
17475 Additionally, this option can specify that GCC should tune the
17476 performance of the code for a big.LITTLE system. Permissible names
17477 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17478 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17479 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
17480 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
17481
17482 -mtune=generic-arch specifies that GCC should tune the performance
17483 for a blend of processors within architecture arch. The aim is to
17484 generate code that run well on the current most popular processors,
17485 balancing between optimizations that benefit some CPUs in the
17486 range, and avoiding performance pitfalls of other CPUs. The
17487 effects of this option may change in future GCC versions as CPU
17488 models come and go.
17489
17490 -mtune permits the same extension options as -mcpu, but the
17491 extension options do not affect the tuning of the generated code.
17492
17493 -mtune=native causes the compiler to auto-detect the CPU of the
17494 build computer. At present, this feature is only supported on
17495 GNU/Linux, and not all architectures are recognized. If the auto-
17496 detect is unsuccessful the option has no effect.
17497
17498 -mcpu=name[+extension...]
17499 This specifies the name of the target ARM processor. GCC uses this
17500 name to derive the name of the target ARM architecture (as if
17501 specified by -march) and the ARM processor type for which to tune
17502 for performance (as if specified by -mtune). Where this option is
17503 used in conjunction with -march or -mtune, those options take
17504 precedence over the appropriate part of this option.
17505
17506 Many of the supported CPUs implement optional architectural
17507 extensions. Where this is so the architectural extensions are
17508 normally enabled by default. If implementations that lack the
17509 extension exist, then the extension syntax can be used to disable
17510 those extensions that have been omitted. For floating-point and
17511 Advanced SIMD (Neon) instructions, the settings of the options
17512 -mfloat-abi and -mfpu must also be considered: floating-point and
17513 Advanced SIMD instructions will only be used if -mfloat-abi is not
17514 set to soft; and any setting of -mfpu other than auto will override
17515 the available floating-point and SIMD extension instructions.
17516
17517 For example, cortex-a9 can be found in three major configurations:
17518 integer only, with just a floating-point unit or with floating-
17519 point and Advanced SIMD. The default is to enable all the
17520 instructions, but the extensions +nosimd and +nofp can be used to
17521 disable just the SIMD or both the SIMD and floating-point
17522 instructions respectively.
17523
17524 Permissible names for this option are the same as those for -mtune.
17525
17526 The following extension options are common to the listed CPUs:
17527
17528 +nodsp
17529 Disable the DSP instructions on cortex-m33, cortex-m35p.
17530
17531 +nofp
17532 Disables the floating-point instructions on arm9e, arm946e-s,
17533 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
17534 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
17535 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
17536 point and SIMD instructions on generic-armv7-a, cortex-a5,
17537 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
17538 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17539 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
17540
17541 +nofp.dp
17542 Disables the double-precision component of the floating-point
17543 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
17544 cortex-m7.
17545
17546 +nosimd
17547 Disables the SIMD (but not floating-point) instructions on
17548 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
17549
17550 +crypto
17551 Enables the cryptographic instructions on cortex-a32,
17552 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
17553 cortex-a73, cortex-a75, exynos-m1, xgene1,
17554 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17555 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
17556 cortex-a75.cortex-a55.
17557
17558 Additionally the generic-armv7-a pseudo target defaults to VFPv3
17559 with 16 double-precision registers. It supports the following
17560 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
17561 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
17562 neon-vfpv4. The meanings are the same as for the extensions to
17563 -march=armv7-a.
17564
17565 -mcpu=generic-arch is also permissible, and is equivalent to
17566 -march=arch -mtune=generic-arch. See -mtune for more information.
17567
17568 -mcpu=native causes the compiler to auto-detect the CPU of the
17569 build computer. At present, this feature is only supported on
17570 GNU/Linux, and not all architectures are recognized. If the auto-
17571 detect is unsuccessful the option has no effect.
17572
17573 -mfpu=name
17574 This specifies what floating-point hardware (or hardware emulation)
17575 is available on the target. Permissible names are: auto, vfpv2,
17576 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
17577 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
17578 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
17579 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
17580 and vfp is an alias for vfpv2.
17581
17582 The setting auto is the default and is special. It causes the
17583 compiler to select the floating-point and Advanced SIMD
17584 instructions based on the settings of -mcpu and -march.
17585
17586 If the selected floating-point hardware includes the NEON extension
17587 (e.g. -mfpu=neon), note that floating-point operations are not
17588 generated by GCC's auto-vectorization pass unless
17589 -funsafe-math-optimizations is also specified. This is because
17590 NEON hardware does not fully implement the IEEE 754 standard for
17591 floating-point arithmetic (in particular denormal values are
17592 treated as zero), so the use of NEON instructions may lead to a
17593 loss of precision.
17594
17595 You can also set the fpu name at function level by using the
17596 "target("fpu=")" function attributes or pragmas.
17597
17598 -mfp16-format=name
17599 Specify the format of the "__fp16" half-precision floating-point
17600 type. Permissible names are none, ieee, and alternative; the
17601 default is none, in which case the "__fp16" type is not defined.
17602
17603 -mstructure-size-boundary=n
17604 The sizes of all structures and unions are rounded up to a multiple
17605 of the number of bits set by this option. Permissible values are
17606 8, 32 and 64. The default value varies for different toolchains.
17607 For the COFF targeted toolchain the default value is 8. A value of
17608 64 is only allowed if the underlying ABI supports it.
17609
17610 Specifying a larger number can produce faster, more efficient code,
17611 but can also increase the size of the program. Different values
17612 are potentially incompatible. Code compiled with one value cannot
17613 necessarily expect to work with code or libraries compiled with
17614 another value, if they exchange information using structures or
17615 unions.
17616
17617 This option is deprecated.
17618
17619 -mabort-on-noreturn
17620 Generate a call to the function "abort" at the end of a "noreturn"
17621 function. It is executed if the function tries to return.
17622
17623 -mlong-calls
17624 -mno-long-calls
17625 Tells the compiler to perform function calls by first loading the
17626 address of the function into a register and then performing a
17627 subroutine call on this register. This switch is needed if the
17628 target function lies outside of the 64-megabyte addressing range of
17629 the offset-based version of subroutine call instruction.
17630
17631 Even if this switch is enabled, not all function calls are turned
17632 into long calls. The heuristic is that static functions, functions
17633 that have the "short_call" attribute, functions that are inside the
17634 scope of a "#pragma no_long_calls" directive, and functions whose
17635 definitions have already been compiled within the current
17636 compilation unit are not turned into long calls. The exceptions to
17637 this rule are that weak function definitions, functions with the
17638 "long_call" attribute or the "section" attribute, and functions
17639 that are within the scope of a "#pragma long_calls" directive are
17640 always turned into long calls.
17641
17642 This feature is not enabled by default. Specifying -mno-long-calls
17643 restores the default behavior, as does placing the function calls
17644 within the scope of a "#pragma long_calls_off" directive. Note
17645 these switches have no effect on how the compiler generates code to
17646 handle function calls via function pointers.
17647
17648 -msingle-pic-base
17649 Treat the register used for PIC addressing as read-only, rather
17650 than loading it in the prologue for each function. The runtime
17651 system is responsible for initializing this register with an
17652 appropriate value before execution begins.
17653
17654 -mpic-register=reg
17655 Specify the register to be used for PIC addressing. For standard
17656 PIC base case, the default is any suitable register determined by
17657 compiler. For single PIC base case, the default is R9 if target is
17658 EABI based or stack-checking is enabled, otherwise the default is
17659 R10.
17660
17661 -mpic-data-is-text-relative
17662 Assume that the displacement between the text and data segments is
17663 fixed at static link time. This permits using PC-relative
17664 addressing operations to access data known to be in the data
17665 segment. For non-VxWorks RTP targets, this option is enabled by
17666 default. When disabled on such targets, it will enable
17667 -msingle-pic-base by default.
17668
17669 -mpoke-function-name
17670 Write the name of each function into the text section, directly
17671 preceding the function prologue. The generated code is similar to
17672 this:
17673
17674 t0
17675 .ascii "arm_poke_function_name", 0
17676 .align
17677 t1
17678 .word 0xff000000 + (t1 - t0)
17679 arm_poke_function_name
17680 mov ip, sp
17681 stmfd sp!, {fp, ip, lr, pc}
17682 sub fp, ip, #4
17683
17684 When performing a stack backtrace, code can inspect the value of
17685 "pc" stored at "fp + 0". If the trace function then looks at
17686 location "pc - 12" and the top 8 bits are set, then we know that
17687 there is a function name embedded immediately preceding this
17688 location and has length "((pc[-3]) & 0xff000000)".
17689
17690 -mthumb
17691 -marm
17692 Select between generating code that executes in ARM and Thumb
17693 states. The default for most configurations is to generate code
17694 that executes in ARM state, but the default can be changed by
17695 configuring GCC with the --with-mode=state configure option.
17696
17697 You can also override the ARM and Thumb mode for each function by
17698 using the "target("thumb")" and "target("arm")" function attributes
17699 or pragmas.
17700
17701 -mflip-thumb
17702 Switch ARM/Thumb modes on alternating functions. This option is
17703 provided for regression testing of mixed Thumb/ARM code generation,
17704 and is not intended for ordinary use in compiling code.
17705
17706 -mtpcs-frame
17707 Generate a stack frame that is compliant with the Thumb Procedure
17708 Call Standard for all non-leaf functions. (A leaf function is one
17709 that does not call any other functions.) The default is
17710 -mno-tpcs-frame.
17711
17712 -mtpcs-leaf-frame
17713 Generate a stack frame that is compliant with the Thumb Procedure
17714 Call Standard for all leaf functions. (A leaf function is one that
17715 does not call any other functions.) The default is
17716 -mno-apcs-leaf-frame.
17717
17718 -mcallee-super-interworking
17719 Gives all externally visible functions in the file being compiled
17720 an ARM instruction set header which switches to Thumb mode before
17721 executing the rest of the function. This allows these functions to
17722 be called from non-interworking code. This option is not valid in
17723 AAPCS configurations because interworking is enabled by default.
17724
17725 -mcaller-super-interworking
17726 Allows calls via function pointers (including virtual functions) to
17727 execute correctly regardless of whether the target code has been
17728 compiled for interworking or not. There is a small overhead in the
17729 cost of executing a function pointer if this option is enabled.
17730 This option is not valid in AAPCS configurations because
17731 interworking is enabled by default.
17732
17733 -mtp=name
17734 Specify the access model for the thread local storage pointer. The
17735 valid models are soft, which generates calls to "__aeabi_read_tp",
17736 cp15, which fetches the thread pointer from "cp15" directly
17737 (supported in the arm6k architecture), and auto, which uses the
17738 best available method for the selected processor. The default
17739 setting is auto.
17740
17741 -mtls-dialect=dialect
17742 Specify the dialect to use for accessing thread local storage. Two
17743 dialects are supported---gnu and gnu2. The gnu dialect selects the
17744 original GNU scheme for supporting local and global dynamic TLS
17745 models. The gnu2 dialect selects the GNU descriptor scheme, which
17746 provides better performance for shared libraries. The GNU
17747 descriptor scheme is compatible with the original scheme, but does
17748 require new assembler, linker and library support. Initial and
17749 local exec TLS models are unaffected by this option and always use
17750 the original scheme.
17751
17752 -mword-relocations
17753 Only generate absolute relocations on word-sized values (i.e.
17754 R_ARM_ABS32). This is enabled by default on targets (uClinux,
17755 SymbianOS) where the runtime loader imposes this restriction, and
17756 when -fpic or -fPIC is specified. This option conflicts with
17757 -mslow-flash-data.
17758
17759 -mfix-cortex-m3-ldrd
17760 Some Cortex-M3 cores can cause data corruption when "ldrd"
17761 instructions with overlapping destination and base registers are
17762 used. This option avoids generating these instructions. This
17763 option is enabled by default when -mcpu=cortex-m3 is specified.
17764
17765 -munaligned-access
17766 -mno-unaligned-access
17767 Enables (or disables) reading and writing of 16- and 32- bit values
17768 from addresses that are not 16- or 32- bit aligned. By default
17769 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17770 ARMv8-M Baseline architectures, and enabled for all other
17771 architectures. If unaligned access is not enabled then words in
17772 packed data structures are accessed a byte at a time.
17773
17774 The ARM attribute "Tag_CPU_unaligned_access" is set in the
17775 generated object file to either true or false, depending upon the
17776 setting of this option. If unaligned access is enabled then the
17777 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
17778
17779 -mneon-for-64bits
17780 This option is deprecated and has no effect.
17781
17782 -mslow-flash-data
17783 Assume loading data from flash is slower than fetching instruction.
17784 Therefore literal load is minimized for better performance. This
17785 option is only supported when compiling for ARMv7 M-profile and off
17786 by default. It conflicts with -mword-relocations.
17787
17788 -masm-syntax-unified
17789 Assume inline assembler is using unified asm syntax. The default
17790 is currently off which implies divided syntax. This option has no
17791 impact on Thumb2. However, this may change in future releases of
17792 GCC. Divided syntax should be considered deprecated.
17793
17794 -mrestrict-it
17795 Restricts generation of IT blocks to conform to the rules of
17796 ARMv8-A. IT blocks can only contain a single 16-bit instruction
17797 from a select set of instructions. This option is on by default for
17798 ARMv8-A Thumb mode.
17799
17800 -mprint-tune-info
17801 Print CPU tuning information as comment in assembler file. This is
17802 an option used only for regression testing of the compiler and not
17803 intended for ordinary use in compiling code. This option is
17804 disabled by default.
17805
17806 -mverbose-cost-dump
17807 Enable verbose cost model dumping in the debug dump files. This
17808 option is provided for use in debugging the compiler.
17809
17810 -mpure-code
17811 Do not allow constant data to be placed in code sections.
17812 Additionally, when compiling for ELF object format give all text
17813 sections the ELF processor-specific section attribute
17814 "SHF_ARM_PURECODE". This option is only available when generating
17815 non-pic code for M-profile targets.
17816
17817 -mcmse
17818 Generate secure code as per the "ARMv8-M Security Extensions:
17819 Requirements on Development Tools Engineering Specification", which
17820 can be found on
17821 <https://developer.arm.com/documentation/ecm0359818/latest/>.
17822
17823 -mfdpic
17824 -mno-fdpic
17825 Select the FDPIC ABI, which uses 64-bit function descriptors to
17826 represent pointers to functions. When the compiler is configured
17827 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
17828 and implies -fPIE if none of the PIC/PIE-related options is
17829 provided. On other targets, it only enables the FDPIC-specific
17830 code generation features, and the user should explicitly provide
17831 the PIC/PIE-related options as needed.
17832
17833 Note that static linking is not supported because it would still
17834 involve the dynamic linker when the program self-relocates. If
17835 such behavior is acceptable, use -static and -Wl,-dynamic-linker
17836 options.
17837
17838 The opposite -mno-fdpic option is useful (and required) to build
17839 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
17840 toolchain as the one used to build the userland programs.
17841
17842 AVR Options
17843
17844 These options are defined for AVR implementations:
17845
17846 -mmcu=mcu
17847 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17848
17849 The default for this option is avr2.
17850
17851 GCC supports the following AVR devices and ISAs:
17852
17853 "avr2"
17854 "Classic" devices with up to 8 KiB of program memory. mcu =
17855 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
17856 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
17857 "at90c8534", "at90s8515", "at90s8535".
17858
17859 "avr25"
17860 "Classic" devices with up to 8 KiB of program memory and with
17861 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
17862 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
17863 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
17864 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
17865 "attiny461a", "attiny4313", "attiny84", "attiny84a",
17866 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
17867 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
17868
17869 "avr3"
17870 "Classic" devices with 16 KiB up to 64 KiB of program memory.
17871 mcu = "at76c711", "at43usb355".
17872
17873 "avr31"
17874 "Classic" devices with 128 KiB of program memory. mcu =
17875 "atmega103", "at43usb320".
17876
17877 "avr35"
17878 "Classic" devices with 16 KiB up to 64 KiB of program memory
17879 and with the "MOVW" instruction. mcu = "attiny167",
17880 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
17881 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
17882
17883 "avr4"
17884 "Enhanced" devices with up to 8 KiB of program memory. mcu =
17885 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
17886 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
17887 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
17888 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
17889 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
17890 "at90pwm3b", "at90pwm81".
17891
17892 "avr5"
17893 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
17894 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
17895 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
17896 "atmega161", "atmega162", "atmega163", "atmega164a",
17897 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
17898 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
17899 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
17900 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
17901 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
17902 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
17903 "atmega324a", "atmega324p", "atmega324pa", "atmega325",
17904 "atmega325a", "atmega325p", "atmega325pa", "atmega328",
17905 "atmega328p", "atmega328pb", "atmega329", "atmega329a",
17906 "atmega329p", "atmega329pa", "atmega3250", "atmega3250a",
17907 "atmega3250p", "atmega3250pa", "atmega3290", "atmega3290a",
17908 "atmega3290p", "atmega3290pa", "atmega406", "atmega64",
17909 "atmega64a", "atmega64c1", "atmega64hve", "atmega64hve2",
17910 "atmega64m1", "atmega64rfr2", "atmega640", "atmega644",
17911 "atmega644a", "atmega644p", "atmega644pa", "atmega644rfr2",
17912 "atmega645", "atmega645a", "atmega645p", "atmega649",
17913 "atmega649a", "atmega649p", "atmega6450", "atmega6450a",
17914 "atmega6450p", "atmega6490", "atmega6490a", "atmega6490p",
17915 "ata5795", "ata5790", "ata5790n", "ata5791", "ata6613c",
17916 "ata6614q", "ata5782", "ata5831", "ata8210", "ata8510",
17917 "ata5702m322", "at90pwm161", "at90pwm216", "at90pwm316",
17918 "at90can32", "at90can64", "at90scr100", "at90usb646",
17919 "at90usb647", "at94k", "m3000".
17920
17921 "avr51"
17922 "Enhanced" devices with 128 KiB of program memory. mcu =
17923 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
17924 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
17925 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
17926
17927 "avr6"
17928 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
17929 of program memory. mcu = "atmega256rfr2", "atmega2560",
17930 "atmega2561", "atmega2564rfr2".
17931
17932 "avrxmega2"
17933 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
17934 program memory. mcu = "atxmega8e5", "atxmega16a4",
17935 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
17936 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
17937 "atxmega32d3", "atxmega32d4", "atxmega32e5".
17938
17939 "avrxmega3"
17940 "XMEGA" devices with up to 64 KiB of combined program memory
17941 and RAM, and with program memory visible in the RAM address
17942 space. mcu = "attiny202", "attiny204", "attiny212",
17943 "attiny214", "attiny402", "attiny404", "attiny406",
17944 "attiny412", "attiny414", "attiny416", "attiny417",
17945 "attiny804", "attiny806", "attiny807", "attiny814",
17946 "attiny816", "attiny817", "attiny1604", "attiny1606",
17947 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
17948 "attiny3214", "attiny3216", "attiny3217", "atmega808",
17949 "atmega809", "atmega1608", "atmega1609", "atmega3208",
17950 "atmega3209", "atmega4808", "atmega4809".
17951
17952 "avrxmega4"
17953 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
17954 program memory. mcu = "atxmega64a3", "atxmega64a3u",
17955 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
17956 "atxmega64d3", "atxmega64d4".
17957
17958 "avrxmega5"
17959 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
17960 program memory and more than 64 KiB of RAM. mcu =
17961 "atxmega64a1", "atxmega64a1u".
17962
17963 "avrxmega6"
17964 "XMEGA" devices with more than 128 KiB of program memory. mcu
17965 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
17966 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
17967 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
17968 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
17969 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
17970 "atxmega256d3", "atxmega384c3", "atxmega384d3".
17971
17972 "avrxmega7"
17973 "XMEGA" devices with more than 128 KiB of program memory and
17974 more than 64 KiB of RAM. mcu = "atxmega128a1",
17975 "atxmega128a1u", "atxmega128a4u".
17976
17977 "avrtiny"
17978 "TINY" Tiny core devices with 512 B up to 4 KiB of program
17979 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
17980 "attiny20", "attiny40".
17981
17982 "avr1"
17983 This ISA is implemented by the minimal AVR core and supported
17984 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
17985 "attiny28", "at90s1200".
17986
17987 -mabsdata
17988 Assume that all data in static storage can be accessed by LDS / STS
17989 instructions. This option has only an effect on reduced Tiny
17990 devices like ATtiny40. See also the "absdata" AVR Variable
17991 Attributes,variable attribute.
17992
17993 -maccumulate-args
17994 Accumulate outgoing function arguments and acquire/release the
17995 needed stack space for outgoing function arguments once in function
17996 prologue/epilogue. Without this option, outgoing arguments are
17997 pushed before calling a function and popped afterwards.
17998
17999 Popping the arguments after the function call can be expensive on
18000 AVR so that accumulating the stack space might lead to smaller
18001 executables because arguments need not be removed from the stack
18002 after such a function call.
18003
18004 This option can lead to reduced code size for functions that
18005 perform several calls to functions that get their arguments on the
18006 stack like calls to printf-like functions.
18007
18008 -mbranch-cost=cost
18009 Set the branch costs for conditional branch instructions to cost.
18010 Reasonable values for cost are small, non-negative integers. The
18011 default branch cost is 0.
18012
18013 -mcall-prologues
18014 Functions prologues/epilogues are expanded as calls to appropriate
18015 subroutines. Code size is smaller.
18016
18017 -mdouble=bits
18018 -mlong-double=bits
18019 Set the size (in bits) of the "double" or "long double" type,
18020 respectively. Possible values for bits are 32 and 64. Whether or
18021 not a specific value for bits is allowed depends on the
18022 "--with-double=" and "--with-long-double=" configure options
18023 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18024 applies for the default values of the options.
18025
18026 -mgas-isr-prologues
18027 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18028 instruction supported by GNU Binutils. If this option is on, the
18029 feature can still be disabled for individual ISRs by means of the
18030 AVR Function Attributes,,"no_gccisr" function attribute. This
18031 feature is activated per default if optimization is on (but not
18032 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18033 PR21683 ("https://sourceware.org/PR21683").
18034
18035 -mint8
18036 Assume "int" to be 8-bit integer. This affects the sizes of all
18037 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18038 and "long long" is 4 bytes. Please note that this option does not
18039 conform to the C standards, but it results in smaller code size.
18040
18041 -mmain-is-OS_task
18042 Do not save registers in "main". The effect is the same like
18043 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18044 It is activated per default if optimization is on.
18045
18046 -mn-flash=num
18047 Assume that the flash memory has a size of num times 64 KiB.
18048
18049 -mno-interrupts
18050 Generated code is not compatible with hardware interrupts. Code
18051 size is smaller.
18052
18053 -mrelax
18054 Try to replace "CALL" resp. "JMP" instruction by the shorter
18055 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18056 just adds the --mlink-relax option to the assembler's command line
18057 and the --relax option to the linker's command line.
18058
18059 Jump relaxing is performed by the linker because jump offsets are
18060 not known before code is located. Therefore, the assembler code
18061 generated by the compiler is the same, but the instructions in the
18062 executable may differ from instructions in the assembler code.
18063
18064 Relaxing must be turned on if linker stubs are needed, see the
18065 section on "EIND" and linker stubs below.
18066
18067 -mrmw
18068 Assume that the device supports the Read-Modify-Write instructions
18069 "XCH", "LAC", "LAS" and "LAT".
18070
18071 -mshort-calls
18072 Assume that "RJMP" and "RCALL" can target the whole program memory.
18073
18074 This option is used internally for multilib selection. It is not
18075 an optimization option, and you don't need to set it by hand.
18076
18077 -msp8
18078 Treat the stack pointer register as an 8-bit register, i.e. assume
18079 the high byte of the stack pointer is zero. In general, you don't
18080 need to set this option by hand.
18081
18082 This option is used internally by the compiler to select and build
18083 multilibs for architectures "avr2" and "avr25". These
18084 architectures mix devices with and without "SPH". For any setting
18085 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
18086 removes this option from the compiler proper's command line,
18087 because the compiler then knows if the device or architecture has
18088 an 8-bit stack pointer and thus no "SPH" register or not.
18089
18090 -mstrict-X
18091 Use address register "X" in a way proposed by the hardware. This
18092 means that "X" is only used in indirect, post-increment or pre-
18093 decrement addressing.
18094
18095 Without this option, the "X" register may be used in the same way
18096 as "Y" or "Z" which then is emulated by additional instructions.
18097 For example, loading a value with "X+const" addressing with a small
18098 non-negative "const < 64" to a register Rn is performed as
18099
18100 adiw r26, const ; X += const
18101 ld <Rn>, X ; <Rn> = *X
18102 sbiw r26, const ; X -= const
18103
18104 -mtiny-stack
18105 Only change the lower 8 bits of the stack pointer.
18106
18107 -mfract-convert-truncate
18108 Allow to use truncation instead of rounding towards zero for
18109 fractional fixed-point types.
18110
18111 -nodevicelib
18112 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
18113
18114 -nodevicespecs
18115 Don't add -specs=device-specs/specs-mcu to the compiler driver's
18116 command line. The user takes responsibility for supplying the sub-
18117 processes like compiler proper, assembler and linker with
18118 appropriate command line options. This means that the user has to
18119 supply her private device specs file by means of -specs=path-to-
18120 specs-file. There is no more need for option -mmcu=mcu.
18121
18122 This option can also serve as a replacement for the older way of
18123 specifying custom device-specs files that needed -B some-path to
18124 point to a directory which contains a folder named "device-specs"
18125 which contains a specs file named "specs-mcu", where mcu was
18126 specified by -mmcu=mcu.
18127
18128 -Waddr-space-convert
18129 Warn about conversions between address spaces in the case where the
18130 resulting address space is not contained in the incoming address
18131 space.
18132
18133 -Wmisspelled-isr
18134 Warn if the ISR is misspelled, i.e. without __vector prefix.
18135 Enabled by default.
18136
18137 "EIND" and Devices with More Than 128 Ki Bytes of Flash
18138
18139 Pointers in the implementation are 16 bits wide. The address of a
18140 function or label is represented as word address so that indirect jumps
18141 and calls can target any code address in the range of 64 Ki words.
18142
18143 In order to facilitate indirect jump on devices with more than 128 Ki
18144 bytes of program memory space, there is a special function register
18145 called "EIND" that serves as most significant part of the target
18146 address when "EICALL" or "EIJMP" instructions are used.
18147
18148 Indirect jumps and calls on these devices are handled as follows by the
18149 compiler and are subject to some limitations:
18150
18151 * The compiler never sets "EIND".
18152
18153 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
18154 instructions or might read "EIND" directly in order to emulate an
18155 indirect call/jump by means of a "RET" instruction.
18156
18157 * The compiler assumes that "EIND" never changes during the startup
18158 code or during the application. In particular, "EIND" is not
18159 saved/restored in function or interrupt service routine
18160 prologue/epilogue.
18161
18162 * For indirect calls to functions and computed goto, the linker
18163 generates stubs. Stubs are jump pads sometimes also called
18164 trampolines. Thus, the indirect call/jump jumps to such a stub.
18165 The stub contains a direct jump to the desired address.
18166
18167 * Linker relaxation must be turned on so that the linker generates
18168 the stubs correctly in all situations. See the compiler option
18169 -mrelax and the linker option --relax. There are corner cases
18170 where the linker is supposed to generate stubs but aborts without
18171 relaxation and without a helpful error message.
18172
18173 * The default linker script is arranged for code with "EIND = 0". If
18174 code is supposed to work for a setup with "EIND != 0", a custom
18175 linker script has to be used in order to place the sections whose
18176 name start with ".trampolines" into the segment where "EIND" points
18177 to.
18178
18179 * The startup code from libgcc never sets "EIND". Notice that
18180 startup code is a blend of code from libgcc and AVR-LibC. For the
18181 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
18182 ("http://nongnu.org/avr-libc/user-manual/").
18183
18184 * It is legitimate for user-specific startup code to set up "EIND"
18185 early, for example by means of initialization code located in
18186 section ".init3". Such code runs prior to general startup code that
18187 initializes RAM and calls constructors, but after the bit of
18188 startup code from AVR-LibC that sets "EIND" to the segment where
18189 the vector table is located.
18190
18191 #include <avr/io.h>
18192
18193 static void
18194 __attribute__((section(".init3"),naked,used,no_instrument_function))
18195 init3_set_eind (void)
18196 {
18197 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18198 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18199 }
18200
18201 The "__trampolines_start" symbol is defined in the linker script.
18202
18203 * Stubs are generated automatically by the linker if the following
18204 two conditions are met:
18205
18206 -<The address of a label is taken by means of the "gs" modifier>
18207 (short for generate stubs) like so:
18208
18209 LDI r24, lo8(gs(<func>))
18210 LDI r25, hi8(gs(<func>))
18211
18212 -<The final location of that label is in a code segment>
18213 outside the segment where the stubs are located.
18214
18215 * The compiler emits such "gs" modifiers for code labels in the
18216 following situations:
18217
18218 -<Taking address of a function or code label.>
18219 -<Computed goto.>
18220 -<If prologue-save function is used, see -mcall-prologues>
18221 command-line option.
18222
18223 -<Switch/case dispatch tables. If you do not want such dispatch>
18224 tables you can specify the -fno-jump-tables command-line
18225 option.
18226
18227 -<C and C++ constructors/destructors called during
18228 startup/shutdown.>
18229 -<If the tools hit a "gs()" modifier explained above.>
18230 * Jumping to non-symbolic addresses like so is not supported:
18231
18232 int main (void)
18233 {
18234 /* Call function at word address 0x2 */
18235 return ((int(*)(void)) 0x2)();
18236 }
18237
18238 Instead, a stub has to be set up, i.e. the function has to be
18239 called through a symbol ("func_4" in the example):
18240
18241 int main (void)
18242 {
18243 extern int func_4 (void);
18244
18245 /* Call function at byte address 0x4 */
18246 return func_4();
18247 }
18248
18249 and the application be linked with -Wl,--defsym,func_4=0x4.
18250 Alternatively, "func_4" can be defined in the linker script.
18251
18252 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
18253 Registers
18254
18255 Some AVR devices support memories larger than the 64 KiB range that can
18256 be accessed with 16-bit pointers. To access memory locations outside
18257 this 64 KiB range, the content of a "RAMP" register is used as high
18258 part of the address: The "X", "Y", "Z" address register is concatenated
18259 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
18260 respectively, to get a wide address. Similarly, "RAMPD" is used
18261 together with direct addressing.
18262
18263 * The startup code initializes the "RAMP" special function registers
18264 with zero.
18265
18266 * If a AVR Named Address Spaces,named address space other than
18267 generic or "__flash" is used, then "RAMPZ" is set as needed before
18268 the operation.
18269
18270 * If the device supports RAM larger than 64 KiB and the compiler
18271 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
18272 reset to zero after the operation.
18273
18274 * If the device comes with a specific "RAMP" register, the ISR
18275 prologue/epilogue saves/restores that SFR and initializes it with
18276 zero in case the ISR code might (implicitly) use it.
18277
18278 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
18279 you use inline assembler to read from locations outside the 16-bit
18280 address range and change one of the "RAMP" registers, you must
18281 reset it to zero after the access.
18282
18283 AVR Built-in Macros
18284
18285 GCC defines several built-in macros so that the user code can test for
18286 the presence or absence of features. Almost any of the following
18287 built-in macros are deduced from device capabilities and thus triggered
18288 by the -mmcu= command-line option.
18289
18290 For even more AVR-specific built-in macros see AVR Named Address Spaces
18291 and AVR Built-in Functions.
18292
18293 "__AVR_ARCH__"
18294 Build-in macro that resolves to a decimal number that identifies
18295 the architecture and depends on the -mmcu=mcu option. Possible
18296 values are:
18297
18298 2, 25, 3, 31, 35, 4, 5, 51, 6
18299
18300 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
18301 "avr51", "avr6",
18302
18303 respectively and
18304
18305 100, 102, 103, 104, 105, 106, 107
18306
18307 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
18308 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
18309 specifies a device, this built-in macro is set accordingly. For
18310 example, with -mmcu=atmega8 the macro is defined to 4.
18311
18312 "__AVR_Device__"
18313 Setting -mmcu=device defines this built-in macro which reflects the
18314 device's name. For example, -mmcu=atmega8 defines the built-in
18315 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
18316 "__AVR_ATtiny261A__", etc.
18317
18318 The built-in macros' names follow the scheme "__AVR_Device__" where
18319 Device is the device name as from the AVR user manual. The
18320 difference between Device in the built-in macro and device in
18321 -mmcu=device is that the latter is always lowercase.
18322
18323 If device is not a device but only a core architecture like avr51,
18324 this macro is not defined.
18325
18326 "__AVR_DEVICE_NAME__"
18327 Setting -mmcu=device defines this built-in macro to the device's
18328 name. For example, with -mmcu=atmega8 the macro is defined to
18329 "atmega8".
18330
18331 If device is not a device but only a core architecture like avr51,
18332 this macro is not defined.
18333
18334 "__AVR_XMEGA__"
18335 The device / architecture belongs to the XMEGA family of devices.
18336
18337 "__AVR_HAVE_ELPM__"
18338 The device has the "ELPM" instruction.
18339
18340 "__AVR_HAVE_ELPMX__"
18341 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
18342
18343 "__AVR_HAVE_MOVW__"
18344 The device has the "MOVW" instruction to perform 16-bit register-
18345 register moves.
18346
18347 "__AVR_HAVE_LPMX__"
18348 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
18349
18350 "__AVR_HAVE_MUL__"
18351 The device has a hardware multiplier.
18352
18353 "__AVR_HAVE_JMP_CALL__"
18354 The device has the "JMP" and "CALL" instructions. This is the case
18355 for devices with more than 8 KiB of program memory.
18356
18357 "__AVR_HAVE_EIJMP_EICALL__"
18358 "__AVR_3_BYTE_PC__"
18359 The device has the "EIJMP" and "EICALL" instructions. This is the
18360 case for devices with more than 128 KiB of program memory. This
18361 also means that the program counter (PC) is 3 bytes wide.
18362
18363 "__AVR_2_BYTE_PC__"
18364 The program counter (PC) is 2 bytes wide. This is the case for
18365 devices with up to 128 KiB of program memory.
18366
18367 "__AVR_HAVE_8BIT_SP__"
18368 "__AVR_HAVE_16BIT_SP__"
18369 The stack pointer (SP) register is treated as 8-bit respectively
18370 16-bit register by the compiler. The definition of these macros is
18371 affected by -mtiny-stack.
18372
18373 "__AVR_HAVE_SPH__"
18374 "__AVR_SP8__"
18375 The device has the SPH (high part of stack pointer) special
18376 function register or has an 8-bit stack pointer, respectively. The
18377 definition of these macros is affected by -mmcu= and in the cases
18378 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
18379
18380 "__AVR_HAVE_RAMPD__"
18381 "__AVR_HAVE_RAMPX__"
18382 "__AVR_HAVE_RAMPY__"
18383 "__AVR_HAVE_RAMPZ__"
18384 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
18385 function register, respectively.
18386
18387 "__NO_INTERRUPTS__"
18388 This macro reflects the -mno-interrupts command-line option.
18389
18390 "__AVR_ERRATA_SKIP__"
18391 "__AVR_ERRATA_SKIP_JMP_CALL__"
18392 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18393 instructions because of a hardware erratum. Skip instructions are
18394 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
18395 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
18396
18397 "__AVR_ISA_RMW__"
18398 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
18399 LAT).
18400
18401 "__AVR_SFR_OFFSET__=offset"
18402 Instructions that can address I/O special function registers
18403 directly like "IN", "OUT", "SBI", etc. may use a different address
18404 as if addressed by an instruction to access RAM like "LD" or "STS".
18405 This offset depends on the device architecture and has to be
18406 subtracted from the RAM address in order to get the respective I/O
18407 address.
18408
18409 "__AVR_SHORT_CALLS__"
18410 The -mshort-calls command line option is set.
18411
18412 "__AVR_PM_BASE_ADDRESS__=addr"
18413 Some devices support reading from flash memory by means of "LD*"
18414 instructions. The flash memory is seen in the data address space
18415 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
18416 defined, this feature is not available. If defined, the address
18417 space is linear and there is no need to put ".rodata" into RAM.
18418 This is handled by the default linker description file, and is
18419 currently available for "avrtiny" and "avrxmega3". Even more
18420 convenient, there is no need to use address spaces like "__flash"
18421 or features like attribute "progmem" and "pgm_read_*".
18422
18423 "__WITH_AVRLIBC__"
18424 The compiler is configured to be used together with AVR-Libc. See
18425 the --with-avrlibc configure option.
18426
18427 "__HAVE_DOUBLE_MULTILIB__"
18428 Defined if -mdouble= acts as a multilib option.
18429
18430 "__HAVE_DOUBLE32__"
18431 "__HAVE_DOUBLE64__"
18432 Defined if the compiler supports 32-bit double resp. 64-bit double.
18433 The actual layout is specified by option -mdouble=.
18434
18435 "__DEFAULT_DOUBLE__"
18436 The size in bits of "double" if -mdouble= is not set. To test the
18437 layout of "double" in a program, use the built-in macro
18438 "__SIZEOF_DOUBLE__".
18439
18440 "__HAVE_LONG_DOUBLE32__"
18441 "__HAVE_LONG_DOUBLE64__"
18442 "__HAVE_LONG_DOUBLE_MULTILIB__"
18443 "__DEFAULT_LONG_DOUBLE__"
18444 Same as above, but for "long double" instead of "double".
18445
18446 "__WITH_DOUBLE_COMPARISON__"
18447 Reflects the "--with-double-comparison={tristate|bool|libf7}"
18448 configure option ("https://gcc.gnu.org/install/configure.html#avr")
18449 and is defined to 2 or 3.
18450
18451 "__WITH_LIBF7_LIBGCC__"
18452 "__WITH_LIBF7_MATH__"
18453 "__WITH_LIBF7_MATH_SYMBOLS__"
18454 Reflects the "--with-libf7={libgcc|math|math-symbols}"
18455 configure option
18456 ("https://gcc.gnu.org/install/configure.html#avr").
18457
18458 Blackfin Options
18459
18460 -mcpu=cpu[-sirevision]
18461 Specifies the name of the target Blackfin processor. Currently,
18462 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
18463 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
18464 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
18465 bf547m, bf548m, bf549m, bf561, bf592.
18466
18467 The optional sirevision specifies the silicon revision of the
18468 target Blackfin processor. Any workarounds available for the
18469 targeted silicon revision are enabled. If sirevision is none, no
18470 workarounds are enabled. If sirevision is any, all workarounds for
18471 the targeted processor are enabled. The "__SILICON_REVISION__"
18472 macro is defined to two hexadecimal digits representing the major
18473 and minor numbers in the silicon revision. If sirevision is none,
18474 the "__SILICON_REVISION__" is not defined. If sirevision is any,
18475 the "__SILICON_REVISION__" is defined to be 0xffff. If this
18476 optional sirevision is not used, GCC assumes the latest known
18477 silicon revision of the targeted Blackfin processor.
18478
18479 GCC defines a preprocessor macro for the specified cpu. For the
18480 bfin-elf toolchain, this option causes the hardware BSP provided by
18481 libgloss to be linked in if -msim is not given.
18482
18483 Without this option, bf532 is used as the processor by default.
18484
18485 Note that support for bf561 is incomplete. For bf561, only the
18486 preprocessor macro is defined.
18487
18488 -msim
18489 Specifies that the program will be run on the simulator. This
18490 causes the simulator BSP provided by libgloss to be linked in.
18491 This option has effect only for bfin-elf toolchain. Certain other
18492 options, such as -mid-shared-library and -mfdpic, imply -msim.
18493
18494 -momit-leaf-frame-pointer
18495 Don't keep the frame pointer in a register for leaf functions.
18496 This avoids the instructions to save, set up and restore frame
18497 pointers and makes an extra register available in leaf functions.
18498
18499 -mspecld-anomaly
18500 When enabled, the compiler ensures that the generated code does not
18501 contain speculative loads after jump instructions. If this option
18502 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
18503
18504 -mno-specld-anomaly
18505 Don't generate extra code to prevent speculative loads from
18506 occurring.
18507
18508 -mcsync-anomaly
18509 When enabled, the compiler ensures that the generated code does not
18510 contain CSYNC or SSYNC instructions too soon after conditional
18511 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
18512 is defined.
18513
18514 -mno-csync-anomaly
18515 Don't generate extra code to prevent CSYNC or SSYNC instructions
18516 from occurring too soon after a conditional branch.
18517
18518 -mlow64k
18519 When enabled, the compiler is free to take advantage of the
18520 knowledge that the entire program fits into the low 64k of memory.
18521
18522 -mno-low64k
18523 Assume that the program is arbitrarily large. This is the default.
18524
18525 -mstack-check-l1
18526 Do stack checking using information placed into L1 scratchpad
18527 memory by the uClinux kernel.
18528
18529 -mid-shared-library
18530 Generate code that supports shared libraries via the library ID
18531 method. This allows for execute in place and shared libraries in
18532 an environment without virtual memory management. This option
18533 implies -fPIC. With a bfin-elf target, this option implies -msim.
18534
18535 -mno-id-shared-library
18536 Generate code that doesn't assume ID-based shared libraries are
18537 being used. This is the default.
18538
18539 -mleaf-id-shared-library
18540 Generate code that supports shared libraries via the library ID
18541 method, but assumes that this library or executable won't link
18542 against any other ID shared libraries. That allows the compiler to
18543 use faster code for jumps and calls.
18544
18545 -mno-leaf-id-shared-library
18546 Do not assume that the code being compiled won't link against any
18547 ID shared libraries. Slower code is generated for jump and call
18548 insns.
18549
18550 -mshared-library-id=n
18551 Specifies the identification number of the ID-based shared library
18552 being compiled. Specifying a value of 0 generates more compact
18553 code; specifying other values forces the allocation of that number
18554 to the current library but is no more space- or time-efficient than
18555 omitting this option.
18556
18557 -msep-data
18558 Generate code that allows the data segment to be located in a
18559 different area of memory from the text segment. This allows for
18560 execute in place in an environment without virtual memory
18561 management by eliminating relocations against the text section.
18562
18563 -mno-sep-data
18564 Generate code that assumes that the data segment follows the text
18565 segment. This is the default.
18566
18567 -mlong-calls
18568 -mno-long-calls
18569 Tells the compiler to perform function calls by first loading the
18570 address of the function into a register and then performing a
18571 subroutine call on this register. This switch is needed if the
18572 target function lies outside of the 24-bit addressing range of the
18573 offset-based version of subroutine call instruction.
18574
18575 This feature is not enabled by default. Specifying -mno-long-calls
18576 restores the default behavior. Note these switches have no effect
18577 on how the compiler generates code to handle function calls via
18578 function pointers.
18579
18580 -mfast-fp
18581 Link with the fast floating-point library. This library relaxes
18582 some of the IEEE floating-point standard's rules for checking
18583 inputs against Not-a-Number (NAN), in the interest of performance.
18584
18585 -minline-plt
18586 Enable inlining of PLT entries in function calls to functions that
18587 are not known to bind locally. It has no effect without -mfdpic.
18588
18589 -mmulticore
18590 Build a standalone application for multicore Blackfin processors.
18591 This option causes proper start files and link scripts supporting
18592 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
18593 can only be used with -mcpu=bf561[-sirevision].
18594
18595 This option can be used with -mcorea or -mcoreb, which selects the
18596 one-application-per-core programming model. Without -mcorea or
18597 -mcoreb, the single-application/dual-core programming model is
18598 used. In this model, the main function of Core B should be named as
18599 "coreb_main".
18600
18601 If this option is not used, the single-core application programming
18602 model is used.
18603
18604 -mcorea
18605 Build a standalone application for Core A of BF561 when using the
18606 one-application-per-core programming model. Proper start files and
18607 link scripts are used to support Core A, and the macro
18608 "__BFIN_COREA" is defined. This option can only be used in
18609 conjunction with -mmulticore.
18610
18611 -mcoreb
18612 Build a standalone application for Core B of BF561 when using the
18613 one-application-per-core programming model. Proper start files and
18614 link scripts are used to support Core B, and the macro
18615 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
18616 should be used instead of "main". This option can only be used in
18617 conjunction with -mmulticore.
18618
18619 -msdram
18620 Build a standalone application for SDRAM. Proper start files and
18621 link scripts are used to put the application into SDRAM, and the
18622 macro "__BFIN_SDRAM" is defined. The loader should initialize
18623 SDRAM before loading the application.
18624
18625 -micplb
18626 Assume that ICPLBs are enabled at run time. This has an effect on
18627 certain anomaly workarounds. For Linux targets, the default is to
18628 assume ICPLBs are enabled; for standalone applications the default
18629 is off.
18630
18631 C6X Options
18632
18633 -march=name
18634 This specifies the name of the target architecture. GCC uses this
18635 name to determine what kind of instructions it can emit when
18636 generating assembly code. Permissible names are: c62x, c64x,
18637 c64x+, c67x, c67x+, c674x.
18638
18639 -mbig-endian
18640 Generate code for a big-endian target.
18641
18642 -mlittle-endian
18643 Generate code for a little-endian target. This is the default.
18644
18645 -msim
18646 Choose startup files and linker script suitable for the simulator.
18647
18648 -msdata=default
18649 Put small global and static data in the ".neardata" section, which
18650 is pointed to by register "B14". Put small uninitialized global
18651 and static data in the ".bss" section, which is adjacent to the
18652 ".neardata" section. Put small read-only data into the ".rodata"
18653 section. The corresponding sections used for large pieces of data
18654 are ".fardata", ".far" and ".const".
18655
18656 -msdata=all
18657 Put all data, not just small objects, into the sections reserved
18658 for small data, and use addressing relative to the "B14" register
18659 to access them.
18660
18661 -msdata=none
18662 Make no use of the sections reserved for small data, and use
18663 absolute addresses to access all data. Put all initialized global
18664 and static data in the ".fardata" section, and all uninitialized
18665 data in the ".far" section. Put all constant data into the
18666 ".const" section.
18667
18668 CRIS Options
18669
18670 These options are defined specifically for the CRIS ports.
18671
18672 -march=architecture-type
18673 -mcpu=architecture-type
18674 Generate code for the specified architecture. The choices for
18675 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
18676 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
18677 linux-gnu, where the default is v10.
18678
18679 -mtune=architecture-type
18680 Tune to architecture-type everything applicable about the generated
18681 code, except for the ABI and the set of available instructions.
18682 The choices for architecture-type are the same as for
18683 -march=architecture-type.
18684
18685 -mmax-stack-frame=n
18686 Warn when the stack frame of a function exceeds n bytes.
18687
18688 -metrax4
18689 -metrax100
18690 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
18691 -march=v8 respectively.
18692
18693 -mmul-bug-workaround
18694 -mno-mul-bug-workaround
18695 Work around a bug in the "muls" and "mulu" instructions for CPU
18696 models where it applies. This option is active by default.
18697
18698 -mpdebug
18699 Enable CRIS-specific verbose debug-related information in the
18700 assembly code. This option also has the effect of turning off the
18701 #NO_APP formatted-code indicator to the assembler at the beginning
18702 of the assembly file.
18703
18704 -mcc-init
18705 Do not use condition-code results from previous instruction; always
18706 emit compare and test instructions before use of condition codes.
18707
18708 -mno-side-effects
18709 Do not emit instructions with side effects in addressing modes
18710 other than post-increment.
18711
18712 -mstack-align
18713 -mno-stack-align
18714 -mdata-align
18715 -mno-data-align
18716 -mconst-align
18717 -mno-const-align
18718 These options (no- options) arrange (eliminate arrangements) for
18719 the stack frame, individual data and constants to be aligned for
18720 the maximum single data access size for the chosen CPU model. The
18721 default is to arrange for 32-bit alignment. ABI details such as
18722 structure layout are not affected by these options.
18723
18724 -m32-bit
18725 -m16-bit
18726 -m8-bit
18727 Similar to the stack- data- and const-align options above, these
18728 options arrange for stack frame, writable data and constants to all
18729 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
18730 alignment.
18731
18732 -mno-prologue-epilogue
18733 -mprologue-epilogue
18734 With -mno-prologue-epilogue, the normal function prologue and
18735 epilogue which set up the stack frame are omitted and no return
18736 instructions or return sequences are generated in the code. Use
18737 this option only together with visual inspection of the compiled
18738 code: no warnings or errors are generated when call-saved registers
18739 must be saved, or storage for local variables needs to be
18740 allocated.
18741
18742 -mno-gotplt
18743 -mgotplt
18744 With -fpic and -fPIC, don't generate (do generate) instruction
18745 sequences that load addresses for functions from the PLT part of
18746 the GOT rather than (traditional on other architectures) calls to
18747 the PLT. The default is -mgotplt.
18748
18749 -melf
18750 Legacy no-op option only recognized with the cris-axis-elf and
18751 cris-axis-linux-gnu targets.
18752
18753 -mlinux
18754 Legacy no-op option only recognized with the cris-axis-linux-gnu
18755 target.
18756
18757 -sim
18758 This option, recognized for the cris-axis-elf, arranges to link
18759 with input-output functions from a simulator library. Code,
18760 initialized data and zero-initialized data are allocated
18761 consecutively.
18762
18763 -sim2
18764 Like -sim, but pass linker options to locate initialized data at
18765 0x40000000 and zero-initialized data at 0x80000000.
18766
18767 CR16 Options
18768
18769 These options are defined specifically for the CR16 ports.
18770
18771 -mmac
18772 Enable the use of multiply-accumulate instructions. Disabled by
18773 default.
18774
18775 -mcr16cplus
18776 -mcr16c
18777 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18778 is default.
18779
18780 -msim
18781 Links the library libsim.a which is in compatible with simulator.
18782 Applicable to ELF compiler only.
18783
18784 -mint32
18785 Choose integer type as 32-bit wide.
18786
18787 -mbit-ops
18788 Generates "sbit"/"cbit" instructions for bit manipulations.
18789
18790 -mdata-model=model
18791 Choose a data model. The choices for model are near, far or medium.
18792 medium is default. However, far is not valid with -mcr16c, as the
18793 CR16C architecture does not support the far data model.
18794
18795 C-SKY Options
18796
18797 GCC supports these options when compiling for C-SKY V2 processors.
18798
18799 -march=arch
18800 Specify the C-SKY target architecture. Valid values for arch are:
18801 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
18802
18803 -mcpu=cpu
18804 Specify the C-SKY target processor. Valid values for cpu are:
18805 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
18806 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
18807 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
18808 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
18809 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
18810 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
18811 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
18812 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
18813 ck810tv, ck810ft, and ck810ftv.
18814
18815 -mbig-endian
18816 -EB
18817 -mlittle-endian
18818 -EL Select big- or little-endian code. The default is little-endian.
18819
18820 -mfloat-abi=name
18821 Specifies which floating-point ABI to use. Permissible values are:
18822 soft, softfp and hard.
18823
18824 Specifying soft causes GCC to generate output containing library
18825 calls for floating-point operations. softfp allows the generation
18826 of code using hardware floating-point instructions, but still uses
18827 the soft-float calling conventions. hard allows generation of
18828 floating-point instructions and uses FPU-specific calling
18829 conventions.
18830
18831 The default depends on the specific target configuration. Note
18832 that the hard-float and soft-float ABIs are not link-compatible;
18833 you must compile your entire program with the same ABI, and link
18834 with a compatible set of libraries.
18835
18836 -mhard-float
18837 -msoft-float
18838 Select hardware or software floating-point implementations. The
18839 default is soft float.
18840
18841 -mdouble-float
18842 -mno-double-float
18843 When -mhard-float is in effect, enable generation of double-
18844 precision float instructions. This is the default except when
18845 compiling for CK803.
18846
18847 -mfdivdu
18848 -mno-fdivdu
18849 When -mhard-float is in effect, enable generation of "frecipd",
18850 "fsqrtd", and "fdivd" instructions. This is the default except
18851 when compiling for CK803.
18852
18853 -mfpu=fpu
18854 Select the floating-point processor. This option can only be used
18855 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
18856 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
18857 and fpv2_divd (-mdouble-float -mdivdu).
18858
18859 -melrw
18860 -mno-elrw
18861 Enable the extended "lrw" instruction. This option defaults to on
18862 for CK801 and off otherwise.
18863
18864 -mistack
18865 -mno-istack
18866 Enable interrupt stack instructions; the default is off.
18867
18868 The -mistack option is required to handle the "interrupt" and "isr"
18869 function attributes.
18870
18871 -mmp
18872 Enable multiprocessor instructions; the default is off.
18873
18874 -mcp
18875 Enable coprocessor instructions; the default is off.
18876
18877 -mcache
18878 Enable coprocessor instructions; the default is off.
18879
18880 -msecurity
18881 Enable C-SKY security instructions; the default is off.
18882
18883 -mtrust
18884 Enable C-SKY trust instructions; the default is off.
18885
18886 -mdsp
18887 -medsp
18888 -mvdsp
18889 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
18890 respectively. All of these options default to off.
18891
18892 -mdiv
18893 -mno-div
18894 Generate divide instructions. Default is off.
18895
18896 -msmart
18897 -mno-smart
18898 Generate code for Smart Mode, using only registers numbered 0-7 to
18899 allow use of 16-bit instructions. This option is ignored for CK801
18900 where this is the required behavior, and it defaults to on for
18901 CK802. For other targets, the default is off.
18902
18903 -mhigh-registers
18904 -mno-high-registers
18905 Generate code using the high registers numbered 16-31. This option
18906 is not supported on CK801, CK802, or CK803, and is enabled by
18907 default for other processors.
18908
18909 -manchor
18910 -mno-anchor
18911 Generate code using global anchor symbol addresses.
18912
18913 -mpushpop
18914 -mno-pushpop
18915 Generate code using "push" and "pop" instructions. This option
18916 defaults to on.
18917
18918 -mmultiple-stld
18919 -mstm
18920 -mno-multiple-stld
18921 -mno-stm
18922 Generate code using "stm" and "ldm" instructions. This option
18923 isn't supported on CK801 but is enabled by default on other
18924 processors.
18925
18926 -mconstpool
18927 -mno-constpool
18928 Create constant pools in the compiler instead of deferring it to
18929 the assembler. This option is the default and required for correct
18930 code generation on CK801 and CK802, and is optional on other
18931 processors.
18932
18933 -mstack-size
18934 -mno-stack-size
18935 Emit ".stack_size" directives for each function in the assembly
18936 output. This option defaults to off.
18937
18938 -mccrt
18939 -mno-ccrt
18940 Generate code for the C-SKY compiler runtime instead of libgcc.
18941 This option defaults to off.
18942
18943 -mbranch-cost=n
18944 Set the branch costs to roughly "n" instructions. The default is
18945 1.
18946
18947 -msched-prolog
18948 -mno-sched-prolog
18949 Permit scheduling of function prologue and epilogue sequences.
18950 Using this option can result in code that is not compliant with the
18951 C-SKY V2 ABI prologue requirements and that cannot be debugged or
18952 backtraced. It is disabled by default.
18953
18954 -msim
18955 Links the library libsemi.a which is in compatible with simulator.
18956 Applicable to ELF compiler only.
18957
18958 Darwin Options
18959
18960 These options are defined for all architectures running the Darwin
18961 operating system.
18962
18963 FSF GCC on Darwin does not create "fat" object files; it creates an
18964 object file for the single architecture that GCC was built to target.
18965 Apple's GCC on Darwin does create "fat" files if multiple -arch options
18966 are used; it does so by running the compiler or linker multiple times
18967 and joining the results together with lipo.
18968
18969 The subtype of the file created (like ppc7400 or ppc970 or i686) is
18970 determined by the flags that specify the ISA that GCC is targeting,
18971 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
18972 override this.
18973
18974 The Darwin tools vary in their behavior when presented with an ISA
18975 mismatch. The assembler, as, only permits instructions to be used that
18976 are valid for the subtype of the file it is generating, so you cannot
18977 put 64-bit instructions in a ppc750 object file. The linker for shared
18978 libraries, /usr/bin/libtool, fails and prints an error if asked to
18979 create a shared library with a less restrictive subtype than its input
18980 files (for instance, trying to put a ppc970 object file in a ppc7400
18981 library). The linker for executables, ld, quietly gives the executable
18982 the most restrictive subtype of any of its input files.
18983
18984 -Fdir
18985 Add the framework directory dir to the head of the list of
18986 directories to be searched for header files. These directories are
18987 interleaved with those specified by -I options and are scanned in a
18988 left-to-right order.
18989
18990 A framework directory is a directory with frameworks in it. A
18991 framework is a directory with a Headers and/or PrivateHeaders
18992 directory contained directly in it that ends in .framework. The
18993 name of a framework is the name of this directory excluding the
18994 .framework. Headers associated with the framework are found in one
18995 of those two directories, with Headers being searched first. A
18996 subframework is a framework directory that is in a framework's
18997 Frameworks directory. Includes of subframework headers can only
18998 appear in a header of a framework that contains the subframework,
18999 or in a sibling subframework header. Two subframeworks are
19000 siblings if they occur in the same framework. A subframework
19001 should not have the same name as a framework; a warning is issued
19002 if this is violated. Currently a subframework cannot have
19003 subframeworks; in the future, the mechanism may be extended to
19004 support this. The standard frameworks can be found in
19005 /System/Library/Frameworks and /Library/Frameworks. An example
19006 include looks like "#include <Framework/header.h>", where Framework
19007 denotes the name of the framework and header.h is found in the
19008 PrivateHeaders or Headers directory.
19009
19010 -iframeworkdir
19011 Like -F except the directory is a treated as a system directory.
19012 The main difference between this -iframework and -F is that with
19013 -iframework the compiler does not warn about constructs contained
19014 within header files found via dir. This option is valid only for
19015 the C family of languages.
19016
19017 -gused
19018 Emit debugging information for symbols that are used. For stabs
19019 debugging format, this enables -feliminate-unused-debug-symbols.
19020 This is by default ON.
19021
19022 -gfull
19023 Emit debugging information for all symbols and types.
19024
19025 -mmacosx-version-min=version
19026 The earliest version of MacOS X that this executable will run on is
19027 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19028
19029 If the compiler was built to use the system's headers by default,
19030 then the default for this option is the system version on which the
19031 compiler is running, otherwise the default is to make choices that
19032 are compatible with as many systems and code bases as possible.
19033
19034 -mkernel
19035 Enable kernel development mode. The -mkernel option sets -static,
19036 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19037 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19038 where applicable. This mode also sets -mno-altivec, -msoft-float,
19039 -fno-builtin and -mlong-branch for PowerPC targets.
19040
19041 -mone-byte-bool
19042 Override the defaults for "bool" so that "sizeof(bool)==1". By
19043 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19044 when compiling for Darwin/x86, so this option has no effect on x86.
19045
19046 Warning: The -mone-byte-bool switch causes GCC to generate code
19047 that is not binary compatible with code generated without that
19048 switch. Using this switch may require recompiling all other
19049 modules in a program, including system libraries. Use this switch
19050 to conform to a non-default data model.
19051
19052 -mfix-and-continue
19053 -ffix-and-continue
19054 -findirect-data
19055 Generate code suitable for fast turnaround development, such as to
19056 allow GDB to dynamically load .o files into already-running
19057 programs. -findirect-data and -ffix-and-continue are provided for
19058 backwards compatibility.
19059
19060 -all_load
19061 Loads all members of static archive libraries. See man ld(1) for
19062 more information.
19063
19064 -arch_errors_fatal
19065 Cause the errors having to do with files that have the wrong
19066 architecture to be fatal.
19067
19068 -bind_at_load
19069 Causes the output file to be marked such that the dynamic linker
19070 will bind all undefined references when the file is loaded or
19071 launched.
19072
19073 -bundle
19074 Produce a Mach-o bundle format file. See man ld(1) for more
19075 information.
19076
19077 -bundle_loader executable
19078 This option specifies the executable that will load the build
19079 output file being linked. See man ld(1) for more information.
19080
19081 -dynamiclib
19082 When passed this option, GCC produces a dynamic library instead of
19083 an executable when linking, using the Darwin libtool command.
19084
19085 -force_cpusubtype_ALL
19086 This causes GCC's output file to have the ALL subtype, instead of
19087 one controlled by the -mcpu or -march option.
19088
19089 -allowable_client client_name
19090 -client_name
19091 -compatibility_version
19092 -current_version
19093 -dead_strip
19094 -dependency-file
19095 -dylib_file
19096 -dylinker_install_name
19097 -dynamic
19098 -exported_symbols_list
19099 -filelist
19100 -flat_namespace
19101 -force_flat_namespace
19102 -headerpad_max_install_names
19103 -image_base
19104 -init
19105 -install_name
19106 -keep_private_externs
19107 -multi_module
19108 -multiply_defined
19109 -multiply_defined_unused
19110 -noall_load
19111 -no_dead_strip_inits_and_terms
19112 -nofixprebinding
19113 -nomultidefs
19114 -noprebind
19115 -noseglinkedit
19116 -pagezero_size
19117 -prebind
19118 -prebind_all_twolevel_modules
19119 -private_bundle
19120 -read_only_relocs
19121 -sectalign
19122 -sectobjectsymbols
19123 -whyload
19124 -seg1addr
19125 -sectcreate
19126 -sectobjectsymbols
19127 -sectorder
19128 -segaddr
19129 -segs_read_only_addr
19130 -segs_read_write_addr
19131 -seg_addr_table
19132 -seg_addr_table_filename
19133 -seglinkedit
19134 -segprot
19135 -segs_read_only_addr
19136 -segs_read_write_addr
19137 -single_module
19138 -static
19139 -sub_library
19140 -sub_umbrella
19141 -twolevel_namespace
19142 -umbrella
19143 -undefined
19144 -unexported_symbols_list
19145 -weak_reference_mismatches
19146 -whatsloaded
19147 These options are passed to the Darwin linker. The Darwin linker
19148 man page describes them in detail.
19149
19150 DEC Alpha Options
19151
19152 These -m options are defined for the DEC Alpha implementations:
19153
19154 -mno-soft-float
19155 -msoft-float
19156 Use (do not use) the hardware floating-point instructions for
19157 floating-point operations. When -msoft-float is specified,
19158 functions in libgcc.a are used to perform floating-point
19159 operations. Unless they are replaced by routines that emulate the
19160 floating-point operations, or compiled in such a way as to call
19161 such emulations routines, these routines issue floating-point
19162 operations. If you are compiling for an Alpha without floating-
19163 point operations, you must ensure that the library is built so as
19164 not to call them.
19165
19166 Note that Alpha implementations without floating-point operations
19167 are required to have floating-point registers.
19168
19169 -mfp-reg
19170 -mno-fp-regs
19171 Generate code that uses (does not use) the floating-point register
19172 set. -mno-fp-regs implies -msoft-float. If the floating-point
19173 register set is not used, floating-point operands are passed in
19174 integer registers as if they were integers and floating-point
19175 results are passed in $0 instead of $f0. This is a non-standard
19176 calling sequence, so any function with a floating-point argument or
19177 return value called by code compiled with -mno-fp-regs must also be
19178 compiled with that option.
19179
19180 A typical use of this option is building a kernel that does not
19181 use, and hence need not save and restore, any floating-point
19182 registers.
19183
19184 -mieee
19185 The Alpha architecture implements floating-point hardware optimized
19186 for maximum performance. It is mostly compliant with the IEEE
19187 floating-point standard. However, for full compliance, software
19188 assistance is required. This option generates code fully IEEE-
19189 compliant code except that the inexact-flag is not maintained (see
19190 below). If this option is turned on, the preprocessor macro
19191 "_IEEE_FP" is defined during compilation. The resulting code is
19192 less efficient but is able to correctly support denormalized
19193 numbers and exceptional IEEE values such as not-a-number and
19194 plus/minus infinity. Other Alpha compilers call this option
19195 -ieee_with_no_inexact.
19196
19197 -mieee-with-inexact
19198 This is like -mieee except the generated code also maintains the
19199 IEEE inexact-flag. Turning on this option causes the generated
19200 code to implement fully-compliant IEEE math. In addition to
19201 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
19202 On some Alpha implementations the resulting code may execute
19203 significantly slower than the code generated by default. Since
19204 there is very little code that depends on the inexact-flag, you
19205 should normally not specify this option. Other Alpha compilers
19206 call this option -ieee_with_inexact.
19207
19208 -mfp-trap-mode=trap-mode
19209 This option controls what floating-point related traps are enabled.
19210 Other Alpha compilers call this option -fptm trap-mode. The trap
19211 mode can be set to one of four values:
19212
19213 n This is the default (normal) setting. The only traps that are
19214 enabled are the ones that cannot be disabled in software (e.g.,
19215 division by zero trap).
19216
19217 u In addition to the traps enabled by n, underflow traps are
19218 enabled as well.
19219
19220 su Like u, but the instructions are marked to be safe for software
19221 completion (see Alpha architecture manual for details).
19222
19223 sui Like su, but inexact traps are enabled as well.
19224
19225 -mfp-rounding-mode=rounding-mode
19226 Selects the IEEE rounding mode. Other Alpha compilers call this
19227 option -fprm rounding-mode. The rounding-mode can be one of:
19228
19229 n Normal IEEE rounding mode. Floating-point numbers are rounded
19230 towards the nearest machine number or towards the even machine
19231 number in case of a tie.
19232
19233 m Round towards minus infinity.
19234
19235 c Chopped rounding mode. Floating-point numbers are rounded
19236 towards zero.
19237
19238 d Dynamic rounding mode. A field in the floating-point control
19239 register (fpcr, see Alpha architecture reference manual)
19240 controls the rounding mode in effect. The C library
19241 initializes this register for rounding towards plus infinity.
19242 Thus, unless your program modifies the fpcr, d corresponds to
19243 round towards plus infinity.
19244
19245 -mtrap-precision=trap-precision
19246 In the Alpha architecture, floating-point traps are imprecise.
19247 This means without software assistance it is impossible to recover
19248 from a floating trap and program execution normally needs to be
19249 terminated. GCC can generate code that can assist operating system
19250 trap handlers in determining the exact location that caused a
19251 floating-point trap. Depending on the requirements of an
19252 application, different levels of precisions can be selected:
19253
19254 p Program precision. This option is the default and means a trap
19255 handler can only identify which program caused a floating-point
19256 exception.
19257
19258 f Function precision. The trap handler can determine the
19259 function that caused a floating-point exception.
19260
19261 i Instruction precision. The trap handler can determine the
19262 exact instruction that caused a floating-point exception.
19263
19264 Other Alpha compilers provide the equivalent options called
19265 -scope_safe and -resumption_safe.
19266
19267 -mieee-conformant
19268 This option marks the generated code as IEEE conformant. You must
19269 not use this option unless you also specify -mtrap-precision=i and
19270 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
19271 to emit the line .eflag 48 in the function prologue of the
19272 generated assembly file.
19273
19274 -mbuild-constants
19275 Normally GCC examines a 32- or 64-bit integer constant to see if it
19276 can construct it from smaller constants in two or three
19277 instructions. If it cannot, it outputs the constant as a literal
19278 and generates code to load it from the data segment at run time.
19279
19280 Use this option to require GCC to construct all integer constants
19281 using code, even if it takes more instructions (the maximum is
19282 six).
19283
19284 You typically use this option to build a shared library dynamic
19285 loader. Itself a shared library, it must relocate itself in memory
19286 before it can find the variables and constants in its own data
19287 segment.
19288
19289 -mbwx
19290 -mno-bwx
19291 -mcix
19292 -mno-cix
19293 -mfix
19294 -mno-fix
19295 -mmax
19296 -mno-max
19297 Indicate whether GCC should generate code to use the optional BWX,
19298 CIX, FIX and MAX instruction sets. The default is to use the
19299 instruction sets supported by the CPU type specified via -mcpu=
19300 option or that of the CPU on which GCC was built if none is
19301 specified.
19302
19303 -mfloat-vax
19304 -mfloat-ieee
19305 Generate code that uses (does not use) VAX F and G floating-point
19306 arithmetic instead of IEEE single and double precision.
19307
19308 -mexplicit-relocs
19309 -mno-explicit-relocs
19310 Older Alpha assemblers provided no way to generate symbol
19311 relocations except via assembler macros. Use of these macros does
19312 not allow optimal instruction scheduling. GNU binutils as of
19313 version 2.12 supports a new syntax that allows the compiler to
19314 explicitly mark which relocations should apply to which
19315 instructions. This option is mostly useful for debugging, as GCC
19316 detects the capabilities of the assembler when it is built and sets
19317 the default accordingly.
19318
19319 -msmall-data
19320 -mlarge-data
19321 When -mexplicit-relocs is in effect, static data is accessed via
19322 gp-relative relocations. When -msmall-data is used, objects 8
19323 bytes long or smaller are placed in a small data area (the ".sdata"
19324 and ".sbss" sections) and are accessed via 16-bit relocations off
19325 of the $gp register. This limits the size of the small data area
19326 to 64KB, but allows the variables to be directly accessed via a
19327 single instruction.
19328
19329 The default is -mlarge-data. With this option the data area is
19330 limited to just below 2GB. Programs that require more than 2GB of
19331 data must use "malloc" or "mmap" to allocate the data in the heap
19332 instead of in the program's data segment.
19333
19334 When generating code for shared libraries, -fpic implies
19335 -msmall-data and -fPIC implies -mlarge-data.
19336
19337 -msmall-text
19338 -mlarge-text
19339 When -msmall-text is used, the compiler assumes that the code of
19340 the entire program (or shared library) fits in 4MB, and is thus
19341 reachable with a branch instruction. When -msmall-data is used,
19342 the compiler can assume that all local symbols share the same $gp
19343 value, and thus reduce the number of instructions required for a
19344 function call from 4 to 1.
19345
19346 The default is -mlarge-text.
19347
19348 -mcpu=cpu_type
19349 Set the instruction set and instruction scheduling parameters for
19350 machine type cpu_type. You can specify either the EV style name or
19351 the corresponding chip number. GCC supports scheduling parameters
19352 for the EV4, EV5 and EV6 family of processors and chooses the
19353 default values for the instruction set from the processor you
19354 specify. If you do not specify a processor type, GCC defaults to
19355 the processor on which the compiler was built.
19356
19357 Supported values for cpu_type are
19358
19359 ev4
19360 ev45
19361 21064
19362 Schedules as an EV4 and has no instruction set extensions.
19363
19364 ev5
19365 21164
19366 Schedules as an EV5 and has no instruction set extensions.
19367
19368 ev56
19369 21164a
19370 Schedules as an EV5 and supports the BWX extension.
19371
19372 pca56
19373 21164pc
19374 21164PC
19375 Schedules as an EV5 and supports the BWX and MAX extensions.
19376
19377 ev6
19378 21264
19379 Schedules as an EV6 and supports the BWX, FIX, and MAX
19380 extensions.
19381
19382 ev67
19383 21264a
19384 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
19385 extensions.
19386
19387 Native toolchains also support the value native, which selects the
19388 best architecture option for the host processor. -mcpu=native has
19389 no effect if GCC does not recognize the processor.
19390
19391 -mtune=cpu_type
19392 Set only the instruction scheduling parameters for machine type
19393 cpu_type. The instruction set is not changed.
19394
19395 Native toolchains also support the value native, which selects the
19396 best architecture option for the host processor. -mtune=native has
19397 no effect if GCC does not recognize the processor.
19398
19399 -mmemory-latency=time
19400 Sets the latency the scheduler should assume for typical memory
19401 references as seen by the application. This number is highly
19402 dependent on the memory access patterns used by the application and
19403 the size of the external cache on the machine.
19404
19405 Valid options for time are
19406
19407 number
19408 A decimal number representing clock cycles.
19409
19410 L1
19411 L2
19412 L3
19413 main
19414 The compiler contains estimates of the number of clock cycles
19415 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19416 (also called Dcache, Scache, and Bcache), as well as to main
19417 memory. Note that L3 is only valid for EV5.
19418
19419 eBPF Options
19420
19421 -mframe-limit=bytes
19422 This specifies the hard limit for frame sizes, in bytes.
19423 Currently, the value that can be specified should be less than or
19424 equal to 32767. Defaults to whatever limit is imposed by the
19425 version of the Linux kernel targeted.
19426
19427 -mkernel=version
19428 This specifies the minimum version of the kernel that will run the
19429 compiled program. GCC uses this version to determine which
19430 instructions to use, what kernel helpers to allow, etc. Currently,
19431 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
19432 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
19433 4.20, 5.0, 5.1, 5.2, latest and native.
19434
19435 -mbig-endian
19436 Generate code for a big-endian target.
19437
19438 -mlittle-endian
19439 Generate code for a little-endian target. This is the default.
19440
19441 -mxbpf
19442 Generate code for an expanded version of BPF, which relaxes some of
19443 the restrictions imposed by the BPF architecture:
19444
19445 -<Save and restore callee-saved registers at function entry and>
19446 exit, respectively.
19447
19448 FR30 Options
19449
19450 These options are defined specifically for the FR30 port.
19451
19452 -msmall-model
19453 Use the small address space model. This can produce smaller code,
19454 but it does assume that all symbolic values and addresses fit into
19455 a 20-bit range.
19456
19457 -mno-lsim
19458 Assume that runtime support has been provided and so there is no
19459 need to include the simulator library (libsim.a) on the linker
19460 command line.
19461
19462 FT32 Options
19463
19464 These options are defined specifically for the FT32 port.
19465
19466 -msim
19467 Specifies that the program will be run on the simulator. This
19468 causes an alternate runtime startup and library to be linked. You
19469 must not use this option when generating programs that will run on
19470 real hardware; you must provide your own runtime library for
19471 whatever I/O functions are needed.
19472
19473 -mlra
19474 Enable Local Register Allocation. This is still experimental for
19475 FT32, so by default the compiler uses standard reload.
19476
19477 -mnodiv
19478 Do not use div and mod instructions.
19479
19480 -mft32b
19481 Enable use of the extended instructions of the FT32B processor.
19482
19483 -mcompress
19484 Compress all code using the Ft32B code compression scheme.
19485
19486 -mnopm
19487 Do not generate code that reads program memory.
19488
19489 FRV Options
19490
19491 -mgpr-32
19492 Only use the first 32 general-purpose registers.
19493
19494 -mgpr-64
19495 Use all 64 general-purpose registers.
19496
19497 -mfpr-32
19498 Use only the first 32 floating-point registers.
19499
19500 -mfpr-64
19501 Use all 64 floating-point registers.
19502
19503 -mhard-float
19504 Use hardware instructions for floating-point operations.
19505
19506 -msoft-float
19507 Use library routines for floating-point operations.
19508
19509 -malloc-cc
19510 Dynamically allocate condition code registers.
19511
19512 -mfixed-cc
19513 Do not try to dynamically allocate condition code registers, only
19514 use "icc0" and "fcc0".
19515
19516 -mdword
19517 Change ABI to use double word insns.
19518
19519 -mno-dword
19520 Do not use double word instructions.
19521
19522 -mdouble
19523 Use floating-point double instructions.
19524
19525 -mno-double
19526 Do not use floating-point double instructions.
19527
19528 -mmedia
19529 Use media instructions.
19530
19531 -mno-media
19532 Do not use media instructions.
19533
19534 -mmuladd
19535 Use multiply and add/subtract instructions.
19536
19537 -mno-muladd
19538 Do not use multiply and add/subtract instructions.
19539
19540 -mfdpic
19541 Select the FDPIC ABI, which uses function descriptors to represent
19542 pointers to functions. Without any PIC/PIE-related options, it
19543 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
19544 small data are within a 12-bit range from the GOT base address;
19545 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
19546 bfin-elf target, this option implies -msim.
19547
19548 -minline-plt
19549 Enable inlining of PLT entries in function calls to functions that
19550 are not known to bind locally. It has no effect without -mfdpic.
19551 It's enabled by default if optimizing for speed and compiling for
19552 shared libraries (i.e., -fPIC or -fpic), or when an optimization
19553 option such as -O3 or above is present in the command line.
19554
19555 -mTLS
19556 Assume a large TLS segment when generating thread-local code.
19557
19558 -mtls
19559 Do not assume a large TLS segment when generating thread-local
19560 code.
19561
19562 -mgprel-ro
19563 Enable the use of "GPREL" relocations in the FDPIC ABI for data
19564 that is known to be in read-only sections. It's enabled by
19565 default, except for -fpic or -fpie: even though it may help make
19566 the global offset table smaller, it trades 1 instruction for 4.
19567 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
19568 may be shared by multiple symbols, and it avoids the need for a GOT
19569 entry for the referenced symbol, so it's more likely to be a win.
19570 If it is not, -mno-gprel-ro can be used to disable it.
19571
19572 -multilib-library-pic
19573 Link with the (library, not FD) pic libraries. It's implied by
19574 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
19575 should never have to use it explicitly.
19576
19577 -mlinked-fp
19578 Follow the EABI requirement of always creating a frame pointer
19579 whenever a stack frame is allocated. This option is enabled by
19580 default and can be disabled with -mno-linked-fp.
19581
19582 -mlong-calls
19583 Use indirect addressing to call functions outside the current
19584 compilation unit. This allows the functions to be placed anywhere
19585 within the 32-bit address space.
19586
19587 -malign-labels
19588 Try to align labels to an 8-byte boundary by inserting NOPs into
19589 the previous packet. This option only has an effect when VLIW
19590 packing is enabled. It doesn't create new packets; it merely adds
19591 NOPs to existing ones.
19592
19593 -mlibrary-pic
19594 Generate position-independent EABI code.
19595
19596 -macc-4
19597 Use only the first four media accumulator registers.
19598
19599 -macc-8
19600 Use all eight media accumulator registers.
19601
19602 -mpack
19603 Pack VLIW instructions.
19604
19605 -mno-pack
19606 Do not pack VLIW instructions.
19607
19608 -mno-eflags
19609 Do not mark ABI switches in e_flags.
19610
19611 -mcond-move
19612 Enable the use of conditional-move instructions (default).
19613
19614 This switch is mainly for debugging the compiler and will likely be
19615 removed in a future version.
19616
19617 -mno-cond-move
19618 Disable the use of conditional-move instructions.
19619
19620 This switch is mainly for debugging the compiler and will likely be
19621 removed in a future version.
19622
19623 -mscc
19624 Enable the use of conditional set instructions (default).
19625
19626 This switch is mainly for debugging the compiler and will likely be
19627 removed in a future version.
19628
19629 -mno-scc
19630 Disable the use of conditional set instructions.
19631
19632 This switch is mainly for debugging the compiler and will likely be
19633 removed in a future version.
19634
19635 -mcond-exec
19636 Enable the use of conditional execution (default).
19637
19638 This switch is mainly for debugging the compiler and will likely be
19639 removed in a future version.
19640
19641 -mno-cond-exec
19642 Disable the use of conditional execution.
19643
19644 This switch is mainly for debugging the compiler and will likely be
19645 removed in a future version.
19646
19647 -mvliw-branch
19648 Run a pass to pack branches into VLIW instructions (default).
19649
19650 This switch is mainly for debugging the compiler and will likely be
19651 removed in a future version.
19652
19653 -mno-vliw-branch
19654 Do not run a pass to pack branches into VLIW instructions.
19655
19656 This switch is mainly for debugging the compiler and will likely be
19657 removed in a future version.
19658
19659 -mmulti-cond-exec
19660 Enable optimization of "&&" and "||" in conditional execution
19661 (default).
19662
19663 This switch is mainly for debugging the compiler and will likely be
19664 removed in a future version.
19665
19666 -mno-multi-cond-exec
19667 Disable optimization of "&&" and "||" in conditional execution.
19668
19669 This switch is mainly for debugging the compiler and will likely be
19670 removed in a future version.
19671
19672 -mnested-cond-exec
19673 Enable nested conditional execution optimizations (default).
19674
19675 This switch is mainly for debugging the compiler and will likely be
19676 removed in a future version.
19677
19678 -mno-nested-cond-exec
19679 Disable nested conditional execution optimizations.
19680
19681 This switch is mainly for debugging the compiler and will likely be
19682 removed in a future version.
19683
19684 -moptimize-membar
19685 This switch removes redundant "membar" instructions from the
19686 compiler-generated code. It is enabled by default.
19687
19688 -mno-optimize-membar
19689 This switch disables the automatic removal of redundant "membar"
19690 instructions from the generated code.
19691
19692 -mtomcat-stats
19693 Cause gas to print out tomcat statistics.
19694
19695 -mcpu=cpu
19696 Select the processor type for which to generate code. Possible
19697 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
19698 and simple.
19699
19700 GNU/Linux Options
19701
19702 These -m options are defined for GNU/Linux targets:
19703
19704 -mglibc
19705 Use the GNU C library. This is the default except on
19706 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
19707 targets.
19708
19709 -muclibc
19710 Use uClibc C library. This is the default on *-*-linux-*uclibc*
19711 targets.
19712
19713 -mmusl
19714 Use the musl C library. This is the default on *-*-linux-*musl*
19715 targets.
19716
19717 -mbionic
19718 Use Bionic C library. This is the default on *-*-linux-*android*
19719 targets.
19720
19721 -mandroid
19722 Compile code compatible with Android platform. This is the default
19723 on *-*-linux-*android* targets.
19724
19725 When compiling, this option enables -mbionic, -fPIC,
19726 -fno-exceptions and -fno-rtti by default. When linking, this
19727 option makes the GCC driver pass Android-specific options to the
19728 linker. Finally, this option causes the preprocessor macro
19729 "__ANDROID__" to be defined.
19730
19731 -tno-android-cc
19732 Disable compilation effects of -mandroid, i.e., do not enable
19733 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
19734
19735 -tno-android-ld
19736 Disable linking effects of -mandroid, i.e., pass standard Linux
19737 linking options to the linker.
19738
19739 H8/300 Options
19740
19741 These -m options are defined for the H8/300 implementations:
19742
19743 -mrelax
19744 Shorten some address references at link time, when possible; uses
19745 the linker option -relax.
19746
19747 -mh Generate code for the H8/300H.
19748
19749 -ms Generate code for the H8S.
19750
19751 -mn Generate code for the H8S and H8/300H in the normal mode. This
19752 switch must be used either with -mh or -ms.
19753
19754 -ms2600
19755 Generate code for the H8S/2600. This switch must be used with -ms.
19756
19757 -mexr
19758 Extended registers are stored on stack before execution of function
19759 with monitor attribute. Default option is -mexr. This option is
19760 valid only for H8S targets.
19761
19762 -mno-exr
19763 Extended registers are not stored on stack before execution of
19764 function with monitor attribute. Default option is -mno-exr. This
19765 option is valid only for H8S targets.
19766
19767 -mint32
19768 Make "int" data 32 bits by default.
19769
19770 -malign-300
19771 On the H8/300H and H8S, use the same alignment rules as for the
19772 H8/300. The default for the H8/300H and H8S is to align longs and
19773 floats on 4-byte boundaries. -malign-300 causes them to be aligned
19774 on 2-byte boundaries. This option has no effect on the H8/300.
19775
19776 HPPA Options
19777
19778 These -m options are defined for the HPPA family of computers:
19779
19780 -march=architecture-type
19781 Generate code for the specified architecture. The choices for
19782 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
19783 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
19784 system to determine the proper architecture option for your
19785 machine. Code compiled for lower numbered architectures runs on
19786 higher numbered architectures, but not the other way around.
19787
19788 -mpa-risc-1-0
19789 -mpa-risc-1-1
19790 -mpa-risc-2-0
19791 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
19792
19793 -mcaller-copies
19794 The caller copies function arguments passed by hidden reference.
19795 This option should be used with care as it is not compatible with
19796 the default 32-bit runtime. However, only aggregates larger than
19797 eight bytes are passed by hidden reference and the option provides
19798 better compatibility with OpenMP.
19799
19800 -mjump-in-delay
19801 This option is ignored and provided for compatibility purposes
19802 only.
19803
19804 -mdisable-fpregs
19805 Prevent floating-point registers from being used in any manner.
19806 This is necessary for compiling kernels that perform lazy context
19807 switching of floating-point registers. If you use this option and
19808 attempt to perform floating-point operations, the compiler aborts.
19809
19810 -mdisable-indexing
19811 Prevent the compiler from using indexing address modes. This
19812 avoids some rather obscure problems when compiling MIG generated
19813 code under MACH.
19814
19815 -mno-space-regs
19816 Generate code that assumes the target has no space registers. This
19817 allows GCC to generate faster indirect calls and use unscaled index
19818 address modes.
19819
19820 Such code is suitable for level 0 PA systems and kernels.
19821
19822 -mfast-indirect-calls
19823 Generate code that assumes calls never cross space boundaries.
19824 This allows GCC to emit code that performs faster indirect calls.
19825
19826 This option does not work in the presence of shared libraries or
19827 nested functions.
19828
19829 -mfixed-range=register-range
19830 Generate code treating the given register range as fixed registers.
19831 A fixed register is one that the register allocator cannot use.
19832 This is useful when compiling kernel code. A register range is
19833 specified as two registers separated by a dash. Multiple register
19834 ranges can be specified separated by a comma.
19835
19836 -mlong-load-store
19837 Generate 3-instruction load and store sequences as sometimes
19838 required by the HP-UX 10 linker. This is equivalent to the +k
19839 option to the HP compilers.
19840
19841 -mportable-runtime
19842 Use the portable calling conventions proposed by HP for ELF
19843 systems.
19844
19845 -mgas
19846 Enable the use of assembler directives only GAS understands.
19847
19848 -mschedule=cpu-type
19849 Schedule code according to the constraints for the machine type
19850 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
19851 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
19852 to determine the proper scheduling option for your machine. The
19853 default scheduling is 8000.
19854
19855 -mlinker-opt
19856 Enable the optimization pass in the HP-UX linker. Note this makes
19857 symbolic debugging impossible. It also triggers a bug in the HP-UX
19858 8 and HP-UX 9 linkers in which they give bogus error messages when
19859 linking some programs.
19860
19861 -msoft-float
19862 Generate output containing library calls for floating point.
19863 Warning: the requisite libraries are not available for all HPPA
19864 targets. Normally the facilities of the machine's usual C compiler
19865 are used, but this cannot be done directly in cross-compilation.
19866 You must make your own arrangements to provide suitable library
19867 functions for cross-compilation.
19868
19869 -msoft-float changes the calling convention in the output file;
19870 therefore, it is only useful if you compile all of a program with
19871 this option. In particular, you need to compile libgcc.a, the
19872 library that comes with GCC, with -msoft-float in order for this to
19873 work.
19874
19875 -msio
19876 Generate the predefine, "_SIO", for server IO. The default is
19877 -mwsio. This generates the predefines, "__hp9000s700",
19878 "__hp9000s700__" and "_WSIO", for workstation IO. These options
19879 are available under HP-UX and HI-UX.
19880
19881 -mgnu-ld
19882 Use options specific to GNU ld. This passes -shared to ld when
19883 building a shared library. It is the default when GCC is
19884 configured, explicitly or implicitly, with the GNU linker. This
19885 option does not affect which ld is called; it only changes what
19886 parameters are passed to that ld. The ld that is called is
19887 determined by the --with-ld configure option, GCC's program search
19888 path, and finally by the user's PATH. The linker used by GCC can
19889 be printed using which `gcc -print-prog-name=ld`. This option is
19890 only available on the 64-bit HP-UX GCC, i.e. configured with
19891 hppa*64*-*-hpux*.
19892
19893 -mhp-ld
19894 Use options specific to HP ld. This passes -b to ld when building
19895 a shared library and passes +Accept TypeMismatch to ld on all
19896 links. It is the default when GCC is configured, explicitly or
19897 implicitly, with the HP linker. This option does not affect which
19898 ld is called; it only changes what parameters are passed to that
19899 ld. The ld that is called is determined by the --with-ld configure
19900 option, GCC's program search path, and finally by the user's PATH.
19901 The linker used by GCC can be printed using which `gcc
19902 -print-prog-name=ld`. This option is only available on the 64-bit
19903 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
19904
19905 -mlong-calls
19906 Generate code that uses long call sequences. This ensures that a
19907 call is always able to reach linker generated stubs. The default
19908 is to generate long calls only when the distance from the call site
19909 to the beginning of the function or translation unit, as the case
19910 may be, exceeds a predefined limit set by the branch type being
19911 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
19912 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
19913 always limited at 240,000 bytes.
19914
19915 Distances are measured from the beginning of functions when using
19916 the -ffunction-sections option, or when using the -mgas and
19917 -mno-portable-runtime options together under HP-UX with the SOM
19918 linker.
19919
19920 It is normally not desirable to use this option as it degrades
19921 performance. However, it may be useful in large applications,
19922 particularly when partial linking is used to build the application.
19923
19924 The types of long calls used depends on the capabilities of the
19925 assembler and linker, and the type of code being generated. The
19926 impact on systems that support long absolute calls, and long pic
19927 symbol-difference or pc-relative calls should be relatively small.
19928 However, an indirect call is used on 32-bit ELF systems in pic code
19929 and it is quite long.
19930
19931 -munix=unix-std
19932 Generate compiler predefines and select a startfile for the
19933 specified UNIX standard. The choices for unix-std are 93, 95 and
19934 98. 93 is supported on all HP-UX versions. 95 is available on HP-
19935 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
19936 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
19937 11.00, and 98 for HP-UX 11.11 and later.
19938
19939 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
19940 -munix=95 provides additional predefines for "XOPEN_UNIX" and
19941 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
19942 provides additional predefines for "_XOPEN_UNIX",
19943 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
19944 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
19945
19946 It is important to note that this option changes the interfaces for
19947 various library routines. It also affects the operational behavior
19948 of the C library. Thus, extreme care is needed in using this
19949 option.
19950
19951 Library code that is intended to operate with more than one UNIX
19952 standard must test, set and restore the variable
19953 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
19954 provide this capability.
19955
19956 -nolibdld
19957 Suppress the generation of link options to search libdld.sl when
19958 the -static option is specified on HP-UX 10 and later.
19959
19960 -static
19961 The HP-UX implementation of setlocale in libc has a dependency on
19962 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19963 when the -static option is specified, special link options are
19964 needed to resolve this dependency.
19965
19966 On HP-UX 10 and later, the GCC driver adds the necessary options to
19967 link with libdld.sl when the -static option is specified. This
19968 causes the resulting binary to be dynamic. On the 64-bit port, the
19969 linkers generate dynamic binaries by default in any case. The
19970 -nolibdld option can be used to prevent the GCC driver from adding
19971 these link options.
19972
19973 -threads
19974 Add support for multithreading with the dce thread library under
19975 HP-UX. This option sets flags for both the preprocessor and
19976 linker.
19977
19978 IA-64 Options
19979
19980 These are the -m options defined for the Intel IA-64 architecture.
19981
19982 -mbig-endian
19983 Generate code for a big-endian target. This is the default for HP-
19984 UX.
19985
19986 -mlittle-endian
19987 Generate code for a little-endian target. This is the default for
19988 AIX5 and GNU/Linux.
19989
19990 -mgnu-as
19991 -mno-gnu-as
19992 Generate (or don't) code for the GNU assembler. This is the
19993 default.
19994
19995 -mgnu-ld
19996 -mno-gnu-ld
19997 Generate (or don't) code for the GNU linker. This is the default.
19998
19999 -mno-pic
20000 Generate code that does not use a global pointer register. The
20001 result is not position independent code, and violates the IA-64
20002 ABI.
20003
20004 -mvolatile-asm-stop
20005 -mno-volatile-asm-stop
20006 Generate (or don't) a stop bit immediately before and after
20007 volatile asm statements.
20008
20009 -mregister-names
20010 -mno-register-names
20011 Generate (or don't) in, loc, and out register names for the stacked
20012 registers. This may make assembler output more readable.
20013
20014 -mno-sdata
20015 -msdata
20016 Disable (or enable) optimizations that use the small data section.
20017 This may be useful for working around optimizer bugs.
20018
20019 -mconstant-gp
20020 Generate code that uses a single constant global pointer value.
20021 This is useful when compiling kernel code.
20022
20023 -mauto-pic
20024 Generate code that is self-relocatable. This implies
20025 -mconstant-gp. This is useful when compiling firmware code.
20026
20027 -minline-float-divide-min-latency
20028 Generate code for inline divides of floating-point values using the
20029 minimum latency algorithm.
20030
20031 -minline-float-divide-max-throughput
20032 Generate code for inline divides of floating-point values using the
20033 maximum throughput algorithm.
20034
20035 -mno-inline-float-divide
20036 Do not generate inline code for divides of floating-point values.
20037
20038 -minline-int-divide-min-latency
20039 Generate code for inline divides of integer values using the
20040 minimum latency algorithm.
20041
20042 -minline-int-divide-max-throughput
20043 Generate code for inline divides of integer values using the
20044 maximum throughput algorithm.
20045
20046 -mno-inline-int-divide
20047 Do not generate inline code for divides of integer values.
20048
20049 -minline-sqrt-min-latency
20050 Generate code for inline square roots using the minimum latency
20051 algorithm.
20052
20053 -minline-sqrt-max-throughput
20054 Generate code for inline square roots using the maximum throughput
20055 algorithm.
20056
20057 -mno-inline-sqrt
20058 Do not generate inline code for "sqrt".
20059
20060 -mfused-madd
20061 -mno-fused-madd
20062 Do (don't) generate code that uses the fused multiply/add or
20063 multiply/subtract instructions. The default is to use these
20064 instructions.
20065
20066 -mno-dwarf2-asm
20067 -mdwarf2-asm
20068 Don't (or do) generate assembler code for the DWARF line number
20069 debugging info. This may be useful when not using the GNU
20070 assembler.
20071
20072 -mearly-stop-bits
20073 -mno-early-stop-bits
20074 Allow stop bits to be placed earlier than immediately preceding the
20075 instruction that triggered the stop bit. This can improve
20076 instruction scheduling, but does not always do so.
20077
20078 -mfixed-range=register-range
20079 Generate code treating the given register range as fixed registers.
20080 A fixed register is one that the register allocator cannot use.
20081 This is useful when compiling kernel code. A register range is
20082 specified as two registers separated by a dash. Multiple register
20083 ranges can be specified separated by a comma.
20084
20085 -mtls-size=tls-size
20086 Specify bit size of immediate TLS offsets. Valid values are 14,
20087 22, and 64.
20088
20089 -mtune=cpu-type
20090 Tune the instruction scheduling for a particular CPU, Valid values
20091 are itanium, itanium1, merced, itanium2, and mckinley.
20092
20093 -milp32
20094 -mlp64
20095 Generate code for a 32-bit or 64-bit environment. The 32-bit
20096 environment sets int, long and pointer to 32 bits. The 64-bit
20097 environment sets int to 32 bits and long and pointer to 64 bits.
20098 These are HP-UX specific flags.
20099
20100 -mno-sched-br-data-spec
20101 -msched-br-data-spec
20102 (Dis/En)able data speculative scheduling before reload. This
20103 results in generation of "ld.a" instructions and the corresponding
20104 check instructions ("ld.c" / "chk.a"). The default setting is
20105 disabled.
20106
20107 -msched-ar-data-spec
20108 -mno-sched-ar-data-spec
20109 (En/Dis)able data speculative scheduling after reload. This
20110 results in generation of "ld.a" instructions and the corresponding
20111 check instructions ("ld.c" / "chk.a"). The default setting is
20112 enabled.
20113
20114 -mno-sched-control-spec
20115 -msched-control-spec
20116 (Dis/En)able control speculative scheduling. This feature is
20117 available only during region scheduling (i.e. before reload). This
20118 results in generation of the "ld.s" instructions and the
20119 corresponding check instructions "chk.s". The default setting is
20120 disabled.
20121
20122 -msched-br-in-data-spec
20123 -mno-sched-br-in-data-spec
20124 (En/Dis)able speculative scheduling of the instructions that are
20125 dependent on the data speculative loads before reload. This is
20126 effective only with -msched-br-data-spec enabled. The default
20127 setting is enabled.
20128
20129 -msched-ar-in-data-spec
20130 -mno-sched-ar-in-data-spec
20131 (En/Dis)able speculative scheduling of the instructions that are
20132 dependent on the data speculative loads after reload. This is
20133 effective only with -msched-ar-data-spec enabled. The default
20134 setting is enabled.
20135
20136 -msched-in-control-spec
20137 -mno-sched-in-control-spec
20138 (En/Dis)able speculative scheduling of the instructions that are
20139 dependent on the control speculative loads. This is effective only
20140 with -msched-control-spec enabled. The default setting is enabled.
20141
20142 -mno-sched-prefer-non-data-spec-insns
20143 -msched-prefer-non-data-spec-insns
20144 If enabled, data-speculative instructions are chosen for schedule
20145 only if there are no other choices at the moment. This makes the
20146 use of the data speculation much more conservative. The default
20147 setting is disabled.
20148
20149 -mno-sched-prefer-non-control-spec-insns
20150 -msched-prefer-non-control-spec-insns
20151 If enabled, control-speculative instructions are chosen for
20152 schedule only if there are no other choices at the moment. This
20153 makes the use of the control speculation much more conservative.
20154 The default setting is disabled.
20155
20156 -mno-sched-count-spec-in-critical-path
20157 -msched-count-spec-in-critical-path
20158 If enabled, speculative dependencies are considered during
20159 computation of the instructions priorities. This makes the use of
20160 the speculation a bit more conservative. The default setting is
20161 disabled.
20162
20163 -msched-spec-ldc
20164 Use a simple data speculation check. This option is on by default.
20165
20166 -msched-control-spec-ldc
20167 Use a simple check for control speculation. This option is on by
20168 default.
20169
20170 -msched-stop-bits-after-every-cycle
20171 Place a stop bit after every cycle when scheduling. This option is
20172 on by default.
20173
20174 -msched-fp-mem-deps-zero-cost
20175 Assume that floating-point stores and loads are not likely to cause
20176 a conflict when placed into the same instruction group. This
20177 option is disabled by default.
20178
20179 -msel-sched-dont-check-control-spec
20180 Generate checks for control speculation in selective scheduling.
20181 This flag is disabled by default.
20182
20183 -msched-max-memory-insns=max-insns
20184 Limit on the number of memory insns per instruction group, giving
20185 lower priority to subsequent memory insns attempting to schedule in
20186 the same instruction group. Frequently useful to prevent cache bank
20187 conflicts. The default value is 1.
20188
20189 -msched-max-memory-insns-hard-limit
20190 Makes the limit specified by msched-max-memory-insns a hard limit,
20191 disallowing more than that number in an instruction group.
20192 Otherwise, the limit is "soft", meaning that non-memory operations
20193 are preferred when the limit is reached, but memory operations may
20194 still be scheduled.
20195
20196 LM32 Options
20197
20198 These -m options are defined for the LatticeMico32 architecture:
20199
20200 -mbarrel-shift-enabled
20201 Enable barrel-shift instructions.
20202
20203 -mdivide-enabled
20204 Enable divide and modulus instructions.
20205
20206 -mmultiply-enabled
20207 Enable multiply instructions.
20208
20209 -msign-extend-enabled
20210 Enable sign extend instructions.
20211
20212 -muser-enabled
20213 Enable user-defined instructions.
20214
20215 M32C Options
20216
20217 -mcpu=name
20218 Select the CPU for which code is generated. name may be one of r8c
20219 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
20220 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
20221
20222 -msim
20223 Specifies that the program will be run on the simulator. This
20224 causes an alternate runtime library to be linked in which supports,
20225 for example, file I/O. You must not use this option when
20226 generating programs that will run on real hardware; you must
20227 provide your own runtime library for whatever I/O functions are
20228 needed.
20229
20230 -memregs=number
20231 Specifies the number of memory-based pseudo-registers GCC uses
20232 during code generation. These pseudo-registers are used like real
20233 registers, so there is a tradeoff between GCC's ability to fit the
20234 code into available registers, and the performance penalty of using
20235 memory instead of registers. Note that all modules in a program
20236 must be compiled with the same value for this option. Because of
20237 that, you must not use this option with GCC's default runtime
20238 libraries.
20239
20240 M32R/D Options
20241
20242 These -m options are defined for Renesas M32R/D architectures:
20243
20244 -m32r2
20245 Generate code for the M32R/2.
20246
20247 -m32rx
20248 Generate code for the M32R/X.
20249
20250 -m32r
20251 Generate code for the M32R. This is the default.
20252
20253 -mmodel=small
20254 Assume all objects live in the lower 16MB of memory (so that their
20255 addresses can be loaded with the "ld24" instruction), and assume
20256 all subroutines are reachable with the "bl" instruction. This is
20257 the default.
20258
20259 The addressability of a particular object can be set with the
20260 "model" attribute.
20261
20262 -mmodel=medium
20263 Assume objects may be anywhere in the 32-bit address space (the
20264 compiler generates "seth/add3" instructions to load their
20265 addresses), and assume all subroutines are reachable with the "bl"
20266 instruction.
20267
20268 -mmodel=large
20269 Assume objects may be anywhere in the 32-bit address space (the
20270 compiler generates "seth/add3" instructions to load their
20271 addresses), and assume subroutines may not be reachable with the
20272 "bl" instruction (the compiler generates the much slower
20273 "seth/add3/jl" instruction sequence).
20274
20275 -msdata=none
20276 Disable use of the small data area. Variables are put into one of
20277 ".data", ".bss", or ".rodata" (unless the "section" attribute has
20278 been specified). This is the default.
20279
20280 The small data area consists of sections ".sdata" and ".sbss".
20281 Objects may be explicitly put in the small data area with the
20282 "section" attribute using one of these sections.
20283
20284 -msdata=sdata
20285 Put small global and static data in the small data area, but do not
20286 generate special code to reference them.
20287
20288 -msdata=use
20289 Put small global and static data in the small data area, and
20290 generate special instructions to reference them.
20291
20292 -G num
20293 Put global and static objects less than or equal to num bytes into
20294 the small data or BSS sections instead of the normal data or BSS
20295 sections. The default value of num is 8. The -msdata option must
20296 be set to one of sdata or use for this option to have any effect.
20297
20298 All modules should be compiled with the same -G num value.
20299 Compiling with different values of num may or may not work; if it
20300 doesn't the linker gives an error message---incorrect code is not
20301 generated.
20302
20303 -mdebug
20304 Makes the M32R-specific code in the compiler display some
20305 statistics that might help in debugging programs.
20306
20307 -malign-loops
20308 Align all loops to a 32-byte boundary.
20309
20310 -mno-align-loops
20311 Do not enforce a 32-byte alignment for loops. This is the default.
20312
20313 -missue-rate=number
20314 Issue number instructions per cycle. number can only be 1 or 2.
20315
20316 -mbranch-cost=number
20317 number can only be 1 or 2. If it is 1 then branches are preferred
20318 over conditional code, if it is 2, then the opposite applies.
20319
20320 -mflush-trap=number
20321 Specifies the trap number to use to flush the cache. The default
20322 is 12. Valid numbers are between 0 and 15 inclusive.
20323
20324 -mno-flush-trap
20325 Specifies that the cache cannot be flushed by using a trap.
20326
20327 -mflush-func=name
20328 Specifies the name of the operating system function to call to
20329 flush the cache. The default is _flush_cache, but a function call
20330 is only used if a trap is not available.
20331
20332 -mno-flush-func
20333 Indicates that there is no OS function for flushing the cache.
20334
20335 M680x0 Options
20336
20337 These are the -m options defined for M680x0 and ColdFire processors.
20338 The default settings depend on which architecture was selected when the
20339 compiler was configured; the defaults for the most common choices are
20340 given below.
20341
20342 -march=arch
20343 Generate code for a specific M680x0 or ColdFire instruction set
20344 architecture. Permissible values of arch for M680x0 architectures
20345 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
20346 architectures are selected according to Freescale's ISA
20347 classification and the permissible values are: isaa, isaaplus, isab
20348 and isac.
20349
20350 GCC defines a macro "__mcfarch__" whenever it is generating code
20351 for a ColdFire target. The arch in this macro is one of the -march
20352 arguments given above.
20353
20354 When used together, -march and -mtune select code that runs on a
20355 family of similar processors but that is optimized for a particular
20356 microarchitecture.
20357
20358 -mcpu=cpu
20359 Generate code for a specific M680x0 or ColdFire processor. The
20360 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
20361 68332 and cpu32. The ColdFire cpus are given by the table below,
20362 which also classifies the CPUs into families:
20363
20364 Family : -mcpu arguments
20365 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
20366 5206 : 5202 5204 5206
20367 5206e : 5206e
20368 5208 : 5207 5208
20369 5211a : 5210a 5211a
20370 5213 : 5211 5212 5213
20371 5216 : 5214 5216
20372 52235 : 52230 52231 52232 52233 52234 52235
20373 5225 : 5224 5225
20374 52259 : 52252 52254 52255 52256 52258 52259
20375 5235 : 5232 5233 5234 5235 523x
20376 5249 : 5249
20377 5250 : 5250
20378 5271 : 5270 5271
20379 5272 : 5272
20380 5275 : 5274 5275
20381 5282 : 5280 5281 5282 528x
20382 53017 : 53011 53012 53013 53014 53015 53016 53017
20383 5307 : 5307
20384 5329 : 5327 5328 5329 532x
20385 5373 : 5372 5373 537x
20386 5407 : 5407
20387 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
20388 5485
20389
20390 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
20391 Other combinations of -mcpu and -march are rejected.
20392
20393 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
20394 selected. It also defines "__mcf_family_family", where the value
20395 of family is given by the table above.
20396
20397 -mtune=tune
20398 Tune the code for a particular microarchitecture within the
20399 constraints set by -march and -mcpu. The M680x0 microarchitectures
20400 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
20401 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
20402
20403 You can also use -mtune=68020-40 for code that needs to run
20404 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
20405 is similar but includes 68060 targets as well. These two options
20406 select the same tuning decisions as -m68020-40 and -m68020-60
20407 respectively.
20408
20409 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
20410 680x0 architecture arch. It also defines "mcarch" unless either
20411 -ansi or a non-GNU -std option is used. If GCC is tuning for a
20412 range of architectures, as selected by -mtune=68020-40 or
20413 -mtune=68020-60, it defines the macros for every architecture in
20414 the range.
20415
20416 GCC also defines the macro "__muarch__" when tuning for ColdFire
20417 microarchitecture uarch, where uarch is one of the arguments given
20418 above.
20419
20420 -m68000
20421 -mc68000
20422 Generate output for a 68000. This is the default when the compiler
20423 is configured for 68000-based systems. It is equivalent to
20424 -march=68000.
20425
20426 Use this option for microcontrollers with a 68000 or EC000 core,
20427 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20428
20429 -m68010
20430 Generate output for a 68010. This is the default when the compiler
20431 is configured for 68010-based systems. It is equivalent to
20432 -march=68010.
20433
20434 -m68020
20435 -mc68020
20436 Generate output for a 68020. This is the default when the compiler
20437 is configured for 68020-based systems. It is equivalent to
20438 -march=68020.
20439
20440 -m68030
20441 Generate output for a 68030. This is the default when the compiler
20442 is configured for 68030-based systems. It is equivalent to
20443 -march=68030.
20444
20445 -m68040
20446 Generate output for a 68040. This is the default when the compiler
20447 is configured for 68040-based systems. It is equivalent to
20448 -march=68040.
20449
20450 This option inhibits the use of 68881/68882 instructions that have
20451 to be emulated by software on the 68040. Use this option if your
20452 68040 does not have code to emulate those instructions.
20453
20454 -m68060
20455 Generate output for a 68060. This is the default when the compiler
20456 is configured for 68060-based systems. It is equivalent to
20457 -march=68060.
20458
20459 This option inhibits the use of 68020 and 68881/68882 instructions
20460 that have to be emulated by software on the 68060. Use this option
20461 if your 68060 does not have code to emulate those instructions.
20462
20463 -mcpu32
20464 Generate output for a CPU32. This is the default when the compiler
20465 is configured for CPU32-based systems. It is equivalent to
20466 -march=cpu32.
20467
20468 Use this option for microcontrollers with a CPU32 or CPU32+ core,
20469 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
20470 68341, 68349 and 68360.
20471
20472 -m5200
20473 Generate output for a 520X ColdFire CPU. This is the default when
20474 the compiler is configured for 520X-based systems. It is
20475 equivalent to -mcpu=5206, and is now deprecated in favor of that
20476 option.
20477
20478 Use this option for microcontroller with a 5200 core, including the
20479 MCF5202, MCF5203, MCF5204 and MCF5206.
20480
20481 -m5206e
20482 Generate output for a 5206e ColdFire CPU. The option is now
20483 deprecated in favor of the equivalent -mcpu=5206e.
20484
20485 -m528x
20486 Generate output for a member of the ColdFire 528X family. The
20487 option is now deprecated in favor of the equivalent -mcpu=528x.
20488
20489 -m5307
20490 Generate output for a ColdFire 5307 CPU. The option is now
20491 deprecated in favor of the equivalent -mcpu=5307.
20492
20493 -m5407
20494 Generate output for a ColdFire 5407 CPU. The option is now
20495 deprecated in favor of the equivalent -mcpu=5407.
20496
20497 -mcfv4e
20498 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
20499 This includes use of hardware floating-point instructions. The
20500 option is equivalent to -mcpu=547x, and is now deprecated in favor
20501 of that option.
20502
20503 -m68020-40
20504 Generate output for a 68040, without using any of the new
20505 instructions. This results in code that can run relatively
20506 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20507 generated code does use the 68881 instructions that are emulated on
20508 the 68040.
20509
20510 The option is equivalent to -march=68020 -mtune=68020-40.
20511
20512 -m68020-60
20513 Generate output for a 68060, without using any of the new
20514 instructions. This results in code that can run relatively
20515 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20516 generated code does use the 68881 instructions that are emulated on
20517 the 68060.
20518
20519 The option is equivalent to -march=68020 -mtune=68020-60.
20520
20521 -mhard-float
20522 -m68881
20523 Generate floating-point instructions. This is the default for
20524 68020 and above, and for ColdFire devices that have an FPU. It
20525 defines the macro "__HAVE_68881__" on M680x0 targets and
20526 "__mcffpu__" on ColdFire targets.
20527
20528 -msoft-float
20529 Do not generate floating-point instructions; use library calls
20530 instead. This is the default for 68000, 68010, and 68832 targets.
20531 It is also the default for ColdFire devices that have no FPU.
20532
20533 -mdiv
20534 -mno-div
20535 Generate (do not generate) ColdFire hardware divide and remainder
20536 instructions. If -march is used without -mcpu, the default is "on"
20537 for ColdFire architectures and "off" for M680x0 architectures.
20538 Otherwise, the default is taken from the target CPU (either the
20539 default CPU, or the one specified by -mcpu). For example, the
20540 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
20541
20542 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
20543
20544 -mshort
20545 Consider type "int" to be 16 bits wide, like "short int".
20546 Additionally, parameters passed on the stack are also aligned to a
20547 16-bit boundary even on targets whose API mandates promotion to
20548 32-bit.
20549
20550 -mno-short
20551 Do not consider type "int" to be 16 bits wide. This is the
20552 default.
20553
20554 -mnobitfield
20555 -mno-bitfield
20556 Do not use the bit-field instructions. The -m68000, -mcpu32 and
20557 -m5200 options imply -mnobitfield.
20558
20559 -mbitfield
20560 Do use the bit-field instructions. The -m68020 option implies
20561 -mbitfield. This is the default if you use a configuration
20562 designed for a 68020.
20563
20564 -mrtd
20565 Use a different function-calling convention, in which functions
20566 that take a fixed number of arguments return with the "rtd"
20567 instruction, which pops their arguments while returning. This
20568 saves one instruction in the caller since there is no need to pop
20569 the arguments there.
20570
20571 This calling convention is incompatible with the one normally used
20572 on Unix, so you cannot use it if you need to call libraries
20573 compiled with the Unix compiler.
20574
20575 Also, you must provide function prototypes for all functions that
20576 take variable numbers of arguments (including "printf"); otherwise
20577 incorrect code is generated for calls to those functions.
20578
20579 In addition, seriously incorrect code results if you call a
20580 function with too many arguments. (Normally, extra arguments are
20581 harmlessly ignored.)
20582
20583 The "rtd" instruction is supported by the 68010, 68020, 68030,
20584 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20585
20586 The default is -mno-rtd.
20587
20588 -malign-int
20589 -mno-align-int
20590 Control whether GCC aligns "int", "long", "long long", "float",
20591 "double", and "long double" variables on a 32-bit boundary
20592 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
20593 variables on 32-bit boundaries produces code that runs somewhat
20594 faster on processors with 32-bit busses at the expense of more
20595 memory.
20596
20597 Warning: if you use the -malign-int switch, GCC aligns structures
20598 containing the above types differently than most published
20599 application binary interface specifications for the m68k.
20600
20601 Use the pc-relative addressing mode of the 68000 directly, instead
20602 of using a global offset table. At present, this option implies
20603 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
20604 -fPIC is not presently supported with -mpcrel, though this could be
20605 supported for 68020 and higher processors.
20606
20607 -mno-strict-align
20608 -mstrict-align
20609 Do not (do) assume that unaligned memory references are handled by
20610 the system.
20611
20612 -msep-data
20613 Generate code that allows the data segment to be located in a
20614 different area of memory from the text segment. This allows for
20615 execute-in-place in an environment without virtual memory
20616 management. This option implies -fPIC.
20617
20618 -mno-sep-data
20619 Generate code that assumes that the data segment follows the text
20620 segment. This is the default.
20621
20622 -mid-shared-library
20623 Generate code that supports shared libraries via the library ID
20624 method. This allows for execute-in-place and shared libraries in
20625 an environment without virtual memory management. This option
20626 implies -fPIC.
20627
20628 -mno-id-shared-library
20629 Generate code that doesn't assume ID-based shared libraries are
20630 being used. This is the default.
20631
20632 -mshared-library-id=n
20633 Specifies the identification number of the ID-based shared library
20634 being compiled. Specifying a value of 0 generates more compact
20635 code; specifying other values forces the allocation of that number
20636 to the current library, but is no more space- or time-efficient
20637 than omitting this option.
20638
20639 -mxgot
20640 -mno-xgot
20641 When generating position-independent code for ColdFire, generate
20642 code that works if the GOT has more than 8192 entries. This code
20643 is larger and slower than code generated without this option. On
20644 M680x0 processors, this option is not needed; -fPIC suffices.
20645
20646 GCC normally uses a single instruction to load values from the GOT.
20647 While this is relatively efficient, it only works if the GOT is
20648 smaller than about 64k. Anything larger causes the linker to
20649 report an error such as:
20650
20651 relocation truncated to fit: R_68K_GOT16O foobar
20652
20653 If this happens, you should recompile your code with -mxgot. It
20654 should then work with very large GOTs. However, code generated
20655 with -mxgot is less efficient, since it takes 4 instructions to
20656 fetch the value of a global symbol.
20657
20658 Note that some linkers, including newer versions of the GNU linker,
20659 can create multiple GOTs and sort GOT entries. If you have such a
20660 linker, you should only need to use -mxgot when compiling a single
20661 object file that accesses more than 8192 GOT entries. Very few do.
20662
20663 These options have no effect unless GCC is generating position-
20664 independent code.
20665
20666 -mlong-jump-table-offsets
20667 Use 32-bit offsets in "switch" tables. The default is to use
20668 16-bit offsets.
20669
20670 MCore Options
20671
20672 These are the -m options defined for the Motorola M*Core processors.
20673
20674 -mhardlit
20675 -mno-hardlit
20676 Inline constants into the code stream if it can be done in two
20677 instructions or less.
20678
20679 -mdiv
20680 -mno-div
20681 Use the divide instruction. (Enabled by default).
20682
20683 -mrelax-immediate
20684 -mno-relax-immediate
20685 Allow arbitrary-sized immediates in bit operations.
20686
20687 -mwide-bitfields
20688 -mno-wide-bitfields
20689 Always treat bit-fields as "int"-sized.
20690
20691 -m4byte-functions
20692 -mno-4byte-functions
20693 Force all functions to be aligned to a 4-byte boundary.
20694
20695 -mcallgraph-data
20696 -mno-callgraph-data
20697 Emit callgraph information.
20698
20699 -mslow-bytes
20700 -mno-slow-bytes
20701 Prefer word access when reading byte quantities.
20702
20703 -mlittle-endian
20704 -mbig-endian
20705 Generate code for a little-endian target.
20706
20707 -m210
20708 -m340
20709 Generate code for the 210 processor.
20710
20711 -mno-lsim
20712 Assume that runtime support has been provided and so omit the
20713 simulator library (libsim.a) from the linker command line.
20714
20715 -mstack-increment=size
20716 Set the maximum amount for a single stack increment operation.
20717 Large values can increase the speed of programs that contain
20718 functions that need a large amount of stack space, but they can
20719 also trigger a segmentation fault if the stack is extended too
20720 much. The default value is 0x1000.
20721
20722 MeP Options
20723
20724 -mabsdiff
20725 Enables the "abs" instruction, which is the absolute difference
20726 between two registers.
20727
20728 -mall-opts
20729 Enables all the optional instructions---average, multiply, divide,
20730 bit operations, leading zero, absolute difference, min/max, clip,
20731 and saturation.
20732
20733 -maverage
20734 Enables the "ave" instruction, which computes the average of two
20735 registers.
20736
20737 -mbased=n
20738 Variables of size n bytes or smaller are placed in the ".based"
20739 section by default. Based variables use the $tp register as a base
20740 register, and there is a 128-byte limit to the ".based" section.
20741
20742 -mbitops
20743 Enables the bit operation instructions---bit test ("btstm"), set
20744 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
20745 ("tas").
20746
20747 -mc=name
20748 Selects which section constant data is placed in. name may be
20749 tiny, near, or far.
20750
20751 -mclip
20752 Enables the "clip" instruction. Note that -mclip is not useful
20753 unless you also provide -mminmax.
20754
20755 -mconfig=name
20756 Selects one of the built-in core configurations. Each MeP chip has
20757 one or more modules in it; each module has a core CPU and a variety
20758 of coprocessors, optional instructions, and peripherals. The
20759 "MeP-Integrator" tool, not part of GCC, provides these
20760 configurations through this option; using this option is the same
20761 as using all the corresponding command-line options. The default
20762 configuration is default.
20763
20764 -mcop
20765 Enables the coprocessor instructions. By default, this is a 32-bit
20766 coprocessor. Note that the coprocessor is normally enabled via the
20767 -mconfig= option.
20768
20769 -mcop32
20770 Enables the 32-bit coprocessor's instructions.
20771
20772 -mcop64
20773 Enables the 64-bit coprocessor's instructions.
20774
20775 -mivc2
20776 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20777
20778 -mdc
20779 Causes constant variables to be placed in the ".near" section.
20780
20781 -mdiv
20782 Enables the "div" and "divu" instructions.
20783
20784 -meb
20785 Generate big-endian code.
20786
20787 -mel
20788 Generate little-endian code.
20789
20790 -mio-volatile
20791 Tells the compiler that any variable marked with the "io" attribute
20792 is to be considered volatile.
20793
20794 -ml Causes variables to be assigned to the ".far" section by default.
20795
20796 -mleadz
20797 Enables the "leadz" (leading zero) instruction.
20798
20799 -mm Causes variables to be assigned to the ".near" section by default.
20800
20801 -mminmax
20802 Enables the "min" and "max" instructions.
20803
20804 -mmult
20805 Enables the multiplication and multiply-accumulate instructions.
20806
20807 -mno-opts
20808 Disables all the optional instructions enabled by -mall-opts.
20809
20810 -mrepeat
20811 Enables the "repeat" and "erepeat" instructions, used for low-
20812 overhead looping.
20813
20814 -ms Causes all variables to default to the ".tiny" section. Note that
20815 there is a 65536-byte limit to this section. Accesses to these
20816 variables use the %gp base register.
20817
20818 -msatur
20819 Enables the saturation instructions. Note that the compiler does
20820 not currently generate these itself, but this option is included
20821 for compatibility with other tools, like "as".
20822
20823 -msdram
20824 Link the SDRAM-based runtime instead of the default ROM-based
20825 runtime.
20826
20827 -msim
20828 Link the simulator run-time libraries.
20829
20830 -msimnovec
20831 Link the simulator runtime libraries, excluding built-in support
20832 for reset and exception vectors and tables.
20833
20834 -mtf
20835 Causes all functions to default to the ".far" section. Without
20836 this option, functions default to the ".near" section.
20837
20838 -mtiny=n
20839 Variables that are n bytes or smaller are allocated to the ".tiny"
20840 section. These variables use the $gp base register. The default
20841 for this option is 4, but note that there's a 65536-byte limit to
20842 the ".tiny" section.
20843
20844 MicroBlaze Options
20845
20846 -msoft-float
20847 Use software emulation for floating point (default).
20848
20849 -mhard-float
20850 Use hardware floating-point instructions.
20851
20852 -mmemcpy
20853 Do not optimize block moves, use "memcpy".
20854
20855 -mno-clearbss
20856 This option is deprecated. Use -fno-zero-initialized-in-bss
20857 instead.
20858
20859 -mcpu=cpu-type
20860 Use features of, and schedule code for, the given CPU. Supported
20861 values are in the format vX.YY.Z, where X is a major version, YY is
20862 the minor version, and Z is compatibility code. Example values are
20863 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
20864
20865 -mxl-soft-mul
20866 Use software multiply emulation (default).
20867
20868 -mxl-soft-div
20869 Use software emulation for divides (default).
20870
20871 -mxl-barrel-shift
20872 Use the hardware barrel shifter.
20873
20874 -mxl-pattern-compare
20875 Use pattern compare instructions.
20876
20877 -msmall-divides
20878 Use table lookup optimization for small signed integer divisions.
20879
20880 -mxl-stack-check
20881 This option is deprecated. Use -fstack-check instead.
20882
20883 -mxl-gp-opt
20884 Use GP-relative ".sdata"/".sbss" sections.
20885
20886 -mxl-multiply-high
20887 Use multiply high instructions for high part of 32x32 multiply.
20888
20889 -mxl-float-convert
20890 Use hardware floating-point conversion instructions.
20891
20892 -mxl-float-sqrt
20893 Use hardware floating-point square root instruction.
20894
20895 -mbig-endian
20896 Generate code for a big-endian target.
20897
20898 -mlittle-endian
20899 Generate code for a little-endian target.
20900
20901 -mxl-reorder
20902 Use reorder instructions (swap and byte reversed load/store).
20903
20904 -mxl-mode-app-model
20905 Select application model app-model. Valid models are
20906
20907 executable
20908 normal executable (default), uses startup code crt0.o.
20909
20910 -mpic-data-is-text-relative
20911 Assume that the displacement between the text and data segments
20912 is fixed at static link time. This allows data to be
20913 referenced by offset from start of text address instead of GOT
20914 since PC-relative addressing is not supported.
20915
20916 xmdstub
20917 for use with Xilinx Microprocessor Debugger (XMD) based
20918 software intrusive debug agent called xmdstub. This uses
20919 startup file crt1.o and sets the start address of the program
20920 to 0x800.
20921
20922 bootstrap
20923 for applications that are loaded using a bootloader. This
20924 model uses startup file crt2.o which does not contain a
20925 processor reset vector handler. This is suitable for
20926 transferring control on a processor reset to the bootloader
20927 rather than the application.
20928
20929 novectors
20930 for applications that do not require any of the MicroBlaze
20931 vectors. This option may be useful for applications running
20932 within a monitoring application. This model uses crt3.o as a
20933 startup file.
20934
20935 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
20936 model.
20937
20938 MIPS Options
20939
20940 -EB Generate big-endian code.
20941
20942 -EL Generate little-endian code. This is the default for mips*el-*-*
20943 configurations.
20944
20945 -march=arch
20946 Generate code that runs on arch, which can be the name of a generic
20947 MIPS ISA, or the name of a particular processor. The ISA names
20948 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
20949 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
20950 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
20951 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
20952 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
20953 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
20954 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
20955 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
20956 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
20957 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
20958 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
20959 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
20960 and xlp. The special value from-abi selects the most compatible
20961 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
20962 and mips3 for 64-bit ABIs).
20963
20964 The native Linux/GNU toolchain also supports the value native,
20965 which selects the best architecture option for the host processor.
20966 -march=native has no effect if GCC does not recognize the
20967 processor.
20968
20969 In processor names, a final 000 can be abbreviated as k (for
20970 example, -march=r2k). Prefixes are optional, and vr may be written
20971 r.
20972
20973 Names of the form nf2_1 refer to processors with FPUs clocked at
20974 half the rate of the core, names of the form nf1_1 refer to
20975 processors with FPUs clocked at the same rate as the core, and
20976 names of the form nf3_2 refer to processors with FPUs clocked a
20977 ratio of 3:2 with respect to the core. For compatibility reasons,
20978 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
20979 as synonyms for nf1_1.
20980
20981 GCC defines two macros based on the value of this option. The
20982 first is "_MIPS_ARCH", which gives the name of target architecture,
20983 as a string. The second has the form "_MIPS_ARCH_foo", where foo
20984 is the capitalized value of "_MIPS_ARCH". For example,
20985 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
20986 "_MIPS_ARCH_R2000".
20987
20988 Note that the "_MIPS_ARCH" macro uses the processor names given
20989 above. In other words, it has the full prefix and does not
20990 abbreviate 000 as k. In the case of from-abi, the macro names the
20991 resolved architecture (either "mips1" or "mips3"). It names the
20992 default architecture when no -march option is given.
20993
20994 -mtune=arch
20995 Optimize for arch. Among other things, this option controls the
20996 way instructions are scheduled, and the perceived cost of
20997 arithmetic operations. The list of arch values is the same as for
20998 -march.
20999
21000 When this option is not used, GCC optimizes for the processor
21001 specified by -march. By using -march and -mtune together, it is
21002 possible to generate code that runs on a family of processors, but
21003 optimize the code for one particular member of that family.
21004
21005 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
21006 work in the same way as the -march ones described above.
21007
21008 -mips1
21009 Equivalent to -march=mips1.
21010
21011 -mips2
21012 Equivalent to -march=mips2.
21013
21014 -mips3
21015 Equivalent to -march=mips3.
21016
21017 -mips4
21018 Equivalent to -march=mips4.
21019
21020 -mips32
21021 Equivalent to -march=mips32.
21022
21023 -mips32r3
21024 Equivalent to -march=mips32r3.
21025
21026 -mips32r5
21027 Equivalent to -march=mips32r5.
21028
21029 -mips32r6
21030 Equivalent to -march=mips32r6.
21031
21032 -mips64
21033 Equivalent to -march=mips64.
21034
21035 -mips64r2
21036 Equivalent to -march=mips64r2.
21037
21038 -mips64r3
21039 Equivalent to -march=mips64r3.
21040
21041 -mips64r5
21042 Equivalent to -march=mips64r5.
21043
21044 -mips64r6
21045 Equivalent to -march=mips64r6.
21046
21047 -mips16
21048 -mno-mips16
21049 Generate (do not generate) MIPS16 code. If GCC is targeting a
21050 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
21051
21052 MIPS16 code generation can also be controlled on a per-function
21053 basis by means of "mips16" and "nomips16" attributes.
21054
21055 -mflip-mips16
21056 Generate MIPS16 code on alternating functions. This option is
21057 provided for regression testing of mixed MIPS16/non-MIPS16 code
21058 generation, and is not intended for ordinary use in compiling user
21059 code.
21060
21061 -minterlink-compressed
21062 -mno-interlink-compressed
21063 Require (do not require) that code using the standard
21064 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
21065 microMIPS code, and vice versa.
21066
21067 For example, code using the standard ISA encoding cannot jump
21068 directly to MIPS16 or microMIPS code; it must either use a call or
21069 an indirect jump. -minterlink-compressed therefore disables direct
21070 jumps unless GCC knows that the target of the jump is not
21071 compressed.
21072
21073 -minterlink-mips16
21074 -mno-interlink-mips16
21075 Aliases of -minterlink-compressed and -mno-interlink-compressed.
21076 These options predate the microMIPS ASE and are retained for
21077 backwards compatibility.
21078
21079 -mabi=32
21080 -mabi=o64
21081 -mabi=n32
21082 -mabi=64
21083 -mabi=eabi
21084 Generate code for the given ABI.
21085
21086 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21087 generates 64-bit code when you select a 64-bit architecture, but
21088 you can use -mgp32 to get 32-bit code instead.
21089
21090 For information about the O64 ABI, see
21091 <http://gcc.gnu.org/projects/mipso64-abi.html>.
21092
21093 GCC supports a variant of the o32 ABI in which floating-point
21094 registers are 64 rather than 32 bits wide. You can select this
21095 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
21096 and "mfhc1" instructions and is therefore only supported for
21097 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21098
21099 The register assignments for arguments and return values remain the
21100 same, but each scalar value is passed in a single 64-bit register
21101 rather than a pair of 32-bit registers. For example, scalar
21102 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
21103 The set of call-saved registers also remains the same in that the
21104 even-numbered double-precision registers are saved.
21105
21106 Two additional variants of the o32 ABI are supported to enable a
21107 transition from 32-bit to 64-bit registers. These are FPXX
21108 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
21109 mandates that all code must execute correctly when run using 32-bit
21110 or 64-bit registers. The code can be interlinked with either FP32
21111 or FP64, but not both. The FP64A extension is similar to the FP64
21112 extension but forbids the use of odd-numbered single-precision
21113 registers. This can be used in conjunction with the "FRE" mode of
21114 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
21115 interlink and run in the same process without changing FPU modes.
21116
21117 -mabicalls
21118 -mno-abicalls
21119 Generate (do not generate) code that is suitable for SVR4-style
21120 dynamic objects. -mabicalls is the default for SVR4-based systems.
21121
21122 -mshared
21123 -mno-shared
21124 Generate (do not generate) code that is fully position-independent,
21125 and that can therefore be linked into shared libraries. This
21126 option only affects -mabicalls.
21127
21128 All -mabicalls code has traditionally been position-independent,
21129 regardless of options like -fPIC and -fpic. However, as an
21130 extension, the GNU toolchain allows executables to use absolute
21131 accesses for locally-binding symbols. It can also use shorter GP
21132 initialization sequences and generate direct calls to locally-
21133 defined functions. This mode is selected by -mno-shared.
21134
21135 -mno-shared depends on binutils 2.16 or higher and generates
21136 objects that can only be linked by the GNU linker. However, the
21137 option does not affect the ABI of the final executable; it only
21138 affects the ABI of relocatable objects. Using -mno-shared
21139 generally makes executables both smaller and quicker.
21140
21141 -mshared is the default.
21142
21143 -mplt
21144 -mno-plt
21145 Assume (do not assume) that the static and dynamic linkers support
21146 PLTs and copy relocations. This option only affects -mno-shared
21147 -mabicalls. For the n64 ABI, this option has no effect without
21148 -msym32.
21149
21150 You can make -mplt the default by configuring GCC with
21151 --with-mips-plt. The default is -mno-plt otherwise.
21152
21153 -mxgot
21154 -mno-xgot
21155 Lift (do not lift) the usual restrictions on the size of the global
21156 offset table.
21157
21158 GCC normally uses a single instruction to load values from the GOT.
21159 While this is relatively efficient, it only works if the GOT is
21160 smaller than about 64k. Anything larger causes the linker to
21161 report an error such as:
21162
21163 relocation truncated to fit: R_MIPS_GOT16 foobar
21164
21165 If this happens, you should recompile your code with -mxgot. This
21166 works with very large GOTs, although the code is also less
21167 efficient, since it takes three instructions to fetch the value of
21168 a global symbol.
21169
21170 Note that some linkers can create multiple GOTs. If you have such
21171 a linker, you should only need to use -mxgot when a single object
21172 file accesses more than 64k's worth of GOT entries. Very few do.
21173
21174 These options have no effect unless GCC is generating position
21175 independent code.
21176
21177 -mgp32
21178 Assume that general-purpose registers are 32 bits wide.
21179
21180 -mgp64
21181 Assume that general-purpose registers are 64 bits wide.
21182
21183 -mfp32
21184 Assume that floating-point registers are 32 bits wide.
21185
21186 -mfp64
21187 Assume that floating-point registers are 64 bits wide.
21188
21189 -mfpxx
21190 Do not assume the width of floating-point registers.
21191
21192 -mhard-float
21193 Use floating-point coprocessor instructions.
21194
21195 -msoft-float
21196 Do not use floating-point coprocessor instructions. Implement
21197 floating-point calculations using library calls instead.
21198
21199 -mno-float
21200 Equivalent to -msoft-float, but additionally asserts that the
21201 program being compiled does not perform any floating-point
21202 operations. This option is presently supported only by some bare-
21203 metal MIPS configurations, where it may select a special set of
21204 libraries that lack all floating-point support (including, for
21205 example, the floating-point "printf" formats). If code compiled
21206 with -mno-float accidentally contains floating-point operations, it
21207 is likely to suffer a link-time or run-time failure.
21208
21209 -msingle-float
21210 Assume that the floating-point coprocessor only supports single-
21211 precision operations.
21212
21213 -mdouble-float
21214 Assume that the floating-point coprocessor supports double-
21215 precision operations. This is the default.
21216
21217 -modd-spreg
21218 -mno-odd-spreg
21219 Enable the use of odd-numbered single-precision floating-point
21220 registers for the o32 ABI. This is the default for processors that
21221 are known to support these registers. When using the o32 FPXX ABI,
21222 -mno-odd-spreg is set by default.
21223
21224 -mabs=2008
21225 -mabs=legacy
21226 These options control the treatment of the special not-a-number
21227 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
21228 machine instructions.
21229
21230 By default or when -mabs=legacy is used the legacy treatment is
21231 selected. In this case these instructions are considered
21232 arithmetic and avoided where correct operation is required and the
21233 input operand might be a NaN. A longer sequence of instructions
21234 that manipulate the sign bit of floating-point datum manually is
21235 used instead unless the -ffinite-math-only option has also been
21236 specified.
21237
21238 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
21239 case these instructions are considered non-arithmetic and therefore
21240 operating correctly in all cases, including in particular where the
21241 input operand is a NaN. These instructions are therefore always
21242 used for the respective operations.
21243
21244 -mnan=2008
21245 -mnan=legacy
21246 These options control the encoding of the special not-a-number
21247 (NaN) IEEE 754 floating-point data.
21248
21249 The -mnan=legacy option selects the legacy encoding. In this case
21250 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21251 significand field being 0, whereas signaling NaNs (sNaNs) are
21252 denoted by the first bit of their trailing significand field being
21253 1.
21254
21255 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
21256 case qNaNs are denoted by the first bit of their trailing
21257 significand field being 1, whereas sNaNs are denoted by the first
21258 bit of their trailing significand field being 0.
21259
21260 The default is -mnan=legacy unless GCC has been configured with
21261 --with-nan=2008.
21262
21263 -mllsc
21264 -mno-llsc
21265 Use (do not use) ll, sc, and sync instructions to implement atomic
21266 memory built-in functions. When neither option is specified, GCC
21267 uses the instructions if the target architecture supports them.
21268
21269 -mllsc is useful if the runtime environment can emulate the
21270 instructions and -mno-llsc can be useful when compiling for
21271 nonstandard ISAs. You can make either option the default by
21272 configuring GCC with --with-llsc and --without-llsc respectively.
21273 --with-llsc is the default for some configurations; see the
21274 installation documentation for details.
21275
21276 -mdsp
21277 -mno-dsp
21278 Use (do not use) revision 1 of the MIPS DSP ASE.
21279 This option defines the preprocessor macro "__mips_dsp". It also
21280 defines "__mips_dsp_rev" to 1.
21281
21282 -mdspr2
21283 -mno-dspr2
21284 Use (do not use) revision 2 of the MIPS DSP ASE.
21285 This option defines the preprocessor macros "__mips_dsp" and
21286 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
21287
21288 -msmartmips
21289 -mno-smartmips
21290 Use (do not use) the MIPS SmartMIPS ASE.
21291
21292 -mpaired-single
21293 -mno-paired-single
21294 Use (do not use) paired-single floating-point instructions.
21295 This option requires hardware floating-point support to be
21296 enabled.
21297
21298 -mdmx
21299 -mno-mdmx
21300 Use (do not use) MIPS Digital Media Extension instructions. This
21301 option can only be used when generating 64-bit code and requires
21302 hardware floating-point support to be enabled.
21303
21304 -mips3d
21305 -mno-mips3d
21306 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
21307 -mpaired-single.
21308
21309 -mmicromips
21310 -mno-micromips
21311 Generate (do not generate) microMIPS code.
21312
21313 MicroMIPS code generation can also be controlled on a per-function
21314 basis by means of "micromips" and "nomicromips" attributes.
21315
21316 -mmt
21317 -mno-mt
21318 Use (do not use) MT Multithreading instructions.
21319
21320 -mmcu
21321 -mno-mcu
21322 Use (do not use) the MIPS MCU ASE instructions.
21323
21324 -meva
21325 -mno-eva
21326 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21327
21328 -mvirt
21329 -mno-virt
21330 Use (do not use) the MIPS Virtualization (VZ) instructions.
21331
21332 -mxpa
21333 -mno-xpa
21334 Use (do not use) the MIPS eXtended Physical Address (XPA)
21335 instructions.
21336
21337 -mcrc
21338 -mno-crc
21339 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
21340 instructions.
21341
21342 -mginv
21343 -mno-ginv
21344 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21345
21346 -mloongson-mmi
21347 -mno-loongson-mmi
21348 Use (do not use) the MIPS Loongson MultiMedia extensions
21349 Instructions (MMI).
21350
21351 -mloongson-ext
21352 -mno-loongson-ext
21353 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21354
21355 -mloongson-ext2
21356 -mno-loongson-ext2
21357 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
21358 instructions.
21359
21360 -mlong64
21361 Force "long" types to be 64 bits wide. See -mlong32 for an
21362 explanation of the default and the way that the pointer size is
21363 determined.
21364
21365 -mlong32
21366 Force "long", "int", and pointer types to be 32 bits wide.
21367
21368 The default size of "int"s, "long"s and pointers depends on the
21369 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
21370 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
21371 "long"s. Pointers are the same size as "long"s, or the same size
21372 as integer registers, whichever is smaller.
21373
21374 -msym32
21375 -mno-sym32
21376 Assume (do not assume) that all symbols have 32-bit values,
21377 regardless of the selected ABI. This option is useful in
21378 combination with -mabi=64 and -mno-abicalls because it allows GCC
21379 to generate shorter and faster references to symbolic addresses.
21380
21381 -G num
21382 Put definitions of externally-visible data in a small data section
21383 if that data is no bigger than num bytes. GCC can then generate
21384 more efficient accesses to the data; see -mgpopt for details.
21385
21386 The default -G option depends on the configuration.
21387
21388 -mlocal-sdata
21389 -mno-local-sdata
21390 Extend (do not extend) the -G behavior to local data too, such as
21391 to static variables in C. -mlocal-sdata is the default for all
21392 configurations.
21393
21394 If the linker complains that an application is using too much small
21395 data, you might want to try rebuilding the less performance-
21396 critical parts with -mno-local-sdata. You might also want to build
21397 large libraries with -mno-local-sdata, so that the libraries leave
21398 more room for the main program.
21399
21400 -mextern-sdata
21401 -mno-extern-sdata
21402 Assume (do not assume) that externally-defined data is in a small
21403 data section if the size of that data is within the -G limit.
21404 -mextern-sdata is the default for all configurations.
21405
21406 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
21407 Mod references a variable Var that is no bigger than num bytes, you
21408 must make sure that Var is placed in a small data section. If Var
21409 is defined by another module, you must either compile that module
21410 with a high-enough -G setting or attach a "section" attribute to
21411 Var's definition. If Var is common, you must link the application
21412 with a high-enough -G setting.
21413
21414 The easiest way of satisfying these restrictions is to compile and
21415 link every module with the same -G option. However, you may wish
21416 to build a library that supports several different small data
21417 limits. You can do this by compiling the library with the highest
21418 supported -G setting and additionally using -mno-extern-sdata to
21419 stop the library from making assumptions about externally-defined
21420 data.
21421
21422 -mgpopt
21423 -mno-gpopt
21424 Use (do not use) GP-relative accesses for symbols that are known to
21425 be in a small data section; see -G, -mlocal-sdata and
21426 -mextern-sdata. -mgpopt is the default for all configurations.
21427
21428 -mno-gpopt is useful for cases where the $gp register might not
21429 hold the value of "_gp". For example, if the code is part of a
21430 library that might be used in a boot monitor, programs that call
21431 boot monitor routines pass an unknown value in $gp. (In such
21432 situations, the boot monitor itself is usually compiled with -G0.)
21433
21434 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
21435
21436 -membedded-data
21437 -mno-embedded-data
21438 Allocate variables to the read-only data section first if possible,
21439 then next in the small data section if possible, otherwise in data.
21440 This gives slightly slower code than the default, but reduces the
21441 amount of RAM required when executing, and thus may be preferred
21442 for some embedded systems.
21443
21444 -muninit-const-in-rodata
21445 -mno-uninit-const-in-rodata
21446 Put uninitialized "const" variables in the read-only data section.
21447 This option is only meaningful in conjunction with -membedded-data.
21448
21449 -mcode-readable=setting
21450 Specify whether GCC may generate code that reads from executable
21451 sections. There are three possible settings:
21452
21453 -mcode-readable=yes
21454 Instructions may freely access executable sections. This is
21455 the default setting.
21456
21457 -mcode-readable=pcrel
21458 MIPS16 PC-relative load instructions can access executable
21459 sections, but other instructions must not do so. This option
21460 is useful on 4KSc and 4KSd processors when the code TLBs have
21461 the Read Inhibit bit set. It is also useful on processors that
21462 can be configured to have a dual instruction/data SRAM
21463 interface and that, like the M4K, automatically redirect PC-
21464 relative loads to the instruction RAM.
21465
21466 -mcode-readable=no
21467 Instructions must not access executable sections. This option
21468 can be useful on targets that are configured to have a dual
21469 instruction/data SRAM interface but that (unlike the M4K) do
21470 not automatically redirect PC-relative loads to the instruction
21471 RAM.
21472
21473 -msplit-addresses
21474 -mno-split-addresses
21475 Enable (disable) use of the "%hi()" and "%lo()" assembler
21476 relocation operators. This option has been superseded by
21477 -mexplicit-relocs but is retained for backwards compatibility.
21478
21479 -mexplicit-relocs
21480 -mno-explicit-relocs
21481 Use (do not use) assembler relocation operators when dealing with
21482 symbolic addresses. The alternative, selected by
21483 -mno-explicit-relocs, is to use assembler macros instead.
21484
21485 -mexplicit-relocs is the default if GCC was configured to use an
21486 assembler that supports relocation operators.
21487
21488 -mcheck-zero-division
21489 -mno-check-zero-division
21490 Trap (do not trap) on integer division by zero.
21491
21492 The default is -mcheck-zero-division.
21493
21494 -mdivide-traps
21495 -mdivide-breaks
21496 MIPS systems check for division by zero by generating either a
21497 conditional trap or a break instruction. Using traps results in
21498 smaller code, but is only supported on MIPS II and later. Also,
21499 some versions of the Linux kernel have a bug that prevents trap
21500 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
21501 to allow conditional traps on architectures that support them and
21502 -mdivide-breaks to force the use of breaks.
21503
21504 The default is usually -mdivide-traps, but this can be overridden
21505 at configure time using --with-divide=breaks. Divide-by-zero
21506 checks can be completely disabled using -mno-check-zero-division.
21507
21508 -mload-store-pairs
21509 -mno-load-store-pairs
21510 Enable (disable) an optimization that pairs consecutive load or
21511 store instructions to enable load/store bonding. This option is
21512 enabled by default but only takes effect when the selected
21513 architecture is known to support bonding.
21514
21515 -mmemcpy
21516 -mno-memcpy
21517 Force (do not force) the use of "memcpy" for non-trivial block
21518 moves. The default is -mno-memcpy, which allows GCC to inline most
21519 constant-sized copies.
21520
21521 -mlong-calls
21522 -mno-long-calls
21523 Disable (do not disable) use of the "jal" instruction. Calling
21524 functions using "jal" is more efficient but requires the caller and
21525 callee to be in the same 256 megabyte segment.
21526
21527 This option has no effect on abicalls code. The default is
21528 -mno-long-calls.
21529
21530 -mmad
21531 -mno-mad
21532 Enable (disable) use of the "mad", "madu" and "mul" instructions,
21533 as provided by the R4650 ISA.
21534
21535 -mimadd
21536 -mno-imadd
21537 Enable (disable) use of the "madd" and "msub" integer instructions.
21538 The default is -mimadd on architectures that support "madd" and
21539 "msub" except for the 74k architecture where it was found to
21540 generate slower code.
21541
21542 -mfused-madd
21543 -mno-fused-madd
21544 Enable (disable) use of the floating-point multiply-accumulate
21545 instructions, when they are available. The default is
21546 -mfused-madd.
21547
21548 On the R8000 CPU when multiply-accumulate instructions are used,
21549 the intermediate product is calculated to infinite precision and is
21550 not subject to the FCSR Flush to Zero bit. This may be undesirable
21551 in some circumstances. On other processors the result is
21552 numerically identical to the equivalent computation using separate
21553 multiply, add, subtract and negate instructions.
21554
21555 -nocpp
21556 Tell the MIPS assembler to not run its preprocessor over user
21557 assembler files (with a .s suffix) when assembling them.
21558
21559 -mfix-24k
21560 -mno-fix-24k
21561 Work around the 24K E48 (lost data on stores during refill) errata.
21562 The workarounds are implemented by the assembler rather than by
21563 GCC.
21564
21565 -mfix-r4000
21566 -mno-fix-r4000
21567 Work around certain R4000 CPU errata:
21568
21569 - A double-word or a variable shift may give an incorrect result
21570 if executed immediately after starting an integer division.
21571
21572 - A double-word or a variable shift may give an incorrect result
21573 if executed while an integer multiplication is in progress.
21574
21575 - An integer division may give an incorrect result if started in
21576 a delay slot of a taken branch or a jump.
21577
21578 -mfix-r4400
21579 -mno-fix-r4400
21580 Work around certain R4400 CPU errata:
21581
21582 - A double-word or a variable shift may give an incorrect result
21583 if executed immediately after starting an integer division.
21584
21585 -mfix-r10000
21586 -mno-fix-r10000
21587 Work around certain R10000 errata:
21588
21589 - "ll"/"sc" sequences may not behave atomically on revisions
21590 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21591
21592 This option can only be used if the target architecture supports
21593 branch-likely instructions. -mfix-r10000 is the default when
21594 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
21595
21596 -mfix-r5900
21597 -mno-fix-r5900
21598 Do not attempt to schedule the preceding instruction into the delay
21599 slot of a branch instruction placed at the end of a short loop of
21600 six instructions or fewer and always schedule a "nop" instruction
21601 there instead. The short loop bug under certain conditions causes
21602 loops to execute only once or twice, due to a hardware bug in the
21603 R5900 chip. The workaround is implemented by the assembler rather
21604 than by GCC.
21605
21606 -mfix-rm7000
21607 -mno-fix-rm7000
21608 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
21609 are implemented by the assembler rather than by GCC.
21610
21611 -mfix-vr4120
21612 -mno-fix-vr4120
21613 Work around certain VR4120 errata:
21614
21615 - "dmultu" does not always produce the correct result.
21616
21617 - "div" and "ddiv" do not always produce the correct result if
21618 one of the operands is negative.
21619
21620 The workarounds for the division errata rely on special functions
21621 in libgcc.a. At present, these functions are only provided by the
21622 "mips64vr*-elf" configurations.
21623
21624 Other VR4120 errata require a NOP to be inserted between certain
21625 pairs of instructions. These errata are handled by the assembler,
21626 not by GCC itself.
21627
21628 -mfix-vr4130
21629 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
21630 implemented by the assembler rather than by GCC, although GCC
21631 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
21632 "dmacc" and "dmacchi" instructions are available instead.
21633
21634 -mfix-sb1
21635 -mno-fix-sb1
21636 Work around certain SB-1 CPU core errata. (This flag currently
21637 works around the SB-1 revision 2 "F1" and "F2" floating-point
21638 errata.)
21639
21640 -mr10k-cache-barrier=setting
21641 Specify whether GCC should insert cache barriers to avoid the side
21642 effects of speculation on R10K processors.
21643
21644 In common with many processors, the R10K tries to predict the
21645 outcome of a conditional branch and speculatively executes
21646 instructions from the "taken" branch. It later aborts these
21647 instructions if the predicted outcome is wrong. However, on the
21648 R10K, even aborted instructions can have side effects.
21649
21650 This problem only affects kernel stores and, depending on the
21651 system, kernel loads. As an example, a speculatively-executed
21652 store may load the target memory into cache and mark the cache line
21653 as dirty, even if the store itself is later aborted. If a DMA
21654 operation writes to the same area of memory before the "dirty" line
21655 is flushed, the cached data overwrites the DMA-ed data. See the
21656 R10K processor manual for a full description, including other
21657 potential problems.
21658
21659 One workaround is to insert cache barrier instructions before every
21660 memory access that might be speculatively executed and that might
21661 have side effects even if aborted. -mr10k-cache-barrier=setting
21662 controls GCC's implementation of this workaround. It assumes that
21663 aborted accesses to any byte in the following regions does not have
21664 side effects:
21665
21666 1. the memory occupied by the current function's stack frame;
21667
21668 2. the memory occupied by an incoming stack argument;
21669
21670 3. the memory occupied by an object with a link-time-constant
21671 address.
21672
21673 It is the kernel's responsibility to ensure that speculative
21674 accesses to these regions are indeed safe.
21675
21676 If the input program contains a function declaration such as:
21677
21678 void foo (void);
21679
21680 then the implementation of "foo" must allow "j foo" and "jal foo"
21681 to be executed speculatively. GCC honors this restriction for
21682 functions it compiles itself. It expects non-GCC functions (such
21683 as hand-written assembly code) to do the same.
21684
21685 The option has three forms:
21686
21687 -mr10k-cache-barrier=load-store
21688 Insert a cache barrier before a load or store that might be
21689 speculatively executed and that might have side effects even if
21690 aborted.
21691
21692 -mr10k-cache-barrier=store
21693 Insert a cache barrier before a store that might be
21694 speculatively executed and that might have side effects even if
21695 aborted.
21696
21697 -mr10k-cache-barrier=none
21698 Disable the insertion of cache barriers. This is the default
21699 setting.
21700
21701 -mflush-func=func
21702 -mno-flush-func
21703 Specifies the function to call to flush the I and D caches, or to
21704 not call any such function. If called, the function must take the
21705 same arguments as the common "_flush_func", that is, the address of
21706 the memory range for which the cache is being flushed, the size of
21707 the memory range, and the number 3 (to flush both caches). The
21708 default depends on the target GCC was configured for, but commonly
21709 is either "_flush_func" or "__cpu_flush".
21710
21711 mbranch-cost=num
21712 Set the cost of branches to roughly num "simple" instructions.
21713 This cost is only a heuristic and is not guaranteed to produce
21714 consistent results across releases. A zero cost redundantly
21715 selects the default, which is based on the -mtune setting.
21716
21717 -mbranch-likely
21718 -mno-branch-likely
21719 Enable or disable use of Branch Likely instructions, regardless of
21720 the default for the selected architecture. By default, Branch
21721 Likely instructions may be generated if they are supported by the
21722 selected architecture. An exception is for the MIPS32 and MIPS64
21723 architectures and processors that implement those architectures;
21724 for those, Branch Likely instructions are not be generated by
21725 default because the MIPS32 and MIPS64 architectures specifically
21726 deprecate their use.
21727
21728 -mcompact-branches=never
21729 -mcompact-branches=optimal
21730 -mcompact-branches=always
21731 These options control which form of branches will be generated.
21732 The default is -mcompact-branches=optimal.
21733
21734 The -mcompact-branches=never option ensures that compact branch
21735 instructions will never be generated.
21736
21737 The -mcompact-branches=always option ensures that a compact branch
21738 instruction will be generated if available. If a compact branch
21739 instruction is not available, a delay slot form of the branch will
21740 be used instead.
21741
21742 This option is supported from MIPS Release 6 onwards.
21743
21744 The -mcompact-branches=optimal option will cause a delay slot
21745 branch to be used if one is available in the current ISA and the
21746 delay slot is successfully filled. If the delay slot is not
21747 filled, a compact branch will be chosen if one is available.
21748
21749 -mfp-exceptions
21750 -mno-fp-exceptions
21751 Specifies whether FP exceptions are enabled. This affects how FP
21752 instructions are scheduled for some processors. The default is
21753 that FP exceptions are enabled.
21754
21755 For instance, on the SB-1, if FP exceptions are disabled, and we
21756 are emitting 64-bit code, then we can use both FP pipes.
21757 Otherwise, we can only use one FP pipe.
21758
21759 -mvr4130-align
21760 -mno-vr4130-align
21761 The VR4130 pipeline is two-way superscalar, but can only issue two
21762 instructions together if the first one is 8-byte aligned. When
21763 this option is enabled, GCC aligns pairs of instructions that it
21764 thinks should execute in parallel.
21765
21766 This option only has an effect when optimizing for the VR4130. It
21767 normally makes code faster, but at the expense of making it bigger.
21768 It is enabled by default at optimization level -O3.
21769
21770 -msynci
21771 -mno-synci
21772 Enable (disable) generation of "synci" instructions on
21773 architectures that support it. The "synci" instructions (if
21774 enabled) are generated when "__builtin___clear_cache" is compiled.
21775
21776 This option defaults to -mno-synci, but the default can be
21777 overridden by configuring GCC with --with-synci.
21778
21779 When compiling code for single processor systems, it is generally
21780 safe to use "synci". However, on many multi-core (SMP) systems, it
21781 does not invalidate the instruction caches on all cores and may
21782 lead to undefined behavior.
21783
21784 -mrelax-pic-calls
21785 -mno-relax-pic-calls
21786 Try to turn PIC calls that are normally dispatched via register $25
21787 into direct calls. This is only possible if the linker can resolve
21788 the destination at link time and if the destination is within range
21789 for a direct call.
21790
21791 -mrelax-pic-calls is the default if GCC was configured to use an
21792 assembler and a linker that support the ".reloc" assembly directive
21793 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
21794 this optimization can be performed by the assembler and the linker
21795 alone without help from the compiler.
21796
21797 -mmcount-ra-address
21798 -mno-mcount-ra-address
21799 Emit (do not emit) code that allows "_mcount" to modify the calling
21800 function's return address. When enabled, this option extends the
21801 usual "_mcount" interface with a new ra-address parameter, which
21802 has type "intptr_t *" and is passed in register $12. "_mcount" can
21803 then modify the return address by doing both of the following:
21804
21805 * Returning the new address in register $31.
21806
21807 * Storing the new address in "*ra-address", if ra-address is
21808 nonnull.
21809
21810 The default is -mno-mcount-ra-address.
21811
21812 -mframe-header-opt
21813 -mno-frame-header-opt
21814 Enable (disable) frame header optimization in the o32 ABI. When
21815 using the o32 ABI, calling functions will allocate 16 bytes on the
21816 stack for the called function to write out register arguments.
21817 When enabled, this optimization will suppress the allocation of the
21818 frame header if it can be determined that it is unused.
21819
21820 This optimization is off by default at all optimization levels.
21821
21822 -mlxc1-sxc1
21823 -mno-lxc1-sxc1
21824 When applicable, enable (disable) the generation of "lwxc1",
21825 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
21826
21827 -mmadd4
21828 -mno-madd4
21829 When applicable, enable (disable) the generation of 4-operand
21830 "madd.s", "madd.d" and related instructions. Enabled by default.
21831
21832 MMIX Options
21833
21834 These options are defined for the MMIX:
21835
21836 -mlibfuncs
21837 -mno-libfuncs
21838 Specify that intrinsic library functions are being compiled,
21839 passing all values in registers, no matter the size.
21840
21841 -mepsilon
21842 -mno-epsilon
21843 Generate floating-point comparison instructions that compare with
21844 respect to the "rE" epsilon register.
21845
21846 -mabi=mmixware
21847 -mabi=gnu
21848 Generate code that passes function parameters and return values
21849 that (in the called function) are seen as registers $0 and up, as
21850 opposed to the GNU ABI which uses global registers $231 and up.
21851
21852 -mzero-extend
21853 -mno-zero-extend
21854 When reading data from memory in sizes shorter than 64 bits, use
21855 (do not use) zero-extending load instructions by default, rather
21856 than sign-extending ones.
21857
21858 -mknuthdiv
21859 -mno-knuthdiv
21860 Make the result of a division yielding a remainder have the same
21861 sign as the divisor. With the default, -mno-knuthdiv, the sign of
21862 the remainder follows the sign of the dividend. Both methods are
21863 arithmetically valid, the latter being almost exclusively used.
21864
21865 -mtoplevel-symbols
21866 -mno-toplevel-symbols
21867 Prepend (do not prepend) a : to all global symbols, so the assembly
21868 code can be used with the "PREFIX" assembly directive.
21869
21870 -melf
21871 Generate an executable in the ELF format, rather than the default
21872 mmo format used by the mmix simulator.
21873
21874 -mbranch-predict
21875 -mno-branch-predict
21876 Use (do not use) the probable-branch instructions, when static
21877 branch prediction indicates a probable branch.
21878
21879 -mbase-addresses
21880 -mno-base-addresses
21881 Generate (do not generate) code that uses base addresses. Using a
21882 base address automatically generates a request (handled by the
21883 assembler and the linker) for a constant to be set up in a global
21884 register. The register is used for one or more base address
21885 requests within the range 0 to 255 from the value held in the
21886 register. The generally leads to short and fast code, but the
21887 number of different data items that can be addressed is limited.
21888 This means that a program that uses lots of static data may require
21889 -mno-base-addresses.
21890
21891 -msingle-exit
21892 -mno-single-exit
21893 Force (do not force) generated code to have a single exit point in
21894 each function.
21895
21896 MN10300 Options
21897
21898 These -m options are defined for Matsushita MN10300 architectures:
21899
21900 -mmult-bug
21901 Generate code to avoid bugs in the multiply instructions for the
21902 MN10300 processors. This is the default.
21903
21904 -mno-mult-bug
21905 Do not generate code to avoid bugs in the multiply instructions for
21906 the MN10300 processors.
21907
21908 -mam33
21909 Generate code using features specific to the AM33 processor.
21910
21911 -mno-am33
21912 Do not generate code using features specific to the AM33 processor.
21913 This is the default.
21914
21915 -mam33-2
21916 Generate code using features specific to the AM33/2.0 processor.
21917
21918 -mam34
21919 Generate code using features specific to the AM34 processor.
21920
21921 -mtune=cpu-type
21922 Use the timing characteristics of the indicated CPU type when
21923 scheduling instructions. This does not change the targeted
21924 processor type. The CPU type must be one of mn10300, am33, am33-2
21925 or am34.
21926
21927 -mreturn-pointer-on-d0
21928 When generating a function that returns a pointer, return the
21929 pointer in both "a0" and "d0". Otherwise, the pointer is returned
21930 only in "a0", and attempts to call such functions without a
21931 prototype result in errors. Note that this option is on by
21932 default; use -mno-return-pointer-on-d0 to disable it.
21933
21934 -mno-crt0
21935 Do not link in the C run-time initialization object file.
21936
21937 -mrelax
21938 Indicate to the linker that it should perform a relaxation
21939 optimization pass to shorten branches, calls and absolute memory
21940 addresses. This option only has an effect when used on the command
21941 line for the final link step.
21942
21943 This option makes symbolic debugging impossible.
21944
21945 -mliw
21946 Allow the compiler to generate Long Instruction Word instructions
21947 if the target is the AM33 or later. This is the default. This
21948 option defines the preprocessor macro "__LIW__".
21949
21950 -mno-liw
21951 Do not allow the compiler to generate Long Instruction Word
21952 instructions. This option defines the preprocessor macro
21953 "__NO_LIW__".
21954
21955 -msetlb
21956 Allow the compiler to generate the SETLB and Lcc instructions if
21957 the target is the AM33 or later. This is the default. This option
21958 defines the preprocessor macro "__SETLB__".
21959
21960 -mno-setlb
21961 Do not allow the compiler to generate SETLB or Lcc instructions.
21962 This option defines the preprocessor macro "__NO_SETLB__".
21963
21964 Moxie Options
21965
21966 -meb
21967 Generate big-endian code. This is the default for moxie-*-*
21968 configurations.
21969
21970 -mel
21971 Generate little-endian code.
21972
21973 -mmul.x
21974 Generate mul.x and umul.x instructions. This is the default for
21975 moxiebox-*-* configurations.
21976
21977 -mno-crt0
21978 Do not link in the C run-time initialization object file.
21979
21980 MSP430 Options
21981
21982 These options are defined for the MSP430:
21983
21984 -masm-hex
21985 Force assembly output to always use hex constants. Normally such
21986 constants are signed decimals, but this option is available for
21987 testsuite and/or aesthetic purposes.
21988
21989 -mmcu=
21990 Select the MCU to target. This is used to create a C preprocessor
21991 symbol based upon the MCU name, converted to upper case and pre-
21992 and post-fixed with __. This in turn is used by the msp430.h
21993 header file to select an MCU-specific supplementary header file.
21994
21995 The option also sets the ISA to use. If the MCU name is one that
21996 is known to only support the 430 ISA then that is selected,
21997 otherwise the 430X ISA is selected. A generic MCU name of msp430
21998 can also be used to select the 430 ISA. Similarly the generic
21999 msp430x MCU name selects the 430X ISA.
22000
22001 In addition an MCU-specific linker script is added to the linker
22002 command line. The script's name is the name of the MCU with .ld
22003 appended. Thus specifying -mmcu=xxx on the gcc command line
22004 defines the C preprocessor symbol "__XXX__" and cause the linker to
22005 search for a script called xxx.ld.
22006
22007 The ISA and hardware multiply supported for the different MCUs is
22008 hard-coded into GCC. However, an external devices.csv file can be
22009 used to extend device support beyond those that have been hard-
22010 coded.
22011
22012 GCC searches for the devices.csv file using the following methods
22013 in the given precedence order, where the first method takes
22014 precendence over the second which takes precedence over the third.
22015
22016 Include path specified with "-I" and "-L"
22017 devices.csv will be searched for in each of the directories
22018 specified by include paths and linker library search paths.
22019
22020 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
22021 Define the value of the global environment variable
22022 MSP430_GCC_INCLUDE_DIR to the full path to the directory
22023 containing devices.csv, and GCC will search this directory for
22024 devices.csv. If devices.csv is found, this directory will also
22025 be registered as an include path, and linker library path.
22026 Header files and linker scripts in this directory can therefore
22027 be used without manually specifying "-I" and "-L" on the
22028 command line.
22029
22030 The msp430-elf{,bare}/include/devices directory
22031 Finally, GCC will examine msp430-elf{,bare}/include/devices
22032 from the toolchain root directory. This directory does not
22033 exist in a default installation, but if the user has created it
22034 and copied devices.csv there, then the MCU data will be read.
22035 As above, this directory will also be registered as an include
22036 path, and linker library path.
22037
22038 If none of the above search methods find devices.csv, then the
22039 hard-coded MCU data is used.
22040
22041 -mwarn-mcu
22042 -mno-warn-mcu
22043 This option enables or disables warnings about conflicts between
22044 the MCU name specified by the -mmcu option and the ISA set by the
22045 -mcpu option and/or the hardware multiply support set by the
22046 -mhwmult option. It also toggles warnings about unrecognized MCU
22047 names. This option is on by default.
22048
22049 -mcpu=
22050 Specifies the ISA to use. Accepted values are msp430, msp430x and
22051 msp430xv2. This option is deprecated. The -mmcu= option should be
22052 used to select the ISA.
22053
22054 -msim
22055 Link to the simulator runtime libraries and linker script.
22056 Overrides any scripts that would be selected by the -mmcu= option.
22057
22058 -mlarge
22059 Use large-model addressing (20-bit pointers, 20-bit "size_t").
22060
22061 -msmall
22062 Use small-model addressing (16-bit pointers, 16-bit "size_t").
22063
22064 -mrelax
22065 This option is passed to the assembler and linker, and allows the
22066 linker to perform certain optimizations that cannot be done until
22067 the final link.
22068
22069 mhwmult=
22070 Describes the type of hardware multiply supported by the target.
22071 Accepted values are none for no hardware multiply, 16bit for the
22072 original 16-bit-only multiply supported by early MCUs. 32bit for
22073 the 16/32-bit multiply supported by later MCUs and f5series for the
22074 16/32-bit multiply supported by F5-series MCUs. A value of auto
22075 can also be given. This tells GCC to deduce the hardware multiply
22076 support based upon the MCU name provided by the -mmcu option. If
22077 no -mmcu option is specified or if the MCU name is not recognized
22078 then no hardware multiply support is assumed. "auto" is the
22079 default setting.
22080
22081 Hardware multiplies are normally performed by calling a library
22082 routine. This saves space in the generated code. When compiling
22083 at -O3 or higher however the hardware multiplier is invoked inline.
22084 This makes for bigger, but faster code.
22085
22086 The hardware multiply routines disable interrupts whilst running
22087 and restore the previous interrupt state when they finish. This
22088 makes them safe to use inside interrupt handlers as well as in
22089 normal code.
22090
22091 -minrt
22092 Enable the use of a minimum runtime environment - no static
22093 initializers or constructors. This is intended for memory-
22094 constrained devices. The compiler includes special symbols in some
22095 objects that tell the linker and runtime which code fragments are
22096 required.
22097
22098 -mtiny-printf
22099 Enable reduced code size "printf" and "puts" library functions.
22100 The tiny implementations of these functions are not reentrant, so
22101 must be used with caution in multi-threaded applications.
22102
22103 Support for streams has been removed and the string to be printed
22104 will always be sent to stdout via the "write" syscall. The string
22105 is not buffered before it is sent to write.
22106
22107 This option requires Newlib Nano IO, so GCC must be configured with
22108 --enable-newlib-nano-formatted-io.
22109
22110 -mmax-inline-shift=
22111 This option takes an integer between 0 and 64 inclusive, and sets
22112 the maximum number of inline shift instructions which should be
22113 emitted to perform a shift operation by a constant amount. When
22114 this value needs to be exceeded, an mspabi helper function is used
22115 instead. The default value is 4.
22116
22117 This only affects cases where a shift by multiple positions cannot
22118 be completed with a single instruction (e.g. all shifts >1 on the
22119 430 ISA).
22120
22121 Shifts of a 32-bit value are at least twice as costly, so the value
22122 passed for this option is divided by 2 and the resulting value used
22123 instead.
22124
22125 -mcode-region=
22126 -mdata-region=
22127 These options tell the compiler where to place functions and data
22128 that do not have one of the "lower", "upper", "either" or "section"
22129 attributes. Possible values are "lower", "upper", "either" or
22130 "any". The first three behave like the corresponding attribute.
22131 The fourth possible value - "any" - is the default. It leaves
22132 placement entirely up to the linker script and how it assigns the
22133 standard sections (".text", ".data", etc) to the memory regions.
22134
22135 -msilicon-errata=
22136 This option passes on a request to assembler to enable the fixes
22137 for the named silicon errata.
22138
22139 -msilicon-errata-warn=
22140 This option passes on a request to the assembler to enable warning
22141 messages when a silicon errata might need to be applied.
22142
22143 -mwarn-devices-csv
22144 -mno-warn-devices-csv
22145 Warn if devices.csv is not found or there are problem parsing it
22146 (default: on).
22147
22148 NDS32 Options
22149
22150 These options are defined for NDS32 implementations:
22151
22152 -mbig-endian
22153 Generate code in big-endian mode.
22154
22155 -mlittle-endian
22156 Generate code in little-endian mode.
22157
22158 -mreduced-regs
22159 Use reduced-set registers for register allocation.
22160
22161 -mfull-regs
22162 Use full-set registers for register allocation.
22163
22164 -mcmov
22165 Generate conditional move instructions.
22166
22167 -mno-cmov
22168 Do not generate conditional move instructions.
22169
22170 -mext-perf
22171 Generate performance extension instructions.
22172
22173 -mno-ext-perf
22174 Do not generate performance extension instructions.
22175
22176 -mext-perf2
22177 Generate performance extension 2 instructions.
22178
22179 -mno-ext-perf2
22180 Do not generate performance extension 2 instructions.
22181
22182 -mext-string
22183 Generate string extension instructions.
22184
22185 -mno-ext-string
22186 Do not generate string extension instructions.
22187
22188 -mv3push
22189 Generate v3 push25/pop25 instructions.
22190
22191 -mno-v3push
22192 Do not generate v3 push25/pop25 instructions.
22193
22194 -m16-bit
22195 Generate 16-bit instructions.
22196
22197 -mno-16-bit
22198 Do not generate 16-bit instructions.
22199
22200 -misr-vector-size=num
22201 Specify the size of each interrupt vector, which must be 4 or 16.
22202
22203 -mcache-block-size=num
22204 Specify the size of each cache block, which must be a power of 2
22205 between 4 and 512.
22206
22207 -march=arch
22208 Specify the name of the target architecture.
22209
22210 -mcmodel=code-model
22211 Set the code model to one of
22212
22213 small
22214 All the data and read-only data segments must be within 512KB
22215 addressing space. The text segment must be within 16MB
22216 addressing space.
22217
22218 medium
22219 The data segment must be within 512KB while the read-only data
22220 segment can be within 4GB addressing space. The text segment
22221 should be still within 16MB addressing space.
22222
22223 large
22224 All the text and data segments can be within 4GB addressing
22225 space.
22226
22227 -mctor-dtor
22228 Enable constructor/destructor feature.
22229
22230 -mrelax
22231 Guide linker to relax instructions.
22232
22233 Nios II Options
22234
22235 These are the options defined for the Altera Nios II processor.
22236
22237 -G num
22238 Put global and static objects less than or equal to num bytes into
22239 the small data or BSS sections instead of the normal data or BSS
22240 sections. The default value of num is 8.
22241
22242 -mgpopt=option
22243 -mgpopt
22244 -mno-gpopt
22245 Generate (do not generate) GP-relative accesses. The following
22246 option names are recognized:
22247
22248 none
22249 Do not generate GP-relative accesses.
22250
22251 local
22252 Generate GP-relative accesses for small data objects that are
22253 not external, weak, or uninitialized common symbols. Also use
22254 GP-relative addressing for objects that have been explicitly
22255 placed in a small data section via a "section" attribute.
22256
22257 global
22258 As for local, but also generate GP-relative accesses for small
22259 data objects that are external, weak, or common. If you use
22260 this option, you must ensure that all parts of your program
22261 (including libraries) are compiled with the same -G setting.
22262
22263 data
22264 Generate GP-relative accesses for all data objects in the
22265 program. If you use this option, the entire data and BSS
22266 segments of your program must fit in 64K of memory and you must
22267 use an appropriate linker script to allocate them within the
22268 addressable range of the global pointer.
22269
22270 all Generate GP-relative addresses for function pointers as well as
22271 data pointers. If you use this option, the entire text, data,
22272 and BSS segments of your program must fit in 64K of memory and
22273 you must use an appropriate linker script to allocate them
22274 within the addressable range of the global pointer.
22275
22276 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
22277 equivalent to -mgpopt=none.
22278
22279 The default is -mgpopt except when -fpic or -fPIC is specified to
22280 generate position-independent code. Note that the Nios II ABI does
22281 not permit GP-relative accesses from shared libraries.
22282
22283 You may need to specify -mno-gpopt explicitly when building
22284 programs that include large amounts of small data, including large
22285 GOT data sections. In this case, the 16-bit offset for GP-relative
22286 addressing may not be large enough to allow access to the entire
22287 small data section.
22288
22289 -mgprel-sec=regexp
22290 This option specifies additional section names that can be accessed
22291 via GP-relative addressing. It is most useful in conjunction with
22292 "section" attributes on variable declarations and a custom linker
22293 script. The regexp is a POSIX Extended Regular Expression.
22294
22295 This option does not affect the behavior of the -G option, and the
22296 specified sections are in addition to the standard ".sdata" and
22297 ".sbss" small-data sections that are recognized by -mgpopt.
22298
22299 -mr0rel-sec=regexp
22300 This option specifies names of sections that can be accessed via a
22301 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
22302 32-bit address space. It is most useful in conjunction with
22303 "section" attributes on variable declarations and a custom linker
22304 script. The regexp is a POSIX Extended Regular Expression.
22305
22306 In contrast to the use of GP-relative addressing for small data,
22307 zero-based addressing is never generated by default and there are
22308 no conventional section names used in standard linker scripts for
22309 sections in the low or high areas of memory.
22310
22311 -mel
22312 -meb
22313 Generate little-endian (default) or big-endian (experimental) code,
22314 respectively.
22315
22316 -march=arch
22317 This specifies the name of the target Nios II architecture. GCC
22318 uses this name to determine what kind of instructions it can emit
22319 when generating assembly code. Permissible names are: r1, r2.
22320
22321 The preprocessor macro "__nios2_arch__" is available to programs,
22322 with value 1 or 2, indicating the targeted ISA level.
22323
22324 -mbypass-cache
22325 -mno-bypass-cache
22326 Force all load and store instructions to always bypass cache by
22327 using I/O variants of the instructions. The default is not to
22328 bypass the cache.
22329
22330 -mno-cache-volatile
22331 -mcache-volatile
22332 Volatile memory access bypass the cache using the I/O variants of
22333 the load and store instructions. The default is not to bypass the
22334 cache.
22335
22336 -mno-fast-sw-div
22337 -mfast-sw-div
22338 Do not use table-based fast divide for small numbers. The default
22339 is to use the fast divide at -O3 and above.
22340
22341 -mno-hw-mul
22342 -mhw-mul
22343 -mno-hw-mulx
22344 -mhw-mulx
22345 -mno-hw-div
22346 -mhw-div
22347 Enable or disable emitting "mul", "mulx" and "div" family of
22348 instructions by the compiler. The default is to emit "mul" and not
22349 emit "div" and "mulx".
22350
22351 -mbmx
22352 -mno-bmx
22353 -mcdx
22354 -mno-cdx
22355 Enable or disable generation of Nios II R2 BMX (bit manipulation)
22356 and CDX (code density) instructions. Enabling these instructions
22357 also requires -march=r2. Since these instructions are optional
22358 extensions to the R2 architecture, the default is not to emit them.
22359
22360 -mcustom-insn=N
22361 -mno-custom-insn
22362 Each -mcustom-insn=N option enables use of a custom instruction
22363 with encoding N when generating code that uses insn. For example,
22364 -mcustom-fadds=253 generates custom instruction 253 for single-
22365 precision floating-point add operations instead of the default
22366 behavior of using a library call.
22367
22368 The following values of insn are supported. Except as otherwise
22369 noted, floating-point operations are expected to be implemented
22370 with normal IEEE 754 semantics and correspond directly to the C
22371 operators or the equivalent GCC built-in functions.
22372
22373 Single-precision floating point:
22374
22375 fadds, fsubs, fdivs, fmuls
22376 Binary arithmetic operations.
22377
22378 fnegs
22379 Unary negation.
22380
22381 fabss
22382 Unary absolute value.
22383
22384 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
22385 Comparison operations.
22386
22387 fmins, fmaxs
22388 Floating-point minimum and maximum. These instructions are
22389 only generated if -ffinite-math-only is specified.
22390
22391 fsqrts
22392 Unary square root operation.
22393
22394 fcoss, fsins, ftans, fatans, fexps, flogs
22395 Floating-point trigonometric and exponential functions. These
22396 instructions are only generated if -funsafe-math-optimizations
22397 is also specified.
22398
22399 Double-precision floating point:
22400
22401 faddd, fsubd, fdivd, fmuld
22402 Binary arithmetic operations.
22403
22404 fnegd
22405 Unary negation.
22406
22407 fabsd
22408 Unary absolute value.
22409
22410 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
22411 Comparison operations.
22412
22413 fmind, fmaxd
22414 Double-precision minimum and maximum. These instructions are
22415 only generated if -ffinite-math-only is specified.
22416
22417 fsqrtd
22418 Unary square root operation.
22419
22420 fcosd, fsind, ftand, fatand, fexpd, flogd
22421 Double-precision trigonometric and exponential functions.
22422 These instructions are only generated if
22423 -funsafe-math-optimizations is also specified.
22424
22425 Conversions:
22426
22427 fextsd
22428 Conversion from single precision to double precision.
22429
22430 ftruncds
22431 Conversion from double precision to single precision.
22432
22433 fixsi, fixsu, fixdi, fixdu
22434 Conversion from floating point to signed or unsigned integer
22435 types, with truncation towards zero.
22436
22437 round
22438 Conversion from single-precision floating point to signed
22439 integer, rounding to the nearest integer and ties away from
22440 zero. This corresponds to the "__builtin_lroundf" function
22441 when -fno-math-errno is used.
22442
22443 floatis, floatus, floatid, floatud
22444 Conversion from signed or unsigned integer types to floating-
22445 point types.
22446
22447 In addition, all of the following transfer instructions for
22448 internal registers X and Y must be provided to use any of the
22449 double-precision floating-point instructions. Custom instructions
22450 taking two double-precision source operands expect the first
22451 operand in the 64-bit register X. The other operand (or only
22452 operand of a unary operation) is given to the custom arithmetic
22453 instruction with the least significant half in source register src1
22454 and the most significant half in src2. A custom instruction that
22455 returns a double-precision result returns the most significant 32
22456 bits in the destination register and the other half in 32-bit
22457 register Y. GCC automatically generates the necessary code
22458 sequences to write register X and/or read register Y when double-
22459 precision floating-point instructions are used.
22460
22461 fwrx
22462 Write src1 into the least significant half of X and src2 into
22463 the most significant half of X.
22464
22465 fwry
22466 Write src1 into Y.
22467
22468 frdxhi, frdxlo
22469 Read the most or least (respectively) significant half of X and
22470 store it in dest.
22471
22472 frdy
22473 Read the value of Y and store it into dest.
22474
22475 Note that you can gain more local control over generation of Nios
22476 II custom instructions by using the "target("custom-insn=N")" and
22477 "target("no-custom-insn")" function attributes or pragmas.
22478
22479 -mcustom-fpu-cfg=name
22480 This option enables a predefined, named set of custom instruction
22481 encodings (see -mcustom-insn above). Currently, the following sets
22482 are defined:
22483
22484 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
22485 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
22486
22487 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
22488 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
22489 -fsingle-precision-constant
22490
22491 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
22492 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
22493 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
22494 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
22495 -mcustom-fdivs=255 -fsingle-precision-constant
22496
22497 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
22498 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
22499 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
22500 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
22501 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
22502 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
22503 -mcustom-fsubs=254 -mcustom-fdivs=255
22504
22505 Custom instruction assignments given by individual -mcustom-insn=
22506 options override those given by -mcustom-fpu-cfg=, regardless of
22507 the order of the options on the command line.
22508
22509 Note that you can gain more local control over selection of a FPU
22510 configuration by using the "target("custom-fpu-cfg=name")" function
22511 attribute or pragma.
22512
22513 The name fph2 is an abbreviation for Nios II Floating Point
22514 Hardware 2 Component. Please note that the custom instructions
22515 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
22516 generated if -ffinite-math-only is specified. The custom
22517 instruction enabled by -mcustom-round=248 is only generated if
22518 -fno-math-errno is specified. In contrast to the other
22519 configurations, -fsingle-precision-constant is not set.
22520
22521 These additional -m options are available for the Altera Nios II ELF
22522 (bare-metal) target:
22523
22524 -mhal
22525 Link with HAL BSP. This suppresses linking with the GCC-provided C
22526 runtime startup and termination code, and is typically used in
22527 conjunction with -msys-crt0= to specify the location of the
22528 alternate startup code provided by the HAL BSP.
22529
22530 -msmallc
22531 Link with a limited version of the C library, -lsmallc, rather than
22532 Newlib.
22533
22534 -msys-crt0=startfile
22535 startfile is the file name of the startfile (crt0) to use when
22536 linking. This option is only useful in conjunction with -mhal.
22537
22538 -msys-lib=systemlib
22539 systemlib is the library name of the library that provides low-
22540 level system calls required by the C library, e.g. "read" and
22541 "write". This option is typically used to link with a library
22542 provided by a HAL BSP.
22543
22544 Nvidia PTX Options
22545
22546 These options are defined for Nvidia PTX:
22547
22548 -m64
22549 Ignored, but preserved for backward compatibility. Only 64-bit ABI
22550 is supported.
22551
22552 -misa=ISA-string
22553 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
22554 strings must be lower-case. Valid ISA strings include sm_30 and
22555 sm_35. The default ISA is sm_35.
22556
22557 -mmainkernel
22558 Link in code for a __main kernel. This is for stand-alone instead
22559 of offloading execution.
22560
22561 -moptimize
22562 Apply partitioned execution optimizations. This is the default
22563 when any level of optimization is selected.
22564
22565 -msoft-stack
22566 Generate code that does not use ".local" memory directly for stack
22567 storage. Instead, a per-warp stack pointer is maintained
22568 explicitly. This enables variable-length stack allocation (with
22569 variable-length arrays or "alloca"), and when global memory is used
22570 for underlying storage, makes it possible to access automatic
22571 variables from other threads, or with atomic instructions. This
22572 code generation variant is used for OpenMP offloading, but the
22573 option is exposed on its own for the purpose of testing the
22574 compiler; to generate code suitable for linking into programs using
22575 OpenMP offloading, use option -mgomp.
22576
22577 -muniform-simt
22578 Switch to code generation variant that allows to execute all
22579 threads in each warp, while maintaining memory state and side
22580 effects as if only one thread in each warp was active outside of
22581 OpenMP SIMD regions. All atomic operations and calls to runtime
22582 (malloc, free, vprintf) are conditionally executed (iff current
22583 lane index equals the master lane index), and the register being
22584 assigned is copied via a shuffle instruction from the master lane.
22585 Outside of SIMD regions lane 0 is the master; inside, each thread
22586 sees itself as the master. Shared memory array "int __nvptx_uni[]"
22587 stores all-zeros or all-ones bitmasks for each warp, indicating
22588 current mode (0 outside of SIMD regions). Each thread can bitwise-
22589 and the bitmask at position "tid.y" with current lane index to
22590 compute the master lane index.
22591
22592 -mgomp
22593 Generate code for use in OpenMP offloading: enables -msoft-stack
22594 and -muniform-simt options, and selects corresponding multilib
22595 variant.
22596
22597 OpenRISC Options
22598
22599 These options are defined for OpenRISC:
22600
22601 -mboard=name
22602 Configure a board specific runtime. This will be passed to the
22603 linker for newlib board library linking. The default is "or1ksim".
22604
22605 -mnewlib
22606 This option is ignored; it is for compatibility purposes only.
22607 This used to select linker and preprocessor options for use with
22608 newlib.
22609
22610 -msoft-div
22611 -mhard-div
22612 Select software or hardware divide ("l.div", "l.divu")
22613 instructions. This default is hardware divide.
22614
22615 -msoft-mul
22616 -mhard-mul
22617 Select software or hardware multiply ("l.mul", "l.muli")
22618 instructions. This default is hardware multiply.
22619
22620 -msoft-float
22621 -mhard-float
22622 Select software or hardware for floating point operations. The
22623 default is software.
22624
22625 -mdouble-float
22626 When -mhard-float is selected, enables generation of double-
22627 precision floating point instructions. By default functions from
22628 libgcc are used to perform double-precision floating point
22629 operations.
22630
22631 -munordered-float
22632 When -mhard-float is selected, enables generation of unordered
22633 floating point compare and set flag ("lf.sfun*") instructions. By
22634 default functions from libgcc are used to perform unordered
22635 floating point compare and set flag operations.
22636
22637 -mcmov
22638 Enable generation of conditional move ("l.cmov") instructions. By
22639 default the equivalent will be generated using set and branch.
22640
22641 -mror
22642 Enable generation of rotate right ("l.ror") instructions. By
22643 default functions from libgcc are used to perform rotate right
22644 operations.
22645
22646 -mrori
22647 Enable generation of rotate right with immediate ("l.rori")
22648 instructions. By default functions from libgcc are used to perform
22649 rotate right with immediate operations.
22650
22651 -msext
22652 Enable generation of sign extension ("l.ext*") instructions. By
22653 default memory loads are used to perform sign extension.
22654
22655 -msfimm
22656 Enable generation of compare and set flag with immediate ("l.sf*i")
22657 instructions. By default extra instructions will be generated to
22658 store the immediate to a register first.
22659
22660 -mshftimm
22661 Enable generation of shift with immediate ("l.srai", "l.srli",
22662 "l.slli") instructions. By default extra instructions will be
22663 generated to store the immediate to a register first.
22664
22665 PDP-11 Options
22666
22667 These options are defined for the PDP-11:
22668
22669 -mfpu
22670 Use hardware FPP floating point. This is the default. (FIS
22671 floating point on the PDP-11/40 is not supported.) Implies -m45.
22672
22673 -msoft-float
22674 Do not use hardware floating point.
22675
22676 -mac0
22677 Return floating-point results in ac0 (fr0 in Unix assembler
22678 syntax).
22679
22680 -mno-ac0
22681 Return floating-point results in memory. This is the default.
22682
22683 -m40
22684 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22685
22686 -m45
22687 Generate code for a PDP-11/45. This is the default.
22688
22689 -m10
22690 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22691
22692 -mint16
22693 -mno-int32
22694 Use 16-bit "int". This is the default.
22695
22696 -mint32
22697 -mno-int16
22698 Use 32-bit "int".
22699
22700 -msplit
22701 Target has split instruction and data space. Implies -m45.
22702
22703 -munix-asm
22704 Use Unix assembler syntax.
22705
22706 -mdec-asm
22707 Use DEC assembler syntax.
22708
22709 -mgnu-asm
22710 Use GNU assembler syntax. This is the default.
22711
22712 -mlra
22713 Use the new LRA register allocator. By default, the old "reload"
22714 allocator is used.
22715
22716 picoChip Options
22717
22718 These -m options are defined for picoChip implementations:
22719
22720 -mae=ae_type
22721 Set the instruction set, register set, and instruction scheduling
22722 parameters for array element type ae_type. Supported values for
22723 ae_type are ANY, MUL, and MAC.
22724
22725 -mae=ANY selects a completely generic AE type. Code generated with
22726 this option runs on any of the other AE types. The code is not as
22727 efficient as it would be if compiled for a specific AE type, and
22728 some types of operation (e.g., multiplication) do not work properly
22729 on all types of AE.
22730
22731 -mae=MUL selects a MUL AE type. This is the most useful AE type
22732 for compiled code, and is the default.
22733
22734 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
22735 option may suffer from poor performance of byte (char)
22736 manipulation, since the DSP AE does not provide hardware support
22737 for byte load/stores.
22738
22739 -msymbol-as-address
22740 Enable the compiler to directly use a symbol name as an address in
22741 a load/store instruction, without first loading it into a register.
22742 Typically, the use of this option generates larger programs, which
22743 run faster than when the option isn't used. However, the results
22744 vary from program to program, so it is left as a user option,
22745 rather than being permanently enabled.
22746
22747 -mno-inefficient-warnings
22748 Disables warnings about the generation of inefficient code. These
22749 warnings can be generated, for example, when compiling code that
22750 performs byte-level memory operations on the MAC AE type. The MAC
22751 AE has no hardware support for byte-level memory operations, so all
22752 byte load/stores must be synthesized from word load/store
22753 operations. This is inefficient and a warning is generated to
22754 indicate that you should rewrite the code to avoid byte operations,
22755 or to target an AE type that has the necessary hardware support.
22756 This option disables these warnings.
22757
22758 PowerPC Options
22759
22760 These are listed under
22761
22762 PRU Options
22763
22764 These command-line options are defined for PRU target:
22765
22766 -minrt
22767 Link with a minimum runtime environment, with no support for static
22768 initializers and constructors. Using this option can significantly
22769 reduce the size of the final ELF binary. Beware that the compiler
22770 could still generate code with static initializers and
22771 constructors. It is up to the programmer to ensure that the source
22772 program will not use those features.
22773
22774 -mmcu=mcu
22775 Specify the PRU MCU variant to use. Check Newlib for the exact
22776 list of supported MCUs.
22777
22778 -mno-relax
22779 Make GCC pass the --no-relax command-line option to the linker
22780 instead of the --relax option.
22781
22782 -mloop
22783 Allow (or do not allow) GCC to use the LOOP instruction.
22784
22785 -mabi=variant
22786 Specify the ABI variant to output code for. -mabi=ti selects the
22787 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
22788 more naturally with certain GCC assumptions. These are the
22789 differences:
22790
22791 Function Pointer Size
22792 TI ABI specifies that function (code) pointers are 16-bit,
22793 whereas GNU supports only 32-bit data and code pointers.
22794
22795 Optional Return Value Pointer
22796 Function return values larger than 64 bits are passed by using
22797 a hidden pointer as the first argument of the function. TI
22798 ABI, though, mandates that the pointer can be NULL in case the
22799 caller is not using the returned value. GNU always passes and
22800 expects a valid return value pointer.
22801
22802 The current -mabi=ti implementation simply raises a compile error
22803 when any of the above code constructs is detected. As a
22804 consequence the standard C library cannot be built and it is
22805 omitted when linking with -mabi=ti.
22806
22807 Relaxation is a GNU feature and for safety reasons is disabled when
22808 using -mabi=ti. The TI toolchain does not emit relocations for
22809 QBBx instructions, so the GNU linker cannot adjust them when
22810 shortening adjacent LDI32 pseudo instructions.
22811
22812 RISC-V Options
22813
22814 These command-line options are defined for RISC-V targets:
22815
22816 -mbranch-cost=n
22817 Set the cost of branches to roughly n instructions.
22818
22819 -mplt
22820 -mno-plt
22821 When generating PIC code, do or don't allow the use of PLTs.
22822 Ignored for non-PIC. The default is -mplt.
22823
22824 -mabi=ABI-string
22825 Specify integer and floating-point calling convention. ABI-string
22826 contains two parts: the size of integer types and the registers
22827 used for floating-point types. For example -march=rv64ifd
22828 -mabi=lp64d means that long and pointers are 64-bit (implicitly
22829 defining int to be 32-bit), and that floating-point values up to 64
22830 bits wide are passed in F registers. Contrast this with
22831 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
22832 generate code that uses the F and D extensions but only allows
22833 floating-point values up to 32 bits long to be passed in registers;
22834 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
22835 will be passed in registers.
22836
22837 The default for this argument is system dependent, users who want a
22838 specific calling convention should specify one explicitly. The
22839 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
22840 and lp64d. Some calling conventions are impossible to implement on
22841 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
22842 because the ABI requires 64-bit values be passed in F registers,
22843 but F registers are only 32 bits wide. There is also the ilp32e
22844 ABI that can only be used with the rv32e architecture. This ABI is
22845 not well specified at present, and is subject to change.
22846
22847 -mfdiv
22848 -mno-fdiv
22849 Do or don't use hardware floating-point divide and square root
22850 instructions. This requires the F or D extensions for floating-
22851 point registers. The default is to use them if the specified
22852 architecture has these instructions.
22853
22854 -mdiv
22855 -mno-div
22856 Do or don't use hardware instructions for integer division. This
22857 requires the M extension. The default is to use them if the
22858 specified architecture has these instructions.
22859
22860 -march=ISA-string
22861 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
22862 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
22863
22864 When -march= is not specified, use the setting from -mcpu.
22865
22866 If both -march and -mcpu= are not specified, the default for this
22867 argument is system dependent, users who want a specific
22868 architecture extensions should specify one explicitly.
22869
22870 -mcpu=processor-string
22871 Use architecture of and optimize the output for the given
22872 processor, specified by particular CPU name. Permissible values
22873 for this option are: sifive-e20, sifive-e21, sifive-e24,
22874 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
22875 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
22876
22877 -mtune=processor-string
22878 Optimize the output for the given processor, specified by
22879 microarchitecture or particular CPU name. Permissible values for
22880 this option are: rocket, sifive-3-series, sifive-5-series,
22881 sifive-7-series, size, and all valid options for -mcpu=.
22882
22883 When -mtune= is not specified, use the setting from -mcpu, the
22884 default is rocket if both are not specified.
22885
22886 The size choice is not intended for use by end-users. This is used
22887 when -Os is specified. It overrides the instruction cost info
22888 provided by -mtune=, but does not override the pipeline info. This
22889 helps reduce code size while still giving good performance.
22890
22891 -mpreferred-stack-boundary=num
22892 Attempt to keep the stack boundary aligned to a 2 raised to num
22893 byte boundary. If -mpreferred-stack-boundary is not specified, the
22894 default is 4 (16 bytes or 128-bits).
22895
22896 Warning: If you use this switch, then you must build all modules
22897 with the same value, including any libraries. This includes the
22898 system libraries and startup modules.
22899
22900 -msmall-data-limit=n
22901 Put global and static data smaller than n bytes into a special
22902 section (on some targets).
22903
22904 -msave-restore
22905 -mno-save-restore
22906 Do or don't use smaller but slower prologue and epilogue code that
22907 uses library function calls. The default is to use fast inline
22908 prologues and epilogues.
22909
22910 -mshorten-memrefs
22911 -mno-shorten-memrefs
22912 Do or do not attempt to make more use of compressed load/store
22913 instructions by replacing a load/store of 'base register + large
22914 offset' with a new load/store of 'new base + small offset'. If the
22915 new base gets stored in a compressed register, then the new
22916 load/store can be compressed. Currently targets 32-bit integer
22917 load/stores only.
22918
22919 -mstrict-align
22920 -mno-strict-align
22921 Do not or do generate unaligned memory accesses. The default is
22922 set depending on whether the processor we are optimizing for
22923 supports fast unaligned access or not.
22924
22925 -mcmodel=medlow
22926 Generate code for the medium-low code model. The program and its
22927 statically defined symbols must lie within a single 2 GiB address
22928 range and must lie between absolute addresses -2 GiB and +2 GiB.
22929 Programs can be statically or dynamically linked. This is the
22930 default code model.
22931
22932 -mcmodel=medany
22933 Generate code for the medium-any code model. The program and its
22934 statically defined symbols must be within any single 2 GiB address
22935 range. Programs can be statically or dynamically linked.
22936
22937 -mexplicit-relocs
22938 -mno-exlicit-relocs
22939 Use or do not use assembler relocation operators when dealing with
22940 symbolic addresses. The alternative is to use assembler macros
22941 instead, which may limit optimization.
22942
22943 -mrelax
22944 -mno-relax
22945 Take advantage of linker relaxations to reduce the number of
22946 instructions required to materialize symbol addresses. The default
22947 is to take advantage of linker relaxations.
22948
22949 -memit-attribute
22950 -mno-emit-attribute
22951 Emit (do not emit) RISC-V attribute to record extra information
22952 into ELF objects. This feature requires at least binutils 2.32.
22953
22954 -malign-data=type
22955 Control how GCC aligns variables and constants of array, structure,
22956 or union types. Supported values for type are xlen which uses x
22957 register width as the alignment value, and natural which uses
22958 natural alignment. xlen is the default.
22959
22960 -mbig-endian
22961 Generate big-endian code. This is the default when GCC is
22962 configured for a riscv64be-*-* or riscv32be-*-* target.
22963
22964 -mlittle-endian
22965 Generate little-endian code. This is the default when GCC is
22966 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
22967 or riscv32be-*-* target.
22968
22969 -mstack-protector-guard=guard
22970 -mstack-protector-guard-reg=reg
22971 -mstack-protector-guard-offset=offset
22972 Generate stack protection code using canary at guard. Supported
22973 locations are global for a global canary or tls for per-thread
22974 canary in the TLS block.
22975
22976 With the latter choice the options -mstack-protector-guard-reg=reg
22977 and -mstack-protector-guard-offset=offset furthermore specify which
22978 register to use as base register for reading the canary, and from
22979 what offset from that base register. There is no default register
22980 or offset as this is entirely for use within the Linux kernel.
22981
22982 RL78 Options
22983
22984 -msim
22985 Links in additional target libraries to support operation within a
22986 simulator.
22987
22988 -mmul=none
22989 -mmul=g10
22990 -mmul=g13
22991 -mmul=g14
22992 -mmul=rl78
22993 Specifies the type of hardware multiplication and division support
22994 to be used. The simplest is "none", which uses software for both
22995 multiplication and division. This is the default. The "g13" value
22996 is for the hardware multiply/divide peripheral found on the
22997 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
22998 multiplication and division instructions supported by the RL78/G14
22999 (S3 core) parts. The value "rl78" is an alias for "g14" and the
23000 value "mg10" is an alias for "none".
23001
23002 In addition a C preprocessor macro is defined, based upon the
23003 setting of this option. Possible values are: "__RL78_MUL_NONE__",
23004 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
23005
23006 -mcpu=g10
23007 -mcpu=g13
23008 -mcpu=g14
23009 -mcpu=rl78
23010 Specifies the RL78 core to target. The default is the G14 core,
23011 also known as an S3 core or just RL78. The G13 or S2 core does not
23012 have multiply or divide instructions, instead it uses a hardware
23013 peripheral for these operations. The G10 or S1 core does not have
23014 register banks, so it uses a different calling convention.
23015
23016 If this option is set it also selects the type of hardware multiply
23017 support to use, unless this is overridden by an explicit -mmul=none
23018 option on the command line. Thus specifying -mcpu=g13 enables the
23019 use of the G13 hardware multiply peripheral and specifying
23020 -mcpu=g10 disables the use of hardware multiplications altogether.
23021
23022 Note, although the RL78/G14 core is the default target, specifying
23023 -mcpu=g14 or -mcpu=rl78 on the command line does change the
23024 behavior of the toolchain since it also enables G14 hardware
23025 multiply support. If these options are not specified on the
23026 command line then software multiplication routines will be used
23027 even though the code targets the RL78 core. This is for backwards
23028 compatibility with older toolchains which did not have hardware
23029 multiply and divide support.
23030
23031 In addition a C preprocessor macro is defined, based upon the
23032 setting of this option. Possible values are: "__RL78_G10__",
23033 "__RL78_G13__" or "__RL78_G14__".
23034
23035 -mg10
23036 -mg13
23037 -mg14
23038 -mrl78
23039 These are aliases for the corresponding -mcpu= option. They are
23040 provided for backwards compatibility.
23041
23042 -mallregs
23043 Allow the compiler to use all of the available registers. By
23044 default registers "r24..r31" are reserved for use in interrupt
23045 handlers. With this option enabled these registers can be used in
23046 ordinary functions as well.
23047
23048 -m64bit-doubles
23049 -m32bit-doubles
23050 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
23051 (-m32bit-doubles) in size. The default is -m32bit-doubles.
23052
23053 -msave-mduc-in-interrupts
23054 -mno-save-mduc-in-interrupts
23055 Specifies that interrupt handler functions should preserve the MDUC
23056 registers. This is only necessary if normal code might use the
23057 MDUC registers, for example because it performs multiplication and
23058 division operations. The default is to ignore the MDUC registers
23059 as this makes the interrupt handlers faster. The target option
23060 -mg13 needs to be passed for this to work as this feature is only
23061 available on the G13 target (S2 core). The MDUC registers will
23062 only be saved if the interrupt handler performs a multiplication or
23063 division operation or it calls another function.
23064
23065 IBM RS/6000 and PowerPC Options
23066
23067 These -m options are defined for the IBM RS/6000 and PowerPC:
23068
23069 -mpowerpc-gpopt
23070 -mno-powerpc-gpopt
23071 -mpowerpc-gfxopt
23072 -mno-powerpc-gfxopt
23073 -mpowerpc64
23074 -mno-powerpc64
23075 -mmfcrf
23076 -mno-mfcrf
23077 -mpopcntb
23078 -mno-popcntb
23079 -mpopcntd
23080 -mno-popcntd
23081 -mfprnd
23082 -mno-fprnd
23083 -mcmpb
23084 -mno-cmpb
23085 -mhard-dfp
23086 -mno-hard-dfp
23087 You use these options to specify which instructions are available
23088 on the processor you are using. The default value of these options
23089 is determined when configuring GCC. Specifying the -mcpu=cpu_type
23090 overrides the specification of these options. We recommend you use
23091 the -mcpu=cpu_type option rather than the options listed above.
23092
23093 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
23094 architecture instructions in the General Purpose group, including
23095 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
23096 to use the optional PowerPC architecture instructions in the
23097 Graphics group, including floating-point select.
23098
23099 The -mmfcrf option allows GCC to generate the move from condition
23100 register field instruction implemented on the POWER4 processor and
23101 other processors that support the PowerPC V2.01 architecture. The
23102 -mpopcntb option allows GCC to generate the popcount and double-
23103 precision FP reciprocal estimate instruction implemented on the
23104 POWER5 processor and other processors that support the PowerPC
23105 V2.02 architecture. The -mpopcntd option allows GCC to generate
23106 the popcount instruction implemented on the POWER7 processor and
23107 other processors that support the PowerPC V2.06 architecture. The
23108 -mfprnd option allows GCC to generate the FP round to integer
23109 instructions implemented on the POWER5+ processor and other
23110 processors that support the PowerPC V2.03 architecture. The -mcmpb
23111 option allows GCC to generate the compare bytes instruction
23112 implemented on the POWER6 processor and other processors that
23113 support the PowerPC V2.05 architecture. The -mhard-dfp option
23114 allows GCC to generate the decimal floating-point instructions
23115 implemented on some POWER processors.
23116
23117 The -mpowerpc64 option allows GCC to generate the additional 64-bit
23118 instructions that are found in the full PowerPC64 architecture and
23119 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23120 -mno-powerpc64.
23121
23122 -mcpu=cpu_type
23123 Set architecture type, register usage, and instruction scheduling
23124 parameters for machine type cpu_type. Supported values for
23125 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
23126 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
23127 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
23128 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
23129 power4, power5, power5+, power6, power6x, power7, power8, power9,
23130 future, powerpc, powerpc64, powerpc64le, rs64, and native.
23131
23132 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
23133 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
23134 64-bit little endian PowerPC architecture machine types, with an
23135 appropriate, generic processor model assumed for scheduling
23136 purposes.
23137
23138 Specifying native as cpu type detects and selects the architecture
23139 option that corresponds to the host processor of the system
23140 performing the compilation. -mcpu=native has no effect if GCC does
23141 not recognize the processor.
23142
23143 The other options specify a specific processor. Code generated
23144 under those options runs best on that processor, and may not run at
23145 all on others.
23146
23147 The -mcpu options automatically enable or disable the following
23148 options:
23149
23150 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
23151 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
23152 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
23153 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
23154 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
23155
23156 The particular options set for any particular CPU varies between
23157 compiler versions, depending on what setting seems to produce
23158 optimal code for that CPU; it doesn't necessarily reflect the
23159 actual hardware's capabilities. If you wish to set an individual
23160 option to a particular value, you may specify it after the -mcpu
23161 option, like -mcpu=970 -mno-altivec.
23162
23163 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
23164 disabled by the -mcpu option at present because AIX does not have
23165 full support for these options. You may still enable or disable
23166 them individually if you're sure it'll work in your environment.
23167
23168 -mtune=cpu_type
23169 Set the instruction scheduling parameters for machine type
23170 cpu_type, but do not set the architecture type or register usage,
23171 as -mcpu=cpu_type does. The same values for cpu_type are used for
23172 -mtune as for -mcpu. If both are specified, the code generated
23173 uses the architecture and registers set by -mcpu, but the
23174 scheduling parameters set by -mtune.
23175
23176 -mcmodel=small
23177 Generate PowerPC64 code for the small model: The TOC is limited to
23178 64k.
23179
23180 -mcmodel=medium
23181 Generate PowerPC64 code for the medium model: The TOC and other
23182 static data may be up to a total of 4G in size. This is the
23183 default for 64-bit Linux.
23184
23185 -mcmodel=large
23186 Generate PowerPC64 code for the large model: The TOC may be up to
23187 4G in size. Other data and code is only limited by the 64-bit
23188 address space.
23189
23190 -maltivec
23191 -mno-altivec
23192 Generate code that uses (does not use) AltiVec instructions, and
23193 also enable the use of built-in functions that allow more direct
23194 access to the AltiVec instruction set. You may also need to set
23195 -mabi=altivec to adjust the current ABI with AltiVec ABI
23196 enhancements.
23197
23198 When -maltivec is used, the element order for AltiVec intrinsics
23199 such as "vec_splat", "vec_extract", and "vec_insert" match array
23200 element order corresponding to the endianness of the target. That
23201 is, element zero identifies the leftmost element in a vector
23202 register when targeting a big-endian platform, and identifies the
23203 rightmost element in a vector register when targeting a little-
23204 endian platform.
23205
23206 -mvrsave
23207 -mno-vrsave
23208 Generate VRSAVE instructions when generating AltiVec code.
23209
23210 -msecure-plt
23211 Generate code that allows ld and ld.so to build executables and
23212 shared libraries with non-executable ".plt" and ".got" sections.
23213 This is a PowerPC 32-bit SYSV ABI option.
23214
23215 -mbss-plt
23216 Generate code that uses a BSS ".plt" section that ld.so fills in,
23217 and requires ".plt" and ".got" sections that are both writable and
23218 executable. This is a PowerPC 32-bit SYSV ABI option.
23219
23220 -misel
23221 -mno-isel
23222 This switch enables or disables the generation of ISEL
23223 instructions.
23224
23225 -mvsx
23226 -mno-vsx
23227 Generate code that uses (does not use) vector/scalar (VSX)
23228 instructions, and also enable the use of built-in functions that
23229 allow more direct access to the VSX instruction set.
23230
23231 -mcrypto
23232 -mno-crypto
23233 Enable the use (disable) of the built-in functions that allow
23234 direct access to the cryptographic instructions that were added in
23235 version 2.07 of the PowerPC ISA.
23236
23237 -mhtm
23238 -mno-htm
23239 Enable (disable) the use of the built-in functions that allow
23240 direct access to the Hardware Transactional Memory (HTM)
23241 instructions that were added in version 2.07 of the PowerPC ISA.
23242
23243 -mpower8-fusion
23244 -mno-power8-fusion
23245 Generate code that keeps (does not keeps) some integer operations
23246 adjacent so that the instructions can be fused together on power8
23247 and later processors.
23248
23249 -mpower8-vector
23250 -mno-power8-vector
23251 Generate code that uses (does not use) the vector and scalar
23252 instructions that were added in version 2.07 of the PowerPC ISA.
23253 Also enable the use of built-in functions that allow more direct
23254 access to the vector instructions.
23255
23256 -mquad-memory
23257 -mno-quad-memory
23258 Generate code that uses (does not use) the non-atomic quad word
23259 memory instructions. The -mquad-memory option requires use of
23260 64-bit mode.
23261
23262 -mquad-memory-atomic
23263 -mno-quad-memory-atomic
23264 Generate code that uses (does not use) the atomic quad word memory
23265 instructions. The -mquad-memory-atomic option requires use of
23266 64-bit mode.
23267
23268 -mfloat128
23269 -mno-float128
23270 Enable/disable the __float128 keyword for IEEE 128-bit floating
23271 point and use either software emulation for IEEE 128-bit floating
23272 point or hardware instructions.
23273
23274 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
23275 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
23276 support. The IEEE 128-bit floating point support only works on
23277 PowerPC Linux systems.
23278
23279 The default for -mfloat128 is enabled on PowerPC Linux systems
23280 using the VSX instruction set, and disabled on other systems.
23281
23282 If you use the ISA 3.0 instruction set (-mpower9-vector or
23283 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
23284 support will also enable the generation of ISA 3.0 IEEE 128-bit
23285 floating point instructions. Otherwise, if you do not specify to
23286 generate ISA 3.0 instructions or you are targeting a 32-bit big
23287 endian system, IEEE 128-bit floating point will be done with
23288 software emulation.
23289
23290 -mfloat128-hardware
23291 -mno-float128-hardware
23292 Enable/disable using ISA 3.0 hardware instructions to support the
23293 __float128 data type.
23294
23295 The default for -mfloat128-hardware is enabled on PowerPC Linux
23296 systems using the ISA 3.0 instruction set, and disabled on other
23297 systems.
23298
23299 -m32
23300 -m64
23301 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23302 targets (including GNU/Linux). The 32-bit environment sets int,
23303 long and pointer to 32 bits and generates code that runs on any
23304 PowerPC variant. The 64-bit environment sets int to 32 bits and
23305 long and pointer to 64 bits, and generates code for PowerPC64, as
23306 for -mpowerpc64.
23307
23308 -mfull-toc
23309 -mno-fp-in-toc
23310 -mno-sum-in-toc
23311 -mminimal-toc
23312 Modify generation of the TOC (Table Of Contents), which is created
23313 for every executable file. The -mfull-toc option is selected by
23314 default. In that case, GCC allocates at least one TOC entry for
23315 each unique non-automatic variable reference in your program. GCC
23316 also places floating-point constants in the TOC. However, only
23317 16,384 entries are available in the TOC.
23318
23319 If you receive a linker error message that saying you have
23320 overflowed the available TOC space, you can reduce the amount of
23321 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
23322 -mno-fp-in-toc prevents GCC from putting floating-point constants
23323 in the TOC and -mno-sum-in-toc forces GCC to generate code to
23324 calculate the sum of an address and a constant at run time instead
23325 of putting that sum into the TOC. You may specify one or both of
23326 these options. Each causes GCC to produce very slightly slower and
23327 larger code at the expense of conserving TOC space.
23328
23329 If you still run out of space in the TOC even when you specify both
23330 of these options, specify -mminimal-toc instead. This option
23331 causes GCC to make only one TOC entry for every file. When you
23332 specify this option, GCC produces code that is slower and larger
23333 but which uses extremely little TOC space. You may wish to use
23334 this option only on files that contain less frequently-executed
23335 code.
23336
23337 -maix64
23338 -maix32
23339 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
23340 64-bit "long" type, and the infrastructure needed to support them.
23341 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
23342 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
23343
23344 -mxl-compat
23345 -mno-xl-compat
23346 Produce code that conforms more closely to IBM XL compiler
23347 semantics when using AIX-compatible ABI. Pass floating-point
23348 arguments to prototyped functions beyond the register save area
23349 (RSA) on the stack in addition to argument FPRs. Do not assume
23350 that most significant double in 128-bit long double value is
23351 properly rounded when comparing values and converting to double.
23352 Use XL symbol names for long double support routines.
23353
23354 The AIX calling convention was extended but not initially
23355 documented to handle an obscure K&R C case of calling a function
23356 that takes the address of its arguments with fewer arguments than
23357 declared. IBM XL compilers access floating-point arguments that do
23358 not fit in the RSA from the stack when a subroutine is compiled
23359 without optimization. Because always storing floating-point
23360 arguments on the stack is inefficient and rarely needed, this
23361 option is not enabled by default and only is necessary when calling
23362 subroutines compiled by IBM XL compilers without optimization.
23363
23364 -mpe
23365 Support IBM RS/6000 SP Parallel Environment (PE). Link an
23366 application written to use message passing with special startup
23367 code to enable the application to run. The system must have PE
23368 installed in the standard location (/usr/lpp/ppe.poe/), or the
23369 specs file must be overridden with the -specs= option to specify
23370 the appropriate directory location. The Parallel Environment does
23371 not support threads, so the -mpe option and the -pthread option are
23372 incompatible.
23373
23374 -malign-natural
23375 -malign-power
23376 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23377 -malign-natural overrides the ABI-defined alignment of larger
23378 types, such as floating-point doubles, on their natural size-based
23379 boundary. The option -malign-power instructs GCC to follow the
23380 ABI-specified alignment rules. GCC defaults to the standard
23381 alignment defined in the ABI.
23382
23383 On 64-bit Darwin, natural alignment is the default, and
23384 -malign-power is not supported.
23385
23386 -msoft-float
23387 -mhard-float
23388 Generate code that does not use (uses) the floating-point register
23389 set. Software floating-point emulation is provided if you use the
23390 -msoft-float option, and pass the option to GCC when linking.
23391
23392 -mmultiple
23393 -mno-multiple
23394 Generate code that uses (does not use) the load multiple word
23395 instructions and the store multiple word instructions. These
23396 instructions are generated by default on POWER systems, and not
23397 generated on PowerPC systems. Do not use -mmultiple on little-
23398 endian PowerPC systems, since those instructions do not work when
23399 the processor is in little-endian mode. The exceptions are PPC740
23400 and PPC750 which permit these instructions in little-endian mode.
23401
23402 -mupdate
23403 -mno-update
23404 Generate code that uses (does not use) the load or store
23405 instructions that update the base register to the address of the
23406 calculated memory location. These instructions are generated by
23407 default. If you use -mno-update, there is a small window between
23408 the time that the stack pointer is updated and the address of the
23409 previous frame is stored, which means code that walks the stack
23410 frame across interrupts or signals may get corrupted data.
23411
23412 -mavoid-indexed-addresses
23413 -mno-avoid-indexed-addresses
23414 Generate code that tries to avoid (not avoid) the use of indexed
23415 load or store instructions. These instructions can incur a
23416 performance penalty on Power6 processors in certain situations,
23417 such as when stepping through large arrays that cross a 16M
23418 boundary. This option is enabled by default when targeting Power6
23419 and disabled otherwise.
23420
23421 -mfused-madd
23422 -mno-fused-madd
23423 Generate code that uses (does not use) the floating-point multiply
23424 and accumulate instructions. These instructions are generated by
23425 default if hardware floating point is used. The machine-dependent
23426 -mfused-madd option is now mapped to the machine-independent
23427 -ffp-contract=fast option, and -mno-fused-madd is mapped to
23428 -ffp-contract=off.
23429
23430 -mmulhw
23431 -mno-mulhw
23432 Generate code that uses (does not use) the half-word multiply and
23433 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
23434 processors. These instructions are generated by default when
23435 targeting those processors.
23436
23437 -mdlmzb
23438 -mno-dlmzb
23439 Generate code that uses (does not use) the string-search dlmzb
23440 instruction on the IBM 405, 440, 464 and 476 processors. This
23441 instruction is generated by default when targeting those
23442 processors.
23443
23444 -mno-bit-align
23445 -mbit-align
23446 On System V.4 and embedded PowerPC systems do not (do) force
23447 structures and unions that contain bit-fields to be aligned to the
23448 base type of the bit-field.
23449
23450 For example, by default a structure containing nothing but 8
23451 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
23452 and has a size of 4 bytes. By using -mno-bit-align, the structure
23453 is aligned to a 1-byte boundary and is 1 byte in size.
23454
23455 -mno-strict-align
23456 -mstrict-align
23457 On System V.4 and embedded PowerPC systems do not (do) assume that
23458 unaligned memory references are handled by the system.
23459
23460 -mrelocatable
23461 -mno-relocatable
23462 Generate code that allows (does not allow) a static executable to
23463 be relocated to a different address at run time. A simple embedded
23464 PowerPC system loader should relocate the entire contents of
23465 ".got2" and 4-byte locations listed in the ".fixup" section, a
23466 table of 32-bit addresses generated by this option. For this to
23467 work, all objects linked together must be compiled with
23468 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
23469 stack to an 8-byte boundary.
23470
23471 -mrelocatable-lib
23472 -mno-relocatable-lib
23473 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
23474 to allow static executables to be relocated at run time, but
23475 -mrelocatable-lib does not use the smaller stack alignment of
23476 -mrelocatable. Objects compiled with -mrelocatable-lib may be
23477 linked with objects compiled with any combination of the
23478 -mrelocatable options.
23479
23480 -mno-toc
23481 -mtoc
23482 On System V.4 and embedded PowerPC systems do not (do) assume that
23483 register 2 contains a pointer to a global area pointing to the
23484 addresses used in the program.
23485
23486 -mlittle
23487 -mlittle-endian
23488 On System V.4 and embedded PowerPC systems compile code for the
23489 processor in little-endian mode. The -mlittle-endian option is the
23490 same as -mlittle.
23491
23492 -mbig
23493 -mbig-endian
23494 On System V.4 and embedded PowerPC systems compile code for the
23495 processor in big-endian mode. The -mbig-endian option is the same
23496 as -mbig.
23497
23498 -mdynamic-no-pic
23499 On Darwin and Mac OS X systems, compile code so that it is not
23500 relocatable, but that its external references are relocatable. The
23501 resulting code is suitable for applications, but not shared
23502 libraries.
23503
23504 -msingle-pic-base
23505 Treat the register used for PIC addressing as read-only, rather
23506 than loading it in the prologue for each function. The runtime
23507 system is responsible for initializing this register with an
23508 appropriate value before execution begins.
23509
23510 -mprioritize-restricted-insns=priority
23511 This option controls the priority that is assigned to dispatch-slot
23512 restricted instructions during the second scheduling pass. The
23513 argument priority takes the value 0, 1, or 2 to assign no, highest,
23514 or second-highest (respectively) priority to dispatch-slot
23515 restricted instructions.
23516
23517 -msched-costly-dep=dependence_type
23518 This option controls which dependences are considered costly by the
23519 target during instruction scheduling. The argument dependence_type
23520 takes one of the following values:
23521
23522 no No dependence is costly.
23523
23524 all All dependences are costly.
23525
23526 true_store_to_load
23527 A true dependence from store to load is costly.
23528
23529 store_to_load
23530 Any dependence from store to load is costly.
23531
23532 number
23533 Any dependence for which the latency is greater than or equal
23534 to number is costly.
23535
23536 -minsert-sched-nops=scheme
23537 This option controls which NOP insertion scheme is used during the
23538 second scheduling pass. The argument scheme takes one of the
23539 following values:
23540
23541 no Don't insert NOPs.
23542
23543 pad Pad with NOPs any dispatch group that has vacant issue slots,
23544 according to the scheduler's grouping.
23545
23546 regroup_exact
23547 Insert NOPs to force costly dependent insns into separate
23548 groups. Insert exactly as many NOPs as needed to force an insn
23549 to a new group, according to the estimated processor grouping.
23550
23551 number
23552 Insert NOPs to force costly dependent insns into separate
23553 groups. Insert number NOPs to force an insn to a new group.
23554
23555 -mcall-sysv
23556 On System V.4 and embedded PowerPC systems compile code using
23557 calling conventions that adhere to the March 1995 draft of the
23558 System V Application Binary Interface, PowerPC processor
23559 supplement. This is the default unless you configured GCC using
23560 powerpc-*-eabiaix.
23561
23562 -mcall-sysv-eabi
23563 -mcall-eabi
23564 Specify both -mcall-sysv and -meabi options.
23565
23566 -mcall-sysv-noeabi
23567 Specify both -mcall-sysv and -mno-eabi options.
23568
23569 -mcall-aixdesc
23570 On System V.4 and embedded PowerPC systems compile code for the AIX
23571 operating system.
23572
23573 -mcall-linux
23574 On System V.4 and embedded PowerPC systems compile code for the
23575 Linux-based GNU system.
23576
23577 -mcall-freebsd
23578 On System V.4 and embedded PowerPC systems compile code for the
23579 FreeBSD operating system.
23580
23581 -mcall-netbsd
23582 On System V.4 and embedded PowerPC systems compile code for the
23583 NetBSD operating system.
23584
23585 -mcall-openbsd
23586 On System V.4 and embedded PowerPC systems compile code for the
23587 OpenBSD operating system.
23588
23589 -mtraceback=traceback_type
23590 Select the type of traceback table. Valid values for traceback_type
23591 are full, part, and no.
23592
23593 -maix-struct-return
23594 Return all structures in memory (as specified by the AIX ABI).
23595
23596 -msvr4-struct-return
23597 Return structures smaller than 8 bytes in registers (as specified
23598 by the SVR4 ABI).
23599
23600 -mabi=abi-type
23601 Extend the current ABI with a particular extension, or remove such
23602 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
23603 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
23604
23605 -mabi=ibmlongdouble
23606 Change the current ABI to use IBM extended-precision long double.
23607 This is not likely to work if your system defaults to using IEEE
23608 extended-precision long double. If you change the long double type
23609 from IEEE extended-precision, the compiler will issue a warning
23610 unless you use the -Wno-psabi option. Requires -mlong-double-128
23611 to be enabled.
23612
23613 -mabi=ieeelongdouble
23614 Change the current ABI to use IEEE extended-precision long double.
23615 This is not likely to work if your system defaults to using IBM
23616 extended-precision long double. If you change the long double type
23617 from IBM extended-precision, the compiler will issue a warning
23618 unless you use the -Wno-psabi option. Requires -mlong-double-128
23619 to be enabled.
23620
23621 -mabi=elfv1
23622 Change the current ABI to use the ELFv1 ABI. This is the default
23623 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
23624 ABI requires special system support and is likely to fail in
23625 spectacular ways.
23626
23627 -mabi=elfv2
23628 Change the current ABI to use the ELFv2 ABI. This is the default
23629 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
23630 ABI requires special system support and is likely to fail in
23631 spectacular ways.
23632
23633 -mgnu-attribute
23634 -mno-gnu-attribute
23635 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23636 .gnu.attributes section that specify ABI variations in function
23637 parameters or return values.
23638
23639 -mprototype
23640 -mno-prototype
23641 On System V.4 and embedded PowerPC systems assume that all calls to
23642 variable argument functions are properly prototyped. Otherwise,
23643 the compiler must insert an instruction before every non-prototyped
23644 call to set or clear bit 6 of the condition code register ("CR") to
23645 indicate whether floating-point values are passed in the floating-
23646 point registers in case the function takes variable arguments.
23647 With -mprototype, only calls to prototyped variable argument
23648 functions set or clear the bit.
23649
23650 -msim
23651 On embedded PowerPC systems, assume that the startup module is
23652 called sim-crt0.o and that the standard C libraries are libsim.a
23653 and libc.a. This is the default for powerpc-*-eabisim
23654 configurations.
23655
23656 -mmvme
23657 On embedded PowerPC systems, assume that the startup module is
23658 called crt0.o and the standard C libraries are libmvme.a and
23659 libc.a.
23660
23661 -mads
23662 On embedded PowerPC systems, assume that the startup module is
23663 called crt0.o and the standard C libraries are libads.a and libc.a.
23664
23665 -myellowknife
23666 On embedded PowerPC systems, assume that the startup module is
23667 called crt0.o and the standard C libraries are libyk.a and libc.a.
23668
23669 -mvxworks
23670 On System V.4 and embedded PowerPC systems, specify that you are
23671 compiling for a VxWorks system.
23672
23673 -memb
23674 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
23675 header to indicate that eabi extended relocations are used.
23676
23677 -meabi
23678 -mno-eabi
23679 On System V.4 and embedded PowerPC systems do (do not) adhere to
23680 the Embedded Applications Binary Interface (EABI), which is a set
23681 of modifications to the System V.4 specifications. Selecting
23682 -meabi means that the stack is aligned to an 8-byte boundary, a
23683 function "__eabi" is called from "main" to set up the EABI
23684 environment, and the -msdata option can use both "r2" and "r13" to
23685 point to two separate small data areas. Selecting -mno-eabi means
23686 that the stack is aligned to a 16-byte boundary, no EABI
23687 initialization function is called from "main", and the -msdata
23688 option only uses "r13" to point to a single small data area. The
23689 -meabi option is on by default if you configured GCC using one of
23690 the powerpc*-*-eabi* options.
23691
23692 -msdata=eabi
23693 On System V.4 and embedded PowerPC systems, put small initialized
23694 "const" global and static data in the ".sdata2" section, which is
23695 pointed to by register "r2". Put small initialized non-"const"
23696 global and static data in the ".sdata" section, which is pointed to
23697 by register "r13". Put small uninitialized global and static data
23698 in the ".sbss" section, which is adjacent to the ".sdata" section.
23699 The -msdata=eabi option is incompatible with the -mrelocatable
23700 option. The -msdata=eabi option also sets the -memb option.
23701
23702 -msdata=sysv
23703 On System V.4 and embedded PowerPC systems, put small global and
23704 static data in the ".sdata" section, which is pointed to by
23705 register "r13". Put small uninitialized global and static data in
23706 the ".sbss" section, which is adjacent to the ".sdata" section.
23707 The -msdata=sysv option is incompatible with the -mrelocatable
23708 option.
23709
23710 -msdata=default
23711 -msdata
23712 On System V.4 and embedded PowerPC systems, if -meabi is used,
23713 compile code the same as -msdata=eabi, otherwise compile code the
23714 same as -msdata=sysv.
23715
23716 -msdata=data
23717 On System V.4 and embedded PowerPC systems, put small global data
23718 in the ".sdata" section. Put small uninitialized global data in
23719 the ".sbss" section. Do not use register "r13" to address small
23720 data however. This is the default behavior unless other -msdata
23721 options are used.
23722
23723 -msdata=none
23724 -mno-sdata
23725 On embedded PowerPC systems, put all initialized global and static
23726 data in the ".data" section, and all uninitialized data in the
23727 ".bss" section.
23728
23729 -mreadonly-in-sdata
23730 Put read-only objects in the ".sdata" section as well. This is the
23731 default.
23732
23733 -mblock-move-inline-limit=num
23734 Inline all block moves (such as calls to "memcpy" or structure
23735 copies) less than or equal to num bytes. The minimum value for num
23736 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
23737 default value is target-specific.
23738
23739 -mblock-compare-inline-limit=num
23740 Generate non-looping inline code for all block compares (such as
23741 calls to "memcmp" or structure compares) less than or equal to num
23742 bytes. If num is 0, all inline expansion (non-loop and loop) of
23743 block compare is disabled. The default value is target-specific.
23744
23745 -mblock-compare-inline-loop-limit=num
23746 Generate an inline expansion using loop code for all block compares
23747 that are less than or equal to num bytes, but greater than the
23748 limit for non-loop inline block compare expansion. If the block
23749 length is not constant, at most num bytes will be compared before
23750 "memcmp" is called to compare the remainder of the block. The
23751 default value is target-specific.
23752
23753 -mstring-compare-inline-limit=num
23754 Compare at most num string bytes with inline code. If the
23755 difference or end of string is not found at the end of the inline
23756 compare a call to "strcmp" or "strncmp" will take care of the rest
23757 of the comparison. The default is 64 bytes.
23758
23759 -G num
23760 On embedded PowerPC systems, put global and static items less than
23761 or equal to num bytes into the small data or BSS sections instead
23762 of the normal data or BSS section. By default, num is 8. The -G
23763 num switch is also passed to the linker. All modules should be
23764 compiled with the same -G num value.
23765
23766 -mregnames
23767 -mno-regnames
23768 On System V.4 and embedded PowerPC systems do (do not) emit
23769 register names in the assembly language output using symbolic
23770 forms.
23771
23772 -mlongcall
23773 -mno-longcall
23774 By default assume that all calls are far away so that a longer and
23775 more expensive calling sequence is required. This is required for
23776 calls farther than 32 megabytes (33,554,432 bytes) from the current
23777 location. A short call is generated if the compiler knows the call
23778 cannot be that far away. This setting can be overridden by the
23779 "shortcall" function attribute, or by "#pragma longcall(0)".
23780
23781 Some linkers are capable of detecting out-of-range calls and
23782 generating glue code on the fly. On these systems, long calls are
23783 unnecessary and generate slower code. As of this writing, the AIX
23784 linker can do this, as can the GNU linker for PowerPC/64. It is
23785 planned to add this feature to the GNU linker for 32-bit PowerPC
23786 systems as well.
23787
23788 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
23789 linkers, GCC can generate long calls using an inline PLT call
23790 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
23791 ELFv1 (big-endian) do not support inline PLT calls.
23792
23793 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
23794 L42", plus a branch island (glue code). The two target addresses
23795 represent the callee and the branch island. The Darwin/PPC linker
23796 prefers the first address and generates a "bl callee" if the PPC
23797 "bl" instruction reaches the callee directly; otherwise, the linker
23798 generates "bl L42" to call the branch island. The branch island is
23799 appended to the body of the calling function; it computes the full
23800 32-bit address of the callee and jumps to it.
23801
23802 On Mach-O (Darwin) systems, this option directs the compiler emit
23803 to the glue for every direct call, and the Darwin linker decides
23804 whether to use or discard it.
23805
23806 In the future, GCC may ignore all longcall specifications when the
23807 linker is known to generate glue.
23808
23809 -mpltseq
23810 -mno-pltseq
23811 Implement (do not implement) -fno-plt and long calls using an
23812 inline PLT call sequence that supports lazy linking and long calls
23813 to functions in dlopen'd shared libraries. Inline PLT calls are
23814 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
23815 newer GNU linkers, and are enabled by default if the support is
23816 detected when configuring GCC, and, in the case of 32-bit PowerPC,
23817 if GCC is configured with --enable-secureplt. -mpltseq code and
23818 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
23819 together.
23820
23821 -mtls-markers
23822 -mno-tls-markers
23823 Mark (do not mark) calls to "__tls_get_addr" with a relocation
23824 specifying the function argument. The relocation allows the linker
23825 to reliably associate function call with argument setup
23826 instructions for TLS optimization, which in turn allows GCC to
23827 better schedule the sequence.
23828
23829 -mrecip
23830 -mno-recip
23831 This option enables use of the reciprocal estimate and reciprocal
23832 square root estimate instructions with additional Newton-Raphson
23833 steps to increase precision instead of doing a divide or square
23834 root and divide for floating-point arguments. You should use the
23835 -ffast-math option when using -mrecip (or at least
23836 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
23837 and -fno-trapping-math). Note that while the throughput of the
23838 sequence is generally higher than the throughput of the non-
23839 reciprocal instruction, the precision of the sequence can be
23840 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
23841 0.99999994) for reciprocal square roots.
23842
23843 -mrecip=opt
23844 This option controls which reciprocal estimate instructions may be
23845 used. opt is a comma-separated list of options, which may be
23846 preceded by a "!" to invert the option:
23847
23848 all Enable all estimate instructions.
23849
23850 default
23851 Enable the default instructions, equivalent to -mrecip.
23852
23853 none
23854 Disable all estimate instructions, equivalent to -mno-recip.
23855
23856 div Enable the reciprocal approximation instructions for both
23857 single and double precision.
23858
23859 divf
23860 Enable the single-precision reciprocal approximation
23861 instructions.
23862
23863 divd
23864 Enable the double-precision reciprocal approximation
23865 instructions.
23866
23867 rsqrt
23868 Enable the reciprocal square root approximation instructions
23869 for both single and double precision.
23870
23871 rsqrtf
23872 Enable the single-precision reciprocal square root
23873 approximation instructions.
23874
23875 rsqrtd
23876 Enable the double-precision reciprocal square root
23877 approximation instructions.
23878
23879 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
23880 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
23881 "XVRSQRTEDP" instructions which handle the double-precision
23882 reciprocal square root calculations.
23883
23884 -mrecip-precision
23885 -mno-recip-precision
23886 Assume (do not assume) that the reciprocal estimate instructions
23887 provide higher-precision estimates than is mandated by the PowerPC
23888 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
23889 automatically selects -mrecip-precision. The double-precision
23890 square root estimate instructions are not generated by default on
23891 low-precision machines, since they do not provide an estimate that
23892 converges after three steps.
23893
23894 -mveclibabi=type
23895 Specifies the ABI type to use for vectorizing intrinsics using an
23896 external library. The only type supported at present is mass,
23897 which specifies to use IBM's Mathematical Acceleration Subsystem
23898 (MASS) libraries for vectorizing intrinsics using external
23899 libraries. GCC currently emits calls to "acosd2", "acosf4",
23900 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
23901 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
23902 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
23903 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
23904 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
23905 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
23906 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
23907 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
23908 "tanhf4" when generating code for power7. Both -ftree-vectorize
23909 and -funsafe-math-optimizations must also be enabled. The MASS
23910 libraries must be specified at link time.
23911
23912 -mfriz
23913 -mno-friz
23914 Generate (do not generate) the "friz" instruction when the
23915 -funsafe-math-optimizations option is used to optimize rounding of
23916 floating-point values to 64-bit integer and back to floating point.
23917 The "friz" instruction does not return the same value if the
23918 floating-point number is too large to fit in an integer.
23919
23920 -mpointers-to-nested-functions
23921 -mno-pointers-to-nested-functions
23922 Generate (do not generate) code to load up the static chain
23923 register ("r11") when calling through a pointer on AIX and 64-bit
23924 Linux systems where a function pointer points to a 3-word
23925 descriptor giving the function address, TOC value to be loaded in
23926 register "r2", and static chain value to be loaded in register
23927 "r11". The -mpointers-to-nested-functions is on by default. You
23928 cannot call through pointers to nested functions or pointers to
23929 functions compiled in other languages that use the static chain if
23930 you use -mno-pointers-to-nested-functions.
23931
23932 -msave-toc-indirect
23933 -mno-save-toc-indirect
23934 Generate (do not generate) code to save the TOC value in the
23935 reserved stack location in the function prologue if the function
23936 calls through a pointer on AIX and 64-bit Linux systems. If the
23937 TOC value is not saved in the prologue, it is saved just before the
23938 call through the pointer. The -mno-save-toc-indirect option is the
23939 default.
23940
23941 -mcompat-align-parm
23942 -mno-compat-align-parm
23943 Generate (do not generate) code to pass structure parameters with a
23944 maximum alignment of 64 bits, for compatibility with older versions
23945 of GCC.
23946
23947 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23948 structure parameter on a 128-bit boundary when that structure
23949 contained a member requiring 128-bit alignment. This is corrected
23950 in more recent versions of GCC. This option may be used to
23951 generate code that is compatible with functions compiled with older
23952 versions of GCC.
23953
23954 The -mno-compat-align-parm option is the default.
23955
23956 -mstack-protector-guard=guard
23957 -mstack-protector-guard-reg=reg
23958 -mstack-protector-guard-offset=offset
23959 -mstack-protector-guard-symbol=symbol
23960 Generate stack protection code using canary at guard. Supported
23961 locations are global for global canary or tls for per-thread canary
23962 in the TLS block (the default with GNU libc version 2.4 or later).
23963
23964 With the latter choice the options -mstack-protector-guard-reg=reg
23965 and -mstack-protector-guard-offset=offset furthermore specify which
23966 register to use as base register for reading the canary, and from
23967 what offset from that base register. The default for those is as
23968 specified in the relevant ABI.
23969 -mstack-protector-guard-symbol=symbol overrides the offset with a
23970 symbol reference to a canary in the TLS block.
23971
23972 -mpcrel
23973 -mno-pcrel
23974 Generate (do not generate) pc-relative addressing when the option
23975 -mcpu=future is used. The -mpcrel option requires that the medium
23976 code model (-mcmodel=medium) and prefixed addressing (-mprefixed)
23977 options are enabled.
23978
23979 -mprefixed
23980 -mno-prefixed
23981 Generate (do not generate) addressing modes using prefixed load and
23982 store instructions when the option -mcpu=future is used.
23983
23984 -mmma
23985 -mno-mma
23986 Generate (do not generate) the MMA instructions when the option
23987 -mcpu=future is used.
23988
23989 -mrop-protect
23990 -mno-rop-protect
23991 Generate (do not generate) ROP protection instructions when the
23992 target processor supports them. Currently this option disables the
23993 shrink-wrap optimization (-fshrink-wrap).
23994
23995 -mprivileged
23996 -mno-privileged
23997 Generate (do not generate) code that will run in privileged state.
23998
23999 -mblock-ops-unaligned-vsx
24000 -mno-block-ops-unaligned-vsx
24001 Generate (do not generate) unaligned vsx loads and stores for
24002 inline expansion of "memcpy" and "memmove".
24003
24004 RX Options
24005
24006 These command-line options are defined for RX targets:
24007
24008 -m64bit-doubles
24009 -m32bit-doubles
24010 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24011 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
24012 RX floating-point hardware only works on 32-bit values, which is
24013 why the default is -m32bit-doubles.
24014
24015 -fpu
24016 -nofpu
24017 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
24018 hardware. The default is enabled for the RX600 series and disabled
24019 for the RX200 series.
24020
24021 Floating-point instructions are only generated for 32-bit floating-
24022 point values, however, so the FPU hardware is not used for doubles
24023 if the -m64bit-doubles option is used.
24024
24025 Note If the -fpu option is enabled then -funsafe-math-optimizations
24026 is also enabled automatically. This is because the RX FPU
24027 instructions are themselves unsafe.
24028
24029 -mcpu=name
24030 Selects the type of RX CPU to be targeted. Currently three types
24031 are supported, the generic RX600 and RX200 series hardware and the
24032 specific RX610 CPU. The default is RX600.
24033
24034 The only difference between RX600 and RX610 is that the RX610 does
24035 not support the "MVTIPL" instruction.
24036
24037 The RX200 series does not have a hardware floating-point unit and
24038 so -nofpu is enabled by default when this type is selected.
24039
24040 -mbig-endian-data
24041 -mlittle-endian-data
24042 Store data (but not code) in the big-endian format. The default is
24043 -mlittle-endian-data, i.e. to store data in the little-endian
24044 format.
24045
24046 -msmall-data-limit=N
24047 Specifies the maximum size in bytes of global and static variables
24048 which can be placed into the small data area. Using the small data
24049 area can lead to smaller and faster code, but the size of area is
24050 limited and it is up to the programmer to ensure that the area does
24051 not overflow. Also when the small data area is used one of the
24052 RX's registers (usually "r13") is reserved for use pointing to this
24053 area, so it is no longer available for use by the compiler. This
24054 could result in slower and/or larger code if variables are pushed
24055 onto the stack instead of being held in this register.
24056
24057 Note, common variables (variables that have not been initialized)
24058 and constants are not placed into the small data area as they are
24059 assigned to other sections in the output executable.
24060
24061 The default value is zero, which disables this feature. Note, this
24062 feature is not enabled by default with higher optimization levels
24063 (-O2 etc) because of the potentially detrimental effects of
24064 reserving a register. It is up to the programmer to experiment and
24065 discover whether this feature is of benefit to their program. See
24066 the description of the -mpid option for a description of how the
24067 actual register to hold the small data area pointer is chosen.
24068
24069 -msim
24070 -mno-sim
24071 Use the simulator runtime. The default is to use the libgloss
24072 board-specific runtime.
24073
24074 -mas100-syntax
24075 -mno-as100-syntax
24076 When generating assembler output use a syntax that is compatible
24077 with Renesas's AS100 assembler. This syntax can also be handled by
24078 the GAS assembler, but it has some restrictions so it is not
24079 generated by default.
24080
24081 -mmax-constant-size=N
24082 Specifies the maximum size, in bytes, of a constant that can be
24083 used as an operand in a RX instruction. Although the RX
24084 instruction set does allow constants of up to 4 bytes in length to
24085 be used in instructions, a longer value equates to a longer
24086 instruction. Thus in some circumstances it can be beneficial to
24087 restrict the size of constants that are used in instructions.
24088 Constants that are too big are instead placed into a constant pool
24089 and referenced via register indirection.
24090
24091 The value N can be between 0 and 4. A value of 0 (the default) or
24092 4 means that constants of any size are allowed.
24093
24094 -mrelax
24095 Enable linker relaxation. Linker relaxation is a process whereby
24096 the linker attempts to reduce the size of a program by finding
24097 shorter versions of various instructions. Disabled by default.
24098
24099 -mint-register=N
24100 Specify the number of registers to reserve for fast interrupt
24101 handler functions. The value N can be between 0 and 4. A value of
24102 1 means that register "r13" is reserved for the exclusive use of
24103 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
24104 value of 3 reserves "r13", "r12" and "r11", and a value of 4
24105 reserves "r13" through "r10". A value of 0, the default, does not
24106 reserve any registers.
24107
24108 -msave-acc-in-interrupts
24109 Specifies that interrupt handler functions should preserve the
24110 accumulator register. This is only necessary if normal code might
24111 use the accumulator register, for example because it performs
24112 64-bit multiplications. The default is to ignore the accumulator
24113 as this makes the interrupt handlers faster.
24114
24115 -mpid
24116 -mno-pid
24117 Enables the generation of position independent data. When enabled
24118 any access to constant data is done via an offset from a base
24119 address held in a register. This allows the location of constant
24120 data to be determined at run time without requiring the executable
24121 to be relocated, which is a benefit to embedded applications with
24122 tight memory constraints. Data that can be modified is not
24123 affected by this option.
24124
24125 Note, using this feature reserves a register, usually "r13", for
24126 the constant data base address. This can result in slower and/or
24127 larger code, especially in complicated functions.
24128
24129 The actual register chosen to hold the constant data base address
24130 depends upon whether the -msmall-data-limit and/or the
24131 -mint-register command-line options are enabled. Starting with
24132 register "r13" and proceeding downwards, registers are allocated
24133 first to satisfy the requirements of -mint-register, then -mpid and
24134 finally -msmall-data-limit. Thus it is possible for the small data
24135 area register to be "r8" if both -mint-register=4 and -mpid are
24136 specified on the command line.
24137
24138 By default this feature is not enabled. The default can be
24139 restored via the -mno-pid command-line option.
24140
24141 -mno-warn-multiple-fast-interrupts
24142 -mwarn-multiple-fast-interrupts
24143 Prevents GCC from issuing a warning message if it finds more than
24144 one fast interrupt handler when it is compiling a file. The
24145 default is to issue a warning for each extra fast interrupt handler
24146 found, as the RX only supports one such interrupt.
24147
24148 -mallow-string-insns
24149 -mno-allow-string-insns
24150 Enables or disables the use of the string manipulation instructions
24151 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
24152 "RMPA" instruction. These instructions may prefetch data, which is
24153 not safe to do if accessing an I/O register. (See section 12.2.7
24154 of the RX62N Group User's Manual for more information).
24155
24156 The default is to allow these instructions, but it is not possible
24157 for GCC to reliably detect all circumstances where a string
24158 instruction might be used to access an I/O register, so their use
24159 cannot be disabled automatically. Instead it is reliant upon the
24160 programmer to use the -mno-allow-string-insns option if their
24161 program accesses I/O space.
24162
24163 When the instructions are enabled GCC defines the C preprocessor
24164 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
24165 "__RX_DISALLOW_STRING_INSNS__".
24166
24167 -mjsr
24168 -mno-jsr
24169 Use only (or not only) "JSR" instructions to access functions.
24170 This option can be used when code size exceeds the range of "BSR"
24171 instructions. Note that -mno-jsr does not mean to not use "JSR"
24172 but instead means that any type of branch may be used.
24173
24174 Note: The generic GCC command-line option -ffixed-reg has special
24175 significance to the RX port when used with the "interrupt" function
24176 attribute. This attribute indicates a function intended to process
24177 fast interrupts. GCC ensures that it only uses the registers "r10",
24178 "r11", "r12" and/or "r13" and only provided that the normal use of the
24179 corresponding registers have been restricted via the -ffixed-reg or
24180 -mint-register command-line options.
24181
24182 S/390 and zSeries Options
24183
24184 These are the -m options defined for the S/390 and zSeries
24185 architecture.
24186
24187 -mhard-float
24188 -msoft-float
24189 Use (do not use) the hardware floating-point instructions and
24190 registers for floating-point operations. When -msoft-float is
24191 specified, functions in libgcc.a are used to perform floating-point
24192 operations. When -mhard-float is specified, the compiler generates
24193 IEEE floating-point instructions. This is the default.
24194
24195 -mhard-dfp
24196 -mno-hard-dfp
24197 Use (do not use) the hardware decimal-floating-point instructions
24198 for decimal-floating-point operations. When -mno-hard-dfp is
24199 specified, functions in libgcc.a are used to perform decimal-
24200 floating-point operations. When -mhard-dfp is specified, the
24201 compiler generates decimal-floating-point hardware instructions.
24202 This is the default for -march=z9-ec or higher.
24203
24204 -mlong-double-64
24205 -mlong-double-128
24206 These switches control the size of "long double" type. A size of 64
24207 bits makes the "long double" type equivalent to the "double" type.
24208 This is the default.
24209
24210 -mbackchain
24211 -mno-backchain
24212 Store (do not store) the address of the caller's frame as backchain
24213 pointer into the callee's stack frame. A backchain may be needed
24214 to allow debugging using tools that do not understand DWARF call
24215 frame information. When -mno-packed-stack is in effect, the
24216 backchain pointer is stored at the bottom of the stack frame; when
24217 -mpacked-stack is in effect, the backchain is placed into the
24218 topmost word of the 96/160 byte register save area.
24219
24220 In general, code compiled with -mbackchain is call-compatible with
24221 code compiled with -mno-backchain; however, use of the backchain
24222 for debugging purposes usually requires that the whole binary is
24223 built with -mbackchain. Note that the combination of -mbackchain,
24224 -mpacked-stack and -mhard-float is not supported. In order to
24225 build a linux kernel use -msoft-float.
24226
24227 The default is to not maintain the backchain.
24228
24229 -mpacked-stack
24230 -mno-packed-stack
24231 Use (do not use) the packed stack layout. When -mno-packed-stack
24232 is specified, the compiler uses the all fields of the 96/160 byte
24233 register save area only for their default purpose; unused fields
24234 still take up stack space. When -mpacked-stack is specified,
24235 register save slots are densely packed at the top of the register
24236 save area; unused space is reused for other purposes, allowing for
24237 more efficient use of the available stack space. However, when
24238 -mbackchain is also in effect, the topmost word of the save area is
24239 always used to store the backchain, and the return address register
24240 is always saved two words below the backchain.
24241
24242 As long as the stack frame backchain is not used, code generated
24243 with -mpacked-stack is call-compatible with code generated with
24244 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
24245 S/390 or zSeries generated code that uses the stack frame backchain
24246 at run time, not just for debugging purposes. Such code is not
24247 call-compatible with code compiled with -mpacked-stack. Also, note
24248 that the combination of -mbackchain, -mpacked-stack and
24249 -mhard-float is not supported. In order to build a linux kernel
24250 use -msoft-float.
24251
24252 The default is to not use the packed stack layout.
24253
24254 -msmall-exec
24255 -mno-small-exec
24256 Generate (or do not generate) code using the "bras" instruction to
24257 do subroutine calls. This only works reliably if the total
24258 executable size does not exceed 64k. The default is to use the
24259 "basr" instruction instead, which does not have this limitation.
24260
24261 -m64
24262 -m31
24263 When -m31 is specified, generate code compliant to the GNU/Linux
24264 for S/390 ABI. When -m64 is specified, generate code compliant to
24265 the GNU/Linux for zSeries ABI. This allows GCC in particular to
24266 generate 64-bit instructions. For the s390 targets, the default is
24267 -m31, while the s390x targets default to -m64.
24268
24269 -mzarch
24270 -mesa
24271 When -mzarch is specified, generate code using the instructions
24272 available on z/Architecture. When -mesa is specified, generate
24273 code using the instructions available on ESA/390. Note that -mesa
24274 is not possible with -m64. When generating code compliant to the
24275 GNU/Linux for S/390 ABI, the default is -mesa. When generating
24276 code compliant to the GNU/Linux for zSeries ABI, the default is
24277 -mzarch.
24278
24279 -mhtm
24280 -mno-htm
24281 The -mhtm option enables a set of builtins making use of
24282 instructions available with the transactional execution facility
24283 introduced with the IBM zEnterprise EC12 machine generation S/390
24284 System z Built-in Functions. -mhtm is enabled by default when
24285 using -march=zEC12.
24286
24287 -mvx
24288 -mno-vx
24289 When -mvx is specified, generate code using the instructions
24290 available with the vector extension facility introduced with the
24291 IBM z13 machine generation. This option changes the ABI for some
24292 vector type values with regard to alignment and calling
24293 conventions. In case vector type values are being used in an ABI-
24294 relevant context a GAS .gnu_attribute command will be added to mark
24295 the resulting binary with the ABI used. -mvx is enabled by default
24296 when using -march=z13.
24297
24298 -mzvector
24299 -mno-zvector
24300 The -mzvector option enables vector language extensions and
24301 builtins using instructions available with the vector extension
24302 facility introduced with the IBM z13 machine generation. This
24303 option adds support for vector to be used as a keyword to define
24304 vector type variables and arguments. vector is only available when
24305 GNU extensions are enabled. It will not be expanded when
24306 requesting strict standard compliance e.g. with -std=c99. In
24307 addition to the GCC low-level builtins -mzvector enables a set of
24308 builtins added for compatibility with AltiVec-style implementations
24309 like Power and Cell. In order to make use of these builtins the
24310 header file vecintrin.h needs to be included. -mzvector is
24311 disabled by default.
24312
24313 -mmvcle
24314 -mno-mvcle
24315 Generate (or do not generate) code using the "mvcle" instruction to
24316 perform block moves. When -mno-mvcle is specified, use a "mvc"
24317 loop instead. This is the default unless optimizing for size.
24318
24319 -mdebug
24320 -mno-debug
24321 Print (or do not print) additional debug information when
24322 compiling. The default is to not print debug information.
24323
24324 -march=cpu-type
24325 Generate code that runs on cpu-type, which is the name of a system
24326 representing a certain processor type. Possible values for cpu-
24327 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
24328 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, and native.
24329
24330 The default is -march=z900.
24331
24332 Specifying native as cpu type can be used to select the best
24333 architecture option for the host processor. -march=native has no
24334 effect if GCC does not recognize the processor.
24335
24336 -mtune=cpu-type
24337 Tune to cpu-type everything applicable about the generated code,
24338 except for the ABI and the set of available instructions. The list
24339 of cpu-type values is the same as for -march. The default is the
24340 value used for -march.
24341
24342 -mtpf-trace
24343 -mno-tpf-trace
24344 Generate code that adds (does not add) in TPF OS specific branches
24345 to trace routines in the operating system. This option is off by
24346 default, even when compiling for the TPF OS.
24347
24348 -mtpf-trace-skip
24349 -mno-tpf-trace-skip
24350 Generate code that changes (does not change) the default branch
24351 targets enabled by -mtpf-trace to point to specialized trace
24352 routines providing the ability of selectively skipping function
24353 trace entries for the TPF OS. This option is off by default, even
24354 when compiling for the TPF OS and specifying -mtpf-trace.
24355
24356 -mfused-madd
24357 -mno-fused-madd
24358 Generate code that uses (does not use) the floating-point multiply
24359 and accumulate instructions. These instructions are generated by
24360 default if hardware floating point is used.
24361
24362 -mwarn-framesize=framesize
24363 Emit a warning if the current function exceeds the given frame
24364 size. Because this is a compile-time check it doesn't need to be a
24365 real problem when the program runs. It is intended to identify
24366 functions that most probably cause a stack overflow. It is useful
24367 to be used in an environment with limited stack size e.g. the linux
24368 kernel.
24369
24370 -mwarn-dynamicstack
24371 Emit a warning if the function calls "alloca" or uses dynamically-
24372 sized arrays. This is generally a bad idea with a limited stack
24373 size.
24374
24375 -mstack-guard=stack-guard
24376 -mstack-size=stack-size
24377 If these options are provided the S/390 back end emits additional
24378 instructions in the function prologue that trigger a trap if the
24379 stack size is stack-guard bytes above the stack-size (remember that
24380 the stack on S/390 grows downward). If the stack-guard option is
24381 omitted the smallest power of 2 larger than the frame size of the
24382 compiled function is chosen. These options are intended to be used
24383 to help debugging stack overflow problems. The additionally
24384 emitted code causes only little overhead and hence can also be used
24385 in production-like systems without greater performance degradation.
24386 The given values have to be exact powers of 2 and stack-size has to
24387 be greater than stack-guard without exceeding 64k. In order to be
24388 efficient the extra code makes the assumption that the stack starts
24389 at an address aligned to the value given by stack-size. The stack-
24390 guard option can only be used in conjunction with stack-size.
24391
24392 -mhotpatch=pre-halfwords,post-halfwords
24393 If the hotpatch option is enabled, a "hot-patching" function
24394 prologue is generated for all functions in the compilation unit.
24395 The funtion label is prepended with the given number of two-byte
24396 NOP instructions (pre-halfwords, maximum 1000000). After the
24397 label, 2 * post-halfwords bytes are appended, using the largest NOP
24398 like instructions the architecture allows (maximum 1000000).
24399
24400 If both arguments are zero, hotpatching is disabled.
24401
24402 This option can be overridden for individual functions with the
24403 "hotpatch" attribute.
24404
24405 Score Options
24406
24407 These options are defined for Score implementations:
24408
24409 -meb
24410 Compile code for big-endian mode. This is the default.
24411
24412 -mel
24413 Compile code for little-endian mode.
24414
24415 -mnhwloop
24416 Disable generation of "bcnz" instructions.
24417
24418 -muls
24419 Enable generation of unaligned load and store instructions.
24420
24421 -mmac
24422 Enable the use of multiply-accumulate instructions. Disabled by
24423 default.
24424
24425 -mscore5
24426 Specify the SCORE5 as the target architecture.
24427
24428 -mscore5u
24429 Specify the SCORE5U of the target architecture.
24430
24431 -mscore7
24432 Specify the SCORE7 as the target architecture. This is the default.
24433
24434 -mscore7d
24435 Specify the SCORE7D as the target architecture.
24436
24437 SH Options
24438
24439 These -m options are defined for the SH implementations:
24440
24441 -m1 Generate code for the SH1.
24442
24443 -m2 Generate code for the SH2.
24444
24445 -m2e
24446 Generate code for the SH2e.
24447
24448 -m2a-nofpu
24449 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
24450 way that the floating-point unit is not used.
24451
24452 -m2a-single-only
24453 Generate code for the SH2a-FPU, in such a way that no double-
24454 precision floating-point operations are used.
24455
24456 -m2a-single
24457 Generate code for the SH2a-FPU assuming the floating-point unit is
24458 in single-precision mode by default.
24459
24460 -m2a
24461 Generate code for the SH2a-FPU assuming the floating-point unit is
24462 in double-precision mode by default.
24463
24464 -m3 Generate code for the SH3.
24465
24466 -m3e
24467 Generate code for the SH3e.
24468
24469 -m4-nofpu
24470 Generate code for the SH4 without a floating-point unit.
24471
24472 -m4-single-only
24473 Generate code for the SH4 with a floating-point unit that only
24474 supports single-precision arithmetic.
24475
24476 -m4-single
24477 Generate code for the SH4 assuming the floating-point unit is in
24478 single-precision mode by default.
24479
24480 -m4 Generate code for the SH4.
24481
24482 -m4-100
24483 Generate code for SH4-100.
24484
24485 -m4-100-nofpu
24486 Generate code for SH4-100 in such a way that the floating-point
24487 unit is not used.
24488
24489 -m4-100-single
24490 Generate code for SH4-100 assuming the floating-point unit is in
24491 single-precision mode by default.
24492
24493 -m4-100-single-only
24494 Generate code for SH4-100 in such a way that no double-precision
24495 floating-point operations are used.
24496
24497 -m4-200
24498 Generate code for SH4-200.
24499
24500 -m4-200-nofpu
24501 Generate code for SH4-200 without in such a way that the floating-
24502 point unit is not used.
24503
24504 -m4-200-single
24505 Generate code for SH4-200 assuming the floating-point unit is in
24506 single-precision mode by default.
24507
24508 -m4-200-single-only
24509 Generate code for SH4-200 in such a way that no double-precision
24510 floating-point operations are used.
24511
24512 -m4-300
24513 Generate code for SH4-300.
24514
24515 -m4-300-nofpu
24516 Generate code for SH4-300 without in such a way that the floating-
24517 point unit is not used.
24518
24519 -m4-300-single
24520 Generate code for SH4-300 in such a way that no double-precision
24521 floating-point operations are used.
24522
24523 -m4-300-single-only
24524 Generate code for SH4-300 in such a way that no double-precision
24525 floating-point operations are used.
24526
24527 -m4-340
24528 Generate code for SH4-340 (no MMU, no FPU).
24529
24530 -m4-500
24531 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
24532 assembler.
24533
24534 -m4a-nofpu
24535 Generate code for the SH4al-dsp, or for a SH4a in such a way that
24536 the floating-point unit is not used.
24537
24538 -m4a-single-only
24539 Generate code for the SH4a, in such a way that no double-precision
24540 floating-point operations are used.
24541
24542 -m4a-single
24543 Generate code for the SH4a assuming the floating-point unit is in
24544 single-precision mode by default.
24545
24546 -m4a
24547 Generate code for the SH4a.
24548
24549 -m4al
24550 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
24551 assembler. GCC doesn't generate any DSP instructions at the
24552 moment.
24553
24554 -mb Compile code for the processor in big-endian mode.
24555
24556 -ml Compile code for the processor in little-endian mode.
24557
24558 -mdalign
24559 Align doubles at 64-bit boundaries. Note that this changes the
24560 calling conventions, and thus some functions from the standard C
24561 library do not work unless you recompile it first with -mdalign.
24562
24563 -mrelax
24564 Shorten some address references at link time, when possible; uses
24565 the linker option -relax.
24566
24567 -mbigtable
24568 Use 32-bit offsets in "switch" tables. The default is to use
24569 16-bit offsets.
24570
24571 -mbitops
24572 Enable the use of bit manipulation instructions on SH2A.
24573
24574 -mfmovd
24575 Enable the use of the instruction "fmovd". Check -mdalign for
24576 alignment constraints.
24577
24578 -mrenesas
24579 Comply with the calling conventions defined by Renesas.
24580
24581 -mno-renesas
24582 Comply with the calling conventions defined for GCC before the
24583 Renesas conventions were available. This option is the default for
24584 all targets of the SH toolchain.
24585
24586 -mnomacsave
24587 Mark the "MAC" register as call-clobbered, even if -mrenesas is
24588 given.
24589
24590 -mieee
24591 -mno-ieee
24592 Control the IEEE compliance of floating-point comparisons, which
24593 affects the handling of cases where the result of a comparison is
24594 unordered. By default -mieee is implicitly enabled. If
24595 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
24596 results in faster floating-point greater-equal and less-equal
24597 comparisons. The implicit settings can be overridden by specifying
24598 either -mieee or -mno-ieee.
24599
24600 -minline-ic_invalidate
24601 Inline code to invalidate instruction cache entries after setting
24602 up nested function trampolines. This option has no effect if
24603 -musermode is in effect and the selected code generation option
24604 (e.g. -m4) does not allow the use of the "icbi" instruction. If
24605 the selected code generation option does not allow the use of the
24606 "icbi" instruction, and -musermode is not in effect, the inlined
24607 code manipulates the instruction cache address array directly with
24608 an associative write. This not only requires privileged mode at
24609 run time, but it also fails if the cache line had been mapped via
24610 the TLB and has become unmapped.
24611
24612 -misize
24613 Dump instruction size and location in the assembly code.
24614
24615 -mpadstruct
24616 This option is deprecated. It pads structures to multiple of 4
24617 bytes, which is incompatible with the SH ABI.
24618
24619 -matomic-model=model
24620 Sets the model of atomic operations and additional parameters as a
24621 comma separated list. For details on the atomic built-in functions
24622 see __atomic Builtins. The following models and parameters are
24623 supported:
24624
24625 none
24626 Disable compiler generated atomic sequences and emit library
24627 calls for atomic operations. This is the default if the target
24628 is not "sh*-*-linux*".
24629
24630 soft-gusa
24631 Generate GNU/Linux compatible gUSA software atomic sequences
24632 for the atomic built-in functions. The generated atomic
24633 sequences require additional support from the
24634 interrupt/exception handling code of the system and are only
24635 suitable for SH3* and SH4* single-core systems. This option is
24636 enabled by default when the target is "sh*-*-linux*" and SH3*
24637 or SH4*. When the target is SH4A, this option also partially
24638 utilizes the hardware atomic instructions "movli.l" and
24639 "movco.l" to create more efficient code, unless strict is
24640 specified.
24641
24642 soft-tcb
24643 Generate software atomic sequences that use a variable in the
24644 thread control block. This is a variation of the gUSA
24645 sequences which can also be used on SH1* and SH2* targets. The
24646 generated atomic sequences require additional support from the
24647 interrupt/exception handling code of the system and are only
24648 suitable for single-core systems. When using this model, the
24649 gbr-offset= parameter has to be specified as well.
24650
24651 soft-imask
24652 Generate software atomic sequences that temporarily disable
24653 interrupts by setting "SR.IMASK = 1111". This model works only
24654 when the program runs in privileged mode and is only suitable
24655 for single-core systems. Additional support from the
24656 interrupt/exception handling code of the system is not
24657 required. This model is enabled by default when the target is
24658 "sh*-*-linux*" and SH1* or SH2*.
24659
24660 hard-llcs
24661 Generate hardware atomic sequences using the "movli.l" and
24662 "movco.l" instructions only. This is only available on SH4A
24663 and is suitable for multi-core systems. Since the hardware
24664 instructions support only 32 bit atomic variables access to 8
24665 or 16 bit variables is emulated with 32 bit accesses. Code
24666 compiled with this option is also compatible with other
24667 software atomic model interrupt/exception handling systems if
24668 executed on an SH4A system. Additional support from the
24669 interrupt/exception handling code of the system is not required
24670 for this model.
24671
24672 gbr-offset=
24673 This parameter specifies the offset in bytes of the variable in
24674 the thread control block structure that should be used by the
24675 generated atomic sequences when the soft-tcb model has been
24676 selected. For other models this parameter is ignored. The
24677 specified value must be an integer multiple of four and in the
24678 range 0-1020.
24679
24680 strict
24681 This parameter prevents mixed usage of multiple atomic models,
24682 even if they are compatible, and makes the compiler generate
24683 atomic sequences of the specified model only.
24684
24685 -mtas
24686 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
24687 that depending on the particular hardware and software
24688 configuration this can degrade overall performance due to the
24689 operand cache line flushes that are implied by the "tas.b"
24690 instruction. On multi-core SH4A processors the "tas.b" instruction
24691 must be used with caution since it can result in data corruption
24692 for certain cache configurations.
24693
24694 -mprefergot
24695 When generating position-independent code, emit function calls
24696 using the Global Offset Table instead of the Procedure Linkage
24697 Table.
24698
24699 -musermode
24700 -mno-usermode
24701 Don't allow (allow) the compiler generating privileged mode code.
24702 Specifying -musermode also implies -mno-inline-ic_invalidate if the
24703 inlined code would not work in user mode. -musermode is the
24704 default when the target is "sh*-*-linux*". If the target is SH1*
24705 or SH2* -musermode has no effect, since there is no user mode.
24706
24707 -multcost=number
24708 Set the cost to assume for a multiply insn.
24709
24710 -mdiv=strategy
24711 Set the division strategy to be used for integer division
24712 operations. strategy can be one of:
24713
24714 call-div1
24715 Calls a library function that uses the single-step division
24716 instruction "div1" to perform the operation. Division by zero
24717 calculates an unspecified result and does not trap. This is
24718 the default except for SH4, SH2A and SHcompact.
24719
24720 call-fp
24721 Calls a library function that performs the operation in double
24722 precision floating point. Division by zero causes a floating-
24723 point exception. This is the default for SHcompact with FPU.
24724 Specifying this for targets that do not have a double precision
24725 FPU defaults to "call-div1".
24726
24727 call-table
24728 Calls a library function that uses a lookup table for small
24729 divisors and the "div1" instruction with case distinction for
24730 larger divisors. Division by zero calculates an unspecified
24731 result and does not trap. This is the default for SH4.
24732 Specifying this for targets that do not have dynamic shift
24733 instructions defaults to "call-div1".
24734
24735 When a division strategy has not been specified the default
24736 strategy is selected based on the current target. For SH2A the
24737 default strategy is to use the "divs" and "divu" instructions
24738 instead of library function calls.
24739
24740 -maccumulate-outgoing-args
24741 Reserve space once for outgoing arguments in the function prologue
24742 rather than around each call. Generally beneficial for performance
24743 and size. Also needed for unwinding to avoid changing the stack
24744 frame around conditional code.
24745
24746 -mdivsi3_libfunc=name
24747 Set the name of the library function used for 32-bit signed
24748 division to name. This only affects the name used in the call
24749 division strategies, and the compiler still expects the same sets
24750 of input/output/clobbered registers as if this option were not
24751 present.
24752
24753 -mfixed-range=register-range
24754 Generate code treating the given register range as fixed registers.
24755 A fixed register is one that the register allocator cannot use.
24756 This is useful when compiling kernel code. A register range is
24757 specified as two registers separated by a dash. Multiple register
24758 ranges can be specified separated by a comma.
24759
24760 -mbranch-cost=num
24761 Assume num to be the cost for a branch instruction. Higher numbers
24762 make the compiler try to generate more branch-free code if
24763 possible. If not specified the value is selected depending on the
24764 processor type that is being compiled for.
24765
24766 -mzdcbranch
24767 -mno-zdcbranch
24768 Assume (do not assume) that zero displacement conditional branch
24769 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
24770 the compiler prefers zero displacement branch code sequences. This
24771 is enabled by default when generating code for SH4 and SH4A. It
24772 can be explicitly disabled by specifying -mno-zdcbranch.
24773
24774 -mcbranch-force-delay-slot
24775 Force the usage of delay slots for conditional branches, which
24776 stuffs the delay slot with a "nop" if a suitable instruction cannot
24777 be found. By default this option is disabled. It can be enabled
24778 to work around hardware bugs as found in the original SH7055.
24779
24780 -mfused-madd
24781 -mno-fused-madd
24782 Generate code that uses (does not use) the floating-point multiply
24783 and accumulate instructions. These instructions are generated by
24784 default if hardware floating point is used. The machine-dependent
24785 -mfused-madd option is now mapped to the machine-independent
24786 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24787 -ffp-contract=off.
24788
24789 -mfsca
24790 -mno-fsca
24791 Allow or disallow the compiler to emit the "fsca" instruction for
24792 sine and cosine approximations. The option -mfsca must be used in
24793 combination with -funsafe-math-optimizations. It is enabled by
24794 default when generating code for SH4A. Using -mno-fsca disables
24795 sine and cosine approximations even if -funsafe-math-optimizations
24796 is in effect.
24797
24798 -mfsrra
24799 -mno-fsrra
24800 Allow or disallow the compiler to emit the "fsrra" instruction for
24801 reciprocal square root approximations. The option -mfsrra must be
24802 used in combination with -funsafe-math-optimizations and
24803 -ffinite-math-only. It is enabled by default when generating code
24804 for SH4A. Using -mno-fsrra disables reciprocal square root
24805 approximations even if -funsafe-math-optimizations and
24806 -ffinite-math-only are in effect.
24807
24808 -mpretend-cmove
24809 Prefer zero-displacement conditional branches for conditional move
24810 instruction patterns. This can result in faster code on the SH4
24811 processor.
24812
24813 -mfdpic
24814 Generate code using the FDPIC ABI.
24815
24816 Solaris 2 Options
24817
24818 These -m options are supported on Solaris 2:
24819
24820 -mclear-hwcap
24821 -mclear-hwcap tells the compiler to remove the hardware
24822 capabilities generated by the Solaris assembler. This is only
24823 necessary when object files use ISA extensions not supported by the
24824 current machine, but check at runtime whether or not to use them.
24825
24826 -mimpure-text
24827 -mimpure-text, used in addition to -shared, tells the compiler to
24828 not pass -z text to the linker when linking a shared object. Using
24829 this option, you can link position-dependent code into a shared
24830 object.
24831
24832 -mimpure-text suppresses the "relocations remain against
24833 allocatable but non-writable sections" linker error message.
24834 However, the necessary relocations trigger copy-on-write, and the
24835 shared object is not actually shared across processes. Instead of
24836 using -mimpure-text, you should compile all source code with -fpic
24837 or -fPIC.
24838
24839 These switches are supported in addition to the above on Solaris 2:
24840
24841 -pthreads
24842 This is a synonym for -pthread.
24843
24844 SPARC Options
24845
24846 These -m options are supported on the SPARC:
24847
24848 -mno-app-regs
24849 -mapp-regs
24850 Specify -mapp-regs to generate output using the global registers 2
24851 through 4, which the SPARC SVR4 ABI reserves for applications.
24852 Like the global register 1, each global register 2 through 4 is
24853 then treated as an allocable register that is clobbered by function
24854 calls. This is the default.
24855
24856 To be fully SVR4 ABI-compliant at the cost of some performance
24857 loss, specify -mno-app-regs. You should compile libraries and
24858 system software with this option.
24859
24860 -mflat
24861 -mno-flat
24862 With -mflat, the compiler does not generate save/restore
24863 instructions and uses a "flat" or single register window model.
24864 This model is compatible with the regular register window model.
24865 The local registers and the input registers (0--5) are still
24866 treated as "call-saved" registers and are saved on the stack as
24867 needed.
24868
24869 With -mno-flat (the default), the compiler generates save/restore
24870 instructions (except for leaf functions). This is the normal
24871 operating mode.
24872
24873 -mfpu
24874 -mhard-float
24875 Generate output containing floating-point instructions. This is
24876 the default.
24877
24878 -mno-fpu
24879 -msoft-float
24880 Generate output containing library calls for floating point.
24881 Warning: the requisite libraries are not available for all SPARC
24882 targets. Normally the facilities of the machine's usual C compiler
24883 are used, but this cannot be done directly in cross-compilation.
24884 You must make your own arrangements to provide suitable library
24885 functions for cross-compilation. The embedded targets sparc-*-aout
24886 and sparclite-*-* do provide software floating-point support.
24887
24888 -msoft-float changes the calling convention in the output file;
24889 therefore, it is only useful if you compile all of a program with
24890 this option. In particular, you need to compile libgcc.a, the
24891 library that comes with GCC, with -msoft-float in order for this to
24892 work.
24893
24894 -mhard-quad-float
24895 Generate output containing quad-word (long double) floating-point
24896 instructions.
24897
24898 -msoft-quad-float
24899 Generate output containing library calls for quad-word (long
24900 double) floating-point instructions. The functions called are
24901 those specified in the SPARC ABI. This is the default.
24902
24903 As of this writing, there are no SPARC implementations that have
24904 hardware support for the quad-word floating-point instructions.
24905 They all invoke a trap handler for one of these instructions, and
24906 then the trap handler emulates the effect of the instruction.
24907 Because of the trap handler overhead, this is much slower than
24908 calling the ABI library routines. Thus the -msoft-quad-float
24909 option is the default.
24910
24911 -mno-unaligned-doubles
24912 -munaligned-doubles
24913 Assume that doubles have 8-byte alignment. This is the default.
24914
24915 With -munaligned-doubles, GCC assumes that doubles have 8-byte
24916 alignment only if they are contained in another type, or if they
24917 have an absolute address. Otherwise, it assumes they have 4-byte
24918 alignment. Specifying this option avoids some rare compatibility
24919 problems with code generated by other compilers. It is not the
24920 default because it results in a performance loss, especially for
24921 floating-point code.
24922
24923 -muser-mode
24924 -mno-user-mode
24925 Do not generate code that can only run in supervisor mode. This is
24926 relevant only for the "casa" instruction emitted for the LEON3
24927 processor. This is the default.
24928
24929 -mfaster-structs
24930 -mno-faster-structs
24931 With -mfaster-structs, the compiler assumes that structures should
24932 have 8-byte alignment. This enables the use of pairs of "ldd" and
24933 "std" instructions for copies in structure assignment, in place of
24934 twice as many "ld" and "st" pairs. However, the use of this
24935 changed alignment directly violates the SPARC ABI. Thus, it's
24936 intended only for use on targets where the developer acknowledges
24937 that their resulting code is not directly in line with the rules of
24938 the ABI.
24939
24940 -mstd-struct-return
24941 -mno-std-struct-return
24942 With -mstd-struct-return, the compiler generates checking code in
24943 functions returning structures or unions to detect size mismatches
24944 between the two sides of function calls, as per the 32-bit ABI.
24945
24946 The default is -mno-std-struct-return. This option has no effect
24947 in 64-bit mode.
24948
24949 -mlra
24950 -mno-lra
24951 Enable Local Register Allocation. This is the default for SPARC
24952 since GCC 7 so -mno-lra needs to be passed to get old Reload.
24953
24954 -mcpu=cpu_type
24955 Set the instruction set, register set, and instruction scheduling
24956 parameters for machine type cpu_type. Supported values for
24957 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
24958 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
24959 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24960 niagara7 and m8.
24961
24962 Native Solaris and GNU/Linux toolchains also support the value
24963 native, which selects the best architecture option for the host
24964 processor. -mcpu=native has no effect if GCC does not recognize
24965 the processor.
24966
24967 Default instruction scheduling parameters are used for values that
24968 select an architecture and not an implementation. These are v7,
24969 v8, sparclite, sparclet, v9.
24970
24971 Here is a list of each supported architecture and their supported
24972 implementations.
24973
24974 v7 cypress, leon3v7
24975
24976 v8 supersparc, hypersparc, leon, leon3
24977
24978 sparclite
24979 f930, f934, sparclite86x
24980
24981 sparclet
24982 tsc701
24983
24984 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24985 niagara7, m8
24986
24987 By default (unless configured otherwise), GCC generates code for
24988 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
24989 compiler additionally optimizes it for the Cypress CY7C602 chip, as
24990 used in the SPARCStation/SPARCServer 3xx series. This is also
24991 appropriate for the older SPARCStation 1, 2, IPX etc.
24992
24993 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
24994 architecture. The only difference from V7 code is that the
24995 compiler emits the integer multiply and integer divide instructions
24996 which exist in SPARC-V8 but not in SPARC-V7. With
24997 -mcpu=supersparc, the compiler additionally optimizes it for the
24998 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
24999 series.
25000
25001 With -mcpu=sparclite, GCC generates code for the SPARClite variant
25002 of the SPARC architecture. This adds the integer multiply, integer
25003 divide step and scan ("ffs") instructions which exist in SPARClite
25004 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
25005 optimizes it for the Fujitsu MB86930 chip, which is the original
25006 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
25007 optimizes it for the Fujitsu MB86934 chip, which is the more recent
25008 SPARClite with FPU.
25009
25010 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
25011 the SPARC architecture. This adds the integer multiply,
25012 multiply/accumulate, integer divide step and scan ("ffs")
25013 instructions which exist in SPARClet but not in SPARC-V7. With
25014 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
25015 SPARClet chip.
25016
25017 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
25018 architecture. This adds 64-bit integer and floating-point move
25019 instructions, 3 additional floating-point condition code registers
25020 and conditional move instructions. With -mcpu=ultrasparc, the
25021 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
25022 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
25023 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25024 -mcpu=niagara, the compiler additionally optimizes it for Sun
25025 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
25026 additionally optimizes it for Sun UltraSPARC T2 chips. With
25027 -mcpu=niagara3, the compiler additionally optimizes it for Sun
25028 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
25029 additionally optimizes it for Sun UltraSPARC T4 chips. With
25030 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
25031 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
25032 it for Oracle M8 chips.
25033
25034 -mtune=cpu_type
25035 Set the instruction scheduling parameters for machine type
25036 cpu_type, but do not set the instruction set or register set that
25037 the option -mcpu=cpu_type does.
25038
25039 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
25040 but the only useful values are those that select a particular CPU
25041 implementation. Those are cypress, supersparc, hypersparc, leon,
25042 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
25043 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
25044 m8. With native Solaris and GNU/Linux toolchains, native can also
25045 be used.
25046
25047 -mv8plus
25048 -mno-v8plus
25049 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
25050 difference from the V8 ABI is that the global and out registers are
25051 considered 64 bits wide. This is enabled by default on Solaris in
25052 32-bit mode for all SPARC-V9 processors.
25053
25054 -mvis
25055 -mno-vis
25056 With -mvis, GCC generates code that takes advantage of the
25057 UltraSPARC Visual Instruction Set extensions. The default is
25058 -mno-vis.
25059
25060 -mvis2
25061 -mno-vis2
25062 With -mvis2, GCC generates code that takes advantage of version 2.0
25063 of the UltraSPARC Visual Instruction Set extensions. The default
25064 is -mvis2 when targeting a cpu that supports such instructions,
25065 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
25066
25067 -mvis3
25068 -mno-vis3
25069 With -mvis3, GCC generates code that takes advantage of version 3.0
25070 of the UltraSPARC Visual Instruction Set extensions. The default
25071 is -mvis3 when targeting a cpu that supports such instructions,
25072 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
25073 -mvis.
25074
25075 -mvis4
25076 -mno-vis4
25077 With -mvis4, GCC generates code that takes advantage of version 4.0
25078 of the UltraSPARC Visual Instruction Set extensions. The default
25079 is -mvis4 when targeting a cpu that supports such instructions,
25080 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
25081 -mvis2 and -mvis.
25082
25083 -mvis4b
25084 -mno-vis4b
25085 With -mvis4b, GCC generates code that takes advantage of version
25086 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
25087 additional VIS instructions introduced in the Oracle SPARC
25088 Architecture 2017. The default is -mvis4b when targeting a cpu
25089 that supports such instructions, such as m8 and later. Setting
25090 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
25091
25092 -mcbcond
25093 -mno-cbcond
25094 With -mcbcond, GCC generates code that takes advantage of the
25095 UltraSPARC Compare-and-Branch-on-Condition instructions. The
25096 default is -mcbcond when targeting a CPU that supports such
25097 instructions, such as Niagara-4 and later.
25098
25099 -mfmaf
25100 -mno-fmaf
25101 With -mfmaf, GCC generates code that takes advantage of the
25102 UltraSPARC Fused Multiply-Add Floating-point instructions. The
25103 default is -mfmaf when targeting a CPU that supports such
25104 instructions, such as Niagara-3 and later.
25105
25106 -mfsmuld
25107 -mno-fsmuld
25108 With -mfsmuld, GCC generates code that takes advantage of the
25109 Floating-point Multiply Single to Double (FsMULd) instruction. The
25110 default is -mfsmuld when targeting a CPU supporting the
25111 architecture versions V8 or V9 with FPU except -mcpu=leon.
25112
25113 -mpopc
25114 -mno-popc
25115 With -mpopc, GCC generates code that takes advantage of the
25116 UltraSPARC Population Count instruction. The default is -mpopc
25117 when targeting a CPU that supports such an instruction, such as
25118 Niagara-2 and later.
25119
25120 -msubxc
25121 -mno-subxc
25122 With -msubxc, GCC generates code that takes advantage of the
25123 UltraSPARC Subtract-Extended-with-Carry instruction. The default
25124 is -msubxc when targeting a CPU that supports such an instruction,
25125 such as Niagara-7 and later.
25126
25127 -mfix-at697f
25128 Enable the documented workaround for the single erratum of the
25129 Atmel AT697F processor (which corresponds to erratum #13 of the
25130 AT697E processor).
25131
25132 -mfix-ut699
25133 Enable the documented workarounds for the floating-point errata and
25134 the data cache nullify errata of the UT699 processor.
25135
25136 -mfix-ut700
25137 Enable the documented workaround for the back-to-back store errata
25138 of the UT699E/UT700 processor.
25139
25140 -mfix-gr712rc
25141 Enable the documented workaround for the back-to-back store errata
25142 of the GR712RC processor.
25143
25144 These -m options are supported in addition to the above on SPARC-V9
25145 processors in 64-bit environments:
25146
25147 -m32
25148 -m64
25149 Generate code for a 32-bit or 64-bit environment. The 32-bit
25150 environment sets int, long and pointer to 32 bits. The 64-bit
25151 environment sets int to 32 bits and long and pointer to 64 bits.
25152
25153 -mcmodel=which
25154 Set the code model to one of
25155
25156 medlow
25157 The Medium/Low code model: 64-bit addresses, programs must be
25158 linked in the low 32 bits of memory. Programs can be
25159 statically or dynamically linked.
25160
25161 medmid
25162 The Medium/Middle code model: 64-bit addresses, programs must
25163 be linked in the low 44 bits of memory, the text and data
25164 segments must be less than 2GB in size and the data segment
25165 must be located within 2GB of the text segment.
25166
25167 medany
25168 The Medium/Anywhere code model: 64-bit addresses, programs may
25169 be linked anywhere in memory, the text and data segments must
25170 be less than 2GB in size and the data segment must be located
25171 within 2GB of the text segment.
25172
25173 embmedany
25174 The Medium/Anywhere code model for embedded systems: 64-bit
25175 addresses, the text and data segments must be less than 2GB in
25176 size, both starting anywhere in memory (determined at link
25177 time). The global register %g4 points to the base of the data
25178 segment. Programs are statically linked and PIC is not
25179 supported.
25180
25181 -mmemory-model=mem-model
25182 Set the memory model in force on the processor to one of
25183
25184 default
25185 The default memory model for the processor and operating
25186 system.
25187
25188 rmo Relaxed Memory Order
25189
25190 pso Partial Store Order
25191
25192 tso Total Store Order
25193
25194 sc Sequential Consistency
25195
25196 These memory models are formally defined in Appendix D of the
25197 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
25198 field.
25199
25200 -mstack-bias
25201 -mno-stack-bias
25202 With -mstack-bias, GCC assumes that the stack pointer, and frame
25203 pointer if present, are offset by -2047 which must be added back
25204 when making stack frame references. This is the default in 64-bit
25205 mode. Otherwise, assume no such offset is present.
25206
25207 Options for System V
25208
25209 These additional options are available on System V Release 4 for
25210 compatibility with other compilers on those systems:
25211
25212 -G Create a shared object. It is recommended that -symbolic or
25213 -shared be used instead.
25214
25215 -Qy Identify the versions of each tool used by the compiler, in a
25216 ".ident" assembler directive in the output.
25217
25218 -Qn Refrain from adding ".ident" directives to the output file (this is
25219 the default).
25220
25221 -YP,dirs
25222 Search the directories dirs, and no others, for libraries specified
25223 with -l.
25224
25225 -Ym,dir
25226 Look in the directory dir to find the M4 preprocessor. The
25227 assembler uses this option.
25228
25229 TILE-Gx Options
25230
25231 These -m options are supported on the TILE-Gx:
25232
25233 -mcmodel=small
25234 Generate code for the small model. The distance for direct calls
25235 is limited to 500M in either direction. PC-relative addresses are
25236 32 bits. Absolute addresses support the full address range.
25237
25238 -mcmodel=large
25239 Generate code for the large model. There is no limitation on call
25240 distance, pc-relative addresses, or absolute addresses.
25241
25242 -mcpu=name
25243 Selects the type of CPU to be targeted. Currently the only
25244 supported type is tilegx.
25245
25246 -m32
25247 -m64
25248 Generate code for a 32-bit or 64-bit environment. The 32-bit
25249 environment sets int, long, and pointer to 32 bits. The 64-bit
25250 environment sets int to 32 bits and long and pointer to 64 bits.
25251
25252 -mbig-endian
25253 -mlittle-endian
25254 Generate code in big/little endian mode, respectively.
25255
25256 TILEPro Options
25257
25258 These -m options are supported on the TILEPro:
25259
25260 -mcpu=name
25261 Selects the type of CPU to be targeted. Currently the only
25262 supported type is tilepro.
25263
25264 -m32
25265 Generate code for a 32-bit environment, which sets int, long, and
25266 pointer to 32 bits. This is the only supported behavior so the
25267 flag is essentially ignored.
25268
25269 V850 Options
25270
25271 These -m options are defined for V850 implementations:
25272
25273 -mlong-calls
25274 -mno-long-calls
25275 Treat all calls as being far away (near). If calls are assumed to
25276 be far away, the compiler always loads the function's address into
25277 a register, and calls indirect through the pointer.
25278
25279 -mno-ep
25280 -mep
25281 Do not optimize (do optimize) basic blocks that use the same index
25282 pointer 4 or more times to copy pointer into the "ep" register, and
25283 use the shorter "sld" and "sst" instructions. The -mep option is
25284 on by default if you optimize.
25285
25286 -mno-prolog-function
25287 -mprolog-function
25288 Do not use (do use) external functions to save and restore
25289 registers at the prologue and epilogue of a function. The external
25290 functions are slower, but use less code space if more than one
25291 function saves the same number of registers. The -mprolog-function
25292 option is on by default if you optimize.
25293
25294 -mspace
25295 Try to make the code as small as possible. At present, this just
25296 turns on the -mep and -mprolog-function options.
25297
25298 -mtda=n
25299 Put static or global variables whose size is n bytes or less into
25300 the tiny data area that register "ep" points to. The tiny data
25301 area can hold up to 256 bytes in total (128 bytes for byte
25302 references).
25303
25304 -msda=n
25305 Put static or global variables whose size is n bytes or less into
25306 the small data area that register "gp" points to. The small data
25307 area can hold up to 64 kilobytes.
25308
25309 -mzda=n
25310 Put static or global variables whose size is n bytes or less into
25311 the first 32 kilobytes of memory.
25312
25313 -mv850
25314 Specify that the target processor is the V850.
25315
25316 -mv850e3v5
25317 Specify that the target processor is the V850E3V5. The
25318 preprocessor constant "__v850e3v5__" is defined if this option is
25319 used.
25320
25321 -mv850e2v4
25322 Specify that the target processor is the V850E3V5. This is an
25323 alias for the -mv850e3v5 option.
25324
25325 -mv850e2v3
25326 Specify that the target processor is the V850E2V3. The
25327 preprocessor constant "__v850e2v3__" is defined if this option is
25328 used.
25329
25330 -mv850e2
25331 Specify that the target processor is the V850E2. The preprocessor
25332 constant "__v850e2__" is defined if this option is used.
25333
25334 -mv850e1
25335 Specify that the target processor is the V850E1. The preprocessor
25336 constants "__v850e1__" and "__v850e__" are defined if this option
25337 is used.
25338
25339 -mv850es
25340 Specify that the target processor is the V850ES. This is an alias
25341 for the -mv850e1 option.
25342
25343 -mv850e
25344 Specify that the target processor is the V850E. The preprocessor
25345 constant "__v850e__" is defined if this option is used.
25346
25347 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
25348 -mv850e2v3 nor -mv850e3v5 are defined then a default target
25349 processor is chosen and the relevant __v850*__ preprocessor
25350 constant is defined.
25351
25352 The preprocessor constants "__v850" and "__v851__" are always
25353 defined, regardless of which processor variant is the target.
25354
25355 -mdisable-callt
25356 -mno-disable-callt
25357 This option suppresses generation of the "CALLT" instruction for
25358 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
25359 v850 architecture.
25360
25361 This option is enabled by default when the RH850 ABI is in use (see
25362 -mrh850-abi), and disabled by default when the GCC ABI is in use.
25363 If "CALLT" instructions are being generated then the C preprocessor
25364 symbol "__V850_CALLT__" is defined.
25365
25366 -mrelax
25367 -mno-relax
25368 Pass on (or do not pass on) the -mrelax command-line option to the
25369 assembler.
25370
25371 -mlong-jumps
25372 -mno-long-jumps
25373 Disable (or re-enable) the generation of PC-relative jump
25374 instructions.
25375
25376 -msoft-float
25377 -mhard-float
25378 Disable (or re-enable) the generation of hardware floating point
25379 instructions. This option is only significant when the target
25380 architecture is V850E2V3 or higher. If hardware floating point
25381 instructions are being generated then the C preprocessor symbol
25382 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
25383 defined.
25384
25385 -mloop
25386 Enables the use of the e3v5 LOOP instruction. The use of this
25387 instruction is not enabled by default when the e3v5 architecture is
25388 selected because its use is still experimental.
25389
25390 -mrh850-abi
25391 -mghs
25392 Enables support for the RH850 version of the V850 ABI. This is the
25393 default. With this version of the ABI the following rules apply:
25394
25395 * Integer sized structures and unions are returned via a memory
25396 pointer rather than a register.
25397
25398 * Large structures and unions (more than 8 bytes in size) are
25399 passed by value.
25400
25401 * Functions are aligned to 16-bit boundaries.
25402
25403 * The -m8byte-align command-line option is supported.
25404
25405 * The -mdisable-callt command-line option is enabled by default.
25406 The -mno-disable-callt command-line option is not supported.
25407
25408 When this version of the ABI is enabled the C preprocessor symbol
25409 "__V850_RH850_ABI__" is defined.
25410
25411 -mgcc-abi
25412 Enables support for the old GCC version of the V850 ABI. With this
25413 version of the ABI the following rules apply:
25414
25415 * Integer sized structures and unions are returned in register
25416 "r10".
25417
25418 * Large structures and unions (more than 8 bytes in size) are
25419 passed by reference.
25420
25421 * Functions are aligned to 32-bit boundaries, unless optimizing
25422 for size.
25423
25424 * The -m8byte-align command-line option is not supported.
25425
25426 * The -mdisable-callt command-line option is supported but not
25427 enabled by default.
25428
25429 When this version of the ABI is enabled the C preprocessor symbol
25430 "__V850_GCC_ABI__" is defined.
25431
25432 -m8byte-align
25433 -mno-8byte-align
25434 Enables support for "double" and "long long" types to be aligned on
25435 8-byte boundaries. The default is to restrict the alignment of all
25436 objects to at most 4-bytes. When -m8byte-align is in effect the C
25437 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
25438
25439 -mbig-switch
25440 Generate code suitable for big switch tables. Use this option only
25441 if the assembler/linker complain about out of range branches within
25442 a switch table.
25443
25444 -mapp-regs
25445 This option causes r2 and r5 to be used in the code generated by
25446 the compiler. This setting is the default.
25447
25448 -mno-app-regs
25449 This option causes r2 and r5 to be treated as fixed registers.
25450
25451 VAX Options
25452
25453 These -m options are defined for the VAX:
25454
25455 -munix
25456 Do not output certain jump instructions ("aobleq" and so on) that
25457 the Unix assembler for the VAX cannot handle across long ranges.
25458
25459 -mgnu
25460 Do output those jump instructions, on the assumption that the GNU
25461 assembler is being used.
25462
25463 -mg Output code for G-format floating-point numbers instead of
25464 D-format.
25465
25466 Visium Options
25467
25468 -mdebug
25469 A program which performs file I/O and is destined to run on an MCM
25470 target should be linked with this option. It causes the libraries
25471 libc.a and libdebug.a to be linked. The program should be run on
25472 the target under the control of the GDB remote debugging stub.
25473
25474 -msim
25475 A program which performs file I/O and is destined to run on the
25476 simulator should be linked with option. This causes libraries
25477 libc.a and libsim.a to be linked.
25478
25479 -mfpu
25480 -mhard-float
25481 Generate code containing floating-point instructions. This is the
25482 default.
25483
25484 -mno-fpu
25485 -msoft-float
25486 Generate code containing library calls for floating-point.
25487
25488 -msoft-float changes the calling convention in the output file;
25489 therefore, it is only useful if you compile all of a program with
25490 this option. In particular, you need to compile libgcc.a, the
25491 library that comes with GCC, with -msoft-float in order for this to
25492 work.
25493
25494 -mcpu=cpu_type
25495 Set the instruction set, register set, and instruction scheduling
25496 parameters for machine type cpu_type. Supported values for
25497 cpu_type are mcm, gr5 and gr6.
25498
25499 mcm is a synonym of gr5 present for backward compatibility.
25500
25501 By default (unless configured otherwise), GCC generates code for
25502 the GR5 variant of the Visium architecture.
25503
25504 With -mcpu=gr6, GCC generates code for the GR6 variant of the
25505 Visium architecture. The only difference from GR5 code is that the
25506 compiler will generate block move instructions.
25507
25508 -mtune=cpu_type
25509 Set the instruction scheduling parameters for machine type
25510 cpu_type, but do not set the instruction set or register set that
25511 the option -mcpu=cpu_type would.
25512
25513 -msv-mode
25514 Generate code for the supervisor mode, where there are no
25515 restrictions on the access to general registers. This is the
25516 default.
25517
25518 -muser-mode
25519 Generate code for the user mode, where the access to some general
25520 registers is forbidden: on the GR5, registers r24 to r31 cannot be
25521 accessed in this mode; on the GR6, only registers r29 to r31 are
25522 affected.
25523
25524 VMS Options
25525
25526 These -m options are defined for the VMS implementations:
25527
25528 -mvms-return-codes
25529 Return VMS condition codes from "main". The default is to return
25530 POSIX-style condition (e.g. error) codes.
25531
25532 -mdebug-main=prefix
25533 Flag the first routine whose name starts with prefix as the main
25534 routine for the debugger.
25535
25536 -mmalloc64
25537 Default to 64-bit memory allocation routines.
25538
25539 -mpointer-size=size
25540 Set the default size of pointers. Possible options for size are 32
25541 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
25542 no for supporting only 32 bit pointers. The later option disables
25543 "pragma pointer_size".
25544
25545 VxWorks Options
25546
25547 The options in this section are defined for all VxWorks targets.
25548 Options specific to the target hardware are listed with the other
25549 options for that target.
25550
25551 -mrtp
25552 GCC can generate code for both VxWorks kernels and real time
25553 processes (RTPs). This option switches from the former to the
25554 latter. It also defines the preprocessor macro "__RTP__".
25555
25556 -non-static
25557 Link an RTP executable against shared libraries rather than static
25558 libraries. The options -static and -shared can also be used for
25559 RTPs; -static is the default.
25560
25561 -Bstatic
25562 -Bdynamic
25563 These options are passed down to the linker. They are defined for
25564 compatibility with Diab.
25565
25566 -Xbind-lazy
25567 Enable lazy binding of function calls. This option is equivalent
25568 to -Wl,-z,now and is defined for compatibility with Diab.
25569
25570 -Xbind-now
25571 Disable lazy binding of function calls. This option is the default
25572 and is defined for compatibility with Diab.
25573
25574 x86 Options
25575
25576 These -m options are defined for the x86 family of computers.
25577
25578 -march=cpu-type
25579 Generate instructions for the machine type cpu-type. In contrast
25580 to -mtune=cpu-type, which merely tunes the generated code for the
25581 specified cpu-type, -march=cpu-type allows GCC to generate code
25582 that may not run at all on processors other than the one indicated.
25583 Specifying -march=cpu-type implies -mtune=cpu-type, except where
25584 noted otherwise.
25585
25586 The choices for cpu-type are:
25587
25588 native
25589 This selects the CPU to generate code for at compilation time
25590 by determining the processor type of the compiling machine.
25591 Using -march=native enables all instruction subsets supported
25592 by the local machine (hence the result might not run on
25593 different machines). Using -mtune=native produces code
25594 optimized for the local machine under the constraints of the
25595 selected instruction set.
25596
25597 x86-64
25598 A generic CPU with 64-bit extensions.
25599
25600 x86-64-v2
25601 x86-64-v3
25602 x86-64-v4
25603 These choices for cpu-type select the corresponding micro-
25604 architecture level from the x86-64 psABI. On ABIs other than
25605 the x86-64 psABI they select the same CPU features as the
25606 x86-64 psABI documents for the particular micro-architecture
25607 level.
25608
25609 Since these cpu-type values do not have a corresponding -mtune
25610 setting, using -march with these values enables generic tuning.
25611 Specific tuning can be enabled using the -mtune=other-cpu-type
25612 option with an appropriate other-cpu-type value.
25613
25614 i386
25615 Original Intel i386 CPU.
25616
25617 i486
25618 Intel i486 CPU. (No scheduling is implemented for this chip.)
25619
25620 i586
25621 pentium
25622 Intel Pentium CPU with no MMX support.
25623
25624 lakemont
25625 Intel Lakemont MCU, based on Intel Pentium CPU.
25626
25627 pentium-mmx
25628 Intel Pentium MMX CPU, based on Pentium core with MMX
25629 instruction set support.
25630
25631 pentiumpro
25632 Intel Pentium Pro CPU.
25633
25634 i686
25635 When used with -march, the Pentium Pro instruction set is used,
25636 so the code runs on all i686 family chips. When used with
25637 -mtune, it has the same meaning as generic.
25638
25639 pentium2
25640 Intel Pentium II CPU, based on Pentium Pro core with MMX
25641 instruction set support.
25642
25643 pentium3
25644 pentium3m
25645 Intel Pentium III CPU, based on Pentium Pro core with MMX and
25646 SSE instruction set support.
25647
25648 pentium-m
25649 Intel Pentium M; low-power version of Intel Pentium III CPU
25650 with MMX, SSE and SSE2 instruction set support. Used by
25651 Centrino notebooks.
25652
25653 pentium4
25654 pentium4m
25655 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
25656 support.
25657
25658 prescott
25659 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
25660 SSE3 instruction set support.
25661
25662 nocona
25663 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
25664 MMX, SSE, SSE2 and SSE3 instruction set support.
25665
25666 core2
25667 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
25668 and SSSE3 instruction set support.
25669
25670 nehalem
25671 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
25672 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
25673
25674 westmere
25675 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
25676 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
25677 set support.
25678
25679 sandybridge
25680 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25681 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
25682 instruction set support.
25683
25684 ivybridge
25685 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25686 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
25687 FSGSBASE, RDRND and F16C instruction set support.
25688
25689 haswell
25690 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25691 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25692 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
25693 set support.
25694
25695 broadwell
25696 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25697 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25698 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED ADCX and
25699 PREFETCHW instruction set support.
25700
25701 skylake
25702 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25703 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25704 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25705 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
25706 support.
25707
25708 bonnell
25709 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25710 SSE2, SSE3 and SSSE3 instruction set support.
25711
25712 silvermont
25713 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25714 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25715 PCLMUL and RDRND instruction set support.
25716
25717 goldmont
25718 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25719 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25720 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT and FSGSBASE
25721 instruction set support.
25722
25723 goldmont-plus
25724 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
25725 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25726 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25727 PTWRITE, RDPID, SGX and UMIP instruction set support.
25728
25729 tremont
25730 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25731 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25732 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25733 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25734 CLDEMOTE and WAITPKG instruction set support.
25735
25736 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
25737 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25738 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25739 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER and
25740 AVX512CD instruction set support.
25741
25742 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
25743 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25744 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25745 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25746 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set
25747 support.
25748
25749 skylake-avx512
25750 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
25751 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25752 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25753 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25754 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
25755 support.
25756
25757 cannonlake
25758 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
25759 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25760 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25761 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25762 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
25763 UMIP instruction set support.
25764
25765 icelake-client
25766 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
25767 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25768 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25769 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25770 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25771 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25772 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25773 support.
25774
25775 icelake-server
25776 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
25777 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25778 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25779 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25780 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25781 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25782 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
25783 WBNOINVD instruction set support.
25784
25785 cascadelake
25786 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25787 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25788 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25789 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25790 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
25791 support.
25792
25793 cooperlake
25794 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25795 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25796 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25797 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25798 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
25799 instruction set support.
25800
25801 tigerlake
25802 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25803 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25804 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25805 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25806 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25807 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25808 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG, WBNOINVD,
25809 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
25810 instruction set support.
25811
25812 sapphirerapids
25813 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
25814 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25815 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25816 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25817 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
25818 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE,
25819 PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-
25820 TILE, AMX-INT8 and AVX-VNNI instruction set support.
25821
25822 alderlake
25823 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25824 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25825 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25826 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25827 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
25828 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
25829 WIDEKL and AVX-VNNI instruction set support.
25830
25831 rocketlake
25832 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25833 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25834 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25835 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25836 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25837 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25838 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25839 support.
25840
25841 k6 AMD K6 CPU with MMX instruction set support.
25842
25843 k6-2
25844 k6-3
25845 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
25846 set support.
25847
25848 athlon
25849 athlon-tbird
25850 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
25851 prefetch instructions support.
25852
25853 athlon-4
25854 athlon-xp
25855 athlon-mp
25856 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
25857 full SSE instruction set support.
25858
25859 k8
25860 opteron
25861 athlon64
25862 athlon-fx
25863 Processors based on the AMD K8 core with x86-64 instruction set
25864 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
25865 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
25866 3DNow! and 64-bit instruction set extensions.)
25867
25868 k8-sse3
25869 opteron-sse3
25870 athlon64-sse3
25871 Improved versions of AMD K8 cores with SSE3 instruction set
25872 support.
25873
25874 amdfam10
25875 barcelona
25876 CPUs based on AMD Family 10h cores with x86-64 instruction set
25877 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
25878 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
25879
25880 bdver1
25881 CPUs based on AMD Family 15h cores with x86-64 instruction set
25882 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
25883 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
25884 and 64-bit instruction set extensions.)
25885
25886 bdver2
25887 AMD Family 15h core based CPUs with x86-64 instruction set
25888 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
25889 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
25890 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
25891
25892 bdver3
25893 AMD Family 15h core based CPUs with x86-64 instruction set
25894 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
25895 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
25896 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
25897 extensions.)
25898
25899 bdver4
25900 AMD Family 15h core based CPUs with x86-64 instruction set
25901 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
25902 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
25903 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
25904 instruction set extensions.)
25905
25906 znver1
25907 AMD Family 17h core based CPUs with x86-64 instruction set
25908 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
25909 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
25910 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
25911 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
25912 extensions.)
25913
25914 znver2
25915 AMD Family 17h core based CPUs with x86-64 instruction set
25916 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25917 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25918 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25919 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25920 WBNOINVD, and 64-bit instruction set extensions.)
25921
25922 znver3
25923 AMD Family 19h core based CPUs with x86-64 instruction set
25924 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25925 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25926 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25927 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25928 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
25929 extensions.)
25930
25931 btver1
25932 CPUs based on AMD Family 14h cores with x86-64 instruction set
25933 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
25934 CX16, ABM and 64-bit instruction set extensions.)
25935
25936 btver2
25937 CPUs based on AMD Family 16h cores with x86-64 instruction set
25938 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
25939 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
25940 and 64-bit instruction set extensions.
25941
25942 winchip-c6
25943 IDT WinChip C6 CPU, dealt in same way as i486 with additional
25944 MMX instruction set support.
25945
25946 winchip2
25947 IDT WinChip 2 CPU, dealt in same way as i486 with additional
25948 MMX and 3DNow! instruction set support.
25949
25950 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
25951 scheduling is implemented for this chip.)
25952
25953 c3-2
25954 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
25955 support. (No scheduling is implemented for this chip.)
25956
25957 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
25958 set support. (No scheduling is implemented for this chip.)
25959
25960 samuel-2
25961 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
25962 support. (No scheduling is implemented for this chip.)
25963
25964 nehemiah
25965 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
25966 (No scheduling is implemented for this chip.)
25967
25968 esther
25969 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
25970 set support. (No scheduling is implemented for this chip.)
25971
25972 eden-x2
25973 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
25974 instruction set support. (No scheduling is implemented for
25975 this chip.)
25976
25977 eden-x4
25978 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
25979 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
25980 scheduling is implemented for this chip.)
25981
25982 nano
25983 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
25984 SSSE3 instruction set support. (No scheduling is implemented
25985 for this chip.)
25986
25987 nano-1000
25988 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25989 instruction set support. (No scheduling is implemented for
25990 this chip.)
25991
25992 nano-2000
25993 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25994 instruction set support. (No scheduling is implemented for
25995 this chip.)
25996
25997 nano-3000
25998 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
25999 SSE4.1 instruction set support. (No scheduling is implemented
26000 for this chip.)
26001
26002 nano-x2
26003 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
26004 and SSE4.1 instruction set support. (No scheduling is
26005 implemented for this chip.)
26006
26007 nano-x4
26008 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
26009 and SSE4.1 instruction set support. (No scheduling is
26010 implemented for this chip.)
26011
26012 geode
26013 AMD Geode embedded processor with MMX and 3DNow! instruction
26014 set support.
26015
26016 -mtune=cpu-type
26017 Tune to cpu-type everything applicable about the generated code,
26018 except for the ABI and the set of available instructions. While
26019 picking a specific cpu-type schedules things appropriately for that
26020 particular chip, the compiler does not generate any code that
26021 cannot run on the default machine type unless you use a -march=cpu-
26022 type option. For example, if GCC is configured for
26023 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
26024 for Pentium 4 but still runs on i686 machines.
26025
26026 The choices for cpu-type are the same as for -march. In addition,
26027 -mtune supports 2 extra choices for cpu-type:
26028
26029 generic
26030 Produce code optimized for the most common IA32/AMD64/EM64T
26031 processors. If you know the CPU on which your code will run,
26032 then you should use the corresponding -mtune or -march option
26033 instead of -mtune=generic. But, if you do not know exactly
26034 what CPU users of your application will have, then you should
26035 use this option.
26036
26037 As new processors are deployed in the marketplace, the behavior
26038 of this option will change. Therefore, if you upgrade to a
26039 newer version of GCC, code generation controlled by this option
26040 will change to reflect the processors that are most common at
26041 the time that version of GCC is released.
26042
26043 There is no -march=generic option because -march indicates the
26044 instruction set the compiler can use, and there is no generic
26045 instruction set applicable to all processors. In contrast,
26046 -mtune indicates the processor (or, in this case, collection of
26047 processors) for which the code is optimized.
26048
26049 intel
26050 Produce code optimized for the most current Intel processors,
26051 which are Haswell and Silvermont for this version of GCC. If
26052 you know the CPU on which your code will run, then you should
26053 use the corresponding -mtune or -march option instead of
26054 -mtune=intel. But, if you want your application performs
26055 better on both Haswell and Silvermont, then you should use this
26056 option.
26057
26058 As new Intel processors are deployed in the marketplace, the
26059 behavior of this option will change. Therefore, if you upgrade
26060 to a newer version of GCC, code generation controlled by this
26061 option will change to reflect the most current Intel processors
26062 at the time that version of GCC is released.
26063
26064 There is no -march=intel option because -march indicates the
26065 instruction set the compiler can use, and there is no common
26066 instruction set applicable to all processors. In contrast,
26067 -mtune indicates the processor (or, in this case, collection of
26068 processors) for which the code is optimized.
26069
26070 -mcpu=cpu-type
26071 A deprecated synonym for -mtune.
26072
26073 -mfpmath=unit
26074 Generate floating-point arithmetic for selected unit unit. The
26075 choices for unit are:
26076
26077 387 Use the standard 387 floating-point coprocessor present on the
26078 majority of chips and emulated otherwise. Code compiled with
26079 this option runs almost everywhere. The temporary results are
26080 computed in 80-bit precision instead of the precision specified
26081 by the type, resulting in slightly different results compared
26082 to most of other chips. See -ffloat-store for more detailed
26083 description.
26084
26085 This is the default choice for non-Darwin x86-32 targets.
26086
26087 sse Use scalar floating-point instructions present in the SSE
26088 instruction set. This instruction set is supported by Pentium
26089 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
26090 and Athlon MP chips. The earlier version of the SSE
26091 instruction set supports only single-precision arithmetic, thus
26092 the double and extended-precision arithmetic are still done
26093 using 387. A later version, present only in Pentium 4 and AMD
26094 x86-64 chips, supports double-precision arithmetic too.
26095
26096 For the x86-32 compiler, you must use -march=cpu-type, -msse or
26097 -msse2 switches to enable SSE extensions and make this option
26098 effective. For the x86-64 compiler, these extensions are
26099 enabled by default.
26100
26101 The resulting code should be considerably faster in the
26102 majority of cases and avoid the numerical instability problems
26103 of 387 code, but may break some existing code that expects
26104 temporaries to be 80 bits.
26105
26106 This is the default choice for the x86-64 compiler, Darwin
26107 x86-32 targets, and the default choice for x86-32 targets with
26108 the SSE2 instruction set when -ffast-math is enabled.
26109
26110 sse,387
26111 sse+387
26112 both
26113 Attempt to utilize both instruction sets at once. This
26114 effectively doubles the amount of available registers, and on
26115 chips with separate execution units for 387 and SSE the
26116 execution resources too. Use this option with care, as it is
26117 still experimental, because the GCC register allocator does not
26118 model separate functional units well, resulting in unstable
26119 performance.
26120
26121 -masm=dialect
26122 Output assembly instructions using selected dialect. Also affects
26123 which dialect is used for basic "asm" and extended "asm". Supported
26124 choices (in dialect order) are att or intel. The default is att.
26125 Darwin does not support intel.
26126
26127 -mieee-fp
26128 -mno-ieee-fp
26129 Control whether or not the compiler uses IEEE floating-point
26130 comparisons. These correctly handle the case where the result of a
26131 comparison is unordered.
26132
26133 -m80387
26134 -mhard-float
26135 Generate output containing 80387 instructions for floating point.
26136
26137 -mno-80387
26138 -msoft-float
26139 Generate output containing library calls for floating point.
26140
26141 Warning: the requisite libraries are not part of GCC. Normally the
26142 facilities of the machine's usual C compiler are used, but this
26143 cannot be done directly in cross-compilation. You must make your
26144 own arrangements to provide suitable library functions for cross-
26145 compilation.
26146
26147 On machines where a function returns floating-point results in the
26148 80387 register stack, some floating-point opcodes may be emitted
26149 even if -msoft-float is used.
26150
26151 -mno-fp-ret-in-387
26152 Do not use the FPU registers for return values of functions.
26153
26154 The usual calling convention has functions return values of types
26155 "float" and "double" in an FPU register, even if there is no FPU.
26156 The idea is that the operating system should emulate an FPU.
26157
26158 The option -mno-fp-ret-in-387 causes such values to be returned in
26159 ordinary CPU registers instead.
26160
26161 -mno-fancy-math-387
26162 Some 387 emulators do not support the "sin", "cos" and "sqrt"
26163 instructions for the 387. Specify this option to avoid generating
26164 those instructions. This option is overridden when -march
26165 indicates that the target CPU always has an FPU and so the
26166 instruction does not need emulation. These instructions are not
26167 generated unless you also use the -funsafe-math-optimizations
26168 switch.
26169
26170 -malign-double
26171 -mno-align-double
26172 Control whether GCC aligns "double", "long double", and "long long"
26173 variables on a two-word boundary or a one-word boundary. Aligning
26174 "double" variables on a two-word boundary produces code that runs
26175 somewhat faster on a Pentium at the expense of more memory.
26176
26177 On x86-64, -malign-double is enabled by default.
26178
26179 Warning: if you use the -malign-double switch, structures
26180 containing the above types are aligned differently than the
26181 published application binary interface specifications for the
26182 x86-32 and are not binary compatible with structures in code
26183 compiled without that switch.
26184
26185 -m96bit-long-double
26186 -m128bit-long-double
26187 These switches control the size of "long double" type. The x86-32
26188 application binary interface specifies the size to be 96 bits, so
26189 -m96bit-long-double is the default in 32-bit mode.
26190
26191 Modern architectures (Pentium and newer) prefer "long double" to be
26192 aligned to an 8- or 16-byte boundary. In arrays or structures
26193 conforming to the ABI, this is not possible. So specifying
26194 -m128bit-long-double aligns "long double" to a 16-byte boundary by
26195 padding the "long double" with an additional 32-bit zero.
26196
26197 In the x86-64 compiler, -m128bit-long-double is the default choice
26198 as its ABI specifies that "long double" is aligned on 16-byte
26199 boundary.
26200
26201 Notice that neither of these options enable any extra precision
26202 over the x87 standard of 80 bits for a "long double".
26203
26204 Warning: if you override the default value for your target ABI,
26205 this changes the size of structures and arrays containing "long
26206 double" variables, as well as modifying the function calling
26207 convention for functions taking "long double". Hence they are not
26208 binary-compatible with code compiled without that switch.
26209
26210 -mlong-double-64
26211 -mlong-double-80
26212 -mlong-double-128
26213 These switches control the size of "long double" type. A size of 64
26214 bits makes the "long double" type equivalent to the "double" type.
26215 This is the default for 32-bit Bionic C library. A size of 128
26216 bits makes the "long double" type equivalent to the "__float128"
26217 type. This is the default for 64-bit Bionic C library.
26218
26219 Warning: if you override the default value for your target ABI,
26220 this changes the size of structures and arrays containing "long
26221 double" variables, as well as modifying the function calling
26222 convention for functions taking "long double". Hence they are not
26223 binary-compatible with code compiled without that switch.
26224
26225 -malign-data=type
26226 Control how GCC aligns variables. Supported values for type are
26227 compat uses increased alignment value compatible uses GCC 4.8 and
26228 earlier, abi uses alignment value as specified by the psABI, and
26229 cacheline uses increased alignment value to match the cache line
26230 size. compat is the default.
26231
26232 -mlarge-data-threshold=threshold
26233 When -mcmodel=medium is specified, data objects larger than
26234 threshold are placed in the large data section. This value must be
26235 the same across all objects linked into the binary, and defaults to
26236 65535.
26237
26238 -mrtd
26239 Use a different function-calling convention, in which functions
26240 that take a fixed number of arguments return with the "ret num"
26241 instruction, which pops their arguments while returning. This
26242 saves one instruction in the caller since there is no need to pop
26243 the arguments there.
26244
26245 You can specify that an individual function is called with this
26246 calling sequence with the function attribute "stdcall". You can
26247 also override the -mrtd option by using the function attribute
26248 "cdecl".
26249
26250 Warning: this calling convention is incompatible with the one
26251 normally used on Unix, so you cannot use it if you need to call
26252 libraries compiled with the Unix compiler.
26253
26254 Also, you must provide function prototypes for all functions that
26255 take variable numbers of arguments (including "printf"); otherwise
26256 incorrect code is generated for calls to those functions.
26257
26258 In addition, seriously incorrect code results if you call a
26259 function with too many arguments. (Normally, extra arguments are
26260 harmlessly ignored.)
26261
26262 -mregparm=num
26263 Control how many registers are used to pass integer arguments. By
26264 default, no registers are used to pass arguments, and at most 3
26265 registers can be used. You can control this behavior for a
26266 specific function by using the function attribute "regparm".
26267
26268 Warning: if you use this switch, and num is nonzero, then you must
26269 build all modules with the same value, including any libraries.
26270 This includes the system libraries and startup modules.
26271
26272 -msseregparm
26273 Use SSE register passing conventions for float and double arguments
26274 and return values. You can control this behavior for a specific
26275 function by using the function attribute "sseregparm".
26276
26277 Warning: if you use this switch then you must build all modules
26278 with the same value, including any libraries. This includes the
26279 system libraries and startup modules.
26280
26281 -mvect8-ret-in-mem
26282 Return 8-byte vectors in memory instead of MMX registers. This is
26283 the default on VxWorks to match the ABI of the Sun Studio compilers
26284 until version 12. Only use this option if you need to remain
26285 compatible with existing code produced by those previous compiler
26286 versions or older versions of GCC.
26287
26288 -mpc32
26289 -mpc64
26290 -mpc80
26291 Set 80387 floating-point precision to 32, 64 or 80 bits. When
26292 -mpc32 is specified, the significands of results of floating-point
26293 operations are rounded to 24 bits (single precision); -mpc64 rounds
26294 the significands of results of floating-point operations to 53 bits
26295 (double precision) and -mpc80 rounds the significands of results of
26296 floating-point operations to 64 bits (extended double precision),
26297 which is the default. When this option is used, floating-point
26298 operations in higher precisions are not available to the programmer
26299 without setting the FPU control word explicitly.
26300
26301 Setting the rounding of floating-point operations to less than the
26302 default 80 bits can speed some programs by 2% or more. Note that
26303 some mathematical libraries assume that extended-precision (80-bit)
26304 floating-point operations are enabled by default; routines in such
26305 libraries could suffer significant loss of accuracy, typically
26306 through so-called "catastrophic cancellation", when this option is
26307 used to set the precision to less than extended precision.
26308
26309 -mstackrealign
26310 Realign the stack at entry. On the x86, the -mstackrealign option
26311 generates an alternate prologue and epilogue that realigns the run-
26312 time stack if necessary. This supports mixing legacy codes that
26313 keep 4-byte stack alignment with modern codes that keep 16-byte
26314 stack alignment for SSE compatibility. See also the attribute
26315 "force_align_arg_pointer", applicable to individual functions.
26316
26317 -mpreferred-stack-boundary=num
26318 Attempt to keep the stack boundary aligned to a 2 raised to num
26319 byte boundary. If -mpreferred-stack-boundary is not specified, the
26320 default is 4 (16 bytes or 128 bits).
26321
26322 Warning: When generating code for the x86-64 architecture with SSE
26323 extensions disabled, -mpreferred-stack-boundary=3 can be used to
26324 keep the stack boundary aligned to 8 byte boundary. Since x86-64
26325 ABI require 16 byte stack alignment, this is ABI incompatible and
26326 intended to be used in controlled environment where stack space is
26327 important limitation. This option leads to wrong code when
26328 functions compiled with 16 byte stack alignment (such as functions
26329 from a standard library) are called with misaligned stack. In this
26330 case, SSE instructions may lead to misaligned memory access traps.
26331 In addition, variable arguments are handled incorrectly for 16 byte
26332 aligned objects (including x87 long double and __int128), leading
26333 to wrong results. You must build all modules with
26334 -mpreferred-stack-boundary=3, including any libraries. This
26335 includes the system libraries and startup modules.
26336
26337 -mincoming-stack-boundary=num
26338 Assume the incoming stack is aligned to a 2 raised to num byte
26339 boundary. If -mincoming-stack-boundary is not specified, the one
26340 specified by -mpreferred-stack-boundary is used.
26341
26342 On Pentium and Pentium Pro, "double" and "long double" values
26343 should be aligned to an 8-byte boundary (see -malign-double) or
26344 suffer significant run time performance penalties. On Pentium III,
26345 the Streaming SIMD Extension (SSE) data type "__m128" may not work
26346 properly if it is not 16-byte aligned.
26347
26348 To ensure proper alignment of this values on the stack, the stack
26349 boundary must be as aligned as that required by any value stored on
26350 the stack. Further, every function must be generated such that it
26351 keeps the stack aligned. Thus calling a function compiled with a
26352 higher preferred stack boundary from a function compiled with a
26353 lower preferred stack boundary most likely misaligns the stack. It
26354 is recommended that libraries that use callbacks always use the
26355 default setting.
26356
26357 This extra alignment does consume extra stack space, and generally
26358 increases code size. Code that is sensitive to stack space usage,
26359 such as embedded systems and operating system kernels, may want to
26360 reduce the preferred alignment to -mpreferred-stack-boundary=2.
26361
26362 -mmmx
26363 -msse
26364 -msse2
26365 -msse3
26366 -mssse3
26367 -msse4
26368 -msse4a
26369 -msse4.1
26370 -msse4.2
26371 -mavx
26372 -mavx2
26373 -mavx512f
26374 -mavx512pf
26375 -mavx512er
26376 -mavx512cd
26377 -mavx512vl
26378 -mavx512bw
26379 -mavx512dq
26380 -mavx512ifma
26381 -mavx512vbmi
26382 -msha
26383 -maes
26384 -mpclmul
26385 -mclflushopt
26386 -mclwb
26387 -mfsgsbase
26388 -mptwrite
26389 -mrdrnd
26390 -mf16c
26391 -mfma
26392 -mpconfig
26393 -mwbnoinvd
26394 -mfma4
26395 -mprfchw
26396 -mrdpid
26397 -mprefetchwt1
26398 -mrdseed
26399 -msgx
26400 -mxop
26401 -mlwp
26402 -m3dnow
26403 -m3dnowa
26404 -mpopcnt
26405 -mabm
26406 -madx
26407 -mbmi
26408 -mbmi2
26409 -mlzcnt
26410 -mfxsr
26411 -mxsave
26412 -mxsaveopt
26413 -mxsavec
26414 -mxsaves
26415 -mrtm
26416 -mhle
26417 -mtbm
26418 -mmwaitx
26419 -mclzero
26420 -mpku
26421 -mavx512vbmi2
26422 -mavx512bf16
26423 -mgfni
26424 -mvaes
26425 -mwaitpkg
26426 -mvpclmulqdq
26427 -mavx512bitalg
26428 -mmovdiri
26429 -mmovdir64b
26430 -menqcmd
26431 -muintr
26432 -mtsxldtrk
26433 -mavx512vpopcntdq
26434 -mavx512vp2intersect
26435 -mavx5124fmaps
26436 -mavx512vnni
26437 -mavxvnni
26438 -mavx5124vnniw
26439 -mcldemote
26440 -mserialize
26441 -mamx-tile
26442 -mamx-int8
26443 -mamx-bf16
26444 -mhreset
26445 -mkl
26446 -mwidekl
26447 These switches enable the use of instructions in the MMX, SSE,
26448 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
26449 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
26450 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
26451 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
26452 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
26453 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
26454 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
26455 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
26456 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
26457 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
26458 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI or CLDEMOTE extended
26459 instruction sets. Each has a corresponding -mno- option to disable
26460 use of these instructions.
26461
26462 These extensions are also available as built-in functions: see x86
26463 Built-in Functions, for details of the functions enabled and
26464 disabled by these switches.
26465
26466 To generate SSE/SSE2 instructions automatically from floating-point
26467 code (as opposed to 387 instructions), see -mfpmath=sse.
26468
26469 GCC depresses SSEx instructions when -mavx is used. Instead, it
26470 generates new AVX instructions or AVX equivalence for all SSEx
26471 instructions when needed.
26472
26473 These options enable GCC to use these extended instructions in
26474 generated code, even without -mfpmath=sse. Applications that
26475 perform run-time CPU detection must compile separate files for each
26476 supported architecture, using the appropriate flags. In
26477 particular, the file containing the CPU detection code should be
26478 compiled without these options.
26479
26480 -mdump-tune-features
26481 This option instructs GCC to dump the names of the x86 performance
26482 tuning features and default settings. The names can be used in
26483 -mtune-ctrl=feature-list.
26484
26485 -mtune-ctrl=feature-list
26486 This option is used to do fine grain control of x86 code generation
26487 features. feature-list is a comma separated list of feature names.
26488 See also -mdump-tune-features. When specified, the feature is
26489 turned on if it is not preceded with ^, otherwise, it is turned
26490 off. -mtune-ctrl=feature-list is intended to be used by GCC
26491 developers. Using it may lead to code paths not covered by testing
26492 and can potentially result in compiler ICEs or runtime errors.
26493
26494 -mno-default
26495 This option instructs GCC to turn off all tunable features. See
26496 also -mtune-ctrl=feature-list and -mdump-tune-features.
26497
26498 -mcld
26499 This option instructs GCC to emit a "cld" instruction in the
26500 prologue of functions that use string instructions. String
26501 instructions depend on the DF flag to select between autoincrement
26502 or autodecrement mode. While the ABI specifies the DF flag to be
26503 cleared on function entry, some operating systems violate this
26504 specification by not clearing the DF flag in their exception
26505 dispatchers. The exception handler can be invoked with the DF flag
26506 set, which leads to wrong direction mode when string instructions
26507 are used. This option can be enabled by default on 32-bit x86
26508 targets by configuring GCC with the --enable-cld configure option.
26509 Generation of "cld" instructions can be suppressed with the
26510 -mno-cld compiler option in this case.
26511
26512 -mvzeroupper
26513 This option instructs GCC to emit a "vzeroupper" instruction before
26514 a transfer of control flow out of the function to minimize the AVX
26515 to SSE transition penalty as well as remove unnecessary "zeroupper"
26516 intrinsics.
26517
26518 -mprefer-avx128
26519 This option instructs GCC to use 128-bit AVX instructions instead
26520 of 256-bit AVX instructions in the auto-vectorizer.
26521
26522 -mprefer-vector-width=opt
26523 This option instructs GCC to use opt-bit vector width in
26524 instructions instead of default on the selected platform.
26525
26526 none
26527 No extra limitations applied to GCC other than defined by the
26528 selected platform.
26529
26530 128 Prefer 128-bit vector width for instructions.
26531
26532 256 Prefer 256-bit vector width for instructions.
26533
26534 512 Prefer 512-bit vector width for instructions.
26535
26536 -mcx16
26537 This option enables GCC to generate "CMPXCHG16B" instructions in
26538 64-bit code to implement compare-and-exchange operations on 16-byte
26539 aligned 128-bit objects. This is useful for atomic updates of data
26540 structures exceeding one machine word in size. The compiler uses
26541 this instruction to implement __sync Builtins. However, for
26542 __atomic Builtins operating on 128-bit integers, a library call is
26543 always used.
26544
26545 -msahf
26546 This option enables generation of "SAHF" instructions in 64-bit
26547 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
26548 the introduction of Pentium 4 G1 step in December 2005, lacked the
26549 "LAHF" and "SAHF" instructions which are supported by AMD64. These
26550 are load and store instructions, respectively, for certain status
26551 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
26552 "fmod", "drem", and "remainder" built-in functions; see Other
26553 Builtins for details.
26554
26555 -mmovbe
26556 This option enables use of the "movbe" instruction to implement
26557 "__builtin_bswap32" and "__builtin_bswap64".
26558
26559 -mshstk
26560 The -mshstk option enables shadow stack built-in functions from x86
26561 Control-flow Enforcement Technology (CET).
26562
26563 -mcrc32
26564 This option enables built-in functions "__builtin_ia32_crc32qi",
26565 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
26566 "__builtin_ia32_crc32di" to generate the "crc32" machine
26567 instruction.
26568
26569 -mrecip
26570 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
26571 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
26572 Newton-Raphson step to increase precision instead of "DIVSS" and
26573 "SQRTSS" (and their vectorized variants) for single-precision
26574 floating-point arguments. These instructions are generated only
26575 when -funsafe-math-optimizations is enabled together with
26576 -ffinite-math-only and -fno-trapping-math. Note that while the
26577 throughput of the sequence is higher than the throughput of the
26578 non-reciprocal instruction, the precision of the sequence can be
26579 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
26580 0.99999994).
26581
26582 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
26583 "RSQRTPS") already with -ffast-math (or the above option
26584 combination), and doesn't need -mrecip.
26585
26586 Also note that GCC emits the above sequence with additional Newton-
26587 Raphson step for vectorized single-float division and vectorized
26588 "sqrtf(x)" already with -ffast-math (or the above option
26589 combination), and doesn't need -mrecip.
26590
26591 -mrecip=opt
26592 This option controls which reciprocal estimate instructions may be
26593 used. opt is a comma-separated list of options, which may be
26594 preceded by a ! to invert the option:
26595
26596 all Enable all estimate instructions.
26597
26598 default
26599 Enable the default instructions, equivalent to -mrecip.
26600
26601 none
26602 Disable all estimate instructions, equivalent to -mno-recip.
26603
26604 div Enable the approximation for scalar division.
26605
26606 vec-div
26607 Enable the approximation for vectorized division.
26608
26609 sqrt
26610 Enable the approximation for scalar square root.
26611
26612 vec-sqrt
26613 Enable the approximation for vectorized square root.
26614
26615 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
26616 approximations, except for square root.
26617
26618 -mveclibabi=type
26619 Specifies the ABI type to use for vectorizing intrinsics using an
26620 external library. Supported values for type are svml for the Intel
26621 short vector math library and acml for the AMD math core library.
26622 To use this option, both -ftree-vectorize and
26623 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
26624 ABI-compatible library must be specified at link time.
26625
26626 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
26627 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
26628 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
26629 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
26630 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
26631 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
26632 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
26633 and "vmlsAcos4" for corresponding function type when
26634 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
26635 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
26636 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
26637 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
26638 corresponding function type when -mveclibabi=acml is used.
26639
26640 -mabi=name
26641 Generate code for the specified calling convention. Permissible
26642 values are sysv for the ABI used on GNU/Linux and other systems,
26643 and ms for the Microsoft ABI. The default is to use the Microsoft
26644 ABI when targeting Microsoft Windows and the SysV ABI on all other
26645 systems. You can control this behavior for specific functions by
26646 using the function attributes "ms_abi" and "sysv_abi".
26647
26648 -mforce-indirect-call
26649 Force all calls to functions to be indirect. This is useful when
26650 using Intel Processor Trace where it generates more precise timing
26651 information for function calls.
26652
26653 -mmanual-endbr
26654 Insert ENDBR instruction at function entry only via the "cf_check"
26655 function attribute. This is useful when used with the option
26656 -fcf-protection=branch to control ENDBR insertion at the function
26657 entry.
26658
26659 -mcall-ms2sysv-xlogues
26660 Due to differences in 64-bit ABIs, any Microsoft ABI function that
26661 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
26662 clobbered. By default, the code for saving and restoring these
26663 registers is emitted inline, resulting in fairly lengthy prologues
26664 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
26665 epilogues that use stubs in the static portion of libgcc to perform
26666 these saves and restores, thus reducing function size at the cost
26667 of a few extra instructions.
26668
26669 -mtls-dialect=type
26670 Generate code to access thread-local storage using the gnu or gnu2
26671 conventions. gnu is the conservative default; gnu2 is more
26672 efficient, but it may add compile- and run-time requirements that
26673 cannot be satisfied on all systems.
26674
26675 -mpush-args
26676 -mno-push-args
26677 Use PUSH operations to store outgoing parameters. This method is
26678 shorter and usually equally fast as method using SUB/MOV operations
26679 and is enabled by default. In some cases disabling it may improve
26680 performance because of improved scheduling and reduced
26681 dependencies.
26682
26683 -maccumulate-outgoing-args
26684 If enabled, the maximum amount of space required for outgoing
26685 arguments is computed in the function prologue. This is faster on
26686 most modern CPUs because of reduced dependencies, improved
26687 scheduling and reduced stack usage when the preferred stack
26688 boundary is not equal to 2. The drawback is a notable increase in
26689 code size. This switch implies -mno-push-args.
26690
26691 -mthreads
26692 Support thread-safe exception handling on MinGW. Programs that
26693 rely on thread-safe exception handling must compile and link all
26694 code with the -mthreads option. When compiling, -mthreads defines
26695 -D_MT; when linking, it links in a special thread helper library
26696 -lmingwthrd which cleans up per-thread exception-handling data.
26697
26698 -mms-bitfields
26699 -mno-ms-bitfields
26700 Enable/disable bit-field layout compatible with the native
26701 Microsoft Windows compiler.
26702
26703 If "packed" is used on a structure, or if bit-fields are used, it
26704 may be that the Microsoft ABI lays out the structure differently
26705 than the way GCC normally does. Particularly when moving packed
26706 data between functions compiled with GCC and the native Microsoft
26707 compiler (either via function call or as data in a file), it may be
26708 necessary to access either format.
26709
26710 This option is enabled by default for Microsoft Windows targets.
26711 This behavior can also be controlled locally by use of variable or
26712 type attributes. For more information, see x86 Variable Attributes
26713 and x86 Type Attributes.
26714
26715 The Microsoft structure layout algorithm is fairly simple with the
26716 exception of the bit-field packing. The padding and alignment of
26717 members of structures and whether a bit-field can straddle a
26718 storage-unit boundary are determine by these rules:
26719
26720 1. Structure members are stored sequentially in the order in which
26721 they are
26722 declared: the first member has the lowest memory address and
26723 the last member the highest.
26724
26725 2. Every data object has an alignment requirement. The alignment
26726 requirement
26727 for all data except structures, unions, and arrays is either
26728 the size of the object or the current packing size (specified
26729 with either the "aligned" attribute or the "pack" pragma),
26730 whichever is less. For structures, unions, and arrays, the
26731 alignment requirement is the largest alignment requirement of
26732 its members. Every object is allocated an offset so that:
26733
26734 offset % alignment_requirement == 0
26735
26736 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
26737 allocation
26738 unit if the integral types are the same size and if the next
26739 bit-field fits into the current allocation unit without
26740 crossing the boundary imposed by the common alignment
26741 requirements of the bit-fields.
26742
26743 MSVC interprets zero-length bit-fields in the following ways:
26744
26745 1. If a zero-length bit-field is inserted between two bit-fields
26746 that
26747 are normally coalesced, the bit-fields are not coalesced.
26748
26749 For example:
26750
26751 struct
26752 {
26753 unsigned long bf_1 : 12;
26754 unsigned long : 0;
26755 unsigned long bf_2 : 12;
26756 } t1;
26757
26758 The size of "t1" is 8 bytes with the zero-length bit-field. If
26759 the zero-length bit-field were removed, "t1"'s size would be 4
26760 bytes.
26761
26762 2. If a zero-length bit-field is inserted after a bit-field, "foo",
26763 and the
26764 alignment of the zero-length bit-field is greater than the
26765 member that follows it, "bar", "bar" is aligned as the type of
26766 the zero-length bit-field.
26767
26768 For example:
26769
26770 struct
26771 {
26772 char foo : 4;
26773 short : 0;
26774 char bar;
26775 } t2;
26776
26777 struct
26778 {
26779 char foo : 4;
26780 short : 0;
26781 double bar;
26782 } t3;
26783
26784 For "t2", "bar" is placed at offset 2, rather than offset 1.
26785 Accordingly, the size of "t2" is 4. For "t3", the zero-length
26786 bit-field does not affect the alignment of "bar" or, as a
26787 result, the size of the structure.
26788
26789 Taking this into account, it is important to note the
26790 following:
26791
26792 1. If a zero-length bit-field follows a normal bit-field, the
26793 type of the
26794 zero-length bit-field may affect the alignment of the
26795 structure as whole. For example, "t2" has a size of 4
26796 bytes, since the zero-length bit-field follows a normal
26797 bit-field, and is of type short.
26798
26799 2. Even if a zero-length bit-field is not followed by a normal
26800 bit-field, it may
26801 still affect the alignment of the structure:
26802
26803 struct
26804 {
26805 char foo : 6;
26806 long : 0;
26807 } t4;
26808
26809 Here, "t4" takes up 4 bytes.
26810
26811 3. Zero-length bit-fields following non-bit-field members are
26812 ignored:
26813 struct
26814 {
26815 char foo;
26816 long : 0;
26817 char bar;
26818 } t5;
26819
26820 Here, "t5" takes up 2 bytes.
26821
26822 -mno-align-stringops
26823 Do not align the destination of inlined string operations. This
26824 switch reduces code size and improves performance in case the
26825 destination is already aligned, but GCC doesn't know about it.
26826
26827 -minline-all-stringops
26828 By default GCC inlines string operations only when the destination
26829 is known to be aligned to least a 4-byte boundary. This enables
26830 more inlining and increases code size, but may improve performance
26831 of code that depends on fast "memcpy" and "memset" for short
26832 lengths. The option enables inline expansion of "strlen" for all
26833 pointer alignments.
26834
26835 -minline-stringops-dynamically
26836 For string operations of unknown size, use run-time checks with
26837 inline code for small blocks and a library call for large blocks.
26838
26839 -mstringop-strategy=alg
26840 Override the internal decision heuristic for the particular
26841 algorithm to use for inlining string operations. The allowed
26842 values for alg are:
26843
26844 rep_byte
26845 rep_4byte
26846 rep_8byte
26847 Expand using i386 "rep" prefix of the specified size.
26848
26849 byte_loop
26850 loop
26851 unrolled_loop
26852 Expand into an inline loop.
26853
26854 libcall
26855 Always use a library call.
26856
26857 -mmemcpy-strategy=strategy
26858 Override the internal decision heuristic to decide if
26859 "__builtin_memcpy" should be inlined and what inline algorithm to
26860 use when the expected size of the copy operation is known. strategy
26861 is a comma-separated list of alg:max_size:dest_align triplets. alg
26862 is specified in -mstringop-strategy, max_size specifies the max
26863 byte size with which inline algorithm alg is allowed. For the last
26864 triplet, the max_size must be "-1". The max_size of the triplets in
26865 the list must be specified in increasing order. The minimal byte
26866 size for alg is 0 for the first triplet and "max_size + 1" of the
26867 preceding range.
26868
26869 -mmemset-strategy=strategy
26870 The option is similar to -mmemcpy-strategy= except that it is to
26871 control "__builtin_memset" expansion.
26872
26873 -momit-leaf-frame-pointer
26874 Don't keep the frame pointer in a register for leaf functions.
26875 This avoids the instructions to save, set up, and restore frame
26876 pointers and makes an extra register available in leaf functions.
26877 The option -fomit-leaf-frame-pointer removes the frame pointer for
26878 leaf functions, which might make debugging harder.
26879
26880 -mtls-direct-seg-refs
26881 -mno-tls-direct-seg-refs
26882 Controls whether TLS variables may be accessed with offsets from
26883 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
26884 whether the thread base pointer must be added. Whether or not this
26885 is valid depends on the operating system, and whether it maps the
26886 segment to cover the entire TLS area.
26887
26888 For systems that use the GNU C Library, the default is on.
26889
26890 -msse2avx
26891 -mno-sse2avx
26892 Specify that the assembler should encode SSE instructions with VEX
26893 prefix. The option -mavx turns this on by default.
26894
26895 -mfentry
26896 -mno-fentry
26897 If profiling is active (-pg), put the profiling counter call before
26898 the prologue. Note: On x86 architectures the attribute
26899 "ms_hook_prologue" isn't possible at the moment for -mfentry and
26900 -pg.
26901
26902 -mrecord-mcount
26903 -mno-record-mcount
26904 If profiling is active (-pg), generate a __mcount_loc section that
26905 contains pointers to each profiling call. This is useful for
26906 automatically patching and out calls.
26907
26908 -mnop-mcount
26909 -mno-nop-mcount
26910 If profiling is active (-pg), generate the calls to the profiling
26911 functions as NOPs. This is useful when they should be patched in
26912 later dynamically. This is likely only useful together with
26913 -mrecord-mcount.
26914
26915 -minstrument-return=type
26916 Instrument function exit in -pg -mfentry instrumented functions
26917 with call to specified function. This only instruments true returns
26918 ending with ret, but not sibling calls ending with jump. Valid
26919 types are none to not instrument, call to generate a call to
26920 __return__, or nop5 to generate a 5 byte nop.
26921
26922 -mrecord-return
26923 -mno-record-return
26924 Generate a __return_loc section pointing to all return
26925 instrumentation code.
26926
26927 -mfentry-name=name
26928 Set name of __fentry__ symbol called at function entry for -pg
26929 -mfentry functions.
26930
26931 -mfentry-section=name
26932 Set name of section to record -mrecord-mcount calls (default
26933 __mcount_loc).
26934
26935 -mskip-rax-setup
26936 -mno-skip-rax-setup
26937 When generating code for the x86-64 architecture with SSE
26938 extensions disabled, -mskip-rax-setup can be used to skip setting
26939 up RAX register when there are no variable arguments passed in
26940 vector registers.
26941
26942 Warning: Since RAX register is used to avoid unnecessarily saving
26943 vector registers on stack when passing variable arguments, the
26944 impacts of this option are callees may waste some stack space,
26945 misbehave or jump to a random location. GCC 4.4 or newer don't
26946 have those issues, regardless the RAX register value.
26947
26948 -m8bit-idiv
26949 -mno-8bit-idiv
26950 On some processors, like Intel Atom, 8-bit unsigned integer divide
26951 is much faster than 32-bit/64-bit integer divide. This option
26952 generates a run-time check. If both dividend and divisor are
26953 within range of 0 to 255, 8-bit unsigned integer divide is used
26954 instead of 32-bit/64-bit integer divide.
26955
26956 -mavx256-split-unaligned-load
26957 -mavx256-split-unaligned-store
26958 Split 32-byte AVX unaligned load and store.
26959
26960 -mstack-protector-guard=guard
26961 -mstack-protector-guard-reg=reg
26962 -mstack-protector-guard-offset=offset
26963 Generate stack protection code using canary at guard. Supported
26964 locations are global for global canary or tls for per-thread canary
26965 in the TLS block (the default). This option has effect only when
26966 -fstack-protector or -fstack-protector-all is specified.
26967
26968 With the latter choice the options -mstack-protector-guard-reg=reg
26969 and -mstack-protector-guard-offset=offset furthermore specify which
26970 segment register (%fs or %gs) to use as base register for reading
26971 the canary, and from what offset from that base register. The
26972 default for those is as specified in the relevant ABI.
26973
26974 -mgeneral-regs-only
26975 Generate code that uses only the general-purpose registers. This
26976 prevents the compiler from using floating-point, vector, mask and
26977 bound registers.
26978
26979 -mindirect-branch=choice
26980 Convert indirect call and jump with choice. The default is keep,
26981 which keeps indirect call and jump unmodified. thunk converts
26982 indirect call and jump to call and return thunk. thunk-inline
26983 converts indirect call and jump to inlined call and return thunk.
26984 thunk-extern converts indirect call and jump to external call and
26985 return thunk provided in a separate object file. You can control
26986 this behavior for a specific function by using the function
26987 attribute "indirect_branch".
26988
26989 Note that -mcmodel=large is incompatible with
26990 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
26991 the thunk function may not be reachable in the large code model.
26992
26993 Note that -mindirect-branch=thunk-extern is compatible with
26994 -fcf-protection=branch since the external thunk can be made to
26995 enable control-flow check.
26996
26997 -mfunction-return=choice
26998 Convert function return with choice. The default is keep, which
26999 keeps function return unmodified. thunk converts function return
27000 to call and return thunk. thunk-inline converts function return to
27001 inlined call and return thunk. thunk-extern converts function
27002 return to external call and return thunk provided in a separate
27003 object file. You can control this behavior for a specific function
27004 by using the function attribute "function_return".
27005
27006 Note that -mindirect-return=thunk-extern is compatible with
27007 -fcf-protection=branch since the external thunk can be made to
27008 enable control-flow check.
27009
27010 Note that -mcmodel=large is incompatible with
27011 -mfunction-return=thunk and -mfunction-return=thunk-extern since
27012 the thunk function may not be reachable in the large code model.
27013
27014 -mindirect-branch-register
27015 Force indirect call and jump via register.
27016
27017 These -m switches are supported in addition to the above on x86-64
27018 processors in 64-bit environments.
27019
27020 -m32
27021 -m64
27022 -mx32
27023 -m16
27024 -miamcu
27025 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
27026 option sets "int", "long", and pointer types to 32 bits, and
27027 generates code that runs on any i386 system.
27028
27029 The -m64 option sets "int" to 32 bits and "long" and pointer types
27030 to 64 bits, and generates code for the x86-64 architecture. For
27031 Darwin only the -m64 option also turns off the -fno-pic and
27032 -mdynamic-no-pic options.
27033
27034 The -mx32 option sets "int", "long", and pointer types to 32 bits,
27035 and generates code for the x86-64 architecture.
27036
27037 The -m16 option is the same as -m32, except for that it outputs the
27038 ".code16gcc" assembly directive at the beginning of the assembly
27039 output so that the binary can run in 16-bit mode.
27040
27041 The -miamcu option generates code which conforms to Intel MCU
27042 psABI. It requires the -m32 option to be turned on.
27043
27044 -mno-red-zone
27045 Do not use a so-called "red zone" for x86-64 code. The red zone is
27046 mandated by the x86-64 ABI; it is a 128-byte area beyond the
27047 location of the stack pointer that is not modified by signal or
27048 interrupt handlers and therefore can be used for temporary data
27049 without adjusting the stack pointer. The flag -mno-red-zone
27050 disables this red zone.
27051
27052 -mcmodel=small
27053 Generate code for the small code model: the program and its symbols
27054 must be linked in the lower 2 GB of the address space. Pointers
27055 are 64 bits. Programs can be statically or dynamically linked.
27056 This is the default code model.
27057
27058 -mcmodel=kernel
27059 Generate code for the kernel code model. The kernel runs in the
27060 negative 2 GB of the address space. This model has to be used for
27061 Linux kernel code.
27062
27063 -mcmodel=medium
27064 Generate code for the medium model: the program is linked in the
27065 lower 2 GB of the address space. Small symbols are also placed
27066 there. Symbols with sizes larger than -mlarge-data-threshold are
27067 put into large data or BSS sections and can be located above 2GB.
27068 Programs can be statically or dynamically linked.
27069
27070 -mcmodel=large
27071 Generate code for the large model. This model makes no assumptions
27072 about addresses and sizes of sections.
27073
27074 -maddress-mode=long
27075 Generate code for long address mode. This is only supported for
27076 64-bit and x32 environments. It is the default address mode for
27077 64-bit environments.
27078
27079 -maddress-mode=short
27080 Generate code for short address mode. This is only supported for
27081 32-bit and x32 environments. It is the default address mode for
27082 32-bit and x32 environments.
27083
27084 -mneeded
27085 -mno-needed
27086 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
27087 indicate the micro-architecture ISA level required to execute the
27088 binary.
27089
27090 x86 Windows Options
27091
27092 These additional options are available for Microsoft Windows targets:
27093
27094 -mconsole
27095 This option specifies that a console application is to be
27096 generated, by instructing the linker to set the PE header subsystem
27097 type required for console applications. This option is available
27098 for Cygwin and MinGW targets and is enabled by default on those
27099 targets.
27100
27101 -mdll
27102 This option is available for Cygwin and MinGW targets. It
27103 specifies that a DLL---a dynamic link library---is to be generated,
27104 enabling the selection of the required runtime startup object and
27105 entry point.
27106
27107 -mnop-fun-dllimport
27108 This option is available for Cygwin and MinGW targets. It
27109 specifies that the "dllimport" attribute should be ignored.
27110
27111 -mthread
27112 This option is available for MinGW targets. It specifies that
27113 MinGW-specific thread support is to be used.
27114
27115 -municode
27116 This option is available for MinGW-w64 targets. It causes the
27117 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
27118 capable runtime startup code.
27119
27120 -mwin32
27121 This option is available for Cygwin and MinGW targets. It
27122 specifies that the typical Microsoft Windows predefined macros are
27123 to be set in the pre-processor, but does not influence the choice
27124 of runtime library/startup code.
27125
27126 -mwindows
27127 This option is available for Cygwin and MinGW targets. It
27128 specifies that a GUI application is to be generated by instructing
27129 the linker to set the PE header subsystem type appropriately.
27130
27131 -fno-set-stack-executable
27132 This option is available for MinGW targets. It specifies that the
27133 executable flag for the stack used by nested functions isn't set.
27134 This is necessary for binaries running in kernel mode of Microsoft
27135 Windows, as there the User32 API, which is used to set executable
27136 privileges, isn't available.
27137
27138 -fwritable-relocated-rdata
27139 This option is available for MinGW and Cygwin targets. It
27140 specifies that relocated-data in read-only section is put into the
27141 ".data" section. This is a necessary for older runtimes not
27142 supporting modification of ".rdata" sections for pseudo-relocation.
27143
27144 -mpe-aligned-commons
27145 This option is available for Cygwin and MinGW targets. It
27146 specifies that the GNU extension to the PE file format that permits
27147 the correct alignment of COMMON variables should be used when
27148 generating code. It is enabled by default if GCC detects that the
27149 target assembler found during configuration supports the feature.
27150
27151 See also under x86 Options for standard options.
27152
27153 Xstormy16 Options
27154
27155 These options are defined for Xstormy16:
27156
27157 -msim
27158 Choose startup files and linker script suitable for the simulator.
27159
27160 Xtensa Options
27161
27162 These options are supported for Xtensa targets:
27163
27164 -mconst16
27165 -mno-const16
27166 Enable or disable use of "CONST16" instructions for loading
27167 constant values. The "CONST16" instruction is currently not a
27168 standard option from Tensilica. When enabled, "CONST16"
27169 instructions are always used in place of the standard "L32R"
27170 instructions. The use of "CONST16" is enabled by default only if
27171 the "L32R" instruction is not available.
27172
27173 -mfused-madd
27174 -mno-fused-madd
27175 Enable or disable use of fused multiply/add and multiply/subtract
27176 instructions in the floating-point option. This has no effect if
27177 the floating-point option is not also enabled. Disabling fused
27178 multiply/add and multiply/subtract instructions forces the compiler
27179 to use separate instructions for the multiply and add/subtract
27180 operations. This may be desirable in some cases where strict IEEE
27181 754-compliant results are required: the fused multiply add/subtract
27182 instructions do not round the intermediate result, thereby
27183 producing results with more bits of precision than specified by the
27184 IEEE standard. Disabling fused multiply add/subtract instructions
27185 also ensures that the program output is not sensitive to the
27186 compiler's ability to combine multiply and add/subtract operations.
27187
27188 -mserialize-volatile
27189 -mno-serialize-volatile
27190 When this option is enabled, GCC inserts "MEMW" instructions before
27191 "volatile" memory references to guarantee sequential consistency.
27192 The default is -mserialize-volatile. Use -mno-serialize-volatile
27193 to omit the "MEMW" instructions.
27194
27195 -mforce-no-pic
27196 For targets, like GNU/Linux, where all user-mode Xtensa code must
27197 be position-independent code (PIC), this option disables PIC for
27198 compiling kernel code.
27199
27200 -mtext-section-literals
27201 -mno-text-section-literals
27202 These options control the treatment of literal pools. The default
27203 is -mno-text-section-literals, which places literals in a separate
27204 section in the output file. This allows the literal pool to be
27205 placed in a data RAM/ROM, and it also allows the linker to combine
27206 literal pools from separate object files to remove redundant
27207 literals and improve code size. With -mtext-section-literals, the
27208 literals are interspersed in the text section in order to keep them
27209 as close as possible to their references. This may be necessary
27210 for large assembly files. Literals for each function are placed
27211 right before that function.
27212
27213 -mauto-litpools
27214 -mno-auto-litpools
27215 These options control the treatment of literal pools. The default
27216 is -mno-auto-litpools, which places literals in a separate section
27217 in the output file unless -mtext-section-literals is used. With
27218 -mauto-litpools the literals are interspersed in the text section
27219 by the assembler. Compiler does not produce explicit ".literal"
27220 directives and loads literals into registers with "MOVI"
27221 instructions instead of "L32R" to let the assembler do relaxation
27222 and place literals as necessary. This option allows assembler to
27223 create several literal pools per function and assemble very big
27224 functions, which may not be possible with -mtext-section-literals.
27225
27226 -mtarget-align
27227 -mno-target-align
27228 When this option is enabled, GCC instructs the assembler to
27229 automatically align instructions to reduce branch penalties at the
27230 expense of some code density. The assembler attempts to widen
27231 density instructions to align branch targets and the instructions
27232 following call instructions. If there are not enough preceding
27233 safe density instructions to align a target, no widening is
27234 performed. The default is -mtarget-align. These options do not
27235 affect the treatment of auto-aligned instructions like "LOOP",
27236 which the assembler always aligns, either by widening density
27237 instructions or by inserting NOP instructions.
27238
27239 -mlongcalls
27240 -mno-longcalls
27241 When this option is enabled, GCC instructs the assembler to
27242 translate direct calls to indirect calls unless it can determine
27243 that the target of a direct call is in the range allowed by the
27244 call instruction. This translation typically occurs for calls to
27245 functions in other source files. Specifically, the assembler
27246 translates a direct "CALL" instruction into an "L32R" followed by a
27247 "CALLX" instruction. The default is -mno-longcalls. This option
27248 should be used in programs where the call target can potentially be
27249 out of range. This option is implemented in the assembler, not the
27250 compiler, so the assembly code generated by GCC still shows direct
27251 call instructions---look at the disassembled object code to see the
27252 actual instructions. Note that the assembler uses an indirect call
27253 for every cross-file call, not just those that really are out of
27254 range.
27255
27256 -mabi=name
27257 Generate code for the specified ABI. Permissible values are:
27258 call0, windowed. Default ABI is chosen by the Xtensa core
27259 configuration.
27260
27261 -mabi=call0
27262 When this option is enabled function parameters are passed in
27263 registers "a2" through "a7", registers "a12" through "a15" are
27264 caller-saved, and register "a15" may be used as a frame pointer.
27265 When this version of the ABI is enabled the C preprocessor symbol
27266 "__XTENSA_CALL0_ABI__" is defined.
27267
27268 -mabi=windowed
27269 When this option is enabled function parameters are passed in
27270 registers "a10" through "a15", and called function rotates register
27271 window by 8 registers on entry so that its arguments are found in
27272 registers "a2" through "a7". Register "a7" may be used as a frame
27273 pointer. Register window is rotated 8 registers back upon return.
27274 When this version of the ABI is enabled the C preprocessor symbol
27275 "__XTENSA_WINDOWED_ABI__" is defined.
27276
27277 zSeries Options
27278
27279 These are listed under
27280
27282 This section describes several environment variables that affect how
27283 GCC operates. Some of them work by specifying directories or prefixes
27284 to use when searching for various kinds of files. Some are used to
27285 specify other aspects of the compilation environment.
27286
27287 Note that you can also specify places to search using options such as
27288 -B, -I and -L. These take precedence over places specified using
27289 environment variables, which in turn take precedence over those
27290 specified by the configuration of GCC.
27291
27292 LANG
27293 LC_CTYPE
27294 LC_MESSAGES
27295 LC_ALL
27296 These environment variables control the way that GCC uses
27297 localization information which allows GCC to work with different
27298 national conventions. GCC inspects the locale categories LC_CTYPE
27299 and LC_MESSAGES if it has been configured to do so. These locale
27300 categories can be set to any value supported by your installation.
27301 A typical value is en_GB.UTF-8 for English in the United Kingdom
27302 encoded in UTF-8.
27303
27304 The LC_CTYPE environment variable specifies character
27305 classification. GCC uses it to determine the character boundaries
27306 in a string; this is needed for some multibyte encodings that
27307 contain quote and escape characters that are otherwise interpreted
27308 as a string end or escape.
27309
27310 The LC_MESSAGES environment variable specifies the language to use
27311 in diagnostic messages.
27312
27313 If the LC_ALL environment variable is set, it overrides the value
27314 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
27315 default to the value of the LANG environment variable. If none of
27316 these variables are set, GCC defaults to traditional C English
27317 behavior.
27318
27319 TMPDIR
27320 If TMPDIR is set, it specifies the directory to use for temporary
27321 files. GCC uses temporary files to hold the output of one stage of
27322 compilation which is to be used as input to the next stage: for
27323 example, the output of the preprocessor, which is the input to the
27324 compiler proper.
27325
27326 GCC_COMPARE_DEBUG
27327 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
27328 -fcompare-debug to the compiler driver. See the documentation of
27329 this option for more details.
27330
27331 GCC_EXEC_PREFIX
27332 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
27333 names of the subprograms executed by the compiler. No slash is
27334 added when this prefix is combined with the name of a subprogram,
27335 but you can specify a prefix that ends with a slash if you wish.
27336
27337 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
27338 appropriate prefix to use based on the pathname it is invoked with.
27339
27340 If GCC cannot find the subprogram using the specified prefix, it
27341 tries looking in the usual places for the subprogram.
27342
27343 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
27344 prefix is the prefix to the installed compiler. In many cases
27345 prefix is the value of "prefix" when you ran the configure script.
27346
27347 Other prefixes specified with -B take precedence over this prefix.
27348
27349 This prefix is also used for finding files such as crt0.o that are
27350 used for linking.
27351
27352 In addition, the prefix is used in an unusual way in finding the
27353 directories to search for header files. For each of the standard
27354 directories whose name normally begins with /usr/local/lib/gcc
27355 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
27356 replacing that beginning with the specified prefix to produce an
27357 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
27358 just before it searches the standard directory /usr/local/lib/bar.
27359 If a standard directory begins with the configured prefix then the
27360 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
27361 header files.
27362
27363 COMPILER_PATH
27364 The value of COMPILER_PATH is a colon-separated list of
27365 directories, much like PATH. GCC tries the directories thus
27366 specified when searching for subprograms, if it cannot find the
27367 subprograms using GCC_EXEC_PREFIX.
27368
27369 LIBRARY_PATH
27370 The value of LIBRARY_PATH is a colon-separated list of directories,
27371 much like PATH. When configured as a native compiler, GCC tries
27372 the directories thus specified when searching for special linker
27373 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
27374 GCC also uses these directories when searching for ordinary
27375 libraries for the -l option (but directories specified with -L come
27376 first).
27377
27378 LANG
27379 This variable is used to pass locale information to the compiler.
27380 One way in which this information is used is to determine the
27381 character set to be used when character literals, string literals
27382 and comments are parsed in C and C++. When the compiler is
27383 configured to allow multibyte characters, the following values for
27384 LANG are recognized:
27385
27386 C-JIS
27387 Recognize JIS characters.
27388
27389 C-SJIS
27390 Recognize SJIS characters.
27391
27392 C-EUCJP
27393 Recognize EUCJP characters.
27394
27395 If LANG is not defined, or if it has some other value, then the
27396 compiler uses "mblen" and "mbtowc" as defined by the default locale
27397 to recognize and translate multibyte characters.
27398
27399 GCC_EXTRA_DIAGNOSTIC_OUTPUT
27400 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
27401 values, then additional text will be emitted to stderr when fix-it
27402 hints are emitted. -fdiagnostics-parseable-fixits and
27403 -fno-diagnostics-parseable-fixits take precedence over this
27404 environment variable.
27405
27406 fixits-v1
27407 Emit parseable fix-it hints, equivalent to
27408 -fdiagnostics-parseable-fixits. In particular, columns are
27409 expressed as a count of bytes, starting at byte 1 for the
27410 initial column.
27411
27412 fixits-v2
27413 As "fixits-v1", but columns are expressed as display columns,
27414 as per -fdiagnostics-column-unit=display.
27415
27416 Some additional environment variables affect the behavior of the
27417 preprocessor.
27418
27419 CPATH
27420 C_INCLUDE_PATH
27421 CPLUS_INCLUDE_PATH
27422 OBJC_INCLUDE_PATH
27423 Each variable's value is a list of directories separated by a
27424 special character, much like PATH, in which to look for header
27425 files. The special character, "PATH_SEPARATOR", is target-
27426 dependent and determined at GCC build time. For Microsoft Windows-
27427 based targets it is a semicolon, and for almost all other targets
27428 it is a colon.
27429
27430 CPATH specifies a list of directories to be searched as if
27431 specified with -I, but after any paths given with -I options on the
27432 command line. This environment variable is used regardless of
27433 which language is being preprocessed.
27434
27435 The remaining environment variables apply only when preprocessing
27436 the particular language indicated. Each specifies a list of
27437 directories to be searched as if specified with -isystem, but after
27438 any paths given with -isystem options on the command line.
27439
27440 In all these variables, an empty element instructs the compiler to
27441 search its current working directory. Empty elements can appear at
27442 the beginning or end of a path. For instance, if the value of
27443 CPATH is ":/special/include", that has the same effect as
27444 -I. -I/special/include.
27445
27446 DEPENDENCIES_OUTPUT
27447 If this variable is set, its value specifies how to output
27448 dependencies for Make based on the non-system header files
27449 processed by the compiler. System header files are ignored in the
27450 dependency output.
27451
27452 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
27453 case the Make rules are written to that file, guessing the target
27454 name from the source file name. Or the value can have the form
27455 file target, in which case the rules are written to file file using
27456 target as the target name.
27457
27458 In other words, this environment variable is equivalent to
27459 combining the options -MM and -MF, with an optional -MT switch too.
27460
27461 SUNPRO_DEPENDENCIES
27462 This variable is the same as DEPENDENCIES_OUTPUT (see above),
27463 except that system header files are not ignored, so it implies -M
27464 rather than -MM. However, the dependence on the main input file is
27465 omitted.
27466
27467 SOURCE_DATE_EPOCH
27468 If this variable is set, its value specifies a UNIX timestamp to be
27469 used in replacement of the current date and time in the "__DATE__"
27470 and "__TIME__" macros, so that the embedded timestamps become
27471 reproducible.
27472
27473 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
27474 the number of seconds (excluding leap seconds) since 01 Jan 1970
27475 00:00:00 represented in ASCII; identical to the output of "date
27476 +%s" on GNU/Linux and other systems that support the %s extension
27477 in the "date" command.
27478
27479 The value should be a known timestamp such as the last modification
27480 time of the source or package and it should be set by the build
27481 process.
27482
27484 For instructions on reporting bugs, see
27485 <http://bugzilla.redhat.com/bugzilla>.
27486
27488 1. On some systems, gcc -shared needs to build supplementary stub code
27489 for constructors to work. On multi-libbed systems, gcc -shared
27490 must select the correct support libraries to link against. Failing
27491 to supply the correct flags may lead to subtle defects. Supplying
27492 them in cases where they are not necessary is innocuous.
27493
27495 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
27496 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
27497
27499 See the Info entry for gcc, or
27500 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
27501 to GCC.
27502
27504 Copyright (c) 1988-2021 Free Software Foundation, Inc.
27505
27506 Permission is granted to copy, distribute and/or modify this document
27507 under the terms of the GNU Free Documentation License, Version 1.3 or
27508 any later version published by the Free Software Foundation; with the
27509 Invariant Sections being "GNU General Public License" and "Funding Free
27510 Software", the Front-Cover texts being (a) (see below), and with the
27511 Back-Cover Texts being (b) (see below). A copy of the license is
27512 included in the gfdl(7) man page.
27513
27514 (a) The FSF's Front-Cover Text is:
27515
27516 A GNU Manual
27517
27518 (b) The FSF's Back-Cover Text is:
27519
27520 You have freedom to copy and modify this GNU Manual, like GNU
27521 software. Copies published by the Free Software Foundation raise
27522 funds for GNU development.
27523
27524
27525
27526gcc-11.2.1 2021-07-28 GCC(1)