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
522 -mfix-cmse-cve-2021-35465 -mfdpic
523
524 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
525 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
526 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
527 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
528 -mfract-convert-truncate -mshort-calls -nodevicelib
529 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
530
531 Blackfin Options -mcpu=cpu[-sirevision] -msim
532 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
533 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
534 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
535 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
536 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
537 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
538 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
539
540 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
541 -msdata=sdata-type
542
543 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
544 -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init
545 -mno-side-effects -mstack-align -mdata-align -mconst-align
546 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt
547 -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround
548 -mno-mul-bug-workaround
549
550 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
551 -mdata-model=model
552
553 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
554 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
555 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
556 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
557 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
558 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
559 -msched-prolog -msim
560
561 Darwin Options -all_load -allowable_client -arch
562 -arch_errors_fatal -arch_only -bind_at_load -bundle
563 -bundle_loader -client_name -compatibility_version
564 -current_version -dead_strip -dependency-file -dylib_file
565 -dylinker_install_name -dynamic -dynamiclib
566 -exported_symbols_list -filelist -flat_namespace
567 -force_cpusubtype_ALL -force_flat_namespace
568 -headerpad_max_install_names -iframework -image_base -init
569 -install_name -keep_private_externs -multi_module
570 -multiply_defined -multiply_defined_unused -noall_load
571 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
572 -noprebind -noseglinkedit -pagezero_size -prebind
573 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
574 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
575 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
576 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
577 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
578 -single_module -static -sub_library -sub_umbrella
579 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
580 -weak_reference_mismatches -whatsloaded -F -gused -gfull
581 -mmacosx-version-min=version -mkernel -mone-byte-bool
582
583 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
584 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
585 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
586 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
587 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
588 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
589
590 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
591 -mframe-limit=bytes -mxbpf
592
593 FR30 Options -msmall-model -mno-lsim
594
595 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
596
597 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
598 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
599 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
600 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
601 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
602 -mno-pack -mno-eflags -mcond-move -mno-cond-move
603 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
604 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
605 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
606 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
607
608 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
609 -tno-android-cc -tno-android-ld
610
611 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
612 -malign-300
613
614 HPPA Options -march=architecture-type -mcaller-copies
615 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
616 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
617 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
618 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
619 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
620 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
621 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
622 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
623 -static -threads
624
625 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
626 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
627 -mconstant-gp -mauto-pic -mfused-madd
628 -minline-float-divide-min-latency
629 -minline-float-divide-max-throughput -mno-inline-float-divide
630 -minline-int-divide-min-latency -minline-int-divide-max-throughput
631 -mno-inline-int-divide -minline-sqrt-min-latency
632 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
633 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
634 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
635 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
636 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
637 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
638 -msched-prefer-non-control-spec-insns
639 -msched-stop-bits-after-every-cycle
640 -msched-count-spec-in-critical-path
641 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
642 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
643 insns
644
645 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
646 -mmultiply-enabled -msign-extend-enabled -muser-enabled
647
648 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
649 -mno-align-loops -missue-rate=number -mbranch-cost=number
650 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
651 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
652
653 M32C Options -mcpu=cpu -msim -memregs=number
654
655 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
656 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
657 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
658 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
659 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
660 -malign-int -mstrict-align -msep-data -mno-sep-data
661 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
662 -mxgot -mno-xgot -mlong-jump-table-offsets
663
664 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
665 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
666 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
667 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
668 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
669 -mstack-increment
670
671 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
672 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
673 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
674 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
675 -msimnovec -mtf -mtiny=n
676
677 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
678 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
679 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
680 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
681 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
682 -mpic-data-is-text-relative
683
684 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
685 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
686 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
687 -mno-mips16 -mflip-mips16 -minterlink-compressed
688 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
689 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
690 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
691 -mhard-float -msoft-float -mno-float -msingle-float
692 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
693 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
694 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
695 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
696 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
697 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
698 type -msmartmips -mno-smartmips -mpaired-single
699 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
700 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
701 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
702 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
703 -mno-embedded-data -muninit-const-in-rodata
704 -mno-uninit-const-in-rodata -mcode-readable=setting
705 -msplit-addresses -mno-split-addresses -mexplicit-relocs
706 -mno-explicit-relocs -mcheck-zero-division
707 -mno-check-zero-division -mdivide-traps -mdivide-breaks
708 -mload-store-pairs -mno-load-store-pairs -mmemcpy -mno-memcpy
709 -mlong-calls -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd
710 -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k
711 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
712 -mfix-r5900 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000
713 -mfix-rm7000 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120
714 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1
715 -mflush-func=func -mno-flush-func -mbranch-cost=num
716 -mbranch-likely -mno-branch-likely -mcompact-branches=policy
717 -mfp-exceptions -mno-fp-exceptions -mvr4130-align
718 -mno-vr4130-align -msynci -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1
719 -mmadd4 -mno-madd4 -mrelax-pic-calls -mno-relax-pic-calls
720 -mmcount-ra-address -mframe-header-opt -mno-frame-header-opt
721
722 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
723 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
724 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
725 -mbase-addresses -mno-base-addresses -msingle-exit
726 -mno-single-exit
727
728 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
729 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
730 -mrelax -mliw -msetlb
731
732 Moxie Options -meb -mel -mmul.x -mno-crt0
733
734 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
735 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
736 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
737 -mmax-inline-shift=
738
739 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
740 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
741 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
742 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
743 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
744
745 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
746 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
747 -mbypass-cache -mno-cache-volatile -mcache-volatile
748 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
749 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
750 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
751 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
752 -mno-cdx
753
754 Nvidia PTX Options -m64 -mmainkernel -moptimize
755
756 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
757 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
758 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
759
760 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
761 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
762 -mdec-asm -mgnu-asm -mlra
763
764 picoChip Options -mae=ae_type -mvliw-lookahead=N
765 -msymbol-as-address -mno-inefficient-warnings
766
767 PowerPC Options See RS/6000 and PowerPC Options.
768
769 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
770
771 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
772 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -march=ISA-
773 string -mtune=processor-string -mpreferred-stack-boundary=num
774 -msmall-data-limit=N-bytes -msave-restore -mno-save-restore
775 -mshorten-memrefs -mno-shorten-memrefs -mstrict-align
776 -mno-strict-align -mcmodel=medlow -mcmodel=medany
777 -mexplicit-relocs -mno-explicit-relocs -mrelax -mno-relax
778 -mriscv-attribute -mmo-riscv-attribute -malign-data=type
779 -mbig-endian -mlittle-endian +-mstack-protector-guard=guard
780 -mstack-protector-guard-reg=reg
781 +-mstack-protector-guard-offset=offset
782
783 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
784 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
785 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
786
787 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
788 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
789 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
790 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
791 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
792 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
793 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
794 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
795 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
796 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
797 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
798 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
799 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
800 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
801 -msingle-pic-base -mprioritize-restricted-insns=priority
802 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
803 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
804 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
805 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
806 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
807 -mlongcall -mno-longcall -mpltseq -mno-pltseq
808 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
809 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
810 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
811 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
812 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
813 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
814 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
815 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
816 -mno-pointers-to-nested-functions -msave-toc-indirect
817 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
818 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
819 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
820 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
821 -mfloat128 -mno-float128 -mfloat128-hardware
822 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
823 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
824 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
825 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
826 -mprivileged -mno-privileged
827
828 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
829 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
830 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
831 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
832 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
833 -msave-acc-in-interrupts
834
835 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
836 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
837 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
838 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
839 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
840 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
841 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
842 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
843 -mhotpatch=halfwords,halfwords
844
845 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
846 -mscore7 -mscore7d
847
848 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
849 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
850 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
851 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
852 -mnomacsave -mieee -mno-ieee -mbitops -misize
853 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
854 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
855 -mfixed-range=register-range -maccumulate-outgoing-args
856 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
857 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
858 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
859 -mpretend-cmove -mtas
860
861 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
862 -mno-impure-text -pthreads
863
864 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
865 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
866 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
867 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
868 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
869 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
870 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
871 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
872 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
873 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
874 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
875
876 System V Options -Qy -Qn -YP,paths -Ym,dir
877
878 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
879 -mlittle-endian -mcmodel=code-model
880
881 TILEPro Options -mcpu=cpu -m32
882
883 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
884 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
885 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
886 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
887 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
888 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
889
890 VAX Options -mg -mgnu -munix
891
892 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
893 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
894 -muser-mode
895
896 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
897 -mpointer-size=size
898
899 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
900 -Xbind-now
901
902 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
903 list -mdump-tune-features -mno-default -mfpmath=unit
904 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
905 -mhard-float -msoft-float -mno-wide-multiply -mrtd
906 -malign-double -mpreferred-stack-boundary=num
907 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
908 -mcrc32 -mmwait -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
909 -mprefer-vector-width=opt -mmmx -msse -msse2 -msse3 -mssse3
910 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf
911 -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq
912 -mavx512ifma -mavx512vbmi -msha -maes -mpclmul -mfsgsbase
913 -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite
914 -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves -msse4a
915 -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
916 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle
917 -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
918 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
919 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
920 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
921 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
922 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
923 -mamx-bf16 -muintr -mhreset -mavxvnni -mcldemote -mms-bitfields
924 -mno-align-stringops -minline-all-stringops
925 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
926 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
927 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
928 -m96bit-long-double -mlong-double-64 -mlong-double-80
929 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
930 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
931 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
932 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
933 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
934 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
935 -minstrument-return=type -mfentry-name=name -mfentry-section=name
936 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
937 -malign-data=type -mstack-protector-guard=guard
938 -mstack-protector-guard-reg=reg
939 -mstack-protector-guard-offset=offset
940 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
941 -mcall-ms2sysv-xlogues -mindirect-branch=choice
942 -mfunction-return=choice -mindirect-branch-register -mneeded
943
944 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
945 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
946 -fno-set-stack-executable
947
948 Xstormy16 Options -msim
949
950 Xtensa Options -mconst16 -mno-const16 -mfused-madd
951 -mno-fused-madd -mforce-no-pic -mserialize-volatile
952 -mno-serialize-volatile -mtext-section-literals
953 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
954 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
955 -mabi=abi-type
956
957 zSeries Options See S/390 and zSeries Options.
958
959 Options Controlling the Kind of Output
960 Compilation can involve up to four stages: preprocessing, compilation
961 proper, assembly and linking, always in that order. GCC is capable of
962 preprocessing and compiling several files either into several assembler
963 input files, or into one assembler input file; then each assembler
964 input file produces an object file, and linking combines all the object
965 files (those newly compiled, and those specified as input) into an
966 executable file.
967
968 For any given input file, the file name suffix determines what kind of
969 compilation is done:
970
971 file.c
972 C source code that must be preprocessed.
973
974 file.i
975 C source code that should not be preprocessed.
976
977 file.ii
978 C++ source code that should not be preprocessed.
979
980 file.m
981 Objective-C source code. Note that you must link with the libobjc
982 library to make an Objective-C program work.
983
984 file.mi
985 Objective-C source code that should not be preprocessed.
986
987 file.mm
988 file.M
989 Objective-C++ source code. Note that you must link with the
990 libobjc library to make an Objective-C++ program work. Note that
991 .M refers to a literal capital M.
992
993 file.mii
994 Objective-C++ source code that should not be preprocessed.
995
996 file.h
997 C, C++, Objective-C or Objective-C++ header file to be turned into
998 a precompiled header (default), or C, C++ header file to be turned
999 into an Ada spec (via the -fdump-ada-spec switch).
1000
1001 file.cc
1002 file.cp
1003 file.cxx
1004 file.cpp
1005 file.CPP
1006 file.c++
1007 file.C
1008 C++ source code that must be preprocessed. Note that in .cxx, the
1009 last two letters must both be literally x. Likewise, .C refers to
1010 a literal capital C.
1011
1012 file.mm
1013 file.M
1014 Objective-C++ source code that must be preprocessed.
1015
1016 file.mii
1017 Objective-C++ source code that should not be preprocessed.
1018
1019 file.hh
1020 file.H
1021 file.hp
1022 file.hxx
1023 file.hpp
1024 file.HPP
1025 file.h++
1026 file.tcc
1027 C++ header file to be turned into a precompiled header or Ada spec.
1028
1029 file.f
1030 file.for
1031 file.ftn
1032 Fixed form Fortran source code that should not be preprocessed.
1033
1034 file.F
1035 file.FOR
1036 file.fpp
1037 file.FPP
1038 file.FTN
1039 Fixed form Fortran source code that must be preprocessed (with the
1040 traditional preprocessor).
1041
1042 file.f90
1043 file.f95
1044 file.f03
1045 file.f08
1046 Free form Fortran source code that should not be preprocessed.
1047
1048 file.F90
1049 file.F95
1050 file.F03
1051 file.F08
1052 Free form Fortran source code that must be preprocessed (with the
1053 traditional preprocessor).
1054
1055 file.go
1056 Go source code.
1057
1058 file.brig
1059 BRIG files (binary representation of HSAIL).
1060
1061 file.d
1062 D source code.
1063
1064 file.di
1065 D interface file.
1066
1067 file.dd
1068 D documentation code (Ddoc).
1069
1070 file.ads
1071 Ada source code file that contains a library unit declaration (a
1072 declaration of a package, subprogram, or generic, or a generic
1073 instantiation), or a library unit renaming declaration (a package,
1074 generic, or subprogram renaming declaration). Such files are also
1075 called specs.
1076
1077 file.adb
1078 Ada source code file containing a library unit body (a subprogram
1079 or package body). Such files are also called bodies.
1080
1081 file.s
1082 Assembler code.
1083
1084 file.S
1085 file.sx
1086 Assembler code that must be preprocessed.
1087
1088 other
1089 An object file to be fed straight into linking. Any file name with
1090 no recognized suffix is treated this way.
1091
1092 You can specify the input language explicitly with the -x option:
1093
1094 -x language
1095 Specify explicitly the language for the following input files
1096 (rather than letting the compiler choose a default based on the
1097 file name suffix). This option applies to all following input
1098 files until the next -x option. Possible values for language are:
1099
1100 c c-header cpp-output
1101 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1102 objective-c objective-c-header objective-c-cpp-output
1103 objective-c++ objective-c++-header objective-c++-cpp-output
1104 assembler assembler-with-cpp
1105 ada
1106 d
1107 f77 f77-cpp-input f95 f95-cpp-input
1108 go
1109 brig
1110
1111 -x none
1112 Turn off any specification of a language, so that subsequent files
1113 are handled according to their file name suffixes (as they are if
1114 -x has not been used at all).
1115
1116 If you only want some of the stages of compilation, you can use -x (or
1117 filename suffixes) to tell gcc where to start, and one of the options
1118 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1119 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1120
1121 -c Compile or assemble the source files, but do not link. The linking
1122 stage simply is not done. The ultimate output is in the form of an
1123 object file for each source file.
1124
1125 By default, the object file name for a source file is made by
1126 replacing the suffix .c, .i, .s, etc., with .o.
1127
1128 Unrecognized input files, not requiring compilation or assembly,
1129 are ignored.
1130
1131 -S Stop after the stage of compilation proper; do not assemble. The
1132 output is in the form of an assembler code file for each non-
1133 assembler input file specified.
1134
1135 By default, the assembler file name for a source file is made by
1136 replacing the suffix .c, .i, etc., with .s.
1137
1138 Input files that don't require compilation are ignored.
1139
1140 -E Stop after the preprocessing stage; do not run the compiler proper.
1141 The output is in the form of preprocessed source code, which is
1142 sent to the standard output.
1143
1144 Input files that don't require preprocessing are ignored.
1145
1146 -o file
1147 Place the primary output in file file. This applies to whatever
1148 sort of output is being produced, whether it be an executable file,
1149 an object file, an assembler file or preprocessed C code.
1150
1151 If -o is not specified, the default is to put an executable file in
1152 a.out, the object file for source.suffix in source.o, its assembler
1153 file in source.s, a precompiled header file in source.suffix.gch,
1154 and all preprocessed C source on standard output.
1155
1156 Though -o names only the primary output, it also affects the naming
1157 of auxiliary and dump outputs. See the examples below. Unless
1158 overridden, both auxiliary outputs and dump outputs are placed in
1159 the same directory as the primary output. In auxiliary outputs,
1160 the suffix of the input file is replaced with that of the auxiliary
1161 output file type; in dump outputs, the suffix of the dump file is
1162 appended to the input file suffix. In compilation commands, the
1163 base name of both auxiliary and dump outputs is that of the primary
1164 output; in compile and link commands, the primary output name,
1165 minus the executable suffix, is combined with the input file name.
1166 If both share the same base name, disregarding the suffix, the
1167 result of the combination is that base name, otherwise, they are
1168 concatenated, separated by a dash.
1169
1170 gcc -c foo.c ...
1171
1172 will use foo.o as the primary output, and place aux outputs and
1173 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1174 dump file foo.c.???r.final for -fdump-rtl-final.
1175
1176 If a non-linker output file is explicitly specified, aux and dump
1177 files by default take the same base name:
1178
1179 gcc -c foo.c -o dir/foobar.o ...
1180
1181 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1182
1183 A linker output will instead prefix aux and dump outputs:
1184
1185 gcc foo.c bar.c -o dir/foobar ...
1186
1187 will generally name aux outputs dir/foobar-foo.* and
1188 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1189 dir/foobar-bar.c.*.
1190
1191 The one exception to the above is when the executable shares the
1192 base name with the single input:
1193
1194 gcc foo.c -o dir/foo ...
1195
1196 in which case aux outputs are named dir/foo.* and dump outputs
1197 named dir/foo.c.*.
1198
1199 The location and the names of auxiliary and dump outputs can be
1200 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1201 -save-temps=cwd, and -save-temps=obj.
1202
1203 -dumpbase dumpbase
1204 This option sets the base name for auxiliary and dump output files.
1205 It does not affect the name of the primary output file.
1206 Intermediate outputs, when preserved, are not regarded as primary
1207 outputs, but as auxiliary outputs:
1208
1209 gcc -save-temps -S foo.c
1210
1211 saves the (no longer) temporary preprocessed file in foo.i, and
1212 then compiles to the (implied) output file foo.s, whereas:
1213
1214 gcc -save-temps -dumpbase save-foo -c foo.c
1215
1216 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1217 intermediate, thus auxiliary output), and then assembles to the
1218 (implied) output file foo.o.
1219
1220 Absent this option, dump and aux files take their names from the
1221 input file, or from the (non-linker) output file, if one is
1222 explicitly specified: dump output files (e.g. those requested by
1223 -fdump-* options) with the input name suffix, and aux output files
1224 (those requested by other non-dump options, e.g. "-save-temps",
1225 "-gsplit-dwarf", "-fcallgraph-info") without it.
1226
1227 Similar suffix differentiation of dump and aux outputs can be
1228 attained for explicitly-given -dumpbase basename.suf by also
1229 specifying -dumpbase-ext .suf.
1230
1231 If dumpbase is explicitly specified with any directory component,
1232 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1233 ignored, and instead of appending to it, dumpbase fully overrides
1234 it:
1235
1236 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1237 -dumpdir pfx- -save-temps=cwd ...
1238
1239 creates auxiliary and dump outputs named alt/foo.*, disregarding
1240 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1241 -dumpdir.
1242
1243 When -dumpbase is specified in a command that compiles multiple
1244 inputs, or that compiles and then links, it may be combined with
1245 dumppfx, as specified under -dumpdir. Then, each input file is
1246 compiled using the combined dumppfx, and default values for
1247 dumpbase and auxdropsuf are computed for each input file:
1248
1249 gcc foo.c bar.c -c -dumpbase main ...
1250
1251 creates foo.o and bar.o as primary outputs, and avoids overwriting
1252 the auxiliary and dump outputs by using the dumpbase as a prefix,
1253 creating auxiliary and dump outputs named main-foo.* and
1254 main-bar.*.
1255
1256 An empty string specified as dumpbase avoids the influence of the
1257 output basename in the naming of auxiliary and dump outputs during
1258 compilation, computing default values :
1259
1260 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1261
1262 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1263 how their basenames are taken from the input name, but the
1264 directory still defaults to that of the output.
1265
1266 The empty-string dumpbase does not prevent the use of the output
1267 basename for outputs during linking:
1268
1269 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1270
1271 The compilation of the source files will name auxiliary outputs
1272 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1273 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1274 as the prefix for dumps and auxiliary files.
1275
1276 -dumpbase-ext auxdropsuf
1277 When forming the name of an auxiliary (but not a dump) output file,
1278 drop trailing auxdropsuf from dumpbase before appending any
1279 suffixes. If not specified, this option defaults to the suffix of
1280 a default dumpbase, i.e., the suffix of the input file when
1281 -dumpbase is not present in the command line, or dumpbase is
1282 combined with dumppfx.
1283
1284 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1285
1286 creates dir/foo.o as the main output, and generates auxiliary
1287 outputs in dir/x-foo.*, taking the location of the primary output,
1288 and dropping the .c suffix from the dumpbase. Dump outputs retain
1289 the suffix: dir/x-foo.c.*.
1290
1291 This option is disregarded if it does not match the suffix of a
1292 specified dumpbase, except as an alternative to the executable
1293 suffix when appending the linker output base name to dumppfx, as
1294 specified below:
1295
1296 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1297
1298 creates main.out as the primary output, and avoids overwriting the
1299 auxiliary and dump outputs by using the executable name minus
1300 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1301 and main-bar.* and dump outputs named main-foo.c.* and
1302 main-bar.c.*.
1303
1304 -dumpdir dumppfx
1305 When forming the name of an auxiliary or dump output file, use
1306 dumppfx as a prefix:
1307
1308 gcc -dumpdir pfx- -c foo.c ...
1309
1310 creates foo.o as the primary output, and auxiliary outputs named
1311 pfx-foo.*, combining the given dumppfx with the default dumpbase
1312 derived from the default primary output, derived in turn from the
1313 input name. Dump outputs also take the input name suffix:
1314 pfx-foo.c.*.
1315
1316 If dumppfx is to be used as a directory name, it must end with a
1317 directory separator:
1318
1319 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1320
1321 creates obj/bar.o as the primary output, and auxiliary outputs
1322 named dir/bar.*, combining the given dumppfx with the default
1323 dumpbase derived from the primary output name. Dump outputs also
1324 take the input name suffix: dir/bar.c.*.
1325
1326 It defaults to the location of the output file; options
1327 -save-temps=cwd and -save-temps=obj override this default, just
1328 like an explicit -dumpdir option. In case multiple such options
1329 are given, the last one prevails:
1330
1331 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1332
1333 outputs foo.o, with auxiliary outputs named foo.* because
1334 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1335 option. It does not matter that =obj is the default for
1336 -save-temps, nor that the output directory is implicitly the
1337 current directory. Dump outputs are named foo.c.*.
1338
1339 When compiling from multiple input files, if -dumpbase is
1340 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1341 appended to (or override, if containing any directory components)
1342 an explicit or defaulted dumppfx, so that each of the multiple
1343 compilations gets differently-named aux and dump outputs.
1344
1345 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1346
1347 outputs auxiliary dumps to dir/pfx-main-foo.* and
1348 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1349 retain the input file suffix: dir/pfx-main-foo.c.* and
1350 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1351 compilation:
1352
1353 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1354
1355 that, applying -dumpbase to a single source, does not compute and
1356 append a separate dumpbase per input file. Its auxiliary and dump
1357 outputs go in dir/pfx-main.*.
1358
1359 When compiling and then linking from multiple input files, a
1360 defaulted or explicitly specified dumppfx also undergoes the
1361 dumpbase- transformation above (e.g. the compilation of foo.c and
1362 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1363 are given, the linker output base name, minus auxdropsuf, if
1364 specified, or the executable suffix otherwise, plus a dash is
1365 appended to the default dumppfx instead. Note, however, that
1366 unlike earlier cases of linking:
1367
1368 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1369
1370 does not append the output name main to dumppfx, because -dumpdir
1371 is explicitly specified. The goal is that the explicitly-specified
1372 dumppfx may contain the specified output name as part of the
1373 prefix, if desired; only an explicitly-specified -dumpbase would be
1374 combined with it, in order to avoid simply discarding a meaningful
1375 option.
1376
1377 When compiling and then linking from a single input file, the
1378 linker output base name will only be appended to the default
1379 dumppfx as above if it does not share the base name with the single
1380 input file name. This has been covered in single-input linking
1381 cases above, but not with an explicit -dumpdir that inhibits the
1382 combination, even if overridden by -save-temps=*:
1383
1384 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1385
1386 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1387 current working directory as ultimately requested by
1388 -save-temps=cwd.
1389
1390 Summing it all up for an intuitive though slightly imprecise data
1391 flow: the primary output name is broken into a directory part and a
1392 basename part; dumppfx is set to the former, unless overridden by
1393 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1394 unless overriden by -dumpbase. If there are multiple inputs or
1395 linking, this dumpbase may be combined with dumppfx and taken from
1396 each input file. Auxiliary output names for each input are formed
1397 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1398 output suffix; dump output names are only different in that the
1399 suffix from dumpbase is retained.
1400
1401 When it comes to auxiliary and dump outputs created during LTO
1402 recompilation, a combination of dumppfx and dumpbase, as given or
1403 as derived from the linker output name but not from inputs, even in
1404 cases in which this combination would not otherwise be used as
1405 such, is passed down with a trailing period replacing the compiler-
1406 added dash, if any, as a -dumpdir option to lto-wrapper; being
1407 involved in linking, this program does not normally get any
1408 -dumpbase and -dumpbase-ext, and it ignores them.
1409
1410 When running sub-compilers, lto-wrapper appends LTO stage names to
1411 the received dumppfx, ensures it contains a directory component so
1412 that it overrides any -dumpdir, and passes that as -dumpbase to
1413 sub-compilers.
1414
1415 -v Print (on standard error output) the commands executed to run the
1416 stages of compilation. Also print the version number of the
1417 compiler driver program and of the preprocessor and the compiler
1418 proper.
1419
1420 -###
1421 Like -v except the commands are not executed and arguments are
1422 quoted unless they contain only alphanumeric characters or "./-_".
1423 This is useful for shell scripts to capture the driver-generated
1424 command lines.
1425
1426 --help
1427 Print (on the standard output) a description of the command-line
1428 options understood by gcc. If the -v option is also specified then
1429 --help is also passed on to the various processes invoked by gcc,
1430 so that they can display the command-line options they accept. If
1431 the -Wextra option has also been specified (prior to the --help
1432 option), then command-line options that have no documentation
1433 associated with them are also displayed.
1434
1435 --target-help
1436 Print (on the standard output) a description of target-specific
1437 command-line options for each tool. For some targets extra target-
1438 specific information may also be printed.
1439
1440 --help={class|[^]qualifier}[,...]
1441 Print (on the standard output) a description of the command-line
1442 options understood by the compiler that fit into all specified
1443 classes and qualifiers. These are the supported classes:
1444
1445 optimizers
1446 Display all of the optimization options supported by the
1447 compiler.
1448
1449 warnings
1450 Display all of the options controlling warning messages
1451 produced by the compiler.
1452
1453 target
1454 Display target-specific options. Unlike the --target-help
1455 option however, target-specific options of the linker and
1456 assembler are not displayed. This is because those tools do
1457 not currently support the extended --help= syntax.
1458
1459 params
1460 Display the values recognized by the --param option.
1461
1462 language
1463 Display the options supported for language, where language is
1464 the name of one of the languages supported in this version of
1465 GCC. If an option is supported by all languages, one needs to
1466 select common class.
1467
1468 common
1469 Display the options that are common to all languages.
1470
1471 These are the supported qualifiers:
1472
1473 undocumented
1474 Display only those options that are undocumented.
1475
1476 joined
1477 Display options taking an argument that appears after an equal
1478 sign in the same continuous piece of text, such as:
1479 --help=target.
1480
1481 separate
1482 Display options taking an argument that appears as a separate
1483 word following the original option, such as: -o output-file.
1484
1485 Thus for example to display all the undocumented target-specific
1486 switches supported by the compiler, use:
1487
1488 --help=target,undocumented
1489
1490 The sense of a qualifier can be inverted by prefixing it with the ^
1491 character, so for example to display all binary warning options
1492 (i.e., ones that are either on or off and that do not take an
1493 argument) that have a description, use:
1494
1495 --help=warnings,^joined,^undocumented
1496
1497 The argument to --help= should not consist solely of inverted
1498 qualifiers.
1499
1500 Combining several classes is possible, although this usually
1501 restricts the output so much that there is nothing to display. One
1502 case where it does work, however, is when one of the classes is
1503 target. For example, to display all the target-specific
1504 optimization options, use:
1505
1506 --help=target,optimizers
1507
1508 The --help= option can be repeated on the command line. Each
1509 successive use displays its requested class of options, skipping
1510 those that have already been displayed. If --help is also
1511 specified anywhere on the command line then this takes precedence
1512 over any --help= option.
1513
1514 If the -Q option appears on the command line before the --help=
1515 option, then the descriptive text displayed by --help= is changed.
1516 Instead of describing the displayed options, an indication is given
1517 as to whether the option is enabled, disabled or set to a specific
1518 value (assuming that the compiler knows this at the point where the
1519 --help= option is used).
1520
1521 Here is a truncated example from the ARM port of gcc:
1522
1523 % gcc -Q -mabi=2 --help=target -c
1524 The following options are target specific:
1525 -mabi= 2
1526 -mabort-on-noreturn [disabled]
1527 -mapcs [disabled]
1528
1529 The output is sensitive to the effects of previous command-line
1530 options, so for example it is possible to find out which
1531 optimizations are enabled at -O2 by using:
1532
1533 -Q -O2 --help=optimizers
1534
1535 Alternatively you can discover which binary optimizations are
1536 enabled by -O3 by using:
1537
1538 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1539 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1540 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1541
1542 --version
1543 Display the version number and copyrights of the invoked GCC.
1544
1545 -pass-exit-codes
1546 Normally the gcc program exits with the code of 1 if any phase of
1547 the compiler returns a non-success return code. If you specify
1548 -pass-exit-codes, the gcc program instead returns with the
1549 numerically highest error produced by any phase returning an error
1550 indication. The C, C++, and Fortran front ends return 4 if an
1551 internal compiler error is encountered.
1552
1553 -pipe
1554 Use pipes rather than temporary files for communication between the
1555 various stages of compilation. This fails to work on some systems
1556 where the assembler is unable to read from a pipe; but the GNU
1557 assembler has no trouble.
1558
1559 -specs=file
1560 Process file after the compiler reads in the standard specs file,
1561 in order to override the defaults which the gcc driver program uses
1562 when determining what switches to pass to cc1, cc1plus, as, ld,
1563 etc. More than one -specs=file can be specified on the command
1564 line, and they are processed in order, from left to right.
1565
1566 -wrapper
1567 Invoke all subcommands under a wrapper program. The name of the
1568 wrapper program and its parameters are passed as a comma separated
1569 list.
1570
1571 gcc -c t.c -wrapper gdb,--args
1572
1573 This invokes all subprograms of gcc under gdb --args, thus the
1574 invocation of cc1 is gdb --args cc1 ....
1575
1576 -ffile-prefix-map=old=new
1577 When compiling files residing in directory old, record any
1578 references to them in the result of the compilation as if the files
1579 resided in directory new instead. Specifying this option is
1580 equivalent to specifying all the individual -f*-prefix-map options.
1581 This can be used to make reproducible builds that are location
1582 independent. See also -fmacro-prefix-map and -fdebug-prefix-map.
1583
1584 -fplugin=name.so
1585 Load the plugin code in file name.so, assumed to be a shared object
1586 to be dlopen'd by the compiler. The base name of the shared object
1587 file is used to identify the plugin for the purposes of argument
1588 parsing (See -fplugin-arg-name-key=value below). Each plugin
1589 should define the callback functions specified in the Plugins API.
1590
1591 -fplugin-arg-name-key=value
1592 Define an argument called key with a value of value for the plugin
1593 called name.
1594
1595 -fdump-ada-spec[-slim]
1596 For C and C++ source and include files, generate corresponding Ada
1597 specs.
1598
1599 -fada-spec-parent=unit
1600 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1601 specs as child units of parent unit.
1602
1603 -fdump-go-spec=file
1604 For input files in any language, generate corresponding Go
1605 declarations in file. This generates Go "const", "type", "var",
1606 and "func" declarations which may be a useful way to start writing
1607 a Go interface to code written in some other language.
1608
1609 @file
1610 Read command-line options from file. The options read are inserted
1611 in place of the original @file option. If file does not exist, or
1612 cannot be read, then the option will be treated literally, and not
1613 removed.
1614
1615 Options in file are separated by whitespace. A whitespace
1616 character may be included in an option by surrounding the entire
1617 option in either single or double quotes. Any character (including
1618 a backslash) may be included by prefixing the character to be
1619 included with a backslash. The file may itself contain additional
1620 @file options; any such options will be processed recursively.
1621
1622 Compiling C++ Programs
1623 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1624 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1625 (for shared template code) .tcc; and preprocessed C++ files use the
1626 suffix .ii. GCC recognizes files with these names and compiles them as
1627 C++ programs even if you call the compiler the same way as for
1628 compiling C programs (usually with the name gcc).
1629
1630 However, the use of gcc does not add the C++ library. g++ is a program
1631 that calls GCC and automatically specifies linking against the C++
1632 library. It treats .c, .h and .i files as C++ source files instead of
1633 C source files unless -x is used. This program is also useful when
1634 precompiling a C header file with a .h extension for use in C++
1635 compilations. On many systems, g++ is also installed with the name
1636 c++.
1637
1638 When you compile C++ programs, you may specify many of the same
1639 command-line options that you use for compiling programs in any
1640 language; or command-line options meaningful for C and related
1641 languages; or options that are meaningful only for C++ programs.
1642
1643 Options Controlling C Dialect
1644 The following options control the dialect of C (or languages derived
1645 from C, such as C++, Objective-C and Objective-C++) that the compiler
1646 accepts:
1647
1648 -ansi
1649 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1650 equivalent to -std=c++98.
1651
1652 This turns off certain features of GCC that are incompatible with
1653 ISO C90 (when compiling C code), or of standard C++ (when compiling
1654 C++ code), such as the "asm" and "typeof" keywords, and predefined
1655 macros such as "unix" and "vax" that identify the type of system
1656 you are using. It also enables the undesirable and rarely used ISO
1657 trigraph feature. For the C compiler, it disables recognition of
1658 C++ style // comments as well as the "inline" keyword.
1659
1660 The alternate keywords "__asm__", "__extension__", "__inline__" and
1661 "__typeof__" continue to work despite -ansi. You would not want to
1662 use them in an ISO C program, of course, but it is useful to put
1663 them in header files that might be included in compilations done
1664 with -ansi. Alternate predefined macros such as "__unix__" and
1665 "__vax__" are also available, with or without -ansi.
1666
1667 The -ansi option does not cause non-ISO programs to be rejected
1668 gratuitously. For that, -Wpedantic is required in addition to
1669 -ansi.
1670
1671 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1672 used. Some header files may notice this macro and refrain from
1673 declaring certain functions or defining certain macros that the ISO
1674 standard doesn't call for; this is to avoid interfering with any
1675 programs that might use these names for other things.
1676
1677 Functions that are normally built in but do not have semantics
1678 defined by ISO C (such as "alloca" and "ffs") are not built-in
1679 functions when -ansi is used.
1680
1681 -std=
1682 Determine the language standard. This option is currently only
1683 supported when compiling C or C++.
1684
1685 The compiler can accept several base standards, such as c90 or
1686 c++98, and GNU dialects of those standards, such as gnu90 or
1687 gnu++98. When a base standard is specified, the compiler accepts
1688 all programs following that standard plus those using GNU
1689 extensions that do not contradict it. For example, -std=c90 turns
1690 off certain features of GCC that are incompatible with ISO C90,
1691 such as the "asm" and "typeof" keywords, but not other GNU
1692 extensions that do not have a meaning in ISO C90, such as omitting
1693 the middle term of a "?:" expression. On the other hand, when a GNU
1694 dialect of a standard is specified, all features supported by the
1695 compiler are enabled, even when those features change the meaning
1696 of the base standard. As a result, some strict-conforming programs
1697 may be rejected. The particular standard is used by -Wpedantic to
1698 identify which features are GNU extensions given that version of
1699 the standard. For example -std=gnu90 -Wpedantic warns about C++
1700 style // comments, while -std=gnu99 -Wpedantic does not.
1701
1702 A value for this option must be provided; possible values are
1703
1704 c90
1705 c89
1706 iso9899:1990
1707 Support all ISO C90 programs (certain GNU extensions that
1708 conflict with ISO C90 are disabled). Same as -ansi for C code.
1709
1710 iso9899:199409
1711 ISO C90 as modified in amendment 1.
1712
1713 c99
1714 c9x
1715 iso9899:1999
1716 iso9899:199x
1717 ISO C99. This standard is substantially completely supported,
1718 modulo bugs and floating-point issues (mainly but not entirely
1719 relating to optional C99 features from Annexes F and G). See
1720 <http://gcc.gnu.org/c99status.html> for more information. The
1721 names c9x and iso9899:199x are deprecated.
1722
1723 c11
1724 c1x
1725 iso9899:2011
1726 ISO C11, the 2011 revision of the ISO C standard. This
1727 standard is substantially completely supported, modulo bugs,
1728 floating-point issues (mainly but not entirely relating to
1729 optional C11 features from Annexes F and G) and the optional
1730 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1731 The name c1x is deprecated.
1732
1733 c17
1734 c18
1735 iso9899:2017
1736 iso9899:2018
1737 ISO C17, the 2017 revision of the ISO C standard (published in
1738 2018). This standard is same as C11 except for corrections of
1739 defects (all of which are also applied with -std=c11) and a new
1740 value of "__STDC_VERSION__", and so is supported to the same
1741 extent as C11.
1742
1743 c2x The next version of the ISO C standard, still under
1744 development. The support for this version is experimental and
1745 incomplete.
1746
1747 gnu90
1748 gnu89
1749 GNU dialect of ISO C90 (including some C99 features).
1750
1751 gnu99
1752 gnu9x
1753 GNU dialect of ISO C99. The name gnu9x is deprecated.
1754
1755 gnu11
1756 gnu1x
1757 GNU dialect of ISO C11. The name gnu1x is deprecated.
1758
1759 gnu17
1760 gnu18
1761 GNU dialect of ISO C17. This is the default for C code.
1762
1763 gnu2x
1764 The next version of the ISO C standard, still under
1765 development, plus GNU extensions. The support for this version
1766 is experimental and incomplete.
1767
1768 c++98
1769 c++03
1770 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1771 and some additional defect reports. Same as -ansi for C++ code.
1772
1773 gnu++98
1774 gnu++03
1775 GNU dialect of -std=c++98.
1776
1777 c++11
1778 c++0x
1779 The 2011 ISO C++ standard plus amendments. The name c++0x is
1780 deprecated.
1781
1782 gnu++11
1783 gnu++0x
1784 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1785
1786 c++14
1787 c++1y
1788 The 2014 ISO C++ standard plus amendments. The name c++1y is
1789 deprecated.
1790
1791 gnu++14
1792 gnu++1y
1793 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1794
1795 c++17
1796 c++1z
1797 The 2017 ISO C++ standard plus amendments. The name c++1z is
1798 deprecated.
1799
1800 gnu++17
1801 gnu++1z
1802 GNU dialect of -std=c++17. This is the default for C++ code.
1803 The name gnu++1z is deprecated.
1804
1805 c++20
1806 c++2a
1807 The 2020 ISO C++ standard plus amendments. Support is
1808 experimental, and could change in incompatible ways in future
1809 releases. The name c++2a is deprecated.
1810
1811 gnu++20
1812 gnu++2a
1813 GNU dialect of -std=c++20. Support is experimental, and could
1814 change in incompatible ways in future releases. The name
1815 gnu++2a is deprecated.
1816
1817 c++2b
1818 c++23
1819 The next revision of the ISO C++ standard, planned for 2023.
1820 Support is highly experimental, and will almost certainly
1821 change in incompatible ways in future releases.
1822
1823 gnu++2b
1824 gnu++23
1825 GNU dialect of -std=c++2b. Support is highly experimental, and
1826 will almost certainly change in incompatible ways in future
1827 releases.
1828
1829 -fgnu89-inline
1830 The option -fgnu89-inline tells GCC to use the traditional GNU
1831 semantics for "inline" functions when in C99 mode.
1832
1833 Using this option is roughly equivalent to adding the "gnu_inline"
1834 function attribute to all inline functions.
1835
1836 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1837 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1838 specifies the default behavior). This option is not supported in
1839 -std=c90 or -std=gnu90 mode.
1840
1841 The preprocessor macros "__GNUC_GNU_INLINE__" and
1842 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1843 effect for "inline" functions.
1844
1845 -fpermitted-flt-eval-methods=style
1846 ISO/IEC TS 18661-3 defines new permissible values for
1847 "FLT_EVAL_METHOD" that indicate that operations and constants with
1848 a semantic type that is an interchange or extended format should be
1849 evaluated to the precision and range of that type. These new
1850 values are a superset of those permitted under C99/C11, which does
1851 not specify the meaning of other positive values of
1852 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
1853 been written expecting the possibility of the new values.
1854
1855 -fpermitted-flt-eval-methods specifies whether the compiler should
1856 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
1857 the extended set of values specified in ISO/IEC TS 18661-3.
1858
1859 style is either "c11" or "ts-18661-3" as appropriate.
1860
1861 The default when in a standards compliant mode (-std=c11 or
1862 similar) is -fpermitted-flt-eval-methods=c11. The default when in
1863 a GNU dialect (-std=gnu11 or similar) is
1864 -fpermitted-flt-eval-methods=ts-18661-3.
1865
1866 -aux-info filename
1867 Output to the given filename prototyped declarations for all
1868 functions declared and/or defined in a translation unit, including
1869 those in header files. This option is silently ignored in any
1870 language other than C.
1871
1872 Besides declarations, the file indicates, in comments, the origin
1873 of each declaration (source file and line), whether the declaration
1874 was implicit, prototyped or unprototyped (I, N for new or O for
1875 old, respectively, in the first character after the line number and
1876 the colon), and whether it came from a declaration or a definition
1877 (C or F, respectively, in the following character). In the case of
1878 function definitions, a K&R-style list of arguments followed by
1879 their declarations is also provided, inside comments, after the
1880 declaration.
1881
1882 -fallow-parameterless-variadic-functions
1883 Accept variadic functions without named parameters.
1884
1885 Although it is possible to define such a function, this is not very
1886 useful as it is not possible to read the arguments. This is only
1887 supported for C as this construct is allowed by C++.
1888
1889 -fno-asm
1890 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1891 code can use these words as identifiers. You can use the keywords
1892 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
1893 -fno-asm.
1894
1895 In C++, this switch only affects the "typeof" keyword, since "asm"
1896 and "inline" are standard keywords. You may want to use the
1897 -fno-gnu-keywords flag instead, which has the same effect. In C99
1898 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
1899 and "typeof" keywords, since "inline" is a standard keyword in ISO
1900 C99.
1901
1902 -fno-builtin
1903 -fno-builtin-function
1904 Don't recognize built-in functions that do not begin with
1905 __builtin_ as prefix.
1906
1907 GCC normally generates special code to handle certain built-in
1908 functions more efficiently; for instance, calls to "alloca" may
1909 become single instructions which adjust the stack directly, and
1910 calls to "memcpy" may become inline copy loops. The resulting code
1911 is often both smaller and faster, but since the function calls no
1912 longer appear as such, you cannot set a breakpoint on those calls,
1913 nor can you change the behavior of the functions by linking with a
1914 different library. In addition, when a function is recognized as a
1915 built-in function, GCC may use information about that function to
1916 warn about problems with calls to that function, or to generate
1917 more efficient code, even if the resulting code still contains
1918 calls to that function. For example, warnings are given with
1919 -Wformat for bad calls to "printf" when "printf" is built in and
1920 "strlen" is known not to modify global memory.
1921
1922 With the -fno-builtin-function option only the built-in function
1923 function is disabled. function must not begin with __builtin_. If
1924 a function is named that is not built-in in this version of GCC,
1925 this option is ignored. There is no corresponding
1926 -fbuiltin-function option; if you wish to enable built-in functions
1927 selectively when using -fno-builtin or -ffreestanding, you may
1928 define macros such as:
1929
1930 #define abs(n) __builtin_abs ((n))
1931 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1932
1933 -fgimple
1934 Enable parsing of function definitions marked with "__GIMPLE".
1935 This is an experimental feature that allows unit testing of GIMPLE
1936 passes.
1937
1938 -fhosted
1939 Assert that compilation targets a hosted environment. This implies
1940 -fbuiltin. A hosted environment is one in which the entire
1941 standard library is available, and in which "main" has a return
1942 type of "int". Examples are nearly everything except a kernel.
1943 This is equivalent to -fno-freestanding.
1944
1945 -ffreestanding
1946 Assert that compilation targets a freestanding environment. This
1947 implies -fno-builtin. A freestanding environment is one in which
1948 the standard library may not exist, and program startup may not
1949 necessarily be at "main". The most obvious example is an OS
1950 kernel. This is equivalent to -fno-hosted.
1951
1952 -fopenacc
1953 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
1954 "!$acc" in Fortran. When -fopenacc is specified, the compiler
1955 generates accelerated code according to the OpenACC Application
1956 Programming Interface v2.6 <https://www.openacc.org>. This option
1957 implies -pthread, and thus is only supported on targets that have
1958 support for -pthread.
1959
1960 -fopenacc-dim=geom
1961 Specify default compute dimensions for parallel offload regions
1962 that do not explicitly specify. The geom value is a triple of
1963 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
1964 size can be omitted, to use a target-specific default value.
1965
1966 -fopenmp
1967 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
1968 "!$omp" in Fortran. When -fopenmp is specified, the compiler
1969 generates parallel code according to the OpenMP Application Program
1970 Interface v4.5 <https://www.openmp.org>. This option implies
1971 -pthread, and thus is only supported on targets that have support
1972 for -pthread. -fopenmp implies -fopenmp-simd.
1973
1974 -fopenmp-simd
1975 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
1976 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
1977
1978 -fgnu-tm
1979 When the option -fgnu-tm is specified, the compiler generates code
1980 for the Linux variant of Intel's current Transactional Memory ABI
1981 specification document (Revision 1.1, May 6 2009). This is an
1982 experimental feature whose interface may change in future versions
1983 of GCC, as the official specification changes. Please note that
1984 not all architectures are supported for this feature.
1985
1986 For more information on GCC's support for transactional memory,
1987
1988 Note that the transactional memory feature is not supported with
1989 non-call exceptions (-fnon-call-exceptions).
1990
1991 -fms-extensions
1992 Accept some non-standard constructs used in Microsoft header files.
1993
1994 In C++ code, this allows member names in structures to be similar
1995 to previous types declarations.
1996
1997 typedef int UOW;
1998 struct ABC {
1999 UOW UOW;
2000 };
2001
2002 Some cases of unnamed fields in structures and unions are only
2003 accepted with this option.
2004
2005 Note that this option is off for all targets except for x86 targets
2006 using ms-abi.
2007
2008 -fplan9-extensions
2009 Accept some non-standard constructs used in Plan 9 code.
2010
2011 This enables -fms-extensions, permits passing pointers to
2012 structures with anonymous fields to functions that expect pointers
2013 to elements of the type of the field, and permits referring to
2014 anonymous fields declared using a typedef. This is only
2015 supported for C, not C++.
2016
2017 -fcond-mismatch
2018 Allow conditional expressions with mismatched types in the second
2019 and third arguments. The value of such an expression is void.
2020 This option is not supported for C++.
2021
2022 -flax-vector-conversions
2023 Allow implicit conversions between vectors with differing numbers
2024 of elements and/or incompatible element types. This option should
2025 not be used for new code.
2026
2027 -funsigned-char
2028 Let the type "char" be unsigned, like "unsigned char".
2029
2030 Each kind of machine has a default for what "char" should be. It
2031 is either like "unsigned char" by default or like "signed char" by
2032 default.
2033
2034 Ideally, a portable program should always use "signed char" or
2035 "unsigned char" when it depends on the signedness of an object.
2036 But many programs have been written to use plain "char" and expect
2037 it to be signed, or expect it to be unsigned, depending on the
2038 machines they were written for. This option, and its inverse, let
2039 you make such a program work with the opposite default.
2040
2041 The type "char" is always a distinct type from each of "signed
2042 char" or "unsigned char", even though its behavior is always just
2043 like one of those two.
2044
2045 -fsigned-char
2046 Let the type "char" be signed, like "signed char".
2047
2048 Note that this is equivalent to -fno-unsigned-char, which is the
2049 negative form of -funsigned-char. Likewise, the option
2050 -fno-signed-char is equivalent to -funsigned-char.
2051
2052 -fsigned-bitfields
2053 -funsigned-bitfields
2054 -fno-signed-bitfields
2055 -fno-unsigned-bitfields
2056 These options control whether a bit-field is signed or unsigned,
2057 when the declaration does not use either "signed" or "unsigned".
2058 By default, such a bit-field is signed, because this is consistent:
2059 the basic integer types such as "int" are signed types.
2060
2061 -fsso-struct=endianness
2062 Set the default scalar storage order of structures and unions to
2063 the specified endianness. The accepted values are big-endian,
2064 little-endian and native for the native endianness of the target
2065 (the default). This option is not supported for C++.
2066
2067 Warning: the -fsso-struct switch causes GCC to generate code that
2068 is not binary compatible with code generated without it if the
2069 specified endianness is not the native endianness of the target.
2070
2071 Options Controlling C++ Dialect
2072 This section describes the command-line options that are only
2073 meaningful for C++ programs. You can also use most of the GNU compiler
2074 options regardless of what language your program is in. For example,
2075 you might compile a file firstClass.C like this:
2076
2077 g++ -g -fstrict-enums -O -c firstClass.C
2078
2079 In this example, only -fstrict-enums is an option meant only for C++
2080 programs; you can use the other options with any language supported by
2081 GCC.
2082
2083 Some options for compiling C programs, such as -std, are also relevant
2084 for C++ programs.
2085
2086 Here is a list of options that are only for compiling C++ programs:
2087
2088 -fabi-version=n
2089 Use version n of the C++ ABI. The default is version 0.
2090
2091 Version 0 refers to the version conforming most closely to the C++
2092 ABI specification. Therefore, the ABI obtained using version 0
2093 will change in different versions of G++ as ABI bugs are fixed.
2094
2095 Version 1 is the version of the C++ ABI that first appeared in G++
2096 3.2.
2097
2098 Version 2 is the version of the C++ ABI that first appeared in G++
2099 3.4, and was the default through G++ 4.9.
2100
2101 Version 3 corrects an error in mangling a constant address as a
2102 template argument.
2103
2104 Version 4, which first appeared in G++ 4.5, implements a standard
2105 mangling for vector types.
2106
2107 Version 5, which first appeared in G++ 4.6, corrects the mangling
2108 of attribute const/volatile on function pointer types, decltype of
2109 a plain decl, and use of a function parameter in the declaration of
2110 another parameter.
2111
2112 Version 6, which first appeared in G++ 4.7, corrects the promotion
2113 behavior of C++11 scoped enums and the mangling of template
2114 argument packs, const/static_cast, prefix ++ and --, and a class
2115 scope function used as a template argument.
2116
2117 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2118 as a builtin type and corrects the mangling of lambdas in default
2119 argument scope.
2120
2121 Version 8, which first appeared in G++ 4.9, corrects the
2122 substitution behavior of function types with function-cv-
2123 qualifiers.
2124
2125 Version 9, which first appeared in G++ 5.2, corrects the alignment
2126 of "nullptr_t".
2127
2128 Version 10, which first appeared in G++ 6.1, adds mangling of
2129 attributes that affect type identity, such as ia32 calling
2130 convention attributes (e.g. stdcall).
2131
2132 Version 11, which first appeared in G++ 7, corrects the mangling of
2133 sizeof... expressions and operator names. For multiple entities
2134 with the same name within a function, that are declared in
2135 different scopes, the mangling now changes starting with the
2136 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2137
2138 Version 12, which first appeared in G++ 8, corrects the calling
2139 conventions for empty classes on the x86_64 target and for classes
2140 with only deleted copy/move constructors. It accidentally changes
2141 the calling convention for classes with a deleted copy constructor
2142 and a trivial move constructor.
2143
2144 Version 13, which first appeared in G++ 8.2, fixes the accidental
2145 change in version 12.
2146
2147 Version 14, which first appeared in G++ 10, corrects the mangling
2148 of the nullptr expression.
2149
2150 Version 15, which first appeared in G++ 11, changes the mangling of
2151 "__alignof__" to be distinct from that of "alignof", and dependent
2152 operator names.
2153
2154 See also -Wabi.
2155
2156 -fabi-compat-version=n
2157 On targets that support strong aliases, G++ works around mangling
2158 changes by creating an alias with the correct mangled name when
2159 defining a symbol with an incorrect mangled name. This switch
2160 specifies which ABI version to use for the alias.
2161
2162 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
2163 compatibility). If another ABI version is explicitly selected,
2164 this defaults to 0. For compatibility with GCC versions 3.2
2165 through 4.9, use -fabi-compat-version=2.
2166
2167 If this option is not provided but -Wabi=n is, that version is used
2168 for compatibility aliases. If this option is provided along with
2169 -Wabi (without the version), the version from this option is used
2170 for the warning.
2171
2172 -fno-access-control
2173 Turn off all access checking. This switch is mainly useful for
2174 working around bugs in the access control code.
2175
2176 -faligned-new
2177 Enable support for C++17 "new" of types that require more alignment
2178 than "void* ::operator new(std::size_t)" provides. A numeric
2179 argument such as "-faligned-new=32" can be used to specify how much
2180 alignment (in bytes) is provided by that function, but few users
2181 will need to override the default of "alignof(std::max_align_t)".
2182
2183 This flag is enabled by default for -std=c++17.
2184
2185 -fchar8_t
2186 -fno-char8_t
2187 Enable support for "char8_t" as adopted for C++20. This includes
2188 the addition of a new "char8_t" fundamental type, changes to the
2189 types of UTF-8 string and character literals, new signatures for
2190 user-defined literals, associated standard library updates, and new
2191 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2192
2193 This option enables functions to be overloaded for ordinary and
2194 UTF-8 strings:
2195
2196 int f(const char *); // #1
2197 int f(const char8_t *); // #2
2198 int v1 = f("text"); // Calls #1
2199 int v2 = f(u8"text"); // Calls #2
2200
2201 and introduces new signatures for user-defined literals:
2202
2203 int operator""_udl1(char8_t);
2204 int v3 = u8'x'_udl1;
2205 int operator""_udl2(const char8_t*, std::size_t);
2206 int v4 = u8"text"_udl2;
2207 template<typename T, T...> int operator""_udl3();
2208 int v5 = u8"text"_udl3;
2209
2210 The change to the types of UTF-8 string and character literals
2211 introduces incompatibilities with ISO C++11 and later standards.
2212 For example, the following code is well-formed under ISO C++11, but
2213 is ill-formed when -fchar8_t is specified.
2214
2215 char ca[] = u8"xx"; // error: char-array initialized from wide
2216 // string
2217 const char *cp = u8"xx";// error: invalid conversion from
2218 // `const char8_t*' to `const char*'
2219 int f(const char*);
2220 auto v = f(u8"xx"); // error: invalid conversion from
2221 // `const char8_t*' to `const char*'
2222 std::string s{u8"xx"}; // error: no matching function for call to
2223 // `std::basic_string<char>::basic_string()'
2224 using namespace std::literals;
2225 s = u8"xx"s; // error: conversion from
2226 // `basic_string<char8_t>' to non-scalar
2227 // type `basic_string<char>' requested
2228
2229 -fcheck-new
2230 Check that the pointer returned by "operator new" is non-null
2231 before attempting to modify the storage allocated. This check is
2232 normally unnecessary because the C++ standard specifies that
2233 "operator new" only returns 0 if it is declared "throw()", in which
2234 case the compiler always checks the return value even without this
2235 option. In all other cases, when "operator new" has a non-empty
2236 exception specification, memory exhaustion is signalled by throwing
2237 "std::bad_alloc". See also new (nothrow).
2238
2239 -fconcepts
2240 -fconcepts-ts
2241 Below -std=c++20, -fconcepts enables support for the C++ Extensions
2242 for Concepts Technical Specification, ISO 19217 (2015).
2243
2244 With -std=c++20 and above, Concepts are part of the language
2245 standard, so -fconcepts defaults to on. But the standard
2246 specification of Concepts differs significantly from the TS, so
2247 some constructs that were allowed in the TS but didn't make it into
2248 the standard can still be enabled by -fconcepts-ts.
2249
2250 -fconstexpr-depth=n
2251 Set the maximum nested evaluation depth for C++11 constexpr
2252 functions to n. A limit is needed to detect endless recursion
2253 during constant expression evaluation. The minimum specified by
2254 the standard is 512.
2255
2256 -fconstexpr-cache-depth=n
2257 Set the maximum level of nested evaluation depth for C++11
2258 constexpr functions that will be cached to n. This is a heuristic
2259 that trades off compilation speed (when the cache avoids repeated
2260 calculations) against memory consumption (when the cache grows very
2261 large from highly recursive evaluations). The default is 8. Very
2262 few users are likely to want to adjust it, but if your code does
2263 heavy constexpr calculations you might want to experiment to find
2264 which value works best for you.
2265
2266 -fconstexpr-loop-limit=n
2267 Set the maximum number of iterations for a loop in C++14 constexpr
2268 functions to n. A limit is needed to detect infinite loops during
2269 constant expression evaluation. The default is 262144 (1<<18).
2270
2271 -fconstexpr-ops-limit=n
2272 Set the maximum number of operations during a single constexpr
2273 evaluation. Even when number of iterations of a single loop is
2274 limited with the above limit, if there are several nested loops and
2275 each of them has many iterations but still smaller than the above
2276 limit, or if in a body of some loop or even outside of a loop too
2277 many expressions need to be evaluated, the resulting constexpr
2278 evaluation might take too long. The default is 33554432 (1<<25).
2279
2280 -fcoroutines
2281 Enable support for the C++ coroutines extension (experimental).
2282
2283 -fno-elide-constructors
2284 The C++ standard allows an implementation to omit creating a
2285 temporary that is only used to initialize another object of the
2286 same type. Specifying this option disables that optimization, and
2287 forces G++ to call the copy constructor in all cases. This option
2288 also causes G++ to call trivial member functions which otherwise
2289 would be expanded inline.
2290
2291 In C++17, the compiler is required to omit these temporaries, but
2292 this option still affects trivial member functions.
2293
2294 -fno-enforce-eh-specs
2295 Don't generate code to check for violation of exception
2296 specifications at run time. This option violates the C++ standard,
2297 but may be useful for reducing code size in production builds, much
2298 like defining "NDEBUG". This does not give user code permission to
2299 throw exceptions in violation of the exception specifications; the
2300 compiler still optimizes based on the specifications, so throwing
2301 an unexpected exception results in undefined behavior at run time.
2302
2303 -fextern-tls-init
2304 -fno-extern-tls-init
2305 The C++11 and OpenMP standards allow "thread_local" and
2306 "threadprivate" variables to have dynamic (runtime) initialization.
2307 To support this, any use of such a variable goes through a wrapper
2308 function that performs any necessary initialization. When the use
2309 and definition of the variable are in the same translation unit,
2310 this overhead can be optimized away, but when the use is in a
2311 different translation unit there is significant overhead even if
2312 the variable doesn't actually need dynamic initialization. If the
2313 programmer can be sure that no use of the variable in a non-
2314 defining TU needs to trigger dynamic initialization (either because
2315 the variable is statically initialized, or a use of the variable in
2316 the defining TU will be executed before any uses in another TU),
2317 they can avoid this overhead with the -fno-extern-tls-init option.
2318
2319 On targets that support symbol aliases, the default is
2320 -fextern-tls-init. On targets that do not support symbol aliases,
2321 the default is -fno-extern-tls-init.
2322
2323 -fno-gnu-keywords
2324 Do not recognize "typeof" as a keyword, so that code can use this
2325 word as an identifier. You can use the keyword "__typeof__"
2326 instead. This option is implied by the strict ISO C++ dialects:
2327 -ansi, -std=c++98, -std=c++11, etc.
2328
2329 -fno-implicit-templates
2330 Never emit code for non-inline templates that are instantiated
2331 implicitly (i.e. by use); only emit code for explicit
2332 instantiations. If you use this option, you must take care to
2333 structure your code to include all the necessary explicit
2334 instantiations to avoid getting undefined symbols at link time.
2335
2336 -fno-implicit-inline-templates
2337 Don't emit code for implicit instantiations of inline templates,
2338 either. The default is to handle inlines differently so that
2339 compiles with and without optimization need the same set of
2340 explicit instantiations.
2341
2342 -fno-implement-inlines
2343 To save space, do not emit out-of-line copies of inline functions
2344 controlled by "#pragma implementation". This causes linker errors
2345 if these functions are not inlined everywhere they are called.
2346
2347 -fmodules-ts
2348 -fno-modules-ts
2349 Enable support for C++20 modules The -fno-modules-ts is usually
2350 not needed, as that is the default. Even though this is a C++20
2351 feature, it is not currently implicitly enabled by selecting that
2352 standard version.
2353
2354 -fmodule-header
2355 -fmodule-header=user
2356 -fmodule-header=system
2357 Compile a header file to create an importable header unit.
2358
2359 -fmodule-implicit-inline
2360 Member functions defined in their class definitions are not
2361 implicitly inline for modular code. This is different to
2362 traditional C++ behavior, for good reasons. However, it may result
2363 in a difficulty during code porting. This option makes such
2364 function definitions implicitly inline. It does however generate
2365 an ABI incompatibility, so you must use it everywhere or nowhere.
2366 (Such definitions outside of a named module remain implicitly
2367 inline, regardless.)
2368
2369 -fno-module-lazy
2370 Disable lazy module importing and module mapper creation.
2371
2372 -fmodule-mapper=[hostname]:port[?ident]
2373 -fmodule-mapper=|program[?ident] args...
2374 -fmodule-mapper==socket[?ident]
2375 -fmodule-mapper=<>[inout][?ident]
2376 -fmodule-mapper=<in>out[?ident]
2377 -fmodule-mapper=file[?ident]
2378 An oracle to query for module name to filename mappings. If
2379 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2380 if that is unset, an in-process default is provided.
2381
2382 -fmodule-only
2383 Only emit the Compiled Module Interface, inhibiting any object
2384 file.
2385
2386 -fms-extensions
2387 Disable Wpedantic warnings about constructs used in MFC, such as
2388 implicit int and getting a pointer to member function via non-
2389 standard syntax.
2390
2391 -fnew-inheriting-ctors
2392 Enable the P0136 adjustment to the semantics of C++11 constructor
2393 inheritance. This is part of C++17 but also considered to be a
2394 Defect Report against C++11 and C++14. This flag is enabled by
2395 default unless -fabi-version=10 or lower is specified.
2396
2397 -fnew-ttp-matching
2398 Enable the P0522 resolution to Core issue 150, template template
2399 parameters and default arguments: this allows a template with
2400 default template arguments as an argument for a template template
2401 parameter with fewer template parameters. This flag is enabled by
2402 default for -std=c++17.
2403
2404 -fno-nonansi-builtins
2405 Disable built-in declarations of functions that are not mandated by
2406 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2407 "bzero", "conjf", and other related functions.
2408
2409 -fnothrow-opt
2410 Treat a "throw()" exception specification as if it were a
2411 "noexcept" specification to reduce or eliminate the text size
2412 overhead relative to a function with no exception specification.
2413 If the function has local variables of types with non-trivial
2414 destructors, the exception specification actually makes the
2415 function smaller because the EH cleanups for those variables can be
2416 optimized away. The semantic effect is that an exception thrown
2417 out of a function with such an exception specification results in a
2418 call to "terminate" rather than "unexpected".
2419
2420 -fno-operator-names
2421 Do not treat the operator name keywords "and", "bitand", "bitor",
2422 "compl", "not", "or" and "xor" as synonyms as keywords.
2423
2424 -fno-optional-diags
2425 Disable diagnostics that the standard says a compiler does not need
2426 to issue. Currently, the only such diagnostic issued by G++ is the
2427 one for a name having multiple meanings within a class.
2428
2429 -fpermissive
2430 Downgrade some diagnostics about nonconformant code from errors to
2431 warnings. Thus, using -fpermissive allows some nonconforming code
2432 to compile.
2433
2434 -fno-pretty-templates
2435 When an error message refers to a specialization of a function
2436 template, the compiler normally prints the signature of the
2437 template followed by the template arguments and any typedefs or
2438 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2439 than "void f(int)") so that it's clear which template is involved.
2440 When an error message refers to a specialization of a class
2441 template, the compiler omits any template arguments that match the
2442 default template arguments for that template. If either of these
2443 behaviors make it harder to understand the error message rather
2444 than easier, you can use -fno-pretty-templates to disable them.
2445
2446 -fno-rtti
2447 Disable generation of information about every class with virtual
2448 functions for use by the C++ run-time type identification features
2449 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2450 language, you can save some space by using this flag. Note that
2451 exception handling uses the same information, but G++ generates it
2452 as needed. The "dynamic_cast" operator can still be used for casts
2453 that do not require run-time type information, i.e. casts to "void
2454 *" or to unambiguous base classes.
2455
2456 Mixing code compiled with -frtti with that compiled with -fno-rtti
2457 may not work. For example, programs may fail to link if a class
2458 compiled with -fno-rtti is used as a base for a class compiled with
2459 -frtti.
2460
2461 -fsized-deallocation
2462 Enable the built-in global declarations
2463
2464 void operator delete (void *, std::size_t) noexcept;
2465 void operator delete[] (void *, std::size_t) noexcept;
2466
2467 as introduced in C++14. This is useful for user-defined
2468 replacement deallocation functions that, for example, use the size
2469 of the object to make deallocation faster. Enabled by default
2470 under -std=c++14 and above. The flag -Wsized-deallocation warns
2471 about places that might want to add a definition.
2472
2473 -fstrict-enums
2474 Allow the compiler to optimize using the assumption that a value of
2475 enumerated type can only be one of the values of the enumeration
2476 (as defined in the C++ standard; basically, a value that can be
2477 represented in the minimum number of bits needed to represent all
2478 the enumerators). This assumption may not be valid if the program
2479 uses a cast to convert an arbitrary integer value to the enumerated
2480 type.
2481
2482 -fstrong-eval-order
2483 Evaluate member access, array subscripting, and shift expressions
2484 in left-to-right order, and evaluate assignment in right-to-left
2485 order, as adopted for C++17. Enabled by default with -std=c++17.
2486 -fstrong-eval-order=some enables just the ordering of member access
2487 and shift expressions, and is the default without -std=c++17.
2488
2489 -ftemplate-backtrace-limit=n
2490 Set the maximum number of template instantiation notes for a single
2491 warning or error to n. The default value is 10.
2492
2493 -ftemplate-depth=n
2494 Set the maximum instantiation depth for template classes to n. A
2495 limit on the template instantiation depth is needed to detect
2496 endless recursions during template class instantiation. ANSI/ISO
2497 C++ conforming programs must not rely on a maximum depth greater
2498 than 17 (changed to 1024 in C++11). The default value is 900, as
2499 the compiler can run out of stack space before hitting 1024 in some
2500 situations.
2501
2502 -fno-threadsafe-statics
2503 Do not emit the extra code to use the routines specified in the C++
2504 ABI for thread-safe initialization of local statics. You can use
2505 this option to reduce code size slightly in code that doesn't need
2506 to be thread-safe.
2507
2508 -fuse-cxa-atexit
2509 Register destructors for objects with static storage duration with
2510 the "__cxa_atexit" function rather than the "atexit" function.
2511 This option is required for fully standards-compliant handling of
2512 static destructors, but only works if your C library supports
2513 "__cxa_atexit".
2514
2515 -fno-use-cxa-get-exception-ptr
2516 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2517 causes "std::uncaught_exception" to be incorrect, but is necessary
2518 if the runtime routine is not available.
2519
2520 -fvisibility-inlines-hidden
2521 This switch declares that the user does not attempt to compare
2522 pointers to inline functions or methods where the addresses of the
2523 two functions are taken in different shared objects.
2524
2525 The effect of this is that GCC may, effectively, mark inline
2526 methods with "__attribute__ ((visibility ("hidden")))" so that they
2527 do not appear in the export table of a DSO and do not require a PLT
2528 indirection when used within the DSO. Enabling this option can
2529 have a dramatic effect on load and link times of a DSO as it
2530 massively reduces the size of the dynamic export table when the
2531 library makes heavy use of templates.
2532
2533 The behavior of this switch is not quite the same as marking the
2534 methods as hidden directly, because it does not affect static
2535 variables local to the function or cause the compiler to deduce
2536 that the function is defined in only one shared object.
2537
2538 You may mark a method as having a visibility explicitly to negate
2539 the effect of the switch for that method. For example, if you do
2540 want to compare pointers to a particular inline method, you might
2541 mark it as having default visibility. Marking the enclosing class
2542 with explicit visibility has no effect.
2543
2544 Explicitly instantiated inline methods are unaffected by this
2545 option as their linkage might otherwise cross a shared library
2546 boundary.
2547
2548 -fvisibility-ms-compat
2549 This flag attempts to use visibility settings to make GCC's C++
2550 linkage model compatible with that of Microsoft Visual Studio.
2551
2552 The flag makes these changes to GCC's linkage model:
2553
2554 1. It sets the default visibility to "hidden", like
2555 -fvisibility=hidden.
2556
2557 2. Types, but not their members, are not hidden by default.
2558
2559 3. The One Definition Rule is relaxed for types without explicit
2560 visibility specifications that are defined in more than one
2561 shared object: those declarations are permitted if they are
2562 permitted when this option is not used.
2563
2564 In new code it is better to use -fvisibility=hidden and export
2565 those classes that are intended to be externally visible.
2566 Unfortunately it is possible for code to rely, perhaps
2567 accidentally, on the Visual Studio behavior.
2568
2569 Among the consequences of these changes are that static data
2570 members of the same type with the same name but defined in
2571 different shared objects are different, so changing one does not
2572 change the other; and that pointers to function members defined in
2573 different shared objects may not compare equal. When this flag is
2574 given, it is a violation of the ODR to define types with the same
2575 name differently.
2576
2577 -fno-weak
2578 Do not use weak symbol support, even if it is provided by the
2579 linker. By default, G++ uses weak symbols if they are available.
2580 This option exists only for testing, and should not be used by end-
2581 users; it results in inferior code and has no benefits. This
2582 option may be removed in a future release of G++.
2583
2584 -fext-numeric-literals (C++ and Objective-C++ only)
2585 Accept imaginary, fixed-point, or machine-defined literal number
2586 suffixes as GNU extensions. When this option is turned off these
2587 suffixes are treated as C++11 user-defined literal numeric
2588 suffixes. This is on by default for all pre-C++11 dialects and all
2589 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2590 This option is off by default for ISO C++11 onwards (-std=c++11,
2591 ...).
2592
2593 -nostdinc++
2594 Do not search for header files in the standard directories specific
2595 to C++, but do still search the other standard directories. (This
2596 option is used when building the C++ library.)
2597
2598 -flang-info-include-translate
2599 -flang-info-include-translate-not
2600 -flang-info-include-translate=header
2601 Inform of include translation events. The first will note accepted
2602 include translations, the second will note declined include
2603 translations. The header form will inform of include translations
2604 relating to that specific header. If header is of the form "user"
2605 or "<system>" it will be resolved to a specific user or system
2606 header using the include path.
2607
2608 -flang-info-module-cmi
2609 -flang-info-module-cmi=module
2610 Inform of Compiled Module Interface pathnames. The first will note
2611 all read CMI pathnames. The module form will not reading a
2612 specific module's CMI. module may be a named module or a header-
2613 unit (the latter indicated by either being a pathname containing
2614 directory separators or enclosed in "<>" or "").
2615
2616 -stdlib=libstdc++,libc++
2617 When G++ is configured to support this option, it allows
2618 specification of alternate C++ runtime libraries. Two options are
2619 available: libstdc++ (the default, native C++ runtime for G++) and
2620 libc++ which is the C++ runtime installed on some operating systems
2621 (e.g. Darwin versions from Darwin11 onwards). The option switches
2622 G++ to use the headers from the specified library and to emit
2623 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2624 for linking.
2625
2626 In addition, these warning options have meanings only for C++ programs:
2627
2628 -Wabi-tag (C++ and Objective-C++ only)
2629 Warn when a type with an ABI tag is used in a context that does not
2630 have that ABI tag. See C++ Attributes for more information about
2631 ABI tags.
2632
2633 -Wcomma-subscript (C++ and Objective-C++ only)
2634 Warn about uses of a comma expression within a subscripting
2635 expression. This usage was deprecated in C++20. However, a comma
2636 expression wrapped in "( )" is not deprecated. Example:
2637
2638 void f(int *a, int b, int c) {
2639 a[b,c]; // deprecated
2640 a[(b,c)]; // OK
2641 }
2642
2643 Enabled by default with -std=c++20.
2644
2645 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2646 Warn when performing class template argument deduction (CTAD) on a
2647 type with no explicitly written deduction guides. This warning
2648 will point out cases where CTAD succeeded only because the compiler
2649 synthesized the implicit deduction guides, which might not be what
2650 the programmer intended. Certain style guides allow CTAD only on
2651 types that specifically "opt-in"; i.e., on types that are designed
2652 to support CTAD. This warning can be suppressed with the following
2653 pattern:
2654
2655 struct allow_ctad_t; // any name works
2656 template <typename T> struct S {
2657 S(T) { }
2658 };
2659 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
2660
2661 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2662 Warn when a class seems unusable because all the constructors or
2663 destructors in that class are private, and it has neither friends
2664 nor public static member functions. Also warn if there are no non-
2665 private methods, and there's at least one private member function
2666 that isn't a constructor or destructor.
2667
2668 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2669 Warn when "delete" is used to destroy an instance of a class that
2670 has virtual functions and non-virtual destructor. It is unsafe to
2671 delete an instance of a derived class through a pointer to a base
2672 class if the base class does not have a virtual destructor. This
2673 warning is enabled by -Wall.
2674
2675 -Wdeprecated-copy (C++ and Objective-C++ only)
2676 Warn that the implicit declaration of a copy constructor or copy
2677 assignment operator is deprecated if the class has a user-provided
2678 copy constructor or copy assignment operator, in C++11 and up.
2679 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2680 also deprecate if the class has a user-provided destructor.
2681
2682 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2683 Disable the warning about the case when the usual arithmetic
2684 conversions are applied on operands where one is of enumeration
2685 type and the other is of a different enumeration type. This
2686 conversion was deprecated in C++20. For example:
2687
2688 enum E1 { e };
2689 enum E2 { f };
2690 int k = f - e;
2691
2692 -Wdeprecated-enum-enum-conversion is enabled by default with
2693 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2694 -Wenum-conversion.
2695
2696 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2697 Disable the warning about the case when the usual arithmetic
2698 conversions are applied on operands where one is of enumeration
2699 type and the other is of a floating-point type. This conversion
2700 was deprecated in C++20. For example:
2701
2702 enum E1 { e };
2703 enum E2 { f };
2704 bool b = e <= 3.7;
2705
2706 -Wdeprecated-enum-float-conversion is enabled by default with
2707 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2708 -Wenum-conversion.
2709
2710 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2711 Do not warn about uses of "std::initializer_list" that are likely
2712 to result in dangling pointers. Since the underlying array for an
2713 "initializer_list" is handled like a normal C++ temporary object,
2714 it is easy to inadvertently keep a pointer to the array past the
2715 end of the array's lifetime. For example:
2716
2717 * If a function returns a temporary "initializer_list", or a
2718 local "initializer_list" variable, the array's lifetime ends at
2719 the end of the return statement, so the value returned has a
2720 dangling pointer.
2721
2722 * If a new-expression creates an "initializer_list", the array
2723 only lives until the end of the enclosing full-expression, so
2724 the "initializer_list" in the heap has a dangling pointer.
2725
2726 * When an "initializer_list" variable is assigned from a brace-
2727 enclosed initializer list, the temporary array created for the
2728 right side of the assignment only lives until the end of the
2729 full-expression, so at the next statement the
2730 "initializer_list" variable has a dangling pointer.
2731
2732 // li's initial underlying array lives as long as li
2733 std::initializer_list<int> li = { 1,2,3 };
2734 // assignment changes li to point to a temporary array
2735 li = { 4, 5 };
2736 // now the temporary is gone and li has a dangling pointer
2737 int i = li.begin()[0] // undefined behavior
2738
2739 * When a list constructor stores the "begin" pointer from the
2740 "initializer_list" argument, this doesn't extend the lifetime
2741 of the array, so if a class variable is constructed from a
2742 temporary "initializer_list", the pointer is left dangling by
2743 the end of the variable declaration statement.
2744
2745 -Winvalid-imported-macros
2746 Verify all imported macro definitions are valid at the end of
2747 compilation. This is not enabled by default, as it requires
2748 additional processing to determine. It may be useful when
2749 preparing sets of header-units to ensure consistent macros.
2750
2751 -Wno-literal-suffix (C++ and Objective-C++ only)
2752 Do not warn when a string or character literal is followed by a ud-
2753 suffix which does not begin with an underscore. As a conforming
2754 extension, GCC treats such suffixes as separate preprocessing
2755 tokens in order to maintain backwards compatibility with code that
2756 uses formatting macros from "<inttypes.h>". For example:
2757
2758 #define __STDC_FORMAT_MACROS
2759 #include <inttypes.h>
2760 #include <stdio.h>
2761
2762 int main() {
2763 int64_t i64 = 123;
2764 printf("My int64: %" PRId64"\n", i64);
2765 }
2766
2767 In this case, "PRId64" is treated as a separate preprocessing
2768 token.
2769
2770 This option also controls warnings when a user-defined literal
2771 operator is declared with a literal suffix identifier that doesn't
2772 begin with an underscore. Literal suffix identifiers that don't
2773 begin with an underscore are reserved for future standardization.
2774
2775 These warnings are enabled by default.
2776
2777 -Wno-narrowing (C++ and Objective-C++ only)
2778 For C++11 and later standards, narrowing conversions are diagnosed
2779 by default, as required by the standard. A narrowing conversion
2780 from a constant produces an error, and a narrowing conversion from
2781 a non-constant produces a warning, but -Wno-narrowing suppresses
2782 the diagnostic. Note that this does not affect the meaning of
2783 well-formed code; narrowing conversions are still considered ill-
2784 formed in SFINAE contexts.
2785
2786 With -Wnarrowing in C++98, warn when a narrowing conversion
2787 prohibited by C++11 occurs within { }, e.g.
2788
2789 int i = { 2.2 }; // error: narrowing from double to int
2790
2791 This flag is included in -Wall and -Wc++11-compat.
2792
2793 -Wnoexcept (C++ and Objective-C++ only)
2794 Warn when a noexcept-expression evaluates to false because of a
2795 call to a function that does not have a non-throwing exception
2796 specification (i.e. "throw()" or "noexcept") but is known by the
2797 compiler to never throw an exception.
2798
2799 -Wnoexcept-type (C++ and Objective-C++ only)
2800 Warn if the C++17 feature making "noexcept" part of a function type
2801 changes the mangled name of a symbol relative to C++14. Enabled by
2802 -Wabi and -Wc++17-compat.
2803
2804 As an example:
2805
2806 template <class T> void f(T t) { t(); };
2807 void g() noexcept;
2808 void h() { f(g); }
2809
2810 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2811 "f<void(*)()noexcept>".
2812
2813 -Wclass-memaccess (C++ and Objective-C++ only)
2814 Warn when the destination of a call to a raw memory function such
2815 as "memset" or "memcpy" is an object of class type, and when
2816 writing into such an object might bypass the class non-trivial or
2817 deleted constructor or copy assignment, violate const-correctness
2818 or encapsulation, or corrupt virtual table pointers. Modifying the
2819 representation of such objects may violate invariants maintained by
2820 member functions of the class. For example, the call to "memset"
2821 below is undefined because it modifies a non-trivial class object
2822 and is, therefore, diagnosed. The safe way to either initialize or
2823 clear the storage of objects of such types is by using the
2824 appropriate constructor or assignment operator, if one is
2825 available.
2826
2827 std::string str = "abc";
2828 memset (&str, 0, sizeof str);
2829
2830 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2831 casting the pointer to the class object to "void *" or to a type
2832 that can be safely accessed by the raw memory function suppresses
2833 the warning.
2834
2835 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2836 Warn when a class has virtual functions and an accessible non-
2837 virtual destructor itself or in an accessible polymorphic base
2838 class, in which case it is possible but unsafe to delete an
2839 instance of a derived class through a pointer to the class itself
2840 or base class. This warning is automatically enabled if -Weffc++
2841 is specified.
2842
2843 -Wregister (C++ and Objective-C++ only)
2844 Warn on uses of the "register" storage class specifier, except when
2845 it is part of the GNU Explicit Register Variables extension. The
2846 use of the "register" keyword as storage class specifier has been
2847 deprecated in C++11 and removed in C++17. Enabled by default with
2848 -std=c++17.
2849
2850 -Wreorder (C++ and Objective-C++ only)
2851 Warn when the order of member initializers given in the code does
2852 not match the order in which they must be executed. For instance:
2853
2854 struct A {
2855 int i;
2856 int j;
2857 A(): j (0), i (1) { }
2858 };
2859
2860 The compiler rearranges the member initializers for "i" and "j" to
2861 match the declaration order of the members, emitting a warning to
2862 that effect. This warning is enabled by -Wall.
2863
2864 -Wno-pessimizing-move (C++ and Objective-C++ only)
2865 This warning warns when a call to "std::move" prevents copy
2866 elision. A typical scenario when copy elision can occur is when
2867 returning in a function with a class return type, when the
2868 expression being returned is the name of a non-volatile automatic
2869 object, and is not a function parameter, and has the same type as
2870 the function return type.
2871
2872 struct T {
2873 ...
2874 };
2875 T fn()
2876 {
2877 T t;
2878 ...
2879 return std::move (t);
2880 }
2881
2882 But in this example, the "std::move" call prevents copy elision.
2883
2884 This warning is enabled by -Wall.
2885
2886 -Wno-redundant-move (C++ and Objective-C++ only)
2887 This warning warns about redundant calls to "std::move"; that is,
2888 when a move operation would have been performed even without the
2889 "std::move" call. This happens because the compiler is forced to
2890 treat the object as if it were an rvalue in certain situations such
2891 as returning a local variable, where copy elision isn't applicable.
2892 Consider:
2893
2894 struct T {
2895 ...
2896 };
2897 T fn(T t)
2898 {
2899 ...
2900 return std::move (t);
2901 }
2902
2903 Here, the "std::move" call is redundant. Because G++ implements
2904 Core Issue 1579, another example is:
2905
2906 struct T { // convertible to U
2907 ...
2908 };
2909 struct U {
2910 ...
2911 };
2912 U fn()
2913 {
2914 T t;
2915 ...
2916 return std::move (t);
2917 }
2918
2919 In this example, copy elision isn't applicable because the type of
2920 the expression being returned and the function return type differ,
2921 yet G++ treats the return value as if it were designated by an
2922 rvalue.
2923
2924 This warning is enabled by -Wextra.
2925
2926 -Wrange-loop-construct (C++ and Objective-C++ only)
2927 This warning warns when a C++ range-based for-loop is creating an
2928 unnecessary copy. This can happen when the range declaration is
2929 not a reference, but probably should be. For example:
2930
2931 struct S { char arr[128]; };
2932 void fn () {
2933 S arr[5];
2934 for (const auto x : arr) { ... }
2935 }
2936
2937 It does not warn when the type being copied is a trivially-copyable
2938 type whose size is less than 64 bytes.
2939
2940 This warning also warns when a loop variable in a range-based for-
2941 loop is initialized with a value of a different type resulting in a
2942 copy. For example:
2943
2944 void fn() {
2945 int arr[10];
2946 for (const double &x : arr) { ... }
2947 }
2948
2949 In the example above, in every iteration of the loop a temporary
2950 value of type "double" is created and destroyed, to which the
2951 reference "const double &" is bound.
2952
2953 This warning is enabled by -Wall.
2954
2955 -Wredundant-tags (C++ and Objective-C++ only)
2956 Warn about redundant class-key and enum-key in references to class
2957 types and enumerated types in contexts where the key can be
2958 eliminated without causing an ambiguity. For example:
2959
2960 struct foo;
2961 struct foo *p; // warn that keyword struct can be eliminated
2962
2963 On the other hand, in this example there is no warning:
2964
2965 struct foo;
2966 void foo (); // "hides" struct foo
2967 void bar (struct foo&); // no warning, keyword struct is necessary
2968
2969 -Wno-subobject-linkage (C++ and Objective-C++ only)
2970 Do not warn if a class type has a base or a field whose type uses
2971 the anonymous namespace or depends on a type with no linkage. If a
2972 type A depends on a type B with no or internal linkage, defining it
2973 in multiple translation units would be an ODR violation because the
2974 meaning of B is different in each translation unit. If A only
2975 appears in a single translation unit, the best way to silence the
2976 warning is to give it internal linkage by putting it in an
2977 anonymous namespace as well. The compiler doesn't give this
2978 warning for types defined in the main .C file, as those are
2979 unlikely to have multiple definitions. -Wsubobject-linkage is
2980 enabled by default.
2981
2982 -Weffc++ (C++ and Objective-C++ only)
2983 Warn about violations of the following style guidelines from Scott
2984 Meyers' Effective C++ series of books:
2985
2986 * Define a copy constructor and an assignment operator for
2987 classes with dynamically-allocated memory.
2988
2989 * Prefer initialization to assignment in constructors.
2990
2991 * Have "operator=" return a reference to *this.
2992
2993 * Don't try to return a reference when you must return an object.
2994
2995 * Distinguish between prefix and postfix forms of increment and
2996 decrement operators.
2997
2998 * Never overload "&&", "||", or ",".
2999
3000 This option also enables -Wnon-virtual-dtor, which is also one of
3001 the effective C++ recommendations. However, the check is extended
3002 to warn about the lack of virtual destructor in accessible non-
3003 polymorphic bases classes too.
3004
3005 When selecting this option, be aware that the standard library
3006 headers do not obey all of these guidelines; use grep -v to filter
3007 out those warnings.
3008
3009 -Wno-exceptions (C++ and Objective-C++ only)
3010 Disable the warning about the case when an exception handler is
3011 shadowed by another handler, which can point out a wrong ordering
3012 of exception handlers.
3013
3014 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3015 Warn about the use of an uncasted "NULL" as sentinel. When
3016 compiling only with GCC this is a valid sentinel, as "NULL" is
3017 defined to "__null". Although it is a null pointer constant rather
3018 than a null pointer, it is guaranteed to be of the same size as a
3019 pointer. But this use is not portable across different compilers.
3020
3021 -Wno-non-template-friend (C++ and Objective-C++ only)
3022 Disable warnings when non-template friend functions are declared
3023 within a template. In very old versions of GCC that predate
3024 implementation of the ISO standard, declarations such as friend int
3025 foo(int), where the name of the friend is an unqualified-id, could
3026 be interpreted as a particular specialization of a template
3027 function; the warning exists to diagnose compatibility problems,
3028 and is enabled by default.
3029
3030 -Wold-style-cast (C++ and Objective-C++ only)
3031 Warn if an old-style (C-style) cast to a non-void type is used
3032 within a C++ program. The new-style casts ("dynamic_cast",
3033 "static_cast", "reinterpret_cast", and "const_cast") are less
3034 vulnerable to unintended effects and much easier to search for.
3035
3036 -Woverloaded-virtual (C++ and Objective-C++ only)
3037 Warn when a function declaration hides virtual functions from a
3038 base class. For example, in:
3039
3040 struct A {
3041 virtual void f();
3042 };
3043
3044 struct B: public A {
3045 void f(int);
3046 };
3047
3048 the "A" class version of "f" is hidden in "B", and code like:
3049
3050 B* b;
3051 b->f();
3052
3053 fails to compile.
3054
3055 -Wno-pmf-conversions (C++ and Objective-C++ only)
3056 Disable the diagnostic for converting a bound pointer to member
3057 function to a plain pointer.
3058
3059 -Wsign-promo (C++ and Objective-C++ only)
3060 Warn when overload resolution chooses a promotion from unsigned or
3061 enumerated type to a signed type, over a conversion to an unsigned
3062 type of the same size. Previous versions of G++ tried to preserve
3063 unsignedness, but the standard mandates the current behavior.
3064
3065 -Wtemplates (C++ and Objective-C++ only)
3066 Warn when a primary template declaration is encountered. Some
3067 coding rules disallow templates, and this may be used to enforce
3068 that rule. The warning is inactive inside a system header file,
3069 such as the STL, so one can still use the STL. One may also
3070 instantiate or specialize templates.
3071
3072 -Wno-mismatched-new-delete (C++ and Objective-C++ only)
3073 Warn for mismatches between calls to "operator new" or "operator
3074 delete" and the corresponding call to the allocation or
3075 deallocation function. This includes invocations of C++ "operator
3076 delete" with pointers returned from either mismatched forms of
3077 "operator new", or from other functions that allocate objects for
3078 which the "operator delete" isn't a suitable deallocator, as well
3079 as calls to other deallocation functions with pointers returned
3080 from "operator new" for which the deallocation function isn't
3081 suitable.
3082
3083 For example, the "delete" expression in the function below is
3084 diagnosed because it doesn't match the array form of the "new"
3085 expression the pointer argument was returned from. Similarly, the
3086 call to "free" is also diagnosed.
3087
3088 void f ()
3089 {
3090 int *a = new int[n];
3091 delete a; // warning: mismatch in array forms of expressions
3092
3093 char *p = new char[n];
3094 free (p); // warning: mismatch between new and free
3095 }
3096
3097 The related option -Wmismatched-dealloc diagnoses mismatches
3098 involving allocation and deallocation functions other than
3099 "operator new" and "operator delete".
3100
3101 -Wmismatched-new-delete is enabled by default.
3102
3103 -Wmismatched-tags (C++ and Objective-C++ only)
3104 Warn for declarations of structs, classes, and class templates and
3105 their specializations with a class-key that does not match either
3106 the definition or the first declaration if no definition is
3107 provided.
3108
3109 For example, the declaration of "struct Object" in the argument
3110 list of "draw" triggers the warning. To avoid it, either remove
3111 the redundant class-key "struct" or replace it with "class" to
3112 match its definition.
3113
3114 class Object {
3115 public:
3116 virtual ~Object () = 0;
3117 };
3118 void draw (struct Object*);
3119
3120 It is not wrong to declare a class with the class-key "struct" as
3121 the example above shows. The -Wmismatched-tags option is intended
3122 to help achieve a consistent style of class declarations. In code
3123 that is intended to be portable to Windows-based compilers the
3124 warning helps prevent unresolved references due to the difference
3125 in the mangling of symbols declared with different class-keys. The
3126 option can be used either on its own or in conjunction with
3127 -Wredundant-tags.
3128
3129 -Wmultiple-inheritance (C++ and Objective-C++ only)
3130 Warn when a class is defined with multiple direct base classes.
3131 Some coding rules disallow multiple inheritance, and this may be
3132 used to enforce that rule. The warning is inactive inside a system
3133 header file, such as the STL, so one can still use the STL. One
3134 may also define classes that indirectly use multiple inheritance.
3135
3136 -Wvirtual-inheritance
3137 Warn when a class is defined with a virtual direct base class.
3138 Some coding rules disallow multiple inheritance, and this may be
3139 used to enforce that rule. The warning is inactive inside a system
3140 header file, such as the STL, so one can still use the STL. One
3141 may also define classes that indirectly use virtual inheritance.
3142
3143 -Wno-virtual-move-assign
3144 Suppress warnings about inheriting from a virtual base with a non-
3145 trivial C++11 move assignment operator. This is dangerous because
3146 if the virtual base is reachable along more than one path, it is
3147 moved multiple times, which can mean both objects end up in the
3148 moved-from state. If the move assignment operator is written to
3149 avoid moving from a moved-from object, this warning can be
3150 disabled.
3151
3152 -Wnamespaces
3153 Warn when a namespace definition is opened. Some coding rules
3154 disallow namespaces, and this may be used to enforce that rule.
3155 The warning is inactive inside a system header file, such as the
3156 STL, so one can still use the STL. One may also use using
3157 directives and qualified names.
3158
3159 -Wno-terminate (C++ and Objective-C++ only)
3160 Disable the warning about a throw-expression that will immediately
3161 result in a call to "terminate".
3162
3163 -Wno-vexing-parse (C++ and Objective-C++ only)
3164 Warn about the most vexing parse syntactic ambiguity. This warns
3165 about the cases when a declaration looks like a variable
3166 definition, but the C++ language requires it to be interpreted as a
3167 function declaration. For instance:
3168
3169 void f(double a) {
3170 int i(); // extern int i (void);
3171 int n(int(a)); // extern int n (int);
3172 }
3173
3174 Another example:
3175
3176 struct S { S(int); };
3177 void f(double a) {
3178 S x(int(a)); // extern struct S x (int);
3179 S y(int()); // extern struct S y (int (*) (void));
3180 S z(); // extern struct S z (void);
3181 }
3182
3183 The warning will suggest options how to deal with such an
3184 ambiguity; e.g., it can suggest removing the parentheses or using
3185 braces instead.
3186
3187 This warning is enabled by default.
3188
3189 -Wno-class-conversion (C++ and Objective-C++ only)
3190 Do not warn when a conversion function converts an object to the
3191 same type, to a base class of that type, or to void; such a
3192 conversion function will never be called.
3193
3194 -Wvolatile (C++ and Objective-C++ only)
3195 Warn about deprecated uses of the "volatile" qualifier. This
3196 includes postfix and prefix "++" and "--" expressions of
3197 "volatile"-qualified types, using simple assignments where the left
3198 operand is a "volatile"-qualified non-class type for their value,
3199 compound assignments where the left operand is a
3200 "volatile"-qualified non-class type, "volatile"-qualified function
3201 return type, "volatile"-qualified parameter type, and structured
3202 bindings of a "volatile"-qualified type. This usage was deprecated
3203 in C++20.
3204
3205 Enabled by default with -std=c++20.
3206
3207 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3208 Warn when a literal 0 is used as null pointer constant. This can
3209 be useful to facilitate the conversion to "nullptr" in C++11.
3210
3211 -Waligned-new
3212 Warn about a new-expression of a type that requires greater
3213 alignment than the "alignof(std::max_align_t)" but uses an
3214 allocation function without an explicit alignment parameter. This
3215 option is enabled by -Wall.
3216
3217 Normally this only warns about global allocation functions, but
3218 -Waligned-new=all also warns about class member allocation
3219 functions.
3220
3221 -Wno-placement-new
3222 -Wplacement-new=n
3223 Warn about placement new expressions with undefined behavior, such
3224 as constructing an object in a buffer that is smaller than the type
3225 of the object. For example, the placement new expression below is
3226 diagnosed because it attempts to construct an array of 64 integers
3227 in a buffer only 64 bytes large.
3228
3229 char buf [64];
3230 new (buf) int[64];
3231
3232 This warning is enabled by default.
3233
3234 -Wplacement-new=1
3235 This is the default warning level of -Wplacement-new. At this
3236 level the warning is not issued for some strictly undefined
3237 constructs that GCC allows as extensions for compatibility with
3238 legacy code. For example, the following "new" expression is
3239 not diagnosed at this level even though it has undefined
3240 behavior according to the C++ standard because it writes past
3241 the end of the one-element array.
3242
3243 struct S { int n, a[1]; };
3244 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3245 new (s->a)int [32]();
3246
3247 -Wplacement-new=2
3248 At this level, in addition to diagnosing all the same
3249 constructs as at level 1, a diagnostic is also issued for
3250 placement new expressions that construct an object in the last
3251 member of structure whose type is an array of a single element
3252 and whose size is less than the size of the object being
3253 constructed. While the previous example would be diagnosed,
3254 the following construct makes use of the flexible member array
3255 extension to avoid the warning at level 2.
3256
3257 struct S { int n, a[]; };
3258 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3259 new (s->a)int [32]();
3260
3261 -Wcatch-value
3262 -Wcatch-value=n (C++ and Objective-C++ only)
3263 Warn about catch handlers that do not catch via reference. With
3264 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3265 class types that are caught by value. With -Wcatch-value=2 warn
3266 about all class types that are caught by value. With
3267 -Wcatch-value=3 warn about all types that are not caught by
3268 reference. -Wcatch-value is enabled by -Wall.
3269
3270 -Wconditionally-supported (C++ and Objective-C++ only)
3271 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3272
3273 -Wno-delete-incomplete (C++ and Objective-C++ only)
3274 Do not warn when deleting a pointer to incomplete type, which may
3275 cause undefined behavior at runtime. This warning is enabled by
3276 default.
3277
3278 -Wextra-semi (C++, Objective-C++ only)
3279 Warn about redundant semicolons after in-class function
3280 definitions.
3281
3282 -Wno-inaccessible-base (C++, Objective-C++ only)
3283 This option controls warnings when a base class is inaccessible in
3284 a class derived from it due to ambiguity. The warning is enabled
3285 by default. Note that the warning for ambiguous virtual bases is
3286 enabled by the -Wextra option.
3287
3288 struct A { int a; };
3289
3290 struct B : A { };
3291
3292 struct C : B, A { };
3293
3294 -Wno-inherited-variadic-ctor
3295 Suppress warnings about use of C++11 inheriting constructors when
3296 the base class inherited from has a C variadic constructor; the
3297 warning is on by default because the ellipsis is not inherited.
3298
3299 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3300 Suppress warnings from applying the "offsetof" macro to a non-POD
3301 type. According to the 2014 ISO C++ standard, applying "offsetof"
3302 to a non-standard-layout type is undefined. In existing C++
3303 implementations, however, "offsetof" typically gives meaningful
3304 results. This flag is for users who are aware that they are
3305 writing nonportable code and who have deliberately chosen to ignore
3306 the warning about it.
3307
3308 The restrictions on "offsetof" may be relaxed in a future version
3309 of the C++ standard.
3310
3311 -Wsized-deallocation (C++ and Objective-C++ only)
3312 Warn about a definition of an unsized deallocation function
3313
3314 void operator delete (void *) noexcept;
3315 void operator delete[] (void *) noexcept;
3316
3317 without a definition of the corresponding sized deallocation
3318 function
3319
3320 void operator delete (void *, std::size_t) noexcept;
3321 void operator delete[] (void *, std::size_t) noexcept;
3322
3323 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3324
3325 -Wsuggest-final-types
3326 Warn about types with virtual methods where code quality would be
3327 improved if the type were declared with the C++11 "final"
3328 specifier, or, if possible, declared in an anonymous namespace.
3329 This allows GCC to more aggressively devirtualize the polymorphic
3330 calls. This warning is more effective with link-time optimization,
3331 where the information about the class hierarchy graph is more
3332 complete.
3333
3334 -Wsuggest-final-methods
3335 Warn about virtual methods where code quality would be improved if
3336 the method were declared with the C++11 "final" specifier, or, if
3337 possible, its type were declared in an anonymous namespace or with
3338 the "final" specifier. This warning is more effective with link-
3339 time optimization, where the information about the class hierarchy
3340 graph is more complete. It is recommended to first consider
3341 suggestions of -Wsuggest-final-types and then rebuild with new
3342 annotations.
3343
3344 -Wsuggest-override
3345 Warn about overriding virtual functions that are not marked with
3346 the "override" keyword.
3347
3348 -Wuseless-cast (C++ and Objective-C++ only)
3349 Warn when an expression is casted to its own type.
3350
3351 -Wno-conversion-null (C++ and Objective-C++ only)
3352 Do not warn for conversions between "NULL" and non-pointer types.
3353 -Wconversion-null is enabled by default.
3354
3355 Options Controlling Objective-C and Objective-C++ Dialects
3356 (NOTE: This manual does not describe the Objective-C and Objective-C++
3357 languages themselves.
3358
3359 This section describes the command-line options that are only
3360 meaningful for Objective-C and Objective-C++ programs. You can also
3361 use most of the language-independent GNU compiler options. For
3362 example, you might compile a file some_class.m like this:
3363
3364 gcc -g -fgnu-runtime -O -c some_class.m
3365
3366 In this example, -fgnu-runtime is an option meant only for Objective-C
3367 and Objective-C++ programs; you can use the other options with any
3368 language supported by GCC.
3369
3370 Note that since Objective-C is an extension of the C language,
3371 Objective-C compilations may also use options specific to the C front-
3372 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3373 use C++-specific options (e.g., -Wabi).
3374
3375 Here is a list of options that are only for compiling Objective-C and
3376 Objective-C++ programs:
3377
3378 -fconstant-string-class=class-name
3379 Use class-name as the name of the class to instantiate for each
3380 literal string specified with the syntax "@"..."". The default
3381 class name is "NXConstantString" if the GNU runtime is being used,
3382 and "NSConstantString" if the NeXT runtime is being used (see
3383 below). The -fconstant-cfstrings option, if also present,
3384 overrides the -fconstant-string-class setting and cause "@"...""
3385 literals to be laid out as constant CoreFoundation strings.
3386
3387 -fgnu-runtime
3388 Generate object code compatible with the standard GNU Objective-C
3389 runtime. This is the default for most types of systems.
3390
3391 -fnext-runtime
3392 Generate output compatible with the NeXT runtime. This is the
3393 default for NeXT-based systems, including Darwin and Mac OS X. The
3394 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3395 is used.
3396
3397 -fno-nil-receivers
3398 Assume that all Objective-C message dispatches ("[receiver
3399 message:arg]") in this translation unit ensure that the receiver is
3400 not "nil". This allows for more efficient entry points in the
3401 runtime to be used. This option is only available in conjunction
3402 with the NeXT runtime and ABI version 0 or 1.
3403
3404 -fobjc-abi-version=n
3405 Use version n of the Objective-C ABI for the selected runtime.
3406 This option is currently supported only for the NeXT runtime. In
3407 that case, Version 0 is the traditional (32-bit) ABI without
3408 support for properties and other Objective-C 2.0 additions.
3409 Version 1 is the traditional (32-bit) ABI with support for
3410 properties and other Objective-C 2.0 additions. Version 2 is the
3411 modern (64-bit) ABI. If nothing is specified, the default is
3412 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3413 machines.
3414
3415 -fobjc-call-cxx-cdtors
3416 For each Objective-C class, check if any of its instance variables
3417 is a C++ object with a non-trivial default constructor. If so,
3418 synthesize a special "- (id) .cxx_construct" instance method which
3419 runs non-trivial default constructors on any such instance
3420 variables, in order, and then return "self". Similarly, check if
3421 any instance variable is a C++ object with a non-trivial
3422 destructor, and if so, synthesize a special "- (void)
3423 .cxx_destruct" method which runs all such default destructors, in
3424 reverse order.
3425
3426 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3427 thusly generated only operate on instance variables declared in the
3428 current Objective-C class, and not those inherited from
3429 superclasses. It is the responsibility of the Objective-C runtime
3430 to invoke all such methods in an object's inheritance hierarchy.
3431 The "- (id) .cxx_construct" methods are invoked by the runtime
3432 immediately after a new object instance is allocated; the "- (void)
3433 .cxx_destruct" methods are invoked immediately before the runtime
3434 deallocates an object instance.
3435
3436 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3437 later has support for invoking the "- (id) .cxx_construct" and "-
3438 (void) .cxx_destruct" methods.
3439
3440 -fobjc-direct-dispatch
3441 Allow fast jumps to the message dispatcher. On Darwin this is
3442 accomplished via the comm page.
3443
3444 -fobjc-exceptions
3445 Enable syntactic support for structured exception handling in
3446 Objective-C, similar to what is offered by C++. This option is
3447 required to use the Objective-C keywords @try, @throw, @catch,
3448 @finally and @synchronized. This option is available with both the
3449 GNU runtime and the NeXT runtime (but not available in conjunction
3450 with the NeXT runtime on Mac OS X 10.2 and earlier).
3451
3452 -fobjc-gc
3453 Enable garbage collection (GC) in Objective-C and Objective-C++
3454 programs. This option is only available with the NeXT runtime; the
3455 GNU runtime has a different garbage collection implementation that
3456 does not require special compiler flags.
3457
3458 -fobjc-nilcheck
3459 For the NeXT runtime with version 2 of the ABI, check for a nil
3460 receiver in method invocations before doing the actual method call.
3461 This is the default and can be disabled using -fno-objc-nilcheck.
3462 Class methods and super calls are never checked for nil in this way
3463 no matter what this flag is set to. Currently this flag does
3464 nothing when the GNU runtime, or an older version of the NeXT
3465 runtime ABI, is used.
3466
3467 -fobjc-std=objc1
3468 Conform to the language syntax of Objective-C 1.0, the language
3469 recognized by GCC 4.0. This only affects the Objective-C additions
3470 to the C/C++ language; it does not affect conformance to C/C++
3471 standards, which is controlled by the separate C/C++ dialect option
3472 flags. When this option is used with the Objective-C or
3473 Objective-C++ compiler, any Objective-C syntax that is not
3474 recognized by GCC 4.0 is rejected. This is useful if you need to
3475 make sure that your Objective-C code can be compiled with older
3476 versions of GCC.
3477
3478 -freplace-objc-classes
3479 Emit a special marker instructing ld(1) not to statically link in
3480 the resulting object file, and allow dyld(1) to load it in at run
3481 time instead. This is used in conjunction with the Fix-and-
3482 Continue debugging mode, where the object file in question may be
3483 recompiled and dynamically reloaded in the course of program
3484 execution, without the need to restart the program itself.
3485 Currently, Fix-and-Continue functionality is only available in
3486 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3487
3488 -fzero-link
3489 When compiling for the NeXT runtime, the compiler ordinarily
3490 replaces calls to "objc_getClass("...")" (when the name of the
3491 class is known at compile time) with static class references that
3492 get initialized at load time, which improves run-time performance.
3493 Specifying the -fzero-link flag suppresses this behavior and causes
3494 calls to "objc_getClass("...")" to be retained. This is useful in
3495 Zero-Link debugging mode, since it allows for individual class
3496 implementations to be modified during program execution. The GNU
3497 runtime currently always retains calls to "objc_get_class("...")"
3498 regardless of command-line options.
3499
3500 -fno-local-ivars
3501 By default instance variables in Objective-C can be accessed as if
3502 they were local variables from within the methods of the class
3503 they're declared in. This can lead to shadowing between instance
3504 variables and other variables declared either locally inside a
3505 class method or globally with the same name. Specifying the
3506 -fno-local-ivars flag disables this behavior thus avoiding variable
3507 shadowing issues.
3508
3509 -fivar-visibility=[public|protected|private|package]
3510 Set the default instance variable visibility to the specified
3511 option so that instance variables declared outside the scope of any
3512 access modifier directives default to the specified visibility.
3513
3514 -gen-decls
3515 Dump interface declarations for all classes seen in the source file
3516 to a file named sourcename.decl.
3517
3518 -Wassign-intercept (Objective-C and Objective-C++ only)
3519 Warn whenever an Objective-C assignment is being intercepted by the
3520 garbage collector.
3521
3522 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3523 Do not warn if a property for an Objective-C object has no assign
3524 semantics specified.
3525
3526 -Wno-protocol (Objective-C and Objective-C++ only)
3527 If a class is declared to implement a protocol, a warning is issued
3528 for every method in the protocol that is not implemented by the
3529 class. The default behavior is to issue a warning for every method
3530 not explicitly implemented in the class, even if a method
3531 implementation is inherited from the superclass. If you use the
3532 -Wno-protocol option, then methods inherited from the superclass
3533 are considered to be implemented, and no warning is issued for
3534 them.
3535
3536 -Wobjc-root-class (Objective-C and Objective-C++ only)
3537 Warn if a class interface lacks a superclass. Most classes will
3538 inherit from "NSObject" (or "Object") for example. When declaring
3539 classes intended to be root classes, the warning can be suppressed
3540 by marking their interfaces with
3541 "__attribute__((objc_root_class))".
3542
3543 -Wselector (Objective-C and Objective-C++ only)
3544 Warn if multiple methods of different types for the same selector
3545 are found during compilation. The check is performed on the list
3546 of methods in the final stage of compilation. Additionally, a
3547 check is performed for each selector appearing in a
3548 "@selector(...)" expression, and a corresponding method for that
3549 selector has been found during compilation. Because these checks
3550 scan the method table only at the end of compilation, these
3551 warnings are not produced if the final stage of compilation is not
3552 reached, for example because an error is found during compilation,
3553 or because the -fsyntax-only option is being used.
3554
3555 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3556 Warn if multiple methods with differing argument and/or return
3557 types are found for a given selector when attempting to send a
3558 message using this selector to a receiver of type "id" or "Class".
3559 When this flag is off (which is the default behavior), the compiler
3560 omits such warnings if any differences found are confined to types
3561 that share the same size and alignment.
3562
3563 -Wundeclared-selector (Objective-C and Objective-C++ only)
3564 Warn if a "@selector(...)" expression referring to an undeclared
3565 selector is found. A selector is considered undeclared if no
3566 method with that name has been declared before the "@selector(...)"
3567 expression, either explicitly in an @interface or @protocol
3568 declaration, or implicitly in an @implementation section. This
3569 option always performs its checks as soon as a "@selector(...)"
3570 expression is found, while -Wselector only performs its checks in
3571 the final stage of compilation. This also enforces the coding
3572 style convention that methods and selectors must be declared before
3573 being used.
3574
3575 -print-objc-runtime-info
3576 Generate C header describing the largest structure that is passed
3577 by value, if any.
3578
3579 Options to Control Diagnostic Messages Formatting
3580 Traditionally, diagnostic messages have been formatted irrespective of
3581 the output device's aspect (e.g. its width, ...). You can use the
3582 options described below to control the formatting algorithm for
3583 diagnostic messages, e.g. how many characters per line, how often
3584 source location information should be reported. Note that some
3585 language front ends may not honor these options.
3586
3587 -fmessage-length=n
3588 Try to format error messages so that they fit on lines of about n
3589 characters. If n is zero, then no line-wrapping is done; each
3590 error message appears on a single line. This is the default for
3591 all front ends.
3592
3593 Note - this option also affects the display of the #error and
3594 #warning pre-processor directives, and the deprecated
3595 function/type/variable attribute. It does not however affect the
3596 pragma GCC warning and pragma GCC error pragmas.
3597
3598 -fdiagnostics-plain-output
3599 This option requests that diagnostic output look as plain as
3600 possible, which may be useful when running dejagnu or other
3601 utilities that need to parse diagnostics output and prefer that it
3602 remain more stable over time. -fdiagnostics-plain-output is
3603 currently equivalent to the following options:
3604 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3605 -fdiagnostics-color=never -fdiagnostics-urls=never
3606 -fdiagnostics-path-format=separate-events In the future, if GCC
3607 changes the default appearance of its diagnostics, the
3608 corresponding option to disable the new behavior will be added to
3609 this list.
3610
3611 -fdiagnostics-show-location=once
3612 Only meaningful in line-wrapping mode. Instructs the diagnostic
3613 messages reporter to emit source location information once; that
3614 is, in case the message is too long to fit on a single physical
3615 line and has to be wrapped, the source location won't be emitted
3616 (as prefix) again, over and over, in subsequent continuation lines.
3617 This is the default behavior.
3618
3619 -fdiagnostics-show-location=every-line
3620 Only meaningful in line-wrapping mode. Instructs the diagnostic
3621 messages reporter to emit the same source location information (as
3622 prefix) for physical lines that result from the process of breaking
3623 a message which is too long to fit on a single line.
3624
3625 -fdiagnostics-color[=WHEN]
3626 -fno-diagnostics-color
3627 Use color in diagnostics. WHEN is never, always, or auto. The
3628 default depends on how the compiler has been configured, it can be
3629 any of the above WHEN options or also never if GCC_COLORS
3630 environment variable isn't present in the environment, and auto
3631 otherwise. auto makes GCC use color only when the standard error
3632 is a terminal, and when not executing in an emacs shell. The forms
3633 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3634 -fdiagnostics-color=always and -fdiagnostics-color=never,
3635 respectively.
3636
3637 The colors are defined by the environment variable GCC_COLORS. Its
3638 value is a colon-separated list of capabilities and Select Graphic
3639 Rendition (SGR) substrings. SGR commands are interpreted by the
3640 terminal or terminal emulator. (See the section in the
3641 documentation of your text terminal for permitted values and their
3642 meanings as character attributes.) These substring values are
3643 integers in decimal representation and can be concatenated with
3644 semicolons. Common values to concatenate include 1 for bold, 4 for
3645 underline, 5 for blink, 7 for inverse, 39 for default foreground
3646 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3647 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3648 modes foreground colors, 49 for default background color, 40 to 47
3649 for background colors, 100 to 107 for 16-color mode background
3650 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3651 background colors.
3652
3653 The default GCC_COLORS is
3654
3655 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3656 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3657 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3658 type-diff=01;32
3659
3660 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3661 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3662 GCC_COLORS to the empty string disables colors. Supported
3663 capabilities are as follows.
3664
3665 "error="
3666 SGR substring for error: markers.
3667
3668 "warning="
3669 SGR substring for warning: markers.
3670
3671 "note="
3672 SGR substring for note: markers.
3673
3674 "path="
3675 SGR substring for colorizing paths of control-flow events as
3676 printed via -fdiagnostics-path-format=, such as the identifiers
3677 of individual events and lines indicating interprocedural calls
3678 and returns.
3679
3680 "range1="
3681 SGR substring for first additional range.
3682
3683 "range2="
3684 SGR substring for second additional range.
3685
3686 "locus="
3687 SGR substring for location information, file:line or
3688 file:line:column etc.
3689
3690 "quote="
3691 SGR substring for information printed within quotes.
3692
3693 "fixit-insert="
3694 SGR substring for fix-it hints suggesting text to be inserted
3695 or replaced.
3696
3697 "fixit-delete="
3698 SGR substring for fix-it hints suggesting text to be deleted.
3699
3700 "diff-filename="
3701 SGR substring for filename headers within generated patches.
3702
3703 "diff-hunk="
3704 SGR substring for the starts of hunks within generated patches.
3705
3706 "diff-delete="
3707 SGR substring for deleted lines within generated patches.
3708
3709 "diff-insert="
3710 SGR substring for inserted lines within generated patches.
3711
3712 "type-diff="
3713 SGR substring for highlighting mismatching types within
3714 template arguments in the C++ frontend.
3715
3716 -fdiagnostics-urls[=WHEN]
3717 Use escape sequences to embed URLs in diagnostics. For example,
3718 when -fdiagnostics-show-option emits text showing the command-line
3719 option controlling a diagnostic, embed a URL for documentation of
3720 that option.
3721
3722 WHEN is never, always, or auto. auto makes GCC use URL escape
3723 sequences only when the standard error is a terminal, and when not
3724 executing in an emacs shell or any graphical terminal which is
3725 known to be incompatible with this feature, see below.
3726
3727 The default depends on how the compiler has been configured. It
3728 can be any of the above WHEN options.
3729
3730 GCC can also be configured (via the
3731 --with-diagnostics-urls=auto-if-env configure-time option) so that
3732 the default is affected by environment variables. Under such a
3733 configuration, GCC defaults to using auto if either GCC_URLS or
3734 TERM_URLS environment variables are present and non-empty in the
3735 environment of the compiler, or never if neither are.
3736
3737 However, even with -fdiagnostics-urls=always the behavior is
3738 dependent on those environment variables: If GCC_URLS is set to
3739 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3740 use ST escape sequences. If set to bel, the default, URLs use BEL
3741 escape sequences. Any other non-empty value enables the feature.
3742 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3743 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3744 character, CTRL-G that usually sounds like a beep.
3745
3746 At this time GCC tries to detect also a few terminals that are
3747 known to not implement the URL feature, and have bugs or at least
3748 had bugs in some versions that are still in use, where the URL
3749 escapes are likely to misbehave, i.e. print garbage on the screen.
3750 That list is currently xfce4-terminal, certain known to be buggy
3751 gnome-terminal versions, the linux console, and mingw. This check
3752 can be skipped with the -fdiagnostics-urls=always.
3753
3754 -fno-diagnostics-show-option
3755 By default, each diagnostic emitted includes text indicating the
3756 command-line option that directly controls the diagnostic (if such
3757 an option is known to the diagnostic machinery). Specifying the
3758 -fno-diagnostics-show-option flag suppresses that behavior.
3759
3760 -fno-diagnostics-show-caret
3761 By default, each diagnostic emitted includes the original source
3762 line and a caret ^ indicating the column. This option suppresses
3763 this information. The source line is truncated to n characters, if
3764 the -fmessage-length=n option is given. When the output is done to
3765 the terminal, the width is limited to the width given by the
3766 COLUMNS environment variable or, if not set, to the terminal width.
3767
3768 -fno-diagnostics-show-labels
3769 By default, when printing source code (via
3770 -fdiagnostics-show-caret), diagnostics can label ranges of source
3771 code with pertinent information, such as the types of expressions:
3772
3773 printf ("foo %s bar", long_i + long_j);
3774 ~^ ~~~~~~~~~~~~~~~
3775 | |
3776 char * long int
3777
3778 This option suppresses the printing of these labels (in the example
3779 above, the vertical bars and the "char *" and "long int" text).
3780
3781 -fno-diagnostics-show-cwe
3782 Diagnostic messages can optionally have an associated
3783 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3784 only provides such metadata for some of the -fanalyzer diagnostics.
3785 GCC plugins may also provide diagnostics with such metadata. By
3786 default, if this information is present, it will be printed with
3787 the diagnostic. This option suppresses the printing of this
3788 metadata.
3789
3790 -fno-diagnostics-show-line-numbers
3791 By default, when printing source code (via
3792 -fdiagnostics-show-caret), a left margin is printed, showing line
3793 numbers. This option suppresses this left margin.
3794
3795 -fdiagnostics-minimum-margin-width=width
3796 This option controls the minimum width of the left margin printed
3797 by -fdiagnostics-show-line-numbers. It defaults to 6.
3798
3799 -fdiagnostics-parseable-fixits
3800 Emit fix-it hints in a machine-parseable format, suitable for
3801 consumption by IDEs. For each fix-it, a line will be printed after
3802 the relevant diagnostic, starting with the string "fix-it:". For
3803 example:
3804
3805 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3806
3807 The location is expressed as a half-open range, expressed as a
3808 count of bytes, starting at byte 1 for the initial column. In the
3809 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3810 replaced with the given string:
3811
3812 00000000011111111112222222222
3813 12345678901234567890123456789
3814 gtk_widget_showall (dlg);
3815 ^^^^^^^^^^^^^^^^^^
3816 gtk_widget_show_all
3817
3818 The filename and replacement string escape backslash as "\\", tab
3819 as "\t", newline as "\n", double quotes as "\"", non-printable
3820 characters as octal (e.g. vertical tab as "\013").
3821
3822 An empty replacement string indicates that the given range is to be
3823 removed. An empty range (e.g. "45:3-45:3") indicates that the
3824 string is to be inserted at the given position.
3825
3826 -fdiagnostics-generate-patch
3827 Print fix-it hints to stderr in unified diff format, after any
3828 diagnostics are printed. For example:
3829
3830 --- test.c
3831 +++ test.c
3832 @ -42,5 +42,5 @
3833
3834 void show_cb(GtkDialog *dlg)
3835 {
3836 - gtk_widget_showall(dlg);
3837 + gtk_widget_show_all(dlg);
3838 }
3839
3840 The diff may or may not be colorized, following the same rules as
3841 for diagnostics (see -fdiagnostics-color).
3842
3843 -fdiagnostics-show-template-tree
3844 In the C++ frontend, when printing diagnostics showing mismatching
3845 template types, such as:
3846
3847 could not convert 'std::map<int, std::vector<double> >()'
3848 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3849
3850 the -fdiagnostics-show-template-tree flag enables printing a tree-
3851 like structure showing the common and differing parts of the types,
3852 such as:
3853
3854 map<
3855 [...],
3856 vector<
3857 [double != float]>>
3858
3859 The parts that differ are highlighted with color ("double" and
3860 "float" in this case).
3861
3862 -fno-elide-type
3863 By default when the C++ frontend prints diagnostics showing
3864 mismatching template types, common parts of the types are printed
3865 as "[...]" to simplify the error message. For example:
3866
3867 could not convert 'std::map<int, std::vector<double> >()'
3868 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3869
3870 Specifying the -fno-elide-type flag suppresses that behavior. This
3871 flag also affects the output of the
3872 -fdiagnostics-show-template-tree flag.
3873
3874 -fdiagnostics-path-format=KIND
3875 Specify how to print paths of control-flow events for diagnostics
3876 that have such a path associated with them.
3877
3878 KIND is none, separate-events, or inline-events, the default.
3879
3880 none means to not print diagnostic paths.
3881
3882 separate-events means to print a separate "note" diagnostic for
3883 each event within the diagnostic. For example:
3884
3885 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
3886 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
3887 test.c:27:3: note: (2) when 'i < count'
3888 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3889
3890 inline-events means to print the events "inline" within the source
3891 code. This view attempts to consolidate the events into runs of
3892 sufficiently-close events, printing them as labelled ranges within
3893 the source.
3894
3895 For example, the same events as above might be printed as:
3896
3897 'test': events 1-3
3898 |
3899 | 25 | list = PyList_New(0);
3900 | | ^~~~~~~~~~~~~
3901 | | |
3902 | | (1) when 'PyList_New' fails, returning NULL
3903 | 26 |
3904 | 27 | for (i = 0; i < count; i++) {
3905 | | ~~~
3906 | | |
3907 | | (2) when 'i < count'
3908 | 28 | item = PyLong_FromLong(random());
3909 | 29 | PyList_Append(list, item);
3910 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
3911 | | |
3912 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3913 |
3914
3915 Interprocedural control flow is shown by grouping the events by
3916 stack frame, and using indentation to show how stack frames are
3917 nested, pushed, and popped.
3918
3919 For example:
3920
3921 'test': events 1-2
3922 |
3923 | 133 | {
3924 | | ^
3925 | | |
3926 | | (1) entering 'test'
3927 | 134 | boxed_int *obj = make_boxed_int (i);
3928 | | ~~~~~~~~~~~~~~~~~~
3929 | | |
3930 | | (2) calling 'make_boxed_int'
3931 |
3932 +--> 'make_boxed_int': events 3-4
3933 |
3934 | 120 | {
3935 | | ^
3936 | | |
3937 | | (3) entering 'make_boxed_int'
3938 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
3939 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3940 | | |
3941 | | (4) calling 'wrapped_malloc'
3942 |
3943 +--> 'wrapped_malloc': events 5-6
3944 |
3945 | 7 | {
3946 | | ^
3947 | | |
3948 | | (5) entering 'wrapped_malloc'
3949 | 8 | return malloc (size);
3950 | | ~~~~~~~~~~~~~
3951 | | |
3952 | | (6) calling 'malloc'
3953 |
3954 <-------------+
3955 |
3956 'test': event 7
3957 |
3958 | 138 | free_boxed_int (obj);
3959 | | ^~~~~~~~~~~~~~~~~~~~
3960 | | |
3961 | | (7) calling 'free_boxed_int'
3962 |
3963 (etc)
3964
3965 -fdiagnostics-show-path-depths
3966 This option provides additional information when printing control-
3967 flow paths associated with a diagnostic.
3968
3969 If this is option is provided then the stack depth will be printed
3970 for each run of events within
3971 -fdiagnostics-path-format=separate-events.
3972
3973 This is intended for use by GCC developers and plugin developers
3974 when debugging diagnostics that report interprocedural control
3975 flow.
3976
3977 -fno-show-column
3978 Do not print column numbers in diagnostics. This may be necessary
3979 if diagnostics are being scanned by a program that does not
3980 understand the column numbers, such as dejagnu.
3981
3982 -fdiagnostics-column-unit=UNIT
3983 Select the units for the column number. This affects traditional
3984 diagnostics (in the absence of -fno-show-column), as well as JSON
3985 format diagnostics if requested.
3986
3987 The default UNIT, display, considers the number of display columns
3988 occupied by each character. This may be larger than the number of
3989 bytes required to encode the character, in the case of tab
3990 characters, or it may be smaller, in the case of multibyte
3991 characters. For example, the character "GREEK SMALL LETTER PI
3992 (U+03C0)" occupies one display column, and its UTF-8 encoding
3993 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
3994 occupies two display columns, and its UTF-8 encoding requires four
3995 bytes.
3996
3997 Setting UNIT to byte changes the column number to the raw byte
3998 count in all cases, as was traditionally output by GCC prior to
3999 version 11.1.0.
4000
4001 -fdiagnostics-column-origin=ORIGIN
4002 Select the origin for column numbers, i.e. the column number
4003 assigned to the first column. The default value of 1 corresponds
4004 to traditional GCC behavior and to the GNU style guide. Some
4005 utilities may perform better with an origin of 0; any non-negative
4006 value may be specified.
4007
4008 -fdiagnostics-format=FORMAT
4009 Select a different format for printing diagnostics. FORMAT is text
4010 or json. The default is text.
4011
4012 The json format consists of a top-level JSON array containing JSON
4013 objects representing the diagnostics.
4014
4015 The JSON is emitted as one line, without formatting; the examples
4016 below have been formatted for clarity.
4017
4018 Diagnostics can have child diagnostics. For example, this error
4019 and note:
4020
4021 misleading-indentation.c:15:3: warning: this 'if' clause does not
4022 guard... [-Wmisleading-indentation]
4023 15 | if (flag)
4024 | ^~
4025 misleading-indentation.c:17:5: note: ...this statement, but the latter
4026 is misleadingly indented as if it were guarded by the 'if'
4027 17 | y = 2;
4028 | ^
4029
4030 might be printed in JSON form (after formatting) like this:
4031
4032 [
4033 {
4034 "kind": "warning",
4035 "locations": [
4036 {
4037 "caret": {
4038 "display-column": 3,
4039 "byte-column": 3,
4040 "column": 3,
4041 "file": "misleading-indentation.c",
4042 "line": 15
4043 },
4044 "finish": {
4045 "display-column": 4,
4046 "byte-column": 4,
4047 "column": 4,
4048 "file": "misleading-indentation.c",
4049 "line": 15
4050 }
4051 }
4052 ],
4053 "message": "this \u2018if\u2019 clause does not guard...",
4054 "option": "-Wmisleading-indentation",
4055 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4056 "children": [
4057 {
4058 "kind": "note",
4059 "locations": [
4060 {
4061 "caret": {
4062 "display-column": 5,
4063 "byte-column": 5,
4064 "column": 5,
4065 "file": "misleading-indentation.c",
4066 "line": 17
4067 }
4068 }
4069 ],
4070 "message": "...this statement, but the latter is ..."
4071 }
4072 ]
4073 "column-origin": 1,
4074 },
4075 ...
4076 ]
4077
4078 where the "note" is a child of the "warning".
4079
4080 A diagnostic has a "kind". If this is "warning", then there is an
4081 "option" key describing the command-line option controlling the
4082 warning.
4083
4084 A diagnostic can contain zero or more locations. Each location has
4085 an optional "label" string and up to three positions within it: a
4086 "caret" position and optional "start" and "finish" positions. A
4087 position is described by a "file" name, a "line" number, and three
4088 numbers indicating a column position:
4089
4090 * "display-column" counts display columns, accounting for tabs
4091 and multibyte characters.
4092
4093 * "byte-column" counts raw bytes.
4094
4095 * "column" is equal to one of the previous two, as dictated by
4096 the -fdiagnostics-column-unit option.
4097
4098 All three columns are relative to the origin specified by
4099 -fdiagnostics-column-origin, which is typically equal to 1 but may
4100 be set, for instance, to 0 for compatibility with other utilities
4101 that number columns from 0. The column origin is recorded in the
4102 JSON output in the "column-origin" tag. In the remaining examples
4103 below, the extra column number outputs have been omitted for
4104 brevity.
4105
4106 For example, this error:
4107
4108 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4109 'struct s'} and 'T' {aka 'struct t'})
4110 64 | return callee_4a () + callee_4b ();
4111 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4112 | | |
4113 | | T {aka struct t}
4114 | S {aka struct s}
4115
4116 has three locations. Its primary location is at the "+" token at
4117 column 23. It has two secondary locations, describing the left and
4118 right-hand sides of the expression, which have labels. It might be
4119 printed in JSON form as:
4120
4121 {
4122 "children": [],
4123 "kind": "error",
4124 "locations": [
4125 {
4126 "caret": {
4127 "column": 23, "file": "bad-binary-ops.c", "line": 64
4128 }
4129 },
4130 {
4131 "caret": {
4132 "column": 10, "file": "bad-binary-ops.c", "line": 64
4133 },
4134 "finish": {
4135 "column": 21, "file": "bad-binary-ops.c", "line": 64
4136 },
4137 "label": "S {aka struct s}"
4138 },
4139 {
4140 "caret": {
4141 "column": 25, "file": "bad-binary-ops.c", "line": 64
4142 },
4143 "finish": {
4144 "column": 36, "file": "bad-binary-ops.c", "line": 64
4145 },
4146 "label": "T {aka struct t}"
4147 }
4148 ],
4149 "message": "invalid operands to binary + ..."
4150 }
4151
4152 If a diagnostic contains fix-it hints, it has a "fixits" array,
4153 consisting of half-open intervals, similar to the output of
4154 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4155 a replacement fix-it hint:
4156
4157 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4158 mean 'color'?
4159 8 | return ptr->colour;
4160 | ^~~~~~
4161 | color
4162
4163 might be printed in JSON form as:
4164
4165 {
4166 "children": [],
4167 "fixits": [
4168 {
4169 "next": {
4170 "column": 21,
4171 "file": "demo.c",
4172 "line": 8
4173 },
4174 "start": {
4175 "column": 15,
4176 "file": "demo.c",
4177 "line": 8
4178 },
4179 "string": "color"
4180 }
4181 ],
4182 "kind": "error",
4183 "locations": [
4184 {
4185 "caret": {
4186 "column": 15,
4187 "file": "demo.c",
4188 "line": 8
4189 },
4190 "finish": {
4191 "column": 20,
4192 "file": "demo.c",
4193 "line": 8
4194 }
4195 }
4196 ],
4197 "message": "\u2018struct s\u2019 has no member named ..."
4198 }
4199
4200 where the fix-it hint suggests replacing the text from "start" up
4201 to but not including "next" with "string"'s value. Deletions are
4202 expressed via an empty value for "string", insertions by having
4203 "start" equal "next".
4204
4205 If the diagnostic has a path of control-flow events associated with
4206 it, it has a "path" array of objects representing the events. Each
4207 event object has a "description" string, a "location" object, along
4208 with a "function" string and a "depth" number for representing
4209 interprocedural paths. The "function" represents the current
4210 function at that event, and the "depth" represents the stack depth
4211 relative to some baseline: the higher, the more frames are within
4212 the stack.
4213
4214 For example, the intraprocedural example shown for
4215 -fdiagnostics-path-format= might have this JSON for its path:
4216
4217 "path": [
4218 {
4219 "depth": 0,
4220 "description": "when 'PyList_New' fails, returning NULL",
4221 "function": "test",
4222 "location": {
4223 "column": 10,
4224 "file": "test.c",
4225 "line": 25
4226 }
4227 },
4228 {
4229 "depth": 0,
4230 "description": "when 'i < count'",
4231 "function": "test",
4232 "location": {
4233 "column": 3,
4234 "file": "test.c",
4235 "line": 27
4236 }
4237 },
4238 {
4239 "depth": 0,
4240 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4241 "function": "test",
4242 "location": {
4243 "column": 5,
4244 "file": "test.c",
4245 "line": 29
4246 }
4247 }
4248 ]
4249
4250 Options to Request or Suppress Warnings
4251 Warnings are diagnostic messages that report constructions that are not
4252 inherently erroneous but that are risky or suggest there may have been
4253 an error.
4254
4255 The following language-independent options do not enable specific
4256 warnings but control the kinds of diagnostics produced by GCC.
4257
4258 -fsyntax-only
4259 Check the code for syntax errors, but don't do anything beyond
4260 that.
4261
4262 -fmax-errors=n
4263 Limits the maximum number of error messages to n, at which point
4264 GCC bails out rather than attempting to continue processing the
4265 source code. If n is 0 (the default), there is no limit on the
4266 number of error messages produced. If -Wfatal-errors is also
4267 specified, then -Wfatal-errors takes precedence over this option.
4268
4269 -w Inhibit all warning messages.
4270
4271 -Werror
4272 Make all warnings into errors.
4273
4274 -Werror=
4275 Make the specified warning into an error. The specifier for a
4276 warning is appended; for example -Werror=switch turns the warnings
4277 controlled by -Wswitch into errors. This switch takes a negative
4278 form, to be used to negate -Werror for specific warnings; for
4279 example -Wno-error=switch makes -Wswitch warnings not be errors,
4280 even when -Werror is in effect.
4281
4282 The warning message for each controllable warning includes the
4283 option that controls the warning. That option can then be used
4284 with -Werror= and -Wno-error= as described above. (Printing of the
4285 option in the warning message can be disabled using the
4286 -fno-diagnostics-show-option flag.)
4287
4288 Note that specifying -Werror=foo automatically implies -Wfoo.
4289 However, -Wno-error=foo does not imply anything.
4290
4291 -Wfatal-errors
4292 This option causes the compiler to abort compilation on the first
4293 error occurred rather than trying to keep going and printing
4294 further error messages.
4295
4296 You can request many specific warnings with options beginning with -W,
4297 for example -Wimplicit to request warnings on implicit declarations.
4298 Each of these specific warning options also has a negative form
4299 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4300 manual lists only one of the two forms, whichever is not the default.
4301 For further language-specific options also refer to C++ Dialect Options
4302 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4303 can be produced by enabling the static analyzer;
4304
4305 Some options, such as -Wall and -Wextra, turn on other options, such as
4306 -Wunused, which may turn on further options, such as -Wunused-value.
4307 The combined effect of positive and negative forms is that more
4308 specific options have priority over less specific ones, independently
4309 of their position in the command-line. For options of the same
4310 specificity, the last one takes effect. Options enabled or disabled via
4311 pragmas take effect as if they appeared at the end of the command-line.
4312
4313 When an unrecognized warning option is requested (e.g.,
4314 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4315 not recognized. However, if the -Wno- form is used, the behavior is
4316 slightly different: no diagnostic is produced for -Wno-unknown-warning
4317 unless other diagnostics are being produced. This allows the use of
4318 new -Wno- options with old compilers, but if something goes wrong, the
4319 compiler warns that an unrecognized option is present.
4320
4321 The effectiveness of some warnings depends on optimizations also being
4322 enabled. For example -Wsuggest-final-types is more effective with link-
4323 time optimization and -Wmaybe-uninitialized does not warn at all unless
4324 optimization is enabled.
4325
4326 -Wpedantic
4327 -pedantic
4328 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4329 all programs that use forbidden extensions, and some other programs
4330 that do not follow ISO C and ISO C++. For ISO C, follows the
4331 version of the ISO C standard specified by any -std option used.
4332
4333 Valid ISO C and ISO C++ programs should compile properly with or
4334 without this option (though a rare few require -ansi or a -std
4335 option specifying the required version of ISO C). However, without
4336 this option, certain GNU extensions and traditional C and C++
4337 features are supported as well. With this option, they are
4338 rejected.
4339
4340 -Wpedantic does not cause warning messages for use of the alternate
4341 keywords whose names begin and end with __. This alternate format
4342 can also be used to disable warnings for non-ISO __intN types, i.e.
4343 __intN__. Pedantic warnings are also disabled in the expression
4344 that follows "__extension__". However, only system header files
4345 should use these escape routes; application programs should avoid
4346 them.
4347
4348 Some users try to use -Wpedantic to check programs for strict ISO C
4349 conformance. They soon find that it does not do quite what they
4350 want: it finds some non-ISO practices, but not all---only those for
4351 which ISO C requires a diagnostic, and some others for which
4352 diagnostics have been added.
4353
4354 A feature to report any failure to conform to ISO C might be useful
4355 in some instances, but would require considerable additional work
4356 and would be quite different from -Wpedantic. We don't have plans
4357 to support such a feature in the near future.
4358
4359 Where the standard specified with -std represents a GNU extended
4360 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4361 standard, the version of ISO C on which the GNU extended dialect is
4362 based. Warnings from -Wpedantic are given where they are required
4363 by the base standard. (It does not make sense for such warnings to
4364 be given only for features not in the specified GNU C dialect,
4365 since by definition the GNU dialects of C include all features the
4366 compiler supports with the given option, and there would be nothing
4367 to warn about.)
4368
4369 -pedantic-errors
4370 Give an error whenever the base standard (see -Wpedantic) requires
4371 a diagnostic, in some cases where there is undefined behavior at
4372 compile-time and in some other cases that do not prevent
4373 compilation of programs that are valid according to the standard.
4374 This is not equivalent to -Werror=pedantic, since there are errors
4375 enabled by this option and not enabled by the latter and vice
4376 versa.
4377
4378 -Wall
4379 This enables all the warnings about constructions that some users
4380 consider questionable, and that are easy to avoid (or modify to
4381 prevent the warning), even in conjunction with macros. This also
4382 enables some language-specific warnings described in C++ Dialect
4383 Options and Objective-C and Objective-C++ Dialect Options.
4384
4385 -Wall turns on the following warning flags:
4386
4387 -Waddress -Warray-bounds=1 (only with -O2) -Warray-parameter=2 (C
4388 and Objective-C only) -Wbool-compare -Wbool-operation
4389 -Wc++11-compat -Wc++14-compat -Wcatch-value (C++ and Objective-C++
4390 only) -Wchar-subscripts -Wcomment -Wduplicate-decl-specifier (C and
4391 Objective-C only) -Wenum-compare (in C/ObjC; this is on by default
4392 in C++) -Wformat -Wformat-overflow -Wformat-truncation
4393 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
4394 -Wimplicit-int (C and Objective-C only)
4395 -Wimplicit-function-declaration (C and Objective-C only)
4396 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
4397 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4398 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4399 (only for C/C++) -Wmissing-attributes -Wmissing-braces (only for
4400 C/ObjC) -Wmultistatement-macros -Wnarrowing (only for C++)
4401 -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses
4402 -Wpessimizing-move (only for C++) -Wpointer-sign
4403 -Wrange-loop-construct (only for C++) -Wreorder -Wrestrict
4404 -Wreturn-type -Wsequence-point -Wsign-compare (only in C++)
4405 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
4406 -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch
4407 -Wtautological-compare -Wtrigraphs -Wuninitialized
4408 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
4409 -Wunused-variable -Wvla-parameter (C and Objective-C only)
4410 -Wvolatile-register-var -Wzero-length-bounds
4411
4412 Note that some warning flags are not implied by -Wall. Some of
4413 them warn about constructions that users generally do not consider
4414 questionable, but which occasionally you might wish to check for;
4415 others warn about constructions that are necessary or hard to avoid
4416 in some cases, and there is no simple way to modify the code to
4417 suppress the warning. Some of them are enabled by -Wextra but many
4418 of them must be enabled individually.
4419
4420 -Wextra
4421 This enables some extra warning flags that are not enabled by
4422 -Wall. (This option used to be called -W. The older name is still
4423 supported, but the newer name is more descriptive.)
4424
4425 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4426 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4427 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4428 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4429 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4430 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4431 -Wshift-negative-value (in C++03 and in C99 and newer)
4432 -Wunused-parameter (only with -Wunused or -Wall)
4433 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4434
4435 The option -Wextra also prints warning messages for the following
4436 cases:
4437
4438 * A pointer is compared against integer zero with "<", "<=", ">",
4439 or ">=".
4440
4441 * (C++ only) An enumerator and a non-enumerator both appear in a
4442 conditional expression.
4443
4444 * (C++ only) Ambiguous virtual bases.
4445
4446 * (C++ only) Subscripting an array that has been declared
4447 "register".
4448
4449 * (C++ only) Taking the address of a variable that has been
4450 declared "register".
4451
4452 * (C++ only) A base class is not initialized in the copy
4453 constructor of a derived class.
4454
4455 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4456 Warn about code affected by ABI changes. This includes code that
4457 may not be compatible with the vendor-neutral C++ ABI as well as
4458 the psABI for the particular target.
4459
4460 Since G++ now defaults to updating the ABI with each major release,
4461 normally -Wabi warns only about C++ ABI compatibility problems if
4462 there is a check added later in a release series for an ABI issue
4463 discovered since the initial release. -Wabi warns about more
4464 things if an older ABI version is selected (with -fabi-version=n).
4465
4466 -Wabi can also be used with an explicit version number to warn
4467 about C++ ABI compatibility with a particular -fabi-version level,
4468 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4469
4470 If an explicit version number is provided and -fabi-compat-version
4471 is not specified, the version number from this option is used for
4472 compatibility aliases. If no explicit version number is provided
4473 with this option, but -fabi-compat-version is specified, that
4474 version number is used for C++ ABI warnings.
4475
4476 Although an effort has been made to warn about all such cases,
4477 there are probably some cases that are not warned about, even
4478 though G++ is generating incompatible code. There may also be
4479 cases where warnings are emitted even though the code that is
4480 generated is compatible.
4481
4482 You should rewrite your code to avoid these warnings if you are
4483 concerned about the fact that code generated by G++ may not be
4484 binary compatible with code generated by other compilers.
4485
4486 Known incompatibilities in -fabi-version=2 (which was the default
4487 from GCC 3.4 to 4.9) include:
4488
4489 * A template with a non-type template parameter of reference type
4490 was mangled incorrectly:
4491
4492 extern int N;
4493 template <int &> struct S {};
4494 void n (S<N>) {2}
4495
4496 This was fixed in -fabi-version=3.
4497
4498 * SIMD vector types declared using "__attribute ((vector_size))"
4499 were mangled in a non-standard way that does not allow for
4500 overloading of functions taking vectors of different sizes.
4501
4502 The mangling was changed in -fabi-version=4.
4503
4504 * "__attribute ((const))" and "noreturn" were mangled as type
4505 qualifiers, and "decltype" of a plain declaration was folded
4506 away.
4507
4508 These mangling issues were fixed in -fabi-version=5.
4509
4510 * Scoped enumerators passed as arguments to a variadic function
4511 are promoted like unscoped enumerators, causing "va_arg" to
4512 complain. On most targets this does not actually affect the
4513 parameter passing ABI, as there is no way to pass an argument
4514 smaller than "int".
4515
4516 Also, the ABI changed the mangling of template argument packs,
4517 "const_cast", "static_cast", prefix increment/decrement, and a
4518 class scope function used as a template argument.
4519
4520 These issues were corrected in -fabi-version=6.
4521
4522 * Lambdas in default argument scope were mangled incorrectly, and
4523 the ABI changed the mangling of "nullptr_t".
4524
4525 These issues were corrected in -fabi-version=7.
4526
4527 * When mangling a function type with function-cv-qualifiers, the
4528 un-qualified function type was incorrectly treated as a
4529 substitution candidate.
4530
4531 This was fixed in -fabi-version=8, the default for GCC 5.1.
4532
4533 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
4534 to unaligned accesses. Note that this did not affect the ABI
4535 of a function with a "nullptr_t" parameter, as parameters have
4536 a minimum alignment.
4537
4538 This was fixed in -fabi-version=9, the default for GCC 5.2.
4539
4540 * Target-specific attributes that affect the identity of a type,
4541 such as ia32 calling conventions on a function type (stdcall,
4542 regparm, etc.), did not affect the mangled name, leading to
4543 name collisions when function pointers were used as template
4544 arguments.
4545
4546 This was fixed in -fabi-version=10, the default for GCC 6.1.
4547
4548 This option also enables warnings about psABI-related changes. The
4549 known psABI changes at this point include:
4550
4551 * For SysV/x86-64, unions with "long double" members are passed
4552 in memory as specified in psABI. Prior to GCC 4.4, this was
4553 not the case. For example:
4554
4555 union U {
4556 long double ld;
4557 int i;
4558 };
4559
4560 "union U" is now always passed in memory.
4561
4562 -Wchar-subscripts
4563 Warn if an array subscript has type "char". This is a common cause
4564 of error, as programmers often forget that this type is signed on
4565 some machines. This warning is enabled by -Wall.
4566
4567 -Wno-coverage-mismatch
4568 Warn if feedback profiles do not match when using the -fprofile-use
4569 option. If a source file is changed between compiling with
4570 -fprofile-generate and with -fprofile-use, the files with the
4571 profile feedback can fail to match the source file and GCC cannot
4572 use the profile feedback information. By default, this warning is
4573 enabled and is treated as an error. -Wno-coverage-mismatch can be
4574 used to disable the warning or -Wno-error=coverage-mismatch can be
4575 used to disable the error. Disabling the error for this warning
4576 can result in poorly optimized code and is useful only in the case
4577 of very minor changes such as bug fixes to an existing code-base.
4578 Completely disabling the warning is not recommended.
4579
4580 -Wno-cpp
4581 (C, Objective-C, C++, Objective-C++ and Fortran only) Suppress
4582 warning messages emitted by "#warning" directives.
4583
4584 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
4585 Give a warning when a value of type "float" is implicitly promoted
4586 to "double". CPUs with a 32-bit "single-precision" floating-point
4587 unit implement "float" in hardware, but emulate "double" in
4588 software. On such a machine, doing computations using "double"
4589 values is much more expensive because of the overhead required for
4590 software emulation.
4591
4592 It is easy to accidentally do computations with "double" because
4593 floating-point literals are implicitly of type "double". For
4594 example, in:
4595
4596 float area(float radius)
4597 {
4598 return 3.14159 * radius * radius;
4599 }
4600
4601 the compiler performs the entire computation with "double" because
4602 the floating-point literal is a "double".
4603
4604 -Wduplicate-decl-specifier (C and Objective-C only)
4605 Warn if a declaration has duplicate "const", "volatile", "restrict"
4606 or "_Atomic" specifier. This warning is enabled by -Wall.
4607
4608 -Wformat
4609 -Wformat=n
4610 Check calls to "printf" and "scanf", etc., to make sure that the
4611 arguments supplied have types appropriate to the format string
4612 specified, and that the conversions specified in the format string
4613 make sense. This includes standard functions, and others specified
4614 by format attributes, in the "printf", "scanf", "strftime" and
4615 "strfmon" (an X/Open extension, not in the C standard) families (or
4616 other target-specific families). Which functions are checked
4617 without format attributes having been specified depends on the
4618 standard version selected, and such checks of functions without the
4619 attribute specified are disabled by -ffreestanding or -fno-builtin.
4620
4621 The formats are checked against the format features supported by
4622 GNU libc version 2.2. These include all ISO C90 and C99 features,
4623 as well as features from the Single Unix Specification and some BSD
4624 and GNU extensions. Other library implementations may not support
4625 all these features; GCC does not support warning about features
4626 that go beyond a particular library's limitations. However, if
4627 -Wpedantic is used with -Wformat, warnings are given about format
4628 features not in the selected standard version (but not for
4629 "strfmon" formats, since those are not in any version of the C
4630 standard).
4631
4632 -Wformat=1
4633 -Wformat
4634 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4635 equivalent to -Wformat=0. Since -Wformat also checks for null
4636 format arguments for several functions, -Wformat also implies
4637 -Wnonnull. Some aspects of this level of format checking can
4638 be disabled by the options: -Wno-format-contains-nul,
4639 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4640 is enabled by -Wall.
4641
4642 -Wformat=2
4643 Enable -Wformat plus additional format checks. Currently
4644 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4645 -Wformat-y2k.
4646
4647 -Wno-format-contains-nul
4648 If -Wformat is specified, do not warn about format strings that
4649 contain NUL bytes.
4650
4651 -Wno-format-extra-args
4652 If -Wformat is specified, do not warn about excess arguments to a
4653 "printf" or "scanf" format function. The C standard specifies that
4654 such arguments are ignored.
4655
4656 Where the unused arguments lie between used arguments that are
4657 specified with $ operand number specifications, normally warnings
4658 are still given, since the implementation could not know what type
4659 to pass to "va_arg" to skip the unused arguments. However, in the
4660 case of "scanf" formats, this option suppresses the warning if the
4661 unused arguments are all pointers, since the Single Unix
4662 Specification says that such unused arguments are allowed.
4663
4664 -Wformat-overflow
4665 -Wformat-overflow=level
4666 Warn about calls to formatted input/output functions such as
4667 "sprintf" and "vsprintf" that might overflow the destination
4668 buffer. When the exact number of bytes written by a format
4669 directive cannot be determined at compile-time it is estimated
4670 based on heuristics that depend on the level argument and on
4671 optimization. While enabling optimization will in most cases
4672 improve the accuracy of the warning, it may also result in false
4673 positives.
4674
4675 -Wformat-overflow
4676 -Wformat-overflow=1
4677 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4678 conservative approach that warns only about calls that most
4679 likely overflow the buffer. At this level, numeric arguments
4680 to format directives with unknown values are assumed to have
4681 the value of one, and strings of unknown length to be empty.
4682 Numeric arguments that are known to be bounded to a subrange of
4683 their type, or string arguments whose output is bounded either
4684 by their directive's precision or by a finite set of string
4685 literals, are assumed to take on the value within the range
4686 that results in the most bytes on output. For example, the
4687 call to "sprintf" below is diagnosed because even with both a
4688 and b equal to zero, the terminating NUL character ('\0')
4689 appended by the function to the destination buffer will be
4690 written past its end. Increasing the size of the buffer by a
4691 single byte is sufficient to avoid the warning, though it may
4692 not be sufficient to avoid the overflow.
4693
4694 void f (int a, int b)
4695 {
4696 char buf [13];
4697 sprintf (buf, "a = %i, b = %i\n", a, b);
4698 }
4699
4700 -Wformat-overflow=2
4701 Level 2 warns also about calls that might overflow the
4702 destination buffer given an argument of sufficient length or
4703 magnitude. At level 2, unknown numeric arguments are assumed
4704 to have the minimum representable value for signed types with a
4705 precision greater than 1, and the maximum representable value
4706 otherwise. Unknown string arguments whose length cannot be
4707 assumed to be bounded either by the directive's precision, or
4708 by a finite set of string literals they may evaluate to, or the
4709 character array they may point to, are assumed to be 1
4710 character long.
4711
4712 At level 2, the call in the example above is again diagnosed,
4713 but this time because with a equal to a 32-bit "INT_MIN" the
4714 first %i directive will write some of its digits beyond the end
4715 of the destination buffer. To make the call safe regardless of
4716 the values of the two variables, the size of the destination
4717 buffer must be increased to at least 34 bytes. GCC includes
4718 the minimum size of the buffer in an informational note
4719 following the warning.
4720
4721 An alternative to increasing the size of the destination buffer
4722 is to constrain the range of formatted values. The maximum
4723 length of string arguments can be bounded by specifying the
4724 precision in the format directive. When numeric arguments of
4725 format directives can be assumed to be bounded by less than the
4726 precision of their type, choosing an appropriate length
4727 modifier to the format specifier will reduce the required
4728 buffer size. For example, if a and b in the example above can
4729 be assumed to be within the precision of the "short int" type
4730 then using either the %hi format directive or casting the
4731 argument to "short" reduces the maximum required size of the
4732 buffer to 24 bytes.
4733
4734 void f (int a, int b)
4735 {
4736 char buf [23];
4737 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4738 }
4739
4740 -Wno-format-zero-length
4741 If -Wformat is specified, do not warn about zero-length formats.
4742 The C standard specifies that zero-length formats are allowed.
4743
4744 -Wformat-nonliteral
4745 If -Wformat is specified, also warn if the format string is not a
4746 string literal and so cannot be checked, unless the format function
4747 takes its format arguments as a "va_list".
4748
4749 -Wformat-security
4750 If -Wformat is specified, also warn about uses of format functions
4751 that represent possible security problems. At present, this warns
4752 about calls to "printf" and "scanf" functions where the format
4753 string is not a string literal and there are no format arguments,
4754 as in "printf (foo);". This may be a security hole if the format
4755 string came from untrusted input and contains %n. (This is
4756 currently a subset of what -Wformat-nonliteral warns about, but in
4757 future warnings may be added to -Wformat-security that are not
4758 included in -Wformat-nonliteral.)
4759
4760 -Wformat-signedness
4761 If -Wformat is specified, also warn if the format string requires
4762 an unsigned argument and the argument is signed and vice versa.
4763
4764 -Wformat-truncation
4765 -Wformat-truncation=level
4766 Warn about calls to formatted input/output functions such as
4767 "snprintf" and "vsnprintf" that might result in output truncation.
4768 When the exact number of bytes written by a format directive cannot
4769 be determined at compile-time it is estimated based on heuristics
4770 that depend on the level argument and on optimization. While
4771 enabling optimization will in most cases improve the accuracy of
4772 the warning, it may also result in false positives. Except as
4773 noted otherwise, the option uses the same logic -Wformat-overflow.
4774
4775 -Wformat-truncation
4776 -Wformat-truncation=1
4777 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4778 conservative approach that warns only about calls to bounded
4779 functions whose return value is unused and that will most
4780 likely result in output truncation.
4781
4782 -Wformat-truncation=2
4783 Level 2 warns also about calls to bounded functions whose
4784 return value is used and that might result in truncation given
4785 an argument of sufficient length or magnitude.
4786
4787 -Wformat-y2k
4788 If -Wformat is specified, also warn about "strftime" formats that
4789 may yield only a two-digit year.
4790
4791 -Wnonnull
4792 Warn about passing a null pointer for arguments marked as requiring
4793 a non-null value by the "nonnull" function attribute.
4794
4795 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4796 with the -Wno-nonnull option.
4797
4798 -Wnonnull-compare
4799 Warn when comparing an argument marked with the "nonnull" function
4800 attribute against null inside the function.
4801
4802 -Wnonnull-compare is included in -Wall. It can be disabled with
4803 the -Wno-nonnull-compare option.
4804
4805 -Wnull-dereference
4806 Warn if the compiler detects paths that trigger erroneous or
4807 undefined behavior due to dereferencing a null pointer. This
4808 option is only active when -fdelete-null-pointer-checks is active,
4809 which is enabled by optimizations in most targets. The precision
4810 of the warnings depends on the optimization options used.
4811
4812 -Winit-self (C, C++, Objective-C and Objective-C++ only)
4813 Warn about uninitialized variables that are initialized with
4814 themselves. Note this option can only be used with the
4815 -Wuninitialized option.
4816
4817 For example, GCC warns about "i" being uninitialized in the
4818 following snippet only when -Winit-self has been specified:
4819
4820 int f()
4821 {
4822 int i = i;
4823 return i;
4824 }
4825
4826 This warning is enabled by -Wall in C++.
4827
4828 -Wno-implicit-int (C and Objective-C only)
4829 This option controls warnings when a declaration does not specify a
4830 type. This warning is enabled by default in C99 and later dialects
4831 of C, and also by -Wall.
4832
4833 -Wno-implicit-function-declaration (C and Objective-C only)
4834 This option controls warnings when a function is used before being
4835 declared. This warning is enabled by default in C99 and later
4836 dialects of C, and also by -Wall. The warning is made into an
4837 error by -pedantic-errors.
4838
4839 -Wimplicit (C and Objective-C only)
4840 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
4841 warning is enabled by -Wall.
4842
4843 -Wimplicit-fallthrough
4844 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
4845 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
4846
4847 -Wimplicit-fallthrough=n
4848 Warn when a switch case falls through. For example:
4849
4850 switch (cond)
4851 {
4852 case 1:
4853 a = 1;
4854 break;
4855 case 2:
4856 a = 2;
4857 case 3:
4858 a = 3;
4859 break;
4860 }
4861
4862 This warning does not warn when the last statement of a case cannot
4863 fall through, e.g. when there is a return statement or a call to
4864 function declared with the noreturn attribute.
4865 -Wimplicit-fallthrough= also takes into account control flow
4866 statements, such as ifs, and only warns when appropriate. E.g.
4867
4868 switch (cond)
4869 {
4870 case 1:
4871 if (i > 3) {
4872 bar (5);
4873 break;
4874 } else if (i < 1) {
4875 bar (0);
4876 } else
4877 return;
4878 default:
4879 ...
4880 }
4881
4882 Since there are occasions where a switch case fall through is
4883 desirable, GCC provides an attribute, "__attribute__
4884 ((fallthrough))", that is to be used along with a null statement to
4885 suppress this warning that would normally occur:
4886
4887 switch (cond)
4888 {
4889 case 1:
4890 bar (0);
4891 __attribute__ ((fallthrough));
4892 default:
4893 ...
4894 }
4895
4896 C++17 provides a standard way to suppress the
4897 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
4898 the GNU attribute. In C++11 or C++14 users can use
4899 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
4900 these attributes, it is also possible to add a fallthrough comment
4901 to silence the warning. The whole body of the C or C++ style
4902 comment should match the given regular expressions listed below.
4903 The option argument n specifies what kind of comments are accepted:
4904
4905 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
4906 *<-Wimplicit-fallthrough=1 matches ".*" regular>
4907 expression, any comment is used as fallthrough comment.
4908
4909 *<-Wimplicit-fallthrough=2 case insensitively matches>
4910 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
4911
4912 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
4913 following regular expressions:
4914
4915 *<"-fallthrough">
4916 *<"@fallthrough@">
4917 *<"lint -fallthrough[ \t]*">
4918 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
4919 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
4920 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
4921 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4922 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
4923 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4924 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
4925 following regular expressions:
4926
4927 *<"-fallthrough">
4928 *<"@fallthrough@">
4929 *<"lint -fallthrough[ \t]*">
4930 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
4931 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
4932 fallthrough comments, only attributes disable the warning.
4933
4934 The comment needs to be followed after optional whitespace and
4935 other comments by "case" or "default" keywords or by a user label
4936 that precedes some "case" or "default" label.
4937
4938 switch (cond)
4939 {
4940 case 1:
4941 bar (0);
4942 /* FALLTHRU */
4943 default:
4944 ...
4945 }
4946
4947 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
4948
4949 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
4950 Control if warnings triggered by the "warn_if_not_aligned"
4951 attribute should be issued. These warnings are enabled by default.
4952
4953 -Wignored-qualifiers (C and C++ only)
4954 Warn if the return type of a function has a type qualifier such as
4955 "const". For ISO C such a type qualifier has no effect, since the
4956 value returned by a function is not an lvalue. For C++, the
4957 warning is only emitted for scalar types or "void". ISO C
4958 prohibits qualified "void" return types on function definitions, so
4959 such return types always receive a warning even without this
4960 option.
4961
4962 This warning is also enabled by -Wextra.
4963
4964 -Wno-ignored-attributes (C and C++ only)
4965 This option controls warnings when an attribute is ignored. This
4966 is different from the -Wattributes option in that it warns whenever
4967 the compiler decides to drop an attribute, not that the attribute
4968 is either unknown, used in a wrong place, etc. This warning is
4969 enabled by default.
4970
4971 -Wmain
4972 Warn if the type of "main" is suspicious. "main" should be a
4973 function with external linkage, returning int, taking either zero
4974 arguments, two, or three arguments of appropriate types. This
4975 warning is enabled by default in C++ and is enabled by either -Wall
4976 or -Wpedantic.
4977
4978 -Wmisleading-indentation (C and C++ only)
4979 Warn when the indentation of the code does not reflect the block
4980 structure. Specifically, a warning is issued for "if", "else",
4981 "while", and "for" clauses with a guarded statement that does not
4982 use braces, followed by an unguarded statement with the same
4983 indentation.
4984
4985 In the following example, the call to "bar" is misleadingly
4986 indented as if it were guarded by the "if" conditional.
4987
4988 if (some_condition ())
4989 foo ();
4990 bar (); /* Gotcha: this is not guarded by the "if". */
4991
4992 In the case of mixed tabs and spaces, the warning uses the
4993 -ftabstop= option to determine if the statements line up
4994 (defaulting to 8).
4995
4996 The warning is not issued for code involving multiline preprocessor
4997 logic such as the following example.
4998
4999 if (flagA)
5000 foo (0);
5001 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5002 if (flagB)
5003 #endif
5004 foo (1);
5005
5006 The warning is not issued after a "#line" directive, since this
5007 typically indicates autogenerated code, and no assumptions can be
5008 made about the layout of the file that the directive references.
5009
5010 This warning is enabled by -Wall in C and C++.
5011
5012 -Wmissing-attributes
5013 Warn when a declaration of a function is missing one or more
5014 attributes that a related function is declared with and whose
5015 absence may adversely affect the correctness or efficiency of
5016 generated code. For example, the warning is issued for
5017 declarations of aliases that use attributes to specify less
5018 restrictive requirements than those of their targets. This
5019 typically represents a potential optimization opportunity. By
5020 contrast, the -Wattribute-alias=2 option controls warnings issued
5021 when the alias is more restrictive than the target, which could
5022 lead to incorrect code generation. Attributes considered include
5023 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5024 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5025 "returns_nonnull", and "returns_twice".
5026
5027 In C++, the warning is issued when an explicit specialization of a
5028 primary template declared with attribute "alloc_align",
5029 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5030 or "nonnull" is declared without it. Attributes "deprecated",
5031 "error", and "warning" suppress the warning..
5032
5033 You can use the "copy" attribute to apply the same set of
5034 attributes to a declaration as that on another declaration without
5035 explicitly enumerating the attributes. This attribute can be
5036 applied to declarations of functions, variables, or types.
5037
5038 -Wmissing-attributes is enabled by -Wall.
5039
5040 For example, since the declaration of the primary function template
5041 below makes use of both attribute "malloc" and "alloc_size" the
5042 declaration of the explicit specialization of the template is
5043 diagnosed because it is missing one of the attributes.
5044
5045 template <class T>
5046 T* __attribute__ ((malloc, alloc_size (1)))
5047 allocate (size_t);
5048
5049 template <>
5050 void* __attribute__ ((malloc)) // missing alloc_size
5051 allocate<void> (size_t);
5052
5053 -Wmissing-braces
5054 Warn if an aggregate or union initializer is not fully bracketed.
5055 In the following example, the initializer for "a" is not fully
5056 bracketed, but that for "b" is fully bracketed.
5057
5058 int a[2][2] = { 0, 1, 2, 3 };
5059 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5060
5061 This warning is enabled by -Wall.
5062
5063 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
5064 Warn if a user-supplied include directory does not exist.
5065
5066 -Wno-missing-profile
5067 This option controls warnings if feedback profiles are missing when
5068 using the -fprofile-use option. This option diagnoses those cases
5069 where a new function or a new file is added between compiling with
5070 -fprofile-generate and with -fprofile-use, without regenerating the
5071 profiles. In these cases, the profile feedback data files do not
5072 contain any profile feedback information for the newly added
5073 function or file respectively. Also, in the case when profile
5074 count data (.gcda) files are removed, GCC cannot use any profile
5075 feedback information. In all these cases, warnings are issued to
5076 inform you that a profile generation step is due. Ignoring the
5077 warning can result in poorly optimized code. -Wno-missing-profile
5078 can be used to disable the warning, but this is not recommended and
5079 should be done only when non-existent profile data is justified.
5080
5081 -Wno-mismatched-dealloc
5082 Warn for calls to deallocation functions with pointer arguments
5083 returned from from allocations functions for which the former isn't
5084 a suitable deallocator. A pair of functions can be associated as
5085 matching allocators and deallocators by use of attribute "malloc".
5086 Unless disabled by the -fno-builtin option the standard functions
5087 "calloc", "malloc", "realloc", and "free", as well as the
5088 corresponding forms of C++ "operator new" and "operator delete" are
5089 implicitly associated as matching allocators and deallocators. In
5090 the following example "mydealloc" is the deallocator for pointers
5091 returned from "myalloc".
5092
5093 void mydealloc (void*);
5094
5095 __attribute__ ((malloc (mydealloc, 1))) void*
5096 myalloc (size_t);
5097
5098 void f (void)
5099 {
5100 void *p = myalloc (32);
5101 // ...use p...
5102 free (p); // warning: not a matching deallocator for myalloc
5103 mydealloc (p); // ok
5104 }
5105
5106 In C++, the related option -Wmismatched-new-delete diagnoses
5107 mismatches involving either "operator new" or "operator delete".
5108
5109 Option -Wmismatched-dealloc is enabled by default.
5110
5111 -Wmultistatement-macros
5112 Warn about unsafe multiple statement macros that appear to be
5113 guarded by a clause such as "if", "else", "for", "switch", or
5114 "while", in which only the first statement is actually guarded
5115 after the macro is expanded.
5116
5117 For example:
5118
5119 #define DOIT x++; y++
5120 if (c)
5121 DOIT;
5122
5123 will increment "y" unconditionally, not just when "c" holds. The
5124 can usually be fixed by wrapping the macro in a do-while loop:
5125
5126 #define DOIT do { x++; y++; } while (0)
5127 if (c)
5128 DOIT;
5129
5130 This warning is enabled by -Wall in C and C++.
5131
5132 -Wparentheses
5133 Warn if parentheses are omitted in certain contexts, such as when
5134 there is an assignment in a context where a truth value is
5135 expected, or when operators are nested whose precedence people
5136 often get confused about.
5137
5138 Also warn if a comparison like "x<=y<=z" appears; this is
5139 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5140 interpretation from that of ordinary mathematical notation.
5141
5142 Also warn for dangerous uses of the GNU extension to "?:" with
5143 omitted middle operand. When the condition in the "?": operator is
5144 a boolean expression, the omitted value is always 1. Often
5145 programmers expect it to be a value computed inside the conditional
5146 expression instead.
5147
5148 For C++ this also warns for some cases of unnecessary parentheses
5149 in declarations, which can indicate an attempt at a function call
5150 instead of a declaration:
5151
5152 {
5153 // Declares a local variable called mymutex.
5154 std::unique_lock<std::mutex> (mymutex);
5155 // User meant std::unique_lock<std::mutex> lock (mymutex);
5156 }
5157
5158 This warning is enabled by -Wall.
5159
5160 -Wsequence-point
5161 Warn about code that may have undefined semantics because of
5162 violations of sequence point rules in the C and C++ standards.
5163
5164 The C and C++ standards define the order in which expressions in a
5165 C/C++ program are evaluated in terms of sequence points, which
5166 represent a partial ordering between the execution of parts of the
5167 program: those executed before the sequence point, and those
5168 executed after it. These occur after the evaluation of a full
5169 expression (one which is not part of a larger expression), after
5170 the evaluation of the first operand of a "&&", "||", "? :" or ","
5171 (comma) operator, before a function is called (but after the
5172 evaluation of its arguments and the expression denoting the called
5173 function), and in certain other places. Other than as expressed by
5174 the sequence point rules, the order of evaluation of subexpressions
5175 of an expression is not specified. All these rules describe only a
5176 partial order rather than a total order, since, for example, if two
5177 functions are called within one expression with no sequence point
5178 between them, the order in which the functions are called is not
5179 specified. However, the standards committee have ruled that
5180 function calls do not overlap.
5181
5182 It is not specified when between sequence points modifications to
5183 the values of objects take effect. Programs whose behavior depends
5184 on this have undefined behavior; the C and C++ standards specify
5185 that "Between the previous and next sequence point an object shall
5186 have its stored value modified at most once by the evaluation of an
5187 expression. Furthermore, the prior value shall be read only to
5188 determine the value to be stored.". If a program breaks these
5189 rules, the results on any particular implementation are entirely
5190 unpredictable.
5191
5192 Examples of code with undefined behavior are "a = a++;", "a[n] =
5193 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5194 diagnosed by this option, and it may give an occasional false
5195 positive result, but in general it has been found fairly effective
5196 at detecting this sort of problem in programs.
5197
5198 The C++17 standard will define the order of evaluation of operands
5199 in more cases: in particular it requires that the right-hand side
5200 of an assignment be evaluated before the left-hand side, so the
5201 above examples are no longer undefined. But this option will still
5202 warn about them, to help people avoid writing code that is
5203 undefined in C and earlier revisions of C++.
5204
5205 The standard is worded confusingly, therefore there is some debate
5206 over the precise meaning of the sequence point rules in subtle
5207 cases. Links to discussions of the problem, including proposed
5208 formal definitions, may be found on the GCC readings page, at
5209 <http://gcc.gnu.org/readings.html>.
5210
5211 This warning is enabled by -Wall for C and C++.
5212
5213 -Wno-return-local-addr
5214 Do not warn about returning a pointer (or in C++, a reference) to a
5215 variable that goes out of scope after the function returns.
5216
5217 -Wreturn-type
5218 Warn whenever a function is defined with a return type that
5219 defaults to "int". Also warn about any "return" statement with no
5220 return value in a function whose return type is not "void" (falling
5221 off the end of the function body is considered returning without a
5222 value).
5223
5224 For C only, warn about a "return" statement with an expression in a
5225 function whose return type is "void", unless the expression type is
5226 also "void". As a GNU extension, the latter case is accepted
5227 without a warning unless -Wpedantic is used. Attempting to use the
5228 return value of a non-"void" function other than "main" that flows
5229 off the end by reaching the closing curly brace that terminates the
5230 function is undefined.
5231
5232 Unlike in C, in C++, flowing off the end of a non-"void" function
5233 other than "main" results in undefined behavior even when the value
5234 of the function is not used.
5235
5236 This warning is enabled by default in C++ and by -Wall otherwise.
5237
5238 -Wno-shift-count-negative
5239 Controls warnings if a shift count is negative. This warning is
5240 enabled by default.
5241
5242 -Wno-shift-count-overflow
5243 Controls warnings if a shift count is greater than or equal to the
5244 bit width of the type. This warning is enabled by default.
5245
5246 -Wshift-negative-value
5247 Warn if left shifting a negative value. This warning is enabled by
5248 -Wextra in C99 and C++11 modes (and newer).
5249
5250 -Wno-shift-overflow
5251 -Wshift-overflow=n
5252 These options control warnings about left shift overflows.
5253
5254 -Wshift-overflow=1
5255 This is the warning level of -Wshift-overflow and is enabled by
5256 default in C99 and C++11 modes (and newer). This warning level
5257 does not warn about left-shifting 1 into the sign bit.
5258 (However, in C, such an overflow is still rejected in contexts
5259 where an integer constant expression is required.) No warning
5260 is emitted in C++20 mode (and newer), as signed left shifts
5261 always wrap.
5262
5263 -Wshift-overflow=2
5264 This warning level also warns about left-shifting 1 into the
5265 sign bit, unless C++14 mode (or newer) is active.
5266
5267 -Wswitch
5268 Warn whenever a "switch" statement has an index of enumerated type
5269 and lacks a "case" for one or more of the named codes of that
5270 enumeration. (The presence of a "default" label prevents this
5271 warning.) "case" labels outside the enumeration range also provoke
5272 warnings when this option is used (even if there is a "default"
5273 label). This warning is enabled by -Wall.
5274
5275 -Wswitch-default
5276 Warn whenever a "switch" statement does not have a "default" case.
5277
5278 -Wswitch-enum
5279 Warn whenever a "switch" statement has an index of enumerated type
5280 and lacks a "case" for one or more of the named codes of that
5281 enumeration. "case" labels outside the enumeration range also
5282 provoke warnings when this option is used. The only difference
5283 between -Wswitch and this option is that this option gives a
5284 warning about an omitted enumeration code even if there is a
5285 "default" label.
5286
5287 -Wno-switch-bool
5288 Do not warn when a "switch" statement has an index of boolean type
5289 and the case values are outside the range of a boolean type. It is
5290 possible to suppress this warning by casting the controlling
5291 expression to a type other than "bool". For example:
5292
5293 switch ((int) (a == 4))
5294 {
5295 ...
5296 }
5297
5298 This warning is enabled by default for C and C++ programs.
5299
5300 -Wno-switch-outside-range
5301 This option controls warnings when a "switch" case has a value that
5302 is outside of its respective type range. This warning is enabled
5303 by default for C and C++ programs.
5304
5305 -Wno-switch-unreachable
5306 Do not warn when a "switch" statement contains statements between
5307 the controlling expression and the first case label, which will
5308 never be executed. For example:
5309
5310 switch (cond)
5311 {
5312 i = 15;
5313 ...
5314 case 5:
5315 ...
5316 }
5317
5318 -Wswitch-unreachable does not warn if the statement between the
5319 controlling expression and the first case label is just a
5320 declaration:
5321
5322 switch (cond)
5323 {
5324 int i;
5325 ...
5326 case 5:
5327 i = 5;
5328 ...
5329 }
5330
5331 This warning is enabled by default for C and C++ programs.
5332
5333 -Wsync-nand (C and C++ only)
5334 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5335 built-in functions are used. These functions changed semantics in
5336 GCC 4.4.
5337
5338 -Wunused-but-set-parameter
5339 Warn whenever a function parameter is assigned to, but otherwise
5340 unused (aside from its declaration).
5341
5342 To suppress this warning use the "unused" attribute.
5343
5344 This warning is also enabled by -Wunused together with -Wextra.
5345
5346 -Wunused-but-set-variable
5347 Warn whenever a local variable is assigned to, but otherwise unused
5348 (aside from its declaration). This warning is enabled by -Wall.
5349
5350 To suppress this warning use the "unused" attribute.
5351
5352 This warning is also enabled by -Wunused, which is enabled by
5353 -Wall.
5354
5355 -Wunused-function
5356 Warn whenever a static function is declared but not defined or a
5357 non-inline static function is unused. This warning is enabled by
5358 -Wall.
5359
5360 -Wunused-label
5361 Warn whenever a label is declared but not used. This warning is
5362 enabled by -Wall.
5363
5364 To suppress this warning use the "unused" attribute.
5365
5366 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5367 Warn when a typedef locally defined in a function is not used.
5368 This warning is enabled by -Wall.
5369
5370 -Wunused-parameter
5371 Warn whenever a function parameter is unused aside from its
5372 declaration.
5373
5374 To suppress this warning use the "unused" attribute.
5375
5376 -Wno-unused-result
5377 Do not warn if a caller of a function marked with attribute
5378 "warn_unused_result" does not use its return value. The default is
5379 -Wunused-result.
5380
5381 -Wunused-variable
5382 Warn whenever a local or static variable is unused aside from its
5383 declaration. This option implies -Wunused-const-variable=1 for C,
5384 but not for C++. This warning is enabled by -Wall.
5385
5386 To suppress this warning use the "unused" attribute.
5387
5388 -Wunused-const-variable
5389 -Wunused-const-variable=n
5390 Warn whenever a constant static variable is unused aside from its
5391 declaration. -Wunused-const-variable=1 is enabled by
5392 -Wunused-variable for C, but not for C++. In C this declares
5393 variable storage, but in C++ this is not an error since const
5394 variables take the place of "#define"s.
5395
5396 To suppress this warning use the "unused" attribute.
5397
5398 -Wunused-const-variable=1
5399 This is the warning level that is enabled by -Wunused-variable
5400 for C. It warns only about unused static const variables
5401 defined in the main compilation unit, but not about static
5402 const variables declared in any header included.
5403
5404 -Wunused-const-variable=2
5405 This warning level also warns for unused constant static
5406 variables in headers (excluding system headers). This is the
5407 warning level of -Wunused-const-variable and must be explicitly
5408 requested since in C++ this isn't an error and in C it might be
5409 harder to clean up all headers included.
5410
5411 -Wunused-value
5412 Warn whenever a statement computes a result that is explicitly not
5413 used. To suppress this warning cast the unused expression to
5414 "void". This includes an expression-statement or the left-hand side
5415 of a comma expression that contains no side effects. For example,
5416 an expression such as "x[i,j]" causes a warning, while
5417 "x[(void)i,j]" does not.
5418
5419 This warning is enabled by -Wall.
5420
5421 -Wunused
5422 All the above -Wunused options combined.
5423
5424 In order to get a warning about an unused function parameter, you
5425 must either specify -Wextra -Wunused (note that -Wall implies
5426 -Wunused), or separately specify -Wunused-parameter.
5427
5428 -Wuninitialized
5429 Warn if an object with automatic or allocated storage duration is
5430 used without having been initialized. In C++, also warn if a non-
5431 static reference or non-static "const" member appears in a class
5432 without constructors.
5433
5434 In addition, passing a pointer (or in C++, a reference) to an
5435 uninitialized object to a "const"-qualified argument of a built-in
5436 function known to read the object is also diagnosed by this
5437 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5438
5439 If you want to warn about code that uses the uninitialized value of
5440 the variable in its own initializer, use the -Winit-self option.
5441
5442 These warnings occur for individual uninitialized elements of
5443 structure, union or array variables as well as for variables that
5444 are uninitialized as a whole. They do not occur for variables or
5445 elements declared "volatile". Because these warnings depend on
5446 optimization, the exact variables or elements for which there are
5447 warnings depend on the precise optimization options and version of
5448 GCC used.
5449
5450 Note that there may be no warning about a variable that is used
5451 only to compute a value that itself is never used, because such
5452 computations may be deleted by data flow analysis before the
5453 warnings are printed.
5454
5455 -Wno-invalid-memory-model
5456 This option controls warnings for invocations of __atomic Builtins,
5457 __sync Builtins, and the C11 atomic generic functions with a memory
5458 consistency argument that is either invalid for the operation or
5459 outside the range of values of the "memory_order" enumeration. For
5460 example, since the "__atomic_store" and "__atomic_store_n" built-
5461 ins are only defined for the relaxed, release, and sequentially
5462 consistent memory orders the following code is diagnosed:
5463
5464 void store (int *i)
5465 {
5466 __atomic_store_n (i, 0, memory_order_consume);
5467 }
5468
5469 -Winvalid-memory-model is enabled by default.
5470
5471 -Wmaybe-uninitialized
5472 For an object with automatic or allocated storage duration, if
5473 there exists a path from the function entry to a use of the object
5474 that is initialized, but there exist some other paths for which the
5475 object is not initialized, the compiler emits a warning if it
5476 cannot prove the uninitialized paths are not executed at run time.
5477
5478 In addition, passing a pointer (or in C++, a reference) to an
5479 uninitialized object to a "const"-qualified function argument is
5480 also diagnosed by this warning. (-Wuninitialized is issued for
5481 built-in functions known to read the object.) Annotating the
5482 function with attribute "access (none)" indicates that the argument
5483 isn't used to access the object and avoids the warning.
5484
5485 These warnings are only possible in optimizing compilation, because
5486 otherwise GCC does not keep track of the state of variables.
5487
5488 These warnings are made optional because GCC may not be able to
5489 determine when the code is correct in spite of appearing to have an
5490 error. Here is one example of how this can happen:
5491
5492 {
5493 int x;
5494 switch (y)
5495 {
5496 case 1: x = 1;
5497 break;
5498 case 2: x = 4;
5499 break;
5500 case 3: x = 5;
5501 }
5502 foo (x);
5503 }
5504
5505 If the value of "y" is always 1, 2 or 3, then "x" is always
5506 initialized, but GCC doesn't know this. To suppress the warning,
5507 you need to provide a default case with assert(0) or similar code.
5508
5509 This option also warns when a non-volatile automatic variable might
5510 be changed by a call to "longjmp". The compiler sees only the
5511 calls to "setjmp". It cannot know where "longjmp" will be called;
5512 in fact, a signal handler could call it at any point in the code.
5513 As a result, you may get a warning even when there is in fact no
5514 problem because "longjmp" cannot in fact be called at the place
5515 that would cause a problem.
5516
5517 Some spurious warnings can be avoided if you declare all the
5518 functions you use that never return as "noreturn".
5519
5520 This warning is enabled by -Wall or -Wextra.
5521
5522 -Wunknown-pragmas
5523 Warn when a "#pragma" directive is encountered that is not
5524 understood by GCC. If this command-line option is used, warnings
5525 are even issued for unknown pragmas in system header files. This
5526 is not the case if the warnings are only enabled by the -Wall
5527 command-line option.
5528
5529 -Wno-pragmas
5530 Do not warn about misuses of pragmas, such as incorrect parameters,
5531 invalid syntax, or conflicts between pragmas. See also
5532 -Wunknown-pragmas.
5533
5534 -Wno-prio-ctor-dtor
5535 Do not warn if a priority from 0 to 100 is used for constructor or
5536 destructor. The use of constructor and destructor attributes allow
5537 you to assign a priority to the constructor/destructor to control
5538 its order of execution before "main" is called or after it returns.
5539 The priority values must be greater than 100 as the compiler
5540 reserves priority values between 0--100 for the implementation.
5541
5542 -Wstrict-aliasing
5543 This option is only active when -fstrict-aliasing is active. It
5544 warns about code that might break the strict aliasing rules that
5545 the compiler is using for optimization. The warning does not catch
5546 all cases, but does attempt to catch the more common pitfalls. It
5547 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
5548
5549 -Wstrict-aliasing=n
5550 This option is only active when -fstrict-aliasing is active. It
5551 warns about code that might break the strict aliasing rules that
5552 the compiler is using for optimization. Higher levels correspond
5553 to higher accuracy (fewer false positives). Higher levels also
5554 correspond to more effort, similar to the way -O works.
5555 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
5556
5557 Level 1: Most aggressive, quick, least accurate. Possibly useful
5558 when higher levels do not warn but -fstrict-aliasing still breaks
5559 the code, as it has very few false negatives. However, it has many
5560 false positives. Warns for all pointer conversions between
5561 possibly incompatible types, even if never dereferenced. Runs in
5562 the front end only.
5563
5564 Level 2: Aggressive, quick, not too precise. May still have many
5565 false positives (not as many as level 1 though), and few false
5566 negatives (but possibly more than level 1). Unlike level 1, it
5567 only warns when an address is taken. Warns about incomplete types.
5568 Runs in the front end only.
5569
5570 Level 3 (default for -Wstrict-aliasing): Should have very few false
5571 positives and few false negatives. Slightly slower than levels 1
5572 or 2 when optimization is enabled. Takes care of the common
5573 pun+dereference pattern in the front end: "*(int*)&some_float". If
5574 optimization is enabled, it also runs in the back end, where it
5575 deals with multiple statement cases using flow-sensitive points-to
5576 information. Only warns when the converted pointer is
5577 dereferenced. Does not warn about incomplete types.
5578
5579 -Wstrict-overflow
5580 -Wstrict-overflow=n
5581 This option is only active when signed overflow is undefined. It
5582 warns about cases where the compiler optimizes based on the
5583 assumption that signed overflow does not occur. Note that it does
5584 not warn about all cases where the code might overflow: it only
5585 warns about cases where the compiler implements some optimization.
5586 Thus this warning depends on the optimization level.
5587
5588 An optimization that assumes that signed overflow does not occur is
5589 perfectly safe if the values of the variables involved are such
5590 that overflow never does, in fact, occur. Therefore this warning
5591 can easily give a false positive: a warning about code that is not
5592 actually a problem. To help focus on important issues, several
5593 warning levels are defined. No warnings are issued for the use of
5594 undefined signed overflow when estimating how many iterations a
5595 loop requires, in particular when determining whether a loop will
5596 be executed at all.
5597
5598 -Wstrict-overflow=1
5599 Warn about cases that are both questionable and easy to avoid.
5600 For example the compiler simplifies "x + 1 > x" to 1. This
5601 level of -Wstrict-overflow is enabled by -Wall; higher levels
5602 are not, and must be explicitly requested.
5603
5604 -Wstrict-overflow=2
5605 Also warn about other cases where a comparison is simplified to
5606 a constant. For example: "abs (x) >= 0". This can only be
5607 simplified when signed integer overflow is undefined, because
5608 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
5609 zero. -Wstrict-overflow (with no level) is the same as
5610 -Wstrict-overflow=2.
5611
5612 -Wstrict-overflow=3
5613 Also warn about other cases where a comparison is simplified.
5614 For example: "x + 1 > 1" is simplified to "x > 0".
5615
5616 -Wstrict-overflow=4
5617 Also warn about other simplifications not covered by the above
5618 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
5619
5620 -Wstrict-overflow=5
5621 Also warn about cases where the compiler reduces the magnitude
5622 of a constant involved in a comparison. For example: "x + 2 >
5623 y" is simplified to "x + 1 >= y". This is reported only at the
5624 highest warning level because this simplification applies to
5625 many comparisons, so this warning level gives a very large
5626 number of false positives.
5627
5628 -Wstring-compare
5629 Warn for calls to "strcmp" and "strncmp" whose result is determined
5630 to be either zero or non-zero in tests for such equality owing to
5631 the length of one argument being greater than the size of the array
5632 the other argument is stored in (or the bound in the case of
5633 "strncmp"). Such calls could be mistakes. For example, the call
5634 to "strcmp" below is diagnosed because its result is necessarily
5635 non-zero irrespective of the contents of the array "a".
5636
5637 extern char a[4];
5638 void f (char *d)
5639 {
5640 strcpy (d, "string");
5641 ...
5642 if (0 == strcmp (a, d)) // cannot be true
5643 puts ("a and d are the same");
5644 }
5645
5646 -Wstring-compare is enabled by -Wextra.
5647
5648 -Wno-stringop-overflow
5649 -Wstringop-overflow
5650 -Wstringop-overflow=type
5651 Warn for calls to string manipulation functions such as "memcpy"
5652 and "strcpy" that are determined to overflow the destination
5653 buffer. The optional argument is one greater than the type of
5654 Object Size Checking to perform to determine the size of the
5655 destination. The argument is meaningful only for functions that
5656 operate on character arrays but not for raw memory functions like
5657 "memcpy" which always make use of Object Size type-0. The option
5658 also warns for calls that specify a size in excess of the largest
5659 possible object or at most "SIZE_MAX / 2" bytes. The option
5660 produces the best results with optimization enabled but can detect
5661 a small subset of simple buffer overflows even without optimization
5662 in calls to the GCC built-in functions like "__builtin_memcpy" that
5663 correspond to the standard functions. In any case, the option
5664 warns about just a subset of buffer overflows detected by the
5665 corresponding overflow checking built-ins. For example, the option
5666 issues a warning for the "strcpy" call below because it copies at
5667 least 5 characters (the string "blue" including the terminating
5668 NUL) into the buffer of size 4.
5669
5670 enum Color { blue, purple, yellow };
5671 const char* f (enum Color clr)
5672 {
5673 static char buf [4];
5674 const char *str;
5675 switch (clr)
5676 {
5677 case blue: str = "blue"; break;
5678 case purple: str = "purple"; break;
5679 case yellow: str = "yellow"; break;
5680 }
5681
5682 return strcpy (buf, str); // warning here
5683 }
5684
5685 Option -Wstringop-overflow=2 is enabled by default.
5686
5687 -Wstringop-overflow
5688 -Wstringop-overflow=1
5689 The -Wstringop-overflow=1 option uses type-zero Object Size
5690 Checking to determine the sizes of destination objects. At
5691 this setting the option does not warn for writes past the end
5692 of subobjects of larger objects accessed by pointers unless the
5693 size of the largest surrounding object is known. When the
5694 destination may be one of several objects it is assumed to be
5695 the largest one of them. On Linux systems, when optimization
5696 is enabled at this setting the option warns for the same code
5697 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
5698 value.
5699
5700 -Wstringop-overflow=2
5701 The -Wstringop-overflow=2 option uses type-one Object Size
5702 Checking to determine the sizes of destination objects. At
5703 this setting the option warns about overflows when writing to
5704 members of the largest complete objects whose exact size is
5705 known. However, it does not warn for excessive writes to the
5706 same members of unknown objects referenced by pointers since
5707 they may point to arrays containing unknown numbers of
5708 elements. This is the default setting of the option.
5709
5710 -Wstringop-overflow=3
5711 The -Wstringop-overflow=3 option uses type-two Object Size
5712 Checking to determine the sizes of destination objects. At
5713 this setting the option warns about overflowing the smallest
5714 object or data member. This is the most restrictive setting of
5715 the option that may result in warnings for safe code.
5716
5717 -Wstringop-overflow=4
5718 The -Wstringop-overflow=4 option uses type-three Object Size
5719 Checking to determine the sizes of destination objects. At
5720 this setting the option warns about overflowing any data
5721 members, and when the destination is one of several objects it
5722 uses the size of the largest of them to decide whether to issue
5723 a warning. Similarly to -Wstringop-overflow=3 this setting of
5724 the option may result in warnings for benign code.
5725
5726 -Wno-stringop-overread
5727 Warn for calls to string manipulation functions such as "memchr",
5728 or "strcpy" that are determined to read past the end of the source
5729 sequence.
5730
5731 Option -Wstringop-overread is enabled by default.
5732
5733 -Wno-stringop-truncation
5734 Do not warn for calls to bounded string manipulation functions such
5735 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5736 copied string or leave the destination unchanged.
5737
5738 In the following example, the call to "strncat" specifies a bound
5739 that is less than the length of the source string. As a result,
5740 the copy of the source will be truncated and so the call is
5741 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5742 as the bound.
5743
5744 void append (char *buf, size_t bufsize)
5745 {
5746 strncat (buf, ".txt", 3);
5747 }
5748
5749 As another example, the following call to "strncpy" results in
5750 copying to "d" just the characters preceding the terminating NUL,
5751 without appending the NUL to the end. Assuming the result of
5752 "strncpy" is necessarily a NUL-terminated string is a common
5753 mistake, and so the call is diagnosed. To avoid the warning when
5754 the result is not expected to be NUL-terminated, call "memcpy"
5755 instead.
5756
5757 void copy (char *d, const char *s)
5758 {
5759 strncpy (d, s, strlen (s));
5760 }
5761
5762 In the following example, the call to "strncpy" specifies the size
5763 of the destination buffer as the bound. If the length of the
5764 source string is equal to or greater than this size the result of
5765 the copy will not be NUL-terminated. Therefore, the call is also
5766 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5767 bound and set the last element of the buffer to "NUL".
5768
5769 void copy (const char *s)
5770 {
5771 char buf[80];
5772 strncpy (buf, s, sizeof buf);
5773 ...
5774 }
5775
5776 In situations where a character array is intended to store a
5777 sequence of bytes with no terminating "NUL" such an array may be
5778 annotated with attribute "nonstring" to avoid this warning. Such
5779 arrays, however, are not suitable arguments to functions that
5780 expect "NUL"-terminated strings. To help detect accidental misuses
5781 of such arrays GCC issues warnings unless it can prove that the use
5782 is safe.
5783
5784 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
5785 Warn for cases where adding an attribute may be beneficial. The
5786 attributes currently supported are listed below.
5787
5788 -Wsuggest-attribute=pure
5789 -Wsuggest-attribute=const
5790 -Wsuggest-attribute=noreturn
5791 -Wmissing-noreturn
5792 -Wsuggest-attribute=malloc
5793 Warn about functions that might be candidates for attributes
5794 "pure", "const" or "noreturn" or "malloc". The compiler only
5795 warns for functions visible in other compilation units or (in
5796 the case of "pure" and "const") if it cannot prove that the
5797 function returns normally. A function returns normally if it
5798 doesn't contain an infinite loop or return abnormally by
5799 throwing, calling "abort" or trapping. This analysis requires
5800 option -fipa-pure-const, which is enabled by default at -O and
5801 higher. Higher optimization levels improve the accuracy of the
5802 analysis.
5803
5804 -Wsuggest-attribute=format
5805 -Wmissing-format-attribute
5806 Warn about function pointers that might be candidates for
5807 "format" attributes. Note these are only possible candidates,
5808 not absolute ones. GCC guesses that function pointers with
5809 "format" attributes that are used in assignment,
5810 initialization, parameter passing or return statements should
5811 have a corresponding "format" attribute in the resulting type.
5812 I.e. the left-hand side of the assignment or initialization,
5813 the type of the parameter variable, or the return type of the
5814 containing function respectively should also have a "format"
5815 attribute to avoid the warning.
5816
5817 GCC also warns about function definitions that might be
5818 candidates for "format" attributes. Again, these are only
5819 possible candidates. GCC guesses that "format" attributes
5820 might be appropriate for any function that calls a function
5821 like "vprintf" or "vscanf", but this might not always be the
5822 case, and some functions for which "format" attributes are
5823 appropriate may not be detected.
5824
5825 -Wsuggest-attribute=cold
5826 Warn about functions that might be candidates for "cold"
5827 attribute. This is based on static detection and generally
5828 only warns about functions which always leads to a call to
5829 another "cold" function such as wrappers of C++ "throw" or
5830 fatal error reporting functions leading to "abort".
5831
5832 -Walloc-zero
5833 Warn about calls to allocation functions decorated with attribute
5834 "alloc_size" that specify zero bytes, including those to the built-
5835 in forms of the functions "aligned_alloc", "alloca", "calloc",
5836 "malloc", and "realloc". Because the behavior of these functions
5837 when called with a zero size differs among implementations (and in
5838 the case of "realloc" has been deprecated) relying on it may result
5839 in subtle portability bugs and should be avoided.
5840
5841 -Walloc-size-larger-than=byte-size
5842 Warn about calls to functions decorated with attribute "alloc_size"
5843 that attempt to allocate objects larger than the specified number
5844 of bytes, or where the result of the size computation in an integer
5845 type with infinite precision would exceed the value of PTRDIFF_MAX
5846 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
5847 default. Warnings controlled by the option can be disabled either
5848 by specifying byte-size of SIZE_MAX or more or by
5849 -Wno-alloc-size-larger-than.
5850
5851 -Wno-alloc-size-larger-than
5852 Disable -Walloc-size-larger-than= warnings. The option is
5853 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
5854
5855 -Walloca
5856 This option warns on all uses of "alloca" in the source.
5857
5858 -Walloca-larger-than=byte-size
5859 This option warns on calls to "alloca" with an integer argument
5860 whose value is either zero, or that is not bounded by a controlling
5861 predicate that limits its value to at most byte-size. It also
5862 warns for calls to "alloca" where the bound value is unknown.
5863 Arguments of non-integer types are considered unbounded even if
5864 they appear to be constrained to the expected range.
5865
5866 For example, a bounded case of "alloca" could be:
5867
5868 void func (size_t n)
5869 {
5870 void *p;
5871 if (n <= 1000)
5872 p = alloca (n);
5873 else
5874 p = malloc (n);
5875 f (p);
5876 }
5877
5878 In the above example, passing "-Walloca-larger-than=1000" would not
5879 issue a warning because the call to "alloca" is known to be at most
5880 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
5881 the compiler would emit a warning.
5882
5883 Unbounded uses, on the other hand, are uses of "alloca" with no
5884 controlling predicate constraining its integer argument. For
5885 example:
5886
5887 void func ()
5888 {
5889 void *p = alloca (n);
5890 f (p);
5891 }
5892
5893 If "-Walloca-larger-than=500" were passed, the above would trigger
5894 a warning, but this time because of the lack of bounds checking.
5895
5896 Note, that even seemingly correct code involving signed integers
5897 could cause a warning:
5898
5899 void func (signed int n)
5900 {
5901 if (n < 500)
5902 {
5903 p = alloca (n);
5904 f (p);
5905 }
5906 }
5907
5908 In the above example, n could be negative, causing a larger than
5909 expected argument to be implicitly cast into the "alloca" call.
5910
5911 This option also warns when "alloca" is used in a loop.
5912
5913 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
5914 usually only effective when -ftree-vrp is active (default for -O2
5915 and above).
5916
5917 See also -Wvla-larger-than=byte-size.
5918
5919 -Wno-alloca-larger-than
5920 Disable -Walloca-larger-than= warnings. The option is equivalent
5921 to -Walloca-larger-than=SIZE_MAX or larger.
5922
5923 -Warith-conversion
5924 Do warn about implicit conversions from arithmetic operations even
5925 when conversion of the operands to the same type cannot change
5926 their values. This affects warnings from -Wconversion,
5927 -Wfloat-conversion, and -Wsign-conversion.
5928
5929 void f (char c, int i)
5930 {
5931 c = c + i; // warns with B<-Wconversion>
5932 c = c + 1; // only warns with B<-Warith-conversion>
5933 }
5934
5935 -Warray-bounds
5936 -Warray-bounds=n
5937 This option is only active when -ftree-vrp is active (default for
5938 -O2 and above). It warns about subscripts to arrays that are always
5939 out of bounds. This warning is enabled by -Wall.
5940
5941 -Warray-bounds=1
5942 This is the warning level of -Warray-bounds and is enabled by
5943 -Wall; higher levels are not, and must be explicitly requested.
5944
5945 -Warray-bounds=2
5946 This warning level also warns about out of bounds access for
5947 arrays at the end of a struct and for arrays accessed through
5948 pointers. This warning level may give a larger number of false
5949 positives and is deactivated by default.
5950
5951 -Warray-parameter
5952 -Warray-parameter=n
5953 Warn about redeclarations of functions involving arguments of array
5954 or pointer types of inconsistent kinds or forms, and enable the
5955 detection of out-of-bounds accesses to such parameters by warnings
5956 such as -Warray-bounds.
5957
5958 If the first function declaration uses the array form the bound
5959 specified in the array is assumed to be the minimum number of
5960 elements expected to be provided in calls to the function and the
5961 maximum number of elements accessed by it. Failing to provide
5962 arguments of sufficient size or accessing more than the maximum
5963 number of elements may be diagnosed by warnings such as
5964 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
5965 involving array parameters declared using the "T[static N]" form.
5966
5967 For example, the warning triggers for the following redeclarations
5968 because the first one allows an array of any size to be passed to
5969 "f" while the second one with the keyword "static" specifies that
5970 the array argument must have at least four elements.
5971
5972 void f (int[static 4]);
5973 void f (int[]); // warning (inconsistent array form)
5974
5975 void g (void)
5976 {
5977 int *p = (int *)malloc (4);
5978 f (p); // warning (array too small)
5979 ...
5980 }
5981
5982 At level 2 the warning also triggers for redeclarations involving
5983 any other inconsistency in array or pointer argument forms denoting
5984 array sizes. Pointers and arrays of unspecified bound are
5985 considered equivalent and do not trigger a warning.
5986
5987 void g (int*);
5988 void g (int[]); // no warning
5989 void g (int[8]); // warning (inconsistent array bound)
5990
5991 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
5992 option triggers warnings for similar inconsistencies involving
5993 Variable Length Array arguments.
5994
5995 -Wattribute-alias=n
5996 -Wno-attribute-alias
5997 Warn about declarations using the "alias" and similar attributes
5998 whose target is incompatible with the type of the alias.
5999
6000 -Wattribute-alias=1
6001 The default warning level of the -Wattribute-alias option
6002 diagnoses incompatibilities between the type of the alias
6003 declaration and that of its target. Such incompatibilities are
6004 typically indicative of bugs.
6005
6006 -Wattribute-alias=2
6007 At this level -Wattribute-alias also diagnoses cases where the
6008 attributes of the alias declaration are more restrictive than
6009 the attributes applied to its target. These mismatches can
6010 potentially result in incorrect code generation. In other
6011 cases they may be benign and could be resolved simply by adding
6012 the missing attribute to the target. For comparison, see the
6013 -Wmissing-attributes option, which controls diagnostics when
6014 the alias declaration is less restrictive than the target,
6015 rather than more restrictive.
6016
6017 Attributes considered include "alloc_align", "alloc_size",
6018 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6019 "noreturn", "nothrow", "pure", "returns_nonnull", and
6020 "returns_twice".
6021
6022 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6023 the default. You can disable these warnings with either
6024 -Wno-attribute-alias or -Wattribute-alias=0.
6025
6026 -Wbool-compare
6027 Warn about boolean expression compared with an integer value
6028 different from "true"/"false". For instance, the following
6029 comparison is always false:
6030
6031 int n = 5;
6032 ...
6033 if ((n > 1) == 2) { ... }
6034
6035 This warning is enabled by -Wall.
6036
6037 -Wbool-operation
6038 Warn about suspicious operations on expressions of a boolean type.
6039 For instance, bitwise negation of a boolean is very likely a bug in
6040 the program. For C, this warning also warns about incrementing or
6041 decrementing a boolean, which rarely makes sense. (In C++,
6042 decrementing a boolean is always invalid. Incrementing a boolean
6043 is invalid in C++17, and deprecated otherwise.)
6044
6045 This warning is enabled by -Wall.
6046
6047 -Wduplicated-branches
6048 Warn when an if-else has identical branches. This warning detects
6049 cases like
6050
6051 if (p != NULL)
6052 return 0;
6053 else
6054 return 0;
6055
6056 It doesn't warn when both branches contain just a null statement.
6057 This warning also warn for conditional operators:
6058
6059 int i = x ? *p : *p;
6060
6061 -Wduplicated-cond
6062 Warn about duplicated conditions in an if-else-if chain. For
6063 instance, warn for the following code:
6064
6065 if (p->q != NULL) { ... }
6066 else if (p->q != NULL) { ... }
6067
6068 -Wframe-address
6069 Warn when the __builtin_frame_address or __builtin_return_address
6070 is called with an argument greater than 0. Such calls may return
6071 indeterminate values or crash the program. The warning is included
6072 in -Wall.
6073
6074 -Wno-discarded-qualifiers (C and Objective-C only)
6075 Do not warn if type qualifiers on pointers are being discarded.
6076 Typically, the compiler warns if a "const char *" variable is
6077 passed to a function that takes a "char *" parameter. This option
6078 can be used to suppress such a warning.
6079
6080 -Wno-discarded-array-qualifiers (C and Objective-C only)
6081 Do not warn if type qualifiers on arrays which are pointer targets
6082 are being discarded. Typically, the compiler warns if a "const int
6083 (*)[]" variable is passed to a function that takes a "int (*)[]"
6084 parameter. This option can be used to suppress such a warning.
6085
6086 -Wno-incompatible-pointer-types (C and Objective-C only)
6087 Do not warn when there is a conversion between pointers that have
6088 incompatible types. This warning is for cases not covered by
6089 -Wno-pointer-sign, which warns for pointer argument passing or
6090 assignment with different signedness.
6091
6092 -Wno-int-conversion (C and Objective-C only)
6093 Do not warn about incompatible integer to pointer and pointer to
6094 integer conversions. This warning is about implicit conversions;
6095 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6096 -Wno-pointer-to-int-cast may be used.
6097
6098 -Wzero-length-bounds
6099 Warn about accesses to elements of zero-length array members that
6100 might overlap other members of the same object. Declaring interior
6101 zero-length arrays is discouraged because accesses to them are
6102 undefined. See
6103
6104 For example, the first two stores in function "bad" are diagnosed
6105 because the array elements overlap the subsequent members "b" and
6106 "c". The third store is diagnosed by -Warray-bounds because it is
6107 beyond the bounds of the enclosing object.
6108
6109 struct X { int a[0]; int b, c; };
6110 struct X x;
6111
6112 void bad (void)
6113 {
6114 x.a[0] = 0; // -Wzero-length-bounds
6115 x.a[1] = 1; // -Wzero-length-bounds
6116 x.a[2] = 2; // -Warray-bounds
6117 }
6118
6119 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6120
6121 -Wno-div-by-zero
6122 Do not warn about compile-time integer division by zero. Floating-
6123 point division by zero is not warned about, as it can be a
6124 legitimate way of obtaining infinities and NaNs.
6125
6126 -Wsystem-headers
6127 Print warning messages for constructs found in system header files.
6128 Warnings from system headers are normally suppressed, on the
6129 assumption that they usually do not indicate real problems and
6130 would only make the compiler output harder to read. Using this
6131 command-line option tells GCC to emit warnings from system headers
6132 as if they occurred in user code. However, note that using -Wall
6133 in conjunction with this option does not warn about unknown pragmas
6134 in system headers---for that, -Wunknown-pragmas must also be used.
6135
6136 -Wtautological-compare
6137 Warn if a self-comparison always evaluates to true or false. This
6138 warning detects various mistakes such as:
6139
6140 int i = 1;
6141 ...
6142 if (i > i) { ... }
6143
6144 This warning also warns about bitwise comparisons that always
6145 evaluate to true or false, for instance:
6146
6147 if ((a & 16) == 10) { ... }
6148
6149 will always be false.
6150
6151 This warning is enabled by -Wall.
6152
6153 -Wtrampolines
6154 Warn about trampolines generated for pointers to nested functions.
6155 A trampoline is a small piece of data or code that is created at
6156 run time on the stack when the address of a nested function is
6157 taken, and is used to call the nested function indirectly. For
6158 some targets, it is made up of data only and thus requires no
6159 special treatment. But, for most targets, it is made up of code
6160 and thus requires the stack to be made executable in order for the
6161 program to work properly.
6162
6163 -Wfloat-equal
6164 Warn if floating-point values are used in equality comparisons.
6165
6166 The idea behind this is that sometimes it is convenient (for the
6167 programmer) to consider floating-point values as approximations to
6168 infinitely precise real numbers. If you are doing this, then you
6169 need to compute (by analyzing the code, or in some other way) the
6170 maximum or likely maximum error that the computation introduces,
6171 and allow for it when performing comparisons (and when producing
6172 output, but that's a different problem). In particular, instead of
6173 testing for equality, you should check to see whether the two
6174 values have ranges that overlap; and this is done with the
6175 relational operators, so equality comparisons are probably
6176 mistaken.
6177
6178 -Wtraditional (C and Objective-C only)
6179 Warn about certain constructs that behave differently in
6180 traditional and ISO C. Also warn about ISO C constructs that have
6181 no traditional C equivalent, and/or problematic constructs that
6182 should be avoided.
6183
6184 * Macro parameters that appear within string literals in the
6185 macro body. In traditional C macro replacement takes place
6186 within string literals, but in ISO C it does not.
6187
6188 * In traditional C, some preprocessor directives did not exist.
6189 Traditional preprocessors only considered a line to be a
6190 directive if the # appeared in column 1 on the line. Therefore
6191 -Wtraditional warns about directives that traditional C
6192 understands but ignores because the # does not appear as the
6193 first character on the line. It also suggests you hide
6194 directives like "#pragma" not understood by traditional C by
6195 indenting them. Some traditional implementations do not
6196 recognize "#elif", so this option suggests avoiding it
6197 altogether.
6198
6199 * A function-like macro that appears without arguments.
6200
6201 * The unary plus operator.
6202
6203 * The U integer constant suffix, or the F or L floating-point
6204 constant suffixes. (Traditional C does support the L suffix on
6205 integer constants.) Note, these suffixes appear in macros
6206 defined in the system headers of most modern systems, e.g. the
6207 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6208 code might normally lead to spurious warnings, however GCC's
6209 integrated preprocessor has enough context to avoid warning in
6210 these cases.
6211
6212 * A function declared external in one block and then used after
6213 the end of the block.
6214
6215 * A "switch" statement has an operand of type "long".
6216
6217 * A non-"static" function declaration follows a "static" one.
6218 This construct is not accepted by some traditional C compilers.
6219
6220 * The ISO type of an integer constant has a different width or
6221 signedness from its traditional type. This warning is only
6222 issued if the base of the constant is ten. I.e. hexadecimal or
6223 octal values, which typically represent bit patterns, are not
6224 warned about.
6225
6226 * Usage of ISO string concatenation is detected.
6227
6228 * Initialization of automatic aggregates.
6229
6230 * Identifier conflicts with labels. Traditional C lacks a
6231 separate namespace for labels.
6232
6233 * Initialization of unions. If the initializer is zero, the
6234 warning is omitted. This is done under the assumption that the
6235 zero initializer in user code appears conditioned on e.g.
6236 "__STDC__" to avoid missing initializer warnings and relies on
6237 default initialization to zero in the traditional C case.
6238
6239 * Conversions by prototypes between fixed/floating-point values
6240 and vice versa. The absence of these prototypes when compiling
6241 with traditional C causes serious problems. This is a subset
6242 of the possible conversion warnings; for the full set use
6243 -Wtraditional-conversion.
6244
6245 * Use of ISO C style function definitions. This warning
6246 intentionally is not issued for prototype declarations or
6247 variadic functions because these ISO C features appear in your
6248 code when using libiberty's traditional C compatibility macros,
6249 "PARAMS" and "VPARAMS". This warning is also bypassed for
6250 nested functions because that feature is already a GCC
6251 extension and thus not relevant to traditional C compatibility.
6252
6253 -Wtraditional-conversion (C and Objective-C only)
6254 Warn if a prototype causes a type conversion that is different from
6255 what would happen to the same argument in the absence of a
6256 prototype. This includes conversions of fixed point to floating
6257 and vice versa, and conversions changing the width or signedness of
6258 a fixed-point argument except when the same as the default
6259 promotion.
6260
6261 -Wdeclaration-after-statement (C and Objective-C only)
6262 Warn when a declaration is found after a statement in a block.
6263 This construct, known from C++, was introduced with ISO C99 and is
6264 by default allowed in GCC. It is not supported by ISO C90.
6265
6266 -Wshadow
6267 Warn whenever a local variable or type declaration shadows another
6268 variable, parameter, type, class member (in C++), or instance
6269 variable (in Objective-C) or whenever a built-in function is
6270 shadowed. Note that in C++, the compiler warns if a local variable
6271 shadows an explicit typedef, but not if it shadows a
6272 struct/class/enum. If this warning is enabled, it includes also
6273 all instances of local shadowing. This means that
6274 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6275 -Wshadow is used. Same as -Wshadow=global.
6276
6277 -Wno-shadow-ivar (Objective-C only)
6278 Do not warn whenever a local variable shadows an instance variable
6279 in an Objective-C method.
6280
6281 -Wshadow=global
6282 Warn for any shadowing. Same as -Wshadow.
6283
6284 -Wshadow=local
6285 Warn when a local variable shadows another local variable or
6286 parameter.
6287
6288 -Wshadow=compatible-local
6289 Warn when a local variable shadows another local variable or
6290 parameter whose type is compatible with that of the shadowing
6291 variable. In C++, type compatibility here means the type of the
6292 shadowing variable can be converted to that of the shadowed
6293 variable. The creation of this flag (in addition to
6294 -Wshadow=local) is based on the idea that when a local variable
6295 shadows another one of incompatible type, it is most likely
6296 intentional, not a bug or typo, as shown in the following example:
6297
6298 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6299 {
6300 for (int i = 0; i < N; ++i)
6301 {
6302 ...
6303 }
6304 ...
6305 }
6306
6307 Since the two variable "i" in the example above have incompatible
6308 types, enabling only -Wshadow=compatible-local does not emit a
6309 warning. Because their types are incompatible, if a programmer
6310 accidentally uses one in place of the other, type checking is
6311 expected to catch that and emit an error or warning. Use of this
6312 flag instead of -Wshadow=local can possibly reduce the number of
6313 warnings triggered by intentional shadowing. Note that this also
6314 means that shadowing "const char *i" by "char *i" does not emit a
6315 warning.
6316
6317 This warning is also enabled by -Wshadow=local.
6318
6319 -Wlarger-than=byte-size
6320 Warn whenever an object is defined whose size exceeds byte-size.
6321 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6322 controlled by the option can be disabled either by specifying byte-
6323 size of SIZE_MAX or more or by -Wno-larger-than.
6324
6325 Also warn for calls to bounded functions such as "memchr" or
6326 "strnlen" that specify a bound greater than the largest possible
6327 object, which is PTRDIFF_MAX bytes by default. These warnings can
6328 only be disabled by -Wno-larger-than.
6329
6330 -Wno-larger-than
6331 Disable -Wlarger-than= warnings. The option is equivalent to
6332 -Wlarger-than=SIZE_MAX or larger.
6333
6334 -Wframe-larger-than=byte-size
6335 Warn if the size of a function frame exceeds byte-size. The
6336 computation done to determine the stack frame size is approximate
6337 and not conservative. The actual requirements may be somewhat
6338 greater than byte-size even if you do not get a warning. In
6339 addition, any space allocated via "alloca", variable-length arrays,
6340 or related constructs is not included by the compiler when
6341 determining whether or not to issue a warning.
6342 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6343 controlled by the option can be disabled either by specifying byte-
6344 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6345
6346 -Wno-frame-larger-than
6347 Disable -Wframe-larger-than= warnings. The option is equivalent to
6348 -Wframe-larger-than=SIZE_MAX or larger.
6349
6350 -Wno-free-nonheap-object
6351 Warn when attempting to deallocate an object that was either not
6352 allocated on the heap, or by using a pointer that was not returned
6353 from a prior call to the corresponding allocation function. For
6354 example, because the call to "stpcpy" returns a pointer to the
6355 terminating nul character and not to the begginning of the object,
6356 the call to "free" below is diagnosed.
6357
6358 void f (char *p)
6359 {
6360 p = stpcpy (p, "abc");
6361 // ...
6362 free (p); // warning
6363 }
6364
6365 -Wfree-nonheap-object is enabled by default.
6366
6367 -Wstack-usage=byte-size
6368 Warn if the stack usage of a function might exceed byte-size. The
6369 computation done to determine the stack usage is conservative. Any
6370 space allocated via "alloca", variable-length arrays, or related
6371 constructs is included by the compiler when determining whether or
6372 not to issue a warning.
6373
6374 The message is in keeping with the output of -fstack-usage.
6375
6376 * If the stack usage is fully static but exceeds the specified
6377 amount, it's:
6378
6379 warning: stack usage is 1120 bytes
6380
6381 * If the stack usage is (partly) dynamic but bounded, it's:
6382
6383 warning: stack usage might be 1648 bytes
6384
6385 * If the stack usage is (partly) dynamic and not bounded, it's:
6386
6387 warning: stack usage might be unbounded
6388
6389 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
6390 controlled by the option can be disabled either by specifying byte-
6391 size of SIZE_MAX or more or by -Wno-stack-usage.
6392
6393 -Wno-stack-usage
6394 Disable -Wstack-usage= warnings. The option is equivalent to
6395 -Wstack-usage=SIZE_MAX or larger.
6396
6397 -Wunsafe-loop-optimizations
6398 Warn if the loop cannot be optimized because the compiler cannot
6399 assume anything on the bounds of the loop indices. With
6400 -funsafe-loop-optimizations warn if the compiler makes such
6401 assumptions.
6402
6403 -Wno-pedantic-ms-format (MinGW targets only)
6404 When used in combination with -Wformat and -pedantic without GNU
6405 extensions, this option disables the warnings about non-ISO
6406 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
6407 used on Windows targets, which depend on the MS runtime.
6408
6409 -Wpointer-arith
6410 Warn about anything that depends on the "size of" a function type
6411 or of "void". GNU C assigns these types a size of 1, for
6412 convenience in calculations with "void *" pointers and pointers to
6413 functions. In C++, warn also when an arithmetic operation involves
6414 "NULL". This warning is also enabled by -Wpedantic.
6415
6416 -Wno-pointer-compare
6417 Do not warn if a pointer is compared with a zero character
6418 constant. This usually means that the pointer was meant to be
6419 dereferenced. For example:
6420
6421 const char *p = foo ();
6422 if (p == '\0')
6423 return 42;
6424
6425 Note that the code above is invalid in C++11.
6426
6427 This warning is enabled by default.
6428
6429 -Wtsan
6430 Warn about unsupported features in ThreadSanitizer.
6431
6432 ThreadSanitizer does not support "std::atomic_thread_fence" and can
6433 report false positives.
6434
6435 This warning is enabled by default.
6436
6437 -Wtype-limits
6438 Warn if a comparison is always true or always false due to the
6439 limited range of the data type, but do not warn for constant
6440 expressions. For example, warn if an unsigned variable is compared
6441 against zero with "<" or ">=". This warning is also enabled by
6442 -Wextra.
6443
6444 -Wabsolute-value (C and Objective-C only)
6445 Warn for calls to standard functions that compute the absolute
6446 value of an argument when a more appropriate standard function is
6447 available. For example, calling "abs(3.14)" triggers the warning
6448 because the appropriate function to call to compute the absolute
6449 value of a double argument is "fabs". The option also triggers
6450 warnings when the argument in a call to such a function has an
6451 unsigned type. This warning can be suppressed with an explicit
6452 type cast and it is also enabled by -Wextra.
6453
6454 -Wcomment
6455 -Wcomments
6456 Warn whenever a comment-start sequence /* appears in a /* comment,
6457 or whenever a backslash-newline appears in a // comment. This
6458 warning is enabled by -Wall.
6459
6460 -Wtrigraphs
6461 Warn if any trigraphs are encountered that might change the meaning
6462 of the program. Trigraphs within comments are not warned about,
6463 except those that would form escaped newlines.
6464
6465 This option is implied by -Wall. If -Wall is not given, this
6466 option is still enabled unless trigraphs are enabled. To get
6467 trigraph conversion without warnings, but get the other -Wall
6468 warnings, use -trigraphs -Wall -Wno-trigraphs.
6469
6470 -Wundef
6471 Warn if an undefined identifier is evaluated in an "#if" directive.
6472 Such identifiers are replaced with zero.
6473
6474 -Wexpansion-to-defined
6475 Warn whenever defined is encountered in the expansion of a macro
6476 (including the case where the macro is expanded by an #if
6477 directive). Such usage is not portable. This warning is also
6478 enabled by -Wpedantic and -Wextra.
6479
6480 -Wunused-macros
6481 Warn about macros defined in the main file that are unused. A
6482 macro is used if it is expanded or tested for existence at least
6483 once. The preprocessor also warns if the macro has not been used
6484 at the time it is redefined or undefined.
6485
6486 Built-in macros, macros defined on the command line, and macros
6487 defined in include files are not warned about.
6488
6489 Note: If a macro is actually used, but only used in skipped
6490 conditional blocks, then the preprocessor reports it as unused. To
6491 avoid the warning in such a case, you might improve the scope of
6492 the macro's definition by, for example, moving it into the first
6493 skipped block. Alternatively, you could provide a dummy use with
6494 something like:
6495
6496 #if defined the_macro_causing_the_warning
6497 #endif
6498
6499 -Wno-endif-labels
6500 Do not warn whenever an "#else" or an "#endif" are followed by
6501 text. This sometimes happens in older programs with code of the
6502 form
6503
6504 #if FOO
6505 ...
6506 #else FOO
6507 ...
6508 #endif FOO
6509
6510 The second and third "FOO" should be in comments. This warning is
6511 on by default.
6512
6513 -Wbad-function-cast (C and Objective-C only)
6514 Warn when a function call is cast to a non-matching type. For
6515 example, warn if a call to a function returning an integer type is
6516 cast to a pointer type.
6517
6518 -Wc90-c99-compat (C and Objective-C only)
6519 Warn about features not present in ISO C90, but present in ISO C99.
6520 For instance, warn about use of variable length arrays, "long long"
6521 type, "bool" type, compound literals, designated initializers, and
6522 so on. This option is independent of the standards mode. Warnings
6523 are disabled in the expression that follows "__extension__".
6524
6525 -Wc99-c11-compat (C and Objective-C only)
6526 Warn about features not present in ISO C99, but present in ISO C11.
6527 For instance, warn about use of anonymous structures and unions,
6528 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
6529 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
6530 so on. This option is independent of the standards mode. Warnings
6531 are disabled in the expression that follows "__extension__".
6532
6533 -Wc11-c2x-compat (C and Objective-C only)
6534 Warn about features not present in ISO C11, but present in ISO C2X.
6535 For instance, warn about omitting the string in "_Static_assert",
6536 use of [[]] syntax for attributes, use of decimal floating-point
6537 types, and so on. This option is independent of the standards
6538 mode. Warnings are disabled in the expression that follows
6539 "__extension__".
6540
6541 -Wc++-compat (C and Objective-C only)
6542 Warn about ISO C constructs that are outside of the common subset
6543 of ISO C and ISO C++, e.g. request for implicit conversion from
6544 "void *" to a pointer to non-"void" type.
6545
6546 -Wc++11-compat (C++ and Objective-C++ only)
6547 Warn about C++ constructs whose meaning differs between ISO C++
6548 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
6549 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
6550 enabled by -Wall.
6551
6552 -Wc++14-compat (C++ and Objective-C++ only)
6553 Warn about C++ constructs whose meaning differs between ISO C++
6554 2011 and ISO C++ 2014. This warning is enabled by -Wall.
6555
6556 -Wc++17-compat (C++ and Objective-C++ only)
6557 Warn about C++ constructs whose meaning differs between ISO C++
6558 2014 and ISO C++ 2017. This warning is enabled by -Wall.
6559
6560 -Wc++20-compat (C++ and Objective-C++ only)
6561 Warn about C++ constructs whose meaning differs between ISO C++
6562 2017 and ISO C++ 2020. This warning is enabled by -Wall.
6563
6564 -Wcast-qual
6565 Warn whenever a pointer is cast so as to remove a type qualifier
6566 from the target type. For example, warn if a "const char *" is
6567 cast to an ordinary "char *".
6568
6569 Also warn when making a cast that introduces a type qualifier in an
6570 unsafe way. For example, casting "char **" to "const char **" is
6571 unsafe, as in this example:
6572
6573 /* p is char ** value. */
6574 const char **q = (const char **) p;
6575 /* Assignment of readonly string to const char * is OK. */
6576 *q = "string";
6577 /* Now char** pointer points to read-only memory. */
6578 **p = 'b';
6579
6580 -Wcast-align
6581 Warn whenever a pointer is cast such that the required alignment of
6582 the target is increased. For example, warn if a "char *" is cast
6583 to an "int *" on machines where integers can only be accessed at
6584 two- or four-byte boundaries.
6585
6586 -Wcast-align=strict
6587 Warn whenever a pointer is cast such that the required alignment of
6588 the target is increased. For example, warn if a "char *" is cast
6589 to an "int *" regardless of the target machine.
6590
6591 -Wcast-function-type
6592 Warn when a function pointer is cast to an incompatible function
6593 pointer. In a cast involving function types with a variable
6594 argument list only the types of initial arguments that are provided
6595 are considered. Any parameter of pointer-type matches any other
6596 pointer-type. Any benign differences in integral types are
6597 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
6598 qualifiers are ignored. The function type "void (*) (void)" is
6599 special and matches everything, which can be used to suppress this
6600 warning. In a cast involving pointer to member types this warning
6601 warns whenever the type cast is changing the pointer to member
6602 type. This warning is enabled by -Wextra.
6603
6604 -Wwrite-strings
6605 When compiling C, give string constants the type "const
6606 char[length]" so that copying the address of one into a non-"const"
6607 "char *" pointer produces a warning. These warnings help you find
6608 at compile time code that can try to write into a string constant,
6609 but only if you have been very careful about using "const" in
6610 declarations and prototypes. Otherwise, it is just a nuisance.
6611 This is why we did not make -Wall request these warnings.
6612
6613 When compiling C++, warn about the deprecated conversion from
6614 string literals to "char *". This warning is enabled by default
6615 for C++ programs.
6616
6617 -Wclobbered
6618 Warn for variables that might be changed by "longjmp" or "vfork".
6619 This warning is also enabled by -Wextra.
6620
6621 -Wconversion
6622 Warn for implicit conversions that may alter a value. This includes
6623 conversions between real and integer, like "abs (x)" when "x" is
6624 "double"; conversions between signed and unsigned, like "unsigned
6625 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
6626 not warn for explicit casts like "abs ((int) x)" and "ui =
6627 (unsigned) -1", or if the value is not changed by the conversion
6628 like in "abs (2.0)". Warnings about conversions between signed and
6629 unsigned integers can be disabled by using -Wno-sign-conversion.
6630
6631 For C++, also warn for confusing overload resolution for user-
6632 defined conversions; and conversions that never use a type
6633 conversion operator: conversions to "void", the same type, a base
6634 class or a reference to them. Warnings about conversions between
6635 signed and unsigned integers are disabled by default in C++ unless
6636 -Wsign-conversion is explicitly enabled.
6637
6638 Warnings about conversion from arithmetic on a small type back to
6639 that type are only given with -Warith-conversion.
6640
6641 -Wdangling-else
6642 Warn about constructions where there may be confusion to which "if"
6643 statement an "else" branch belongs. Here is an example of such a
6644 case:
6645
6646 {
6647 if (a)
6648 if (b)
6649 foo ();
6650 else
6651 bar ();
6652 }
6653
6654 In C/C++, every "else" branch belongs to the innermost possible
6655 "if" statement, which in this example is "if (b)". This is often
6656 not what the programmer expected, as illustrated in the above
6657 example by indentation the programmer chose. When there is the
6658 potential for this confusion, GCC issues a warning when this flag
6659 is specified. To eliminate the warning, add explicit braces around
6660 the innermost "if" statement so there is no way the "else" can
6661 belong to the enclosing "if". The resulting code looks like this:
6662
6663 {
6664 if (a)
6665 {
6666 if (b)
6667 foo ();
6668 else
6669 bar ();
6670 }
6671 }
6672
6673 This warning is enabled by -Wparentheses.
6674
6675 -Wdate-time
6676 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
6677 encountered as they might prevent bit-wise-identical reproducible
6678 compilations.
6679
6680 -Wempty-body
6681 Warn if an empty body occurs in an "if", "else" or "do while"
6682 statement. This warning is also enabled by -Wextra.
6683
6684 -Wno-endif-labels
6685 Do not warn about stray tokens after "#else" and "#endif".
6686
6687 -Wenum-compare
6688 Warn about a comparison between values of different enumerated
6689 types. In C++ enumerated type mismatches in conditional
6690 expressions are also diagnosed and the warning is enabled by
6691 default. In C this warning is enabled by -Wall.
6692
6693 -Wenum-conversion
6694 Warn when a value of enumerated type is implicitly converted to a
6695 different enumerated type. This warning is enabled by -Wextra in
6696 C.
6697
6698 -Wjump-misses-init (C, Objective-C only)
6699 Warn if a "goto" statement or a "switch" statement jumps forward
6700 across the initialization of a variable, or jumps backward to a
6701 label after the variable has been initialized. This only warns
6702 about variables that are initialized when they are declared. This
6703 warning is only supported for C and Objective-C; in C++ this sort
6704 of branch is an error in any case.
6705
6706 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
6707 with the -Wno-jump-misses-init option.
6708
6709 -Wsign-compare
6710 Warn when a comparison between signed and unsigned values could
6711 produce an incorrect result when the signed value is converted to
6712 unsigned. In C++, this warning is also enabled by -Wall. In C, it
6713 is also enabled by -Wextra.
6714
6715 -Wsign-conversion
6716 Warn for implicit conversions that may change the sign of an
6717 integer value, like assigning a signed integer expression to an
6718 unsigned integer variable. An explicit cast silences the warning.
6719 In C, this option is enabled also by -Wconversion.
6720
6721 -Wfloat-conversion
6722 Warn for implicit conversions that reduce the precision of a real
6723 value. This includes conversions from real to integer, and from
6724 higher precision real to lower precision real values. This option
6725 is also enabled by -Wconversion.
6726
6727 -Wno-scalar-storage-order
6728 Do not warn on suspicious constructs involving reverse scalar
6729 storage order.
6730
6731 -Wsizeof-array-div
6732 Warn about divisions of two sizeof operators when the first one is
6733 applied to an array and the divisor does not equal the size of the
6734 array element. In such a case, the computation will not yield the
6735 number of elements in the array, which is likely what the user
6736 intended. This warning warns e.g. about
6737
6738 int fn ()
6739 {
6740 int arr[10];
6741 return sizeof (arr) / sizeof (short);
6742 }
6743
6744 This warning is enabled by -Wall.
6745
6746 -Wsizeof-pointer-div
6747 Warn for suspicious divisions of two sizeof expressions that divide
6748 the pointer size by the element size, which is the usual way to
6749 compute the array size but won't work out correctly with pointers.
6750 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
6751 "ptr" is not an array, but a pointer. This warning is enabled by
6752 -Wall.
6753
6754 -Wsizeof-pointer-memaccess
6755 Warn for suspicious length parameters to certain string and memory
6756 built-in functions if the argument uses "sizeof". This warning
6757 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
6758 is not an array, but a pointer, and suggests a possible fix, or
6759 about "memcpy (&foo, ptr, sizeof (&foo));".
6760 -Wsizeof-pointer-memaccess also warns about calls to bounded string
6761 copy functions like "strncat" or "strncpy" that specify as the
6762 bound a "sizeof" expression of the source array. For example, in
6763 the following function the call to "strncat" specifies the size of
6764 the source string as the bound. That is almost certainly a mistake
6765 and so the call is diagnosed.
6766
6767 void make_file (const char *name)
6768 {
6769 char path[PATH_MAX];
6770 strncpy (path, name, sizeof path - 1);
6771 strncat (path, ".text", sizeof ".text");
6772 ...
6773 }
6774
6775 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
6776
6777 -Wno-sizeof-array-argument
6778 Do not warn when the "sizeof" operator is applied to a parameter
6779 that is declared as an array in a function definition. This
6780 warning is enabled by default for C and C++ programs.
6781
6782 -Wmemset-elt-size
6783 Warn for suspicious calls to the "memset" built-in function, if the
6784 first argument references an array, and the third argument is a
6785 number equal to the number of elements, but not equal to the size
6786 of the array in memory. This indicates that the user has omitted a
6787 multiplication by the element size. This warning is enabled by
6788 -Wall.
6789
6790 -Wmemset-transposed-args
6791 Warn for suspicious calls to the "memset" built-in function where
6792 the second argument is not zero and the third argument is zero.
6793 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
6794 because "memset (buf, 0, sizeof buf)" was meant instead. The
6795 diagnostic is only emitted if the third argument is a literal zero.
6796 Otherwise, if it is an expression that is folded to zero, or a cast
6797 of zero to some type, it is far less likely that the arguments have
6798 been mistakenly transposed and no warning is emitted. This warning
6799 is enabled by -Wall.
6800
6801 -Waddress
6802 Warn about suspicious uses of memory addresses. These include using
6803 the address of a function in a conditional expression, such as
6804 "void func(void); if (func)", and comparisons against the memory
6805 address of a string literal, such as "if (x == "abc")". Such uses
6806 typically indicate a programmer error: the address of a function
6807 always evaluates to true, so their use in a conditional usually
6808 indicate that the programmer forgot the parentheses in a function
6809 call; and comparisons against string literals result in unspecified
6810 behavior and are not portable in C, so they usually indicate that
6811 the programmer intended to use "strcmp". This warning is enabled
6812 by -Wall.
6813
6814 -Wno-address-of-packed-member
6815 Do not warn when the address of packed member of struct or union is
6816 taken, which usually results in an unaligned pointer value. This
6817 is enabled by default.
6818
6819 -Wlogical-op
6820 Warn about suspicious uses of logical operators in expressions.
6821 This includes using logical operators in contexts where a bit-wise
6822 operator is likely to be expected. Also warns when the operands of
6823 a logical operator are the same:
6824
6825 extern int a;
6826 if (a < 0 && a < 0) { ... }
6827
6828 -Wlogical-not-parentheses
6829 Warn about logical not used on the left hand side operand of a
6830 comparison. This option does not warn if the right operand is
6831 considered to be a boolean expression. Its purpose is to detect
6832 suspicious code like the following:
6833
6834 int a;
6835 ...
6836 if (!a > 1) { ... }
6837
6838 It is possible to suppress the warning by wrapping the LHS into
6839 parentheses:
6840
6841 if ((!a) > 1) { ... }
6842
6843 This warning is enabled by -Wall.
6844
6845 -Waggregate-return
6846 Warn if any functions that return structures or unions are defined
6847 or called. (In languages where you can return an array, this also
6848 elicits a warning.)
6849
6850 -Wno-aggressive-loop-optimizations
6851 Warn if in a loop with constant number of iterations the compiler
6852 detects undefined behavior in some statement during one or more of
6853 the iterations.
6854
6855 -Wno-attributes
6856 Do not warn if an unexpected "__attribute__" is used, such as
6857 unrecognized attributes, function attributes applied to variables,
6858 etc. This does not stop errors for incorrect use of supported
6859 attributes.
6860
6861 -Wno-builtin-declaration-mismatch
6862 Warn if a built-in function is declared with an incompatible
6863 signature or as a non-function, or when a built-in function
6864 declared with a type that does not include a prototype is called
6865 with arguments whose promoted types do not match those expected by
6866 the function. When -Wextra is specified, also warn when a built-in
6867 function that takes arguments is declared without a prototype. The
6868 -Wbuiltin-declaration-mismatch warning is enabled by default. To
6869 avoid the warning include the appropriate header to bring the
6870 prototypes of built-in functions into scope.
6871
6872 For example, the call to "memset" below is diagnosed by the warning
6873 because the function expects a value of type "size_t" as its
6874 argument but the type of 32 is "int". With -Wextra, the
6875 declaration of the function is diagnosed as well.
6876
6877 extern void* memset ();
6878 void f (void *d)
6879 {
6880 memset (d, '\0', 32);
6881 }
6882
6883 -Wno-builtin-macro-redefined
6884 Do not warn if certain built-in macros are redefined. This
6885 suppresses warnings for redefinition of "__TIMESTAMP__",
6886 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
6887
6888 -Wstrict-prototypes (C and Objective-C only)
6889 Warn if a function is declared or defined without specifying the
6890 argument types. (An old-style function definition is permitted
6891 without a warning if preceded by a declaration that specifies the
6892 argument types.)
6893
6894 -Wold-style-declaration (C and Objective-C only)
6895 Warn for obsolescent usages, according to the C Standard, in a
6896 declaration. For example, warn if storage-class specifiers like
6897 "static" are not the first things in a declaration. This warning
6898 is also enabled by -Wextra.
6899
6900 -Wold-style-definition (C and Objective-C only)
6901 Warn if an old-style function definition is used. A warning is
6902 given even if there is a previous prototype. A definition using ()
6903 is not considered an old-style definition in C2X mode, because it
6904 is equivalent to (void) in that case, but is considered an old-
6905 style definition for older standards.
6906
6907 -Wmissing-parameter-type (C and Objective-C only)
6908 A function parameter is declared without a type specifier in
6909 K&R-style functions:
6910
6911 void foo(bar) { }
6912
6913 This warning is also enabled by -Wextra.
6914
6915 -Wmissing-prototypes (C and Objective-C only)
6916 Warn if a global function is defined without a previous prototype
6917 declaration. This warning is issued even if the definition itself
6918 provides a prototype. Use this option to detect global functions
6919 that do not have a matching prototype declaration in a header file.
6920 This option is not valid for C++ because all function declarations
6921 provide prototypes and a non-matching declaration declares an
6922 overload rather than conflict with an earlier declaration. Use
6923 -Wmissing-declarations to detect missing declarations in C++.
6924
6925 -Wmissing-declarations
6926 Warn if a global function is defined without a previous
6927 declaration. Do so even if the definition itself provides a
6928 prototype. Use this option to detect global functions that are not
6929 declared in header files. In C, no warnings are issued for
6930 functions with previous non-prototype declarations; use
6931 -Wmissing-prototypes to detect missing prototypes. In C++, no
6932 warnings are issued for function templates, or for inline
6933 functions, or for functions in anonymous namespaces.
6934
6935 -Wmissing-field-initializers
6936 Warn if a structure's initializer has some fields missing. For
6937 example, the following code causes such a warning, because "x.h" is
6938 implicitly zero:
6939
6940 struct s { int f, g, h; };
6941 struct s x = { 3, 4 };
6942
6943 This option does not warn about designated initializers, so the
6944 following modification does not trigger a warning:
6945
6946 struct s { int f, g, h; };
6947 struct s x = { .f = 3, .g = 4 };
6948
6949 In C this option does not warn about the universal zero initializer
6950 { 0 }:
6951
6952 struct s { int f, g, h; };
6953 struct s x = { 0 };
6954
6955 Likewise, in C++ this option does not warn about the empty { }
6956 initializer, for example:
6957
6958 struct s { int f, g, h; };
6959 s x = { };
6960
6961 This warning is included in -Wextra. To get other -Wextra warnings
6962 without this one, use -Wextra -Wno-missing-field-initializers.
6963
6964 -Wno-multichar
6965 Do not warn if a multicharacter constant ('FOOF') is used. Usually
6966 they indicate a typo in the user's code, as they have
6967 implementation-defined values, and should not be used in portable
6968 code.
6969
6970 -Wnormalized=[none|id|nfc|nfkc]
6971 In ISO C and ISO C++, two identifiers are different if they are
6972 different sequences of characters. However, sometimes when
6973 characters outside the basic ASCII character set are used, you can
6974 have two different character sequences that look the same. To
6975 avoid confusion, the ISO 10646 standard sets out some normalization
6976 rules which when applied ensure that two sequences that look the
6977 same are turned into the same sequence. GCC can warn you if you
6978 are using identifiers that have not been normalized; this option
6979 controls that warning.
6980
6981 There are four levels of warning supported by GCC. The default is
6982 -Wnormalized=nfc, which warns about any identifier that is not in
6983 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
6984 form for most uses. It is equivalent to -Wnormalized.
6985
6986 Unfortunately, there are some characters allowed in identifiers by
6987 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6988 identifiers. That is, there's no way to use these symbols in
6989 portable ISO C or C++ and have all your identifiers in NFC.
6990 -Wnormalized=id suppresses the warning for these characters. It is
6991 hoped that future versions of the standards involved will correct
6992 this, which is why this option is not the default.
6993
6994 You can switch the warning off for all characters by writing
6995 -Wnormalized=none or -Wno-normalized. You should only do this if
6996 you are using some other normalization scheme (like "D"), because
6997 otherwise you can easily create bugs that are literally impossible
6998 to see.
6999
7000 Some characters in ISO 10646 have distinct meanings but look
7001 identical in some fonts or display methodologies, especially once
7002 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7003 LATIN SMALL LETTER N", displays just like a regular "n" that has
7004 been placed in a superscript. ISO 10646 defines the NFKC
7005 normalization scheme to convert all these into a standard form as
7006 well, and GCC warns if your code is not in NFKC if you use
7007 -Wnormalized=nfkc. This warning is comparable to warning about
7008 every identifier that contains the letter O because it might be
7009 confused with the digit 0, and so is not the default, but may be
7010 useful as a local coding convention if the programming environment
7011 cannot be fixed to display these characters distinctly.
7012
7013 -Wno-attribute-warning
7014 Do not warn about usage of functions declared with "warning"
7015 attribute. By default, this warning is enabled.
7016 -Wno-attribute-warning can be used to disable the warning or
7017 -Wno-error=attribute-warning can be used to disable the error when
7018 compiled with -Werror flag.
7019
7020 -Wno-deprecated
7021 Do not warn about usage of deprecated features.
7022
7023 -Wno-deprecated-declarations
7024 Do not warn about uses of functions, variables, and types marked as
7025 deprecated by using the "deprecated" attribute.
7026
7027 -Wno-overflow
7028 Do not warn about compile-time overflow in constant expressions.
7029
7030 -Wno-odr
7031 Warn about One Definition Rule violations during link-time
7032 optimization. Enabled by default.
7033
7034 -Wopenmp-simd
7035 Warn if the vectorizer cost model overrides the OpenMP simd
7036 directive set by user. The -fsimd-cost-model=unlimited option can
7037 be used to relax the cost model.
7038
7039 -Woverride-init (C and Objective-C only)
7040 Warn if an initialized field without side effects is overridden
7041 when using designated initializers.
7042
7043 This warning is included in -Wextra. To get other -Wextra warnings
7044 without this one, use -Wextra -Wno-override-init.
7045
7046 -Wno-override-init-side-effects (C and Objective-C only)
7047 Do not warn if an initialized field with side effects is overridden
7048 when using designated initializers. This warning is enabled by
7049 default.
7050
7051 -Wpacked
7052 Warn if a structure is given the packed attribute, but the packed
7053 attribute has no effect on the layout or size of the structure.
7054 Such structures may be mis-aligned for little benefit. For
7055 instance, in this code, the variable "f.x" in "struct bar" is
7056 misaligned even though "struct bar" does not itself have the packed
7057 attribute:
7058
7059 struct foo {
7060 int x;
7061 char a, b, c, d;
7062 } __attribute__((packed));
7063 struct bar {
7064 char z;
7065 struct foo f;
7066 };
7067
7068 -Wnopacked-bitfield-compat
7069 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7070 bit-fields of type "char". This was fixed in GCC 4.4 but the
7071 change can lead to differences in the structure layout. GCC
7072 informs you when the offset of such a field has changed in GCC 4.4.
7073 For example there is no longer a 4-bit padding between field "a"
7074 and "b" in this structure:
7075
7076 struct foo
7077 {
7078 char a:4;
7079 char b:8;
7080 } __attribute__ ((packed));
7081
7082 This warning is enabled by default. Use
7083 -Wno-packed-bitfield-compat to disable this warning.
7084
7085 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7086 Warn if a structure field with explicitly specified alignment in a
7087 packed struct or union is misaligned. For example, a warning will
7088 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7089 is less than 8", in this code:
7090
7091 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7092 struct __attribute__ ((packed)) S {
7093 struct S8 s8;
7094 };
7095
7096 This warning is enabled by -Wall.
7097
7098 -Wpadded
7099 Warn if padding is included in a structure, either to align an
7100 element of the structure or to align the whole structure.
7101 Sometimes when this happens it is possible to rearrange the fields
7102 of the structure to reduce the padding and so make the structure
7103 smaller.
7104
7105 -Wredundant-decls
7106 Warn if anything is declared more than once in the same scope, even
7107 in cases where multiple declaration is valid and changes nothing.
7108
7109 -Wrestrict
7110 Warn when an object referenced by a "restrict"-qualified parameter
7111 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7112 another argument, or when copies between such objects overlap. For
7113 example, the call to the "strcpy" function below attempts to
7114 truncate the string by replacing its initial characters with the
7115 last four. However, because the call writes the terminating NUL
7116 into "a[4]", the copies overlap and the call is diagnosed.
7117
7118 void foo (void)
7119 {
7120 char a[] = "abcd1234";
7121 strcpy (a, a + 4);
7122 ...
7123 }
7124
7125 The -Wrestrict option detects some instances of simple overlap even
7126 without optimization but works best at -O2 and above. It is
7127 included in -Wall.
7128
7129 -Wnested-externs (C and Objective-C only)
7130 Warn if an "extern" declaration is encountered within a function.
7131
7132 -Winline
7133 Warn if a function that is declared as inline cannot be inlined.
7134 Even with this option, the compiler does not warn about failures to
7135 inline functions declared in system headers.
7136
7137 The compiler uses a variety of heuristics to determine whether or
7138 not to inline a function. For example, the compiler takes into
7139 account the size of the function being inlined and the amount of
7140 inlining that has already been done in the current function.
7141 Therefore, seemingly insignificant changes in the source program
7142 can cause the warnings produced by -Winline to appear or disappear.
7143
7144 -Wint-in-bool-context
7145 Warn for suspicious use of integer values where boolean values are
7146 expected, such as conditional expressions (?:) using non-boolean
7147 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7148 Or left shifting of signed integers in boolean context, like "for
7149 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7150 regardless of the data type. This warning is enabled by -Wall.
7151
7152 -Wno-int-to-pointer-cast
7153 Suppress warnings from casts to pointer type of an integer of a
7154 different size. In C++, casting to a pointer type of smaller size
7155 is an error. Wint-to-pointer-cast is enabled by default.
7156
7157 -Wno-pointer-to-int-cast (C and Objective-C only)
7158 Suppress warnings from casts from a pointer to an integer type of a
7159 different size.
7160
7161 -Winvalid-pch
7162 Warn if a precompiled header is found in the search path but cannot
7163 be used.
7164
7165 -Wlong-long
7166 Warn if "long long" type is used. This is enabled by either
7167 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
7168 the warning messages, use -Wno-long-long.
7169
7170 -Wvariadic-macros
7171 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7172 alternate syntax is used in ISO C99 mode. This is enabled by
7173 either -Wpedantic or -Wtraditional. To inhibit the warning
7174 messages, use -Wno-variadic-macros.
7175
7176 -Wno-varargs
7177 Do not warn upon questionable usage of the macros used to handle
7178 variable arguments like "va_start". These warnings are enabled by
7179 default.
7180
7181 -Wvector-operation-performance
7182 Warn if vector operation is not implemented via SIMD capabilities
7183 of the architecture. Mainly useful for the performance tuning.
7184 Vector operation can be implemented "piecewise", which means that
7185 the scalar operation is performed on every vector element; "in
7186 parallel", which means that the vector operation is implemented
7187 using scalars of wider type, which normally is more performance
7188 efficient; and "as a single scalar", which means that vector fits
7189 into a scalar type.
7190
7191 -Wvla
7192 Warn if a variable-length array is used in the code. -Wno-vla
7193 prevents the -Wpedantic warning of the variable-length array.
7194
7195 -Wvla-larger-than=byte-size
7196 If this option is used, the compiler warns for declarations of
7197 variable-length arrays whose size is either unbounded, or bounded
7198 by an argument that allows the array size to exceed byte-size
7199 bytes. This is similar to how -Walloca-larger-than=byte-size
7200 works, but with variable-length arrays.
7201
7202 Note that GCC may optimize small variable-length arrays of a known
7203 value into plain arrays, so this warning may not get triggered for
7204 such arrays.
7205
7206 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
7207 typically only effective when -ftree-vrp is active (default for -O2
7208 and above).
7209
7210 See also -Walloca-larger-than=byte-size.
7211
7212 -Wno-vla-larger-than
7213 Disable -Wvla-larger-than= warnings. The option is equivalent to
7214 -Wvla-larger-than=SIZE_MAX or larger.
7215
7216 -Wvla-parameter
7217 Warn about redeclarations of functions involving arguments of
7218 Variable Length Array types of inconsistent kinds or forms, and
7219 enable the detection of out-of-bounds accesses to such parameters
7220 by warnings such as -Warray-bounds.
7221
7222 If the first function declaration uses the VLA form the bound
7223 specified in the array is assumed to be the minimum number of
7224 elements expected to be provided in calls to the function and the
7225 maximum number of elements accessed by it. Failing to provide
7226 arguments of sufficient size or accessing more than the maximum
7227 number of elements may be diagnosed.
7228
7229 For example, the warning triggers for the following redeclarations
7230 because the first one allows an array of any size to be passed to
7231 "f" while the second one specifies that the array argument must
7232 have at least "n" elements. In addition, calling "f" with the
7233 assotiated VLA bound parameter in excess of the actual VLA bound
7234 triggers a warning as well.
7235
7236 void f (int n, int[n]);
7237 void f (int, int[]); // warning: argument 2 previously declared as a VLA
7238
7239 void g (int n)
7240 {
7241 if (n > 4)
7242 return;
7243 int a[n];
7244 f (sizeof a, a); // warning: access to a by f may be out of bounds
7245 ...
7246 }
7247
7248 -Wvla-parameter is included in -Wall. The -Warray-parameter option
7249 triggers warnings for similar problems involving ordinary array
7250 arguments.
7251
7252 -Wvolatile-register-var
7253 Warn if a register variable is declared volatile. The volatile
7254 modifier does not inhibit all optimizations that may eliminate
7255 reads and/or writes to register variables. This warning is enabled
7256 by -Wall.
7257
7258 -Wdisabled-optimization
7259 Warn if a requested optimization pass is disabled. This warning
7260 does not generally indicate that there is anything wrong with your
7261 code; it merely indicates that GCC's optimizers are unable to
7262 handle the code effectively. Often, the problem is that your code
7263 is too big or too complex; GCC refuses to optimize programs when
7264 the optimization itself is likely to take inordinate amounts of
7265 time.
7266
7267 -Wpointer-sign (C and Objective-C only)
7268 Warn for pointer argument passing or assignment with different
7269 signedness. This option is only supported for C and Objective-C.
7270 It is implied by -Wall and by -Wpedantic, which can be disabled
7271 with -Wno-pointer-sign.
7272
7273 -Wstack-protector
7274 This option is only active when -fstack-protector is active. It
7275 warns about functions that are not protected against stack
7276 smashing.
7277
7278 -Woverlength-strings
7279 Warn about string constants that are longer than the "minimum
7280 maximum" length specified in the C standard. Modern compilers
7281 generally allow string constants that are much longer than the
7282 standard's minimum limit, but very portable programs should avoid
7283 using longer strings.
7284
7285 The limit applies after string constant concatenation, and does not
7286 count the trailing NUL. In C90, the limit was 509 characters; in
7287 C99, it was raised to 4095. C++98 does not specify a normative
7288 minimum maximum, so we do not diagnose overlength strings in C++.
7289
7290 This option is implied by -Wpedantic, and can be disabled with
7291 -Wno-overlength-strings.
7292
7293 -Wunsuffixed-float-constants (C and Objective-C only)
7294 Issue a warning for any floating constant that does not have a
7295 suffix. When used together with -Wsystem-headers it warns about
7296 such constants in system header files. This can be useful when
7297 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
7298 the decimal floating-point extension to C99.
7299
7300 -Wno-lto-type-mismatch
7301 During the link-time optimization, do not warn about type
7302 mismatches in global declarations from different compilation units.
7303 Requires -flto to be enabled. Enabled by default.
7304
7305 -Wno-designated-init (C and Objective-C only)
7306 Suppress warnings when a positional initializer is used to
7307 initialize a structure that has been marked with the
7308 "designated_init" attribute.
7309
7310 Options That Control Static Analysis
7311 -fanalyzer
7312 This option enables an static analysis of program flow which looks
7313 for "interesting" interprocedural paths through the code, and
7314 issues warnings for problems found on them.
7315
7316 This analysis is much more expensive than other GCC warnings.
7317
7318 Enabling this option effectively enables the following warnings:
7319
7320 -Wanalyzer-double-fclose -Wanalyzer-double-free
7321 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
7322 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
7323 -Wanalyzer-mismatching-deallocation
7324 -Wanalyzer-possible-null-argument
7325 -Wanalyzer-possible-null-dereference -Wanalyzer-null-argument
7326 -Wanalyzer-null-dereference -Wanalyzer-shift-count-negative
7327 -Wanalyzer-shift-count-overflow -Wanalyzer-stale-setjmp-buffer
7328 -Wanalyzer-tainted-array-index
7329 -Wanalyzer-unsafe-call-within-signal-handler
7330 -Wanalyzer-use-after-free
7331 -Wanalyzer-use-of-pointer-in-stale-stack-frame
7332 -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal
7333
7334 This option is only available if GCC was configured with analyzer
7335 support enabled.
7336
7337 -Wanalyzer-too-complex
7338 If -fanalyzer is enabled, the analyzer uses various heuristics to
7339 attempt to explore the control flow and data flow in the program,
7340 but these can be defeated by sufficiently complicated code.
7341
7342 By default, the analysis silently stops if the code is too
7343 complicated for the analyzer to fully explore and it reaches an
7344 internal limit. The -Wanalyzer-too-complex option warns if this
7345 occurs.
7346
7347 -Wno-analyzer-double-fclose
7348 This warning requires -fanalyzer, which enables it; use
7349 -Wno-analyzer-double-fclose to disable it.
7350
7351 This diagnostic warns for paths through the code in which a "FILE
7352 *" can have "fclose" called on it more than once.
7353
7354 -Wno-analyzer-double-free
7355 This warning requires -fanalyzer, which enables it; use
7356 -Wno-analyzer-double-free to disable it.
7357
7358 This diagnostic warns for paths through the code in which a pointer
7359 can have a deallocator called on it more than once, either "free",
7360 or a deallocator referenced by attribute "malloc".
7361
7362 -Wno-analyzer-exposure-through-output-file
7363 This warning requires -fanalyzer, which enables it; use
7364 -Wno-analyzer-exposure-through-output-file to disable it.
7365
7366 This diagnostic warns for paths through the code in which a
7367 security-sensitive value is written to an output file (such as
7368 writing a password to a log file).
7369
7370 -Wno-analyzer-file-leak
7371 This warning requires -fanalyzer, which enables it; use
7372 -Wno-analyzer-file-leak to disable it.
7373
7374 This diagnostic warns for paths through the code in which a
7375 "<stdio.h>" "FILE *" stream object is leaked.
7376
7377 -Wno-analyzer-free-of-non-heap
7378 This warning requires -fanalyzer, which enables it; use
7379 -Wno-analyzer-free-of-non-heap to disable it.
7380
7381 This diagnostic warns for paths through the code in which "free" is
7382 called on a non-heap pointer (e.g. an on-stack buffer, or a
7383 global).
7384
7385 -Wno-analyzer-malloc-leak
7386 This warning requires -fanalyzer, which enables it; use
7387 -Wno-analyzer-malloc-leak to disable it.
7388
7389 This diagnostic warns for paths through the code in which a pointer
7390 allocated via an allocator is leaked: either "malloc", or a
7391 function marked with attribute "malloc".
7392
7393 -Wno-analyzer-mismatching-deallocation
7394 This warning requires -fanalyzer, which enables it; use
7395 -Wno-analyzer-mismatching-deallocation to disable it.
7396
7397 This diagnostic warns for paths through the code in which the wrong
7398 deallocation function is called on a pointer value, based on which
7399 function was used to allocate the pointer value. The diagnostic
7400 will warn about mismatches between "free", scalar "delete" and
7401 vector "delete[]", and those marked as allocator/deallocator pairs
7402 using attribute "malloc".
7403
7404 -Wno-analyzer-possible-null-argument
7405 This warning requires -fanalyzer, which enables it; use
7406 -Wno-analyzer-possible-null-argument to disable it.
7407
7408 This diagnostic warns for paths through the code in which a
7409 possibly-NULL value is passed to a function argument marked with
7410 "__attribute__((nonnull))" as requiring a non-NULL value.
7411
7412 -Wno-analyzer-possible-null-dereference
7413 This warning requires -fanalyzer, which enables it; use
7414 -Wno-analyzer-possible-null-dereference to disable it.
7415
7416 This diagnostic warns for paths through the code in which a
7417 possibly-NULL value is dereferenced.
7418
7419 -Wno-analyzer-null-argument
7420 This warning requires -fanalyzer, which enables it; use
7421 -Wno-analyzer-null-argument to disable it.
7422
7423 This diagnostic warns for paths through the code in which a value
7424 known to be NULL is passed to a function argument marked with
7425 "__attribute__((nonnull))" as requiring a non-NULL value.
7426
7427 -Wno-analyzer-null-dereference
7428 This warning requires -fanalyzer, which enables it; use
7429 -Wno-analyzer-null-dereference to disable it.
7430
7431 This diagnostic warns for paths through the code in which a value
7432 known to be NULL is dereferenced.
7433
7434 -Wno-analyzer-shift-count-negative
7435 This warning requires -fanalyzer, which enables it; use
7436 -Wno-analyzer-shift-count-negative to disable it.
7437
7438 This diagnostic warns for paths through the code in which a shift
7439 is attempted with a negative count. It is analogous to the
7440 -Wshift-count-negative diagnostic implemented in the C/C++ front
7441 ends, but is implemented based on analyzing interprocedural paths,
7442 rather than merely parsing the syntax tree. However, the analyzer
7443 does not prioritize detection of such paths, so false negatives are
7444 more likely relative to other warnings.
7445
7446 -Wno-analyzer-shift-count-overflow
7447 This warning requires -fanalyzer, which enables it; use
7448 -Wno-analyzer-shift-count-overflow to disable it.
7449
7450 This diagnostic warns for paths through the code in which a shift
7451 is attempted with a count greater than or equal to the precision of
7452 the operand's type. It is analogous to the -Wshift-count-overflow
7453 diagnostic implemented in the C/C++ front ends, but is implemented
7454 based on analyzing interprocedural paths, rather than merely
7455 parsing the syntax tree. However, the analyzer does not prioritize
7456 detection of such paths, so false negatives are more likely
7457 relative to other warnings.
7458
7459 -Wno-analyzer-stale-setjmp-buffer
7460 This warning requires -fanalyzer, which enables it; use
7461 -Wno-analyzer-stale-setjmp-buffer to disable it.
7462
7463 This diagnostic warns for paths through the code in which "longjmp"
7464 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
7465 function that has returned.
7466
7467 When "setjmp" is called on a "jmp_buf" to record a rewind location,
7468 it records the stack frame. The stack frame becomes invalid when
7469 the function containing the "setjmp" call returns. Attempting to
7470 rewind to it via "longjmp" would reference a stack frame that no
7471 longer exists, and likely lead to a crash (or worse).
7472
7473 -Wno-analyzer-tainted-array-index
7474 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7475 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
7476
7477 This diagnostic warns for paths through the code in which a value
7478 that could be under an attacker's control is used as the index of
7479 an array access without being sanitized.
7480
7481 -Wno-analyzer-unsafe-call-within-signal-handler
7482 This warning requires -fanalyzer, which enables it; use
7483 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
7484
7485 This diagnostic warns for paths through the code in which a
7486 function known to be async-signal-unsafe (such as "fprintf") is
7487 called from a signal handler.
7488
7489 -Wno-analyzer-use-after-free
7490 This warning requires -fanalyzer, which enables it; use
7491 -Wno-analyzer-use-after-free to disable it.
7492
7493 This diagnostic warns for paths through the code in which a pointer
7494 is used after a deallocator is called on it: either "free", or a
7495 deallocator referenced by attribute "malloc".
7496
7497 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
7498 This warning requires -fanalyzer, which enables it; use
7499 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
7500
7501 This diagnostic warns for paths through the code in which a pointer
7502 is dereferenced that points to a variable in a stale stack frame.
7503
7504 -Wno-analyzer-write-to-const
7505 This warning requires -fanalyzer, which enables it; use
7506 -Wno-analyzer-write-to-const to disable it.
7507
7508 This diagnostic warns for paths through the code in which the
7509 analyzer detects an attempt to write through a pointer to a "const"
7510 object. However, the analyzer does not prioritize detection of
7511 such paths, so false negatives are more likely relative to other
7512 warnings.
7513
7514 -Wno-analyzer-write-to-string-literal
7515 This warning requires -fanalyzer, which enables it; use
7516 -Wno-analyzer-write-to-string-literal to disable it.
7517
7518 This diagnostic warns for paths through the code in which the
7519 analyzer detects an attempt to write through a pointer to a string
7520 literal. However, the analyzer does not prioritize detection of
7521 such paths, so false negatives are more likely relative to other
7522 warnings.
7523
7524 Pertinent parameters for controlling the exploration are: --param
7525 analyzer-bb-explosion-factor=value, --param
7526 analyzer-max-enodes-per-program-point=value, --param
7527 analyzer-max-recursion-depth=value, and --param
7528 analyzer-min-snodes-for-call-summary=value.
7529
7530 The following options control the analyzer.
7531
7532 -fanalyzer-call-summaries
7533 Simplify interprocedural analysis by computing the effect of
7534 certain calls, rather than exploring all paths through the function
7535 from callsite to each possible return.
7536
7537 If enabled, call summaries are only used for functions with more
7538 than one call site, and that are sufficiently complicated (as per
7539 --param analyzer-min-snodes-for-call-summary=value).
7540
7541 -fanalyzer-checker=name
7542 Restrict the analyzer to run just the named checker, and enable it.
7543
7544 Some checkers are disabled by default (even with -fanalyzer), such
7545 as the "taint" checker that implements
7546 -Wanalyzer-tainted-array-index, and this option is required to
7547 enable them.
7548
7549 -fno-analyzer-feasibility
7550 This option is intended for analyzer developers.
7551
7552 By default the analyzer verifies that there is a feasible control
7553 flow path for each diagnostic it emits: that the conditions that
7554 hold are not mutually exclusive. Diagnostics for which no feasible
7555 path can be found are rejected. This filtering can be suppressed
7556 with -fno-analyzer-feasibility, for debugging issues in this code.
7557
7558 -fanalyzer-fine-grained
7559 This option is intended for analyzer developers.
7560
7561 Internally the analyzer builds an "exploded graph" that combines
7562 control flow graphs with data flow information.
7563
7564 By default, an edge in this graph can contain the effects of a run
7565 of multiple statements within a basic block. With
7566 -fanalyzer-fine-grained, each statement gets its own edge.
7567
7568 -fanalyzer-show-duplicate-count
7569 This option is intended for analyzer developers: if multiple
7570 diagnostics have been detected as being duplicates of each other,
7571 it emits a note when reporting the best diagnostic, giving the
7572 number of additional diagnostics that were suppressed by the
7573 deduplication logic.
7574
7575 -fno-analyzer-state-merge
7576 This option is intended for analyzer developers.
7577
7578 By default the analyzer attempts to simplify analysis by merging
7579 sufficiently similar states at each program point as it builds its
7580 "exploded graph". With -fno-analyzer-state-merge this merging can
7581 be suppressed, for debugging state-handling issues.
7582
7583 -fno-analyzer-state-purge
7584 This option is intended for analyzer developers.
7585
7586 By default the analyzer attempts to simplify analysis by purging
7587 aspects of state at a program point that appear to no longer be
7588 relevant e.g. the values of locals that aren't accessed later in
7589 the function and which aren't relevant to leak analysis.
7590
7591 With -fno-analyzer-state-purge this purging of state can be
7592 suppressed, for debugging state-handling issues.
7593
7594 -fanalyzer-transitivity
7595 This option enables transitivity of constraints within the
7596 analyzer.
7597
7598 -fanalyzer-verbose-edges
7599 This option is intended for analyzer developers. It enables more
7600 verbose, lower-level detail in the descriptions of control flow
7601 within diagnostic paths.
7602
7603 -fanalyzer-verbose-state-changes
7604 This option is intended for analyzer developers. It enables more
7605 verbose, lower-level detail in the descriptions of events relating
7606 to state machines within diagnostic paths.
7607
7608 -fanalyzer-verbosity=level
7609 This option controls the complexity of the control flow paths that
7610 are emitted for analyzer diagnostics.
7611
7612 The level can be one of:
7613
7614 0 At this level, interprocedural call and return events are
7615 displayed, along with the most pertinent state-change events
7616 relating to a diagnostic. For example, for a double-"free"
7617 diagnostic, both calls to "free" will be shown.
7618
7619 1 As per the previous level, but also show events for the entry
7620 to each function.
7621
7622 2 As per the previous level, but also show events relating to
7623 control flow that are significant to triggering the issue (e.g.
7624 "true path taken" at a conditional).
7625
7626 This level is the default.
7627
7628 3 As per the previous level, but show all control flow events,
7629 not just significant ones.
7630
7631 4 This level is intended for analyzer developers; it adds various
7632 other events intended for debugging the analyzer.
7633
7634 -fdump-analyzer
7635 Dump internal details about what the analyzer is doing to
7636 file.analyzer.txt. This option is overridden by
7637 -fdump-analyzer-stderr.
7638
7639 -fdump-analyzer-stderr
7640 Dump internal details about what the analyzer is doing to stderr.
7641 This option overrides -fdump-analyzer.
7642
7643 -fdump-analyzer-callgraph
7644 Dump a representation of the call graph suitable for viewing with
7645 GraphViz to file.callgraph.dot.
7646
7647 -fdump-analyzer-exploded-graph
7648 Dump a representation of the "exploded graph" suitable for viewing
7649 with GraphViz to file.eg.dot. Nodes are color-coded based on
7650 state-machine states to emphasize state changes.
7651
7652 -fdump-analyzer-exploded-nodes
7653 Emit diagnostics showing where nodes in the "exploded graph" are in
7654 relation to the program source.
7655
7656 -fdump-analyzer-exploded-nodes-2
7657 Dump a textual representation of the "exploded graph" to
7658 file.eg.txt.
7659
7660 -fdump-analyzer-exploded-nodes-3
7661 Dump a textual representation of the "exploded graph" to one dump
7662 file per node, to file.eg-id.txt. This is typically a large number
7663 of dump files.
7664
7665 -fdump-analyzer-feasibility
7666 Dump internal details about the analyzer's search for feasible
7667 paths. The details are written in a form suitable for viewing with
7668 GraphViz to filenames of the form file.*.fg.dot and file.*.tg.dot.
7669
7670 -fdump-analyzer-json
7671 Dump a compressed JSON representation of analyzer internals to
7672 file.analyzer.json.gz. The precise format is subject to change.
7673
7674 -fdump-analyzer-state-purge
7675 As per -fdump-analyzer-supergraph, dump a representation of the
7676 "supergraph" suitable for viewing with GraphViz, but annotate the
7677 graph with information on what state will be purged at each node.
7678 The graph is written to file.state-purge.dot.
7679
7680 -fdump-analyzer-supergraph
7681 Dump representations of the "supergraph" suitable for viewing with
7682 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
7683 These show all of the control flow graphs in the program, with
7684 interprocedural edges for calls and returns. The second dump
7685 contains annotations showing nodes in the "exploded graph" and
7686 diagnostics associated with them.
7687
7688 Options for Debugging Your Program
7689 To tell GCC to emit extra information for use by a debugger, in almost
7690 all cases you need only to add -g to your other options.
7691
7692 GCC allows you to use -g with -O. The shortcuts taken by optimized
7693 code may occasionally be surprising: some variables you declared may
7694 not exist at all; flow of control may briefly move where you did not
7695 expect it; some statements may not be executed because they compute
7696 constant results or their values are already at hand; some statements
7697 may execute in different places because they have been moved out of
7698 loops. Nevertheless it is possible to debug optimized output. This
7699 makes it reasonable to use the optimizer for programs that might have
7700 bugs.
7701
7702 If you are not using some other optimization option, consider using -Og
7703 with -g. With no -O option at all, some compiler passes that collect
7704 information useful for debugging do not run at all, so that -Og may
7705 result in a better debugging experience.
7706
7707 -g Produce debugging information in the operating system's native
7708 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
7709 debugging information.
7710
7711 On most systems that use stabs format, -g enables use of extra
7712 debugging information that only GDB can use; this extra information
7713 makes debugging work better in GDB but probably makes other
7714 debuggers crash or refuse to read the program. If you want to
7715 control for certain whether to generate the extra information, use
7716 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
7717
7718 -ggdb
7719 Produce debugging information for use by GDB. This means to use
7720 the most expressive format available (DWARF, stabs, or the native
7721 format if neither of those are supported), including GDB extensions
7722 if at all possible.
7723
7724 -gdwarf
7725 -gdwarf-version
7726 Produce debugging information in DWARF format (if that is
7727 supported). The value of version may be either 2, 3, 4 or 5; the
7728 default version for most targets is 5 (with the exception of
7729 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
7730 AIX, which defaults to version 4).
7731
7732 Note that with DWARF Version 2, some ports require and always use
7733 some non-conflicting DWARF 3 extensions in the unwind tables.
7734
7735 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
7736 maximum benefit. Version 5 requires GDB 8.0 or higher.
7737
7738 GCC no longer supports DWARF Version 1, which is substantially
7739 different than Version 2 and later. For historical reasons, some
7740 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
7741 reference to DWARF Version 2 in their names, but apply to all
7742 currently-supported versions of DWARF.
7743
7744 -gstabs
7745 Produce debugging information in stabs format (if that is
7746 supported), without GDB extensions. This is the format used by DBX
7747 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
7748 this option produces stabs debugging output that is not understood
7749 by DBX. On System V Release 4 systems this option requires the GNU
7750 assembler.
7751
7752 -gstabs+
7753 Produce debugging information in stabs format (if that is
7754 supported), using GNU extensions understood only by the GNU
7755 debugger (GDB). The use of these extensions is likely to make
7756 other debuggers crash or refuse to read the program.
7757
7758 -gxcoff
7759 Produce debugging information in XCOFF format (if that is
7760 supported). This is the format used by the DBX debugger on IBM
7761 RS/6000 systems.
7762
7763 -gxcoff+
7764 Produce debugging information in XCOFF format (if that is
7765 supported), using GNU extensions understood only by the GNU
7766 debugger (GDB). The use of these extensions is likely to make
7767 other debuggers crash or refuse to read the program, and may cause
7768 assemblers other than the GNU assembler (GAS) to fail with an
7769 error.
7770
7771 -gvms
7772 Produce debugging information in Alpha/VMS debug format (if that is
7773 supported). This is the format used by DEBUG on Alpha/VMS systems.
7774
7775 -glevel
7776 -ggdblevel
7777 -gstabslevel
7778 -gxcofflevel
7779 -gvmslevel
7780 Request debugging information and also use level to specify how
7781 much information. The default level is 2.
7782
7783 Level 0 produces no debug information at all. Thus, -g0 negates
7784 -g.
7785
7786 Level 1 produces minimal information, enough for making backtraces
7787 in parts of the program that you don't plan to debug. This
7788 includes descriptions of functions and external variables, and line
7789 number tables, but no information about local variables.
7790
7791 Level 3 includes extra information, such as all the macro
7792 definitions present in the program. Some debuggers support macro
7793 expansion when you use -g3.
7794
7795 If you use multiple -g options, with or without level numbers, the
7796 last such option is the one that is effective.
7797
7798 -gdwarf does not accept a concatenated debug level, to avoid
7799 confusion with -gdwarf-level. Instead use an additional -glevel
7800 option to change the debug level for DWARF.
7801
7802 -fno-eliminate-unused-debug-symbols
7803 By default, no debug information is produced for symbols that are
7804 not actually used. Use this option if you want debug information
7805 for all symbols.
7806
7807 -femit-class-debug-always
7808 Instead of emitting debugging information for a C++ class in only
7809 one object file, emit it in all object files using the class. This
7810 option should be used only with debuggers that are unable to handle
7811 the way GCC normally emits debugging information for classes
7812 because using this option increases the size of debugging
7813 information by as much as a factor of two.
7814
7815 -fno-merge-debug-strings
7816 Direct the linker to not merge together strings in the debugging
7817 information that are identical in different object files. Merging
7818 is not supported by all assemblers or linkers. Merging decreases
7819 the size of the debug information in the output file at the cost of
7820 increasing link processing time. Merging is enabled by default.
7821
7822 -fdebug-prefix-map=old=new
7823 When compiling files residing in directory old, record debugging
7824 information describing them as if the files resided in directory
7825 new instead. This can be used to replace a build-time path with an
7826 install-time path in the debug info. It can also be used to change
7827 an absolute path to a relative path by using . for new. This can
7828 give more reproducible builds, which are location independent, but
7829 may require an extra command to tell GDB where to find the source
7830 files. See also -ffile-prefix-map.
7831
7832 -fvar-tracking
7833 Run variable tracking pass. It computes where variables are stored
7834 at each position in code. Better debugging information is then
7835 generated (if the debugging information format supports this
7836 information).
7837
7838 It is enabled by default when compiling with optimization (-Os, -O,
7839 -O2, ...), debugging information (-g) and the debug info format
7840 supports it.
7841
7842 -fvar-tracking-assignments
7843 Annotate assignments to user variables early in the compilation and
7844 attempt to carry the annotations over throughout the compilation
7845 all the way to the end, in an attempt to improve debug information
7846 while optimizing. Use of -gdwarf-4 is recommended along with it.
7847
7848 It can be enabled even if var-tracking is disabled, in which case
7849 annotations are created and maintained, but discarded at the end.
7850 By default, this flag is enabled together with -fvar-tracking,
7851 except when selective scheduling is enabled.
7852
7853 -gsplit-dwarf
7854 If DWARF debugging information is enabled, separate as much
7855 debugging information as possible into a separate output file with
7856 the extension .dwo. This option allows the build system to avoid
7857 linking files with debug information. To be useful, this option
7858 requires a debugger capable of reading .dwo files.
7859
7860 -gdwarf32
7861 -gdwarf64
7862 If DWARF debugging information is enabled, the -gdwarf32 selects
7863 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
7864 format. The default is target specific, on most targets it is
7865 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
7866 support more than 2GiB of debug information in any of the DWARF
7867 debug information sections. The 64-bit DWARF format allows larger
7868 debug information and might not be well supported by all consumers
7869 yet.
7870
7871 -gdescribe-dies
7872 Add description attributes to some DWARF DIEs that have no name
7873 attribute, such as artificial variables, external references and
7874 call site parameter DIEs.
7875
7876 -gpubnames
7877 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
7878
7879 -ggnu-pubnames
7880 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
7881 format suitable for conversion into a GDB index. This option is
7882 only useful with a linker that can produce GDB index version 7.
7883
7884 -fdebug-types-section
7885 When using DWARF Version 4 or higher, type DIEs can be put into
7886 their own ".debug_types" section instead of making them part of the
7887 ".debug_info" section. It is more efficient to put them in a
7888 separate comdat section since the linker can then remove
7889 duplicates. But not all DWARF consumers support ".debug_types"
7890 sections yet and on some objects ".debug_types" produces larger
7891 instead of smaller debugging information.
7892
7893 -grecord-gcc-switches
7894 -gno-record-gcc-switches
7895 This switch causes the command-line options used to invoke the
7896 compiler that may affect code generation to be appended to the
7897 DW_AT_producer attribute in DWARF debugging information. The
7898 options are concatenated with spaces separating them from each
7899 other and from the compiler version. It is enabled by default.
7900 See also -frecord-gcc-switches for another way of storing compiler
7901 options into the object file.
7902
7903 -gstrict-dwarf
7904 Disallow using extensions of later DWARF standard version than
7905 selected with -gdwarf-version. On most targets using non-
7906 conflicting DWARF extensions from later standard versions is
7907 allowed.
7908
7909 -gno-strict-dwarf
7910 Allow using extensions of later DWARF standard version than
7911 selected with -gdwarf-version.
7912
7913 -gas-loc-support
7914 Inform the compiler that the assembler supports ".loc" directives.
7915 It may then use them for the assembler to generate DWARF2+ line
7916 number tables.
7917
7918 This is generally desirable, because assembler-generated line-
7919 number tables are a lot more compact than those the compiler can
7920 generate itself.
7921
7922 This option will be enabled by default if, at GCC configure time,
7923 the assembler was found to support such directives.
7924
7925 -gno-as-loc-support
7926 Force GCC to generate DWARF2+ line number tables internally, if
7927 DWARF2+ line number tables are to be generated.
7928
7929 -gas-locview-support
7930 Inform the compiler that the assembler supports "view" assignment
7931 and reset assertion checking in ".loc" directives.
7932
7933 This option will be enabled by default if, at GCC configure time,
7934 the assembler was found to support them.
7935
7936 -gno-as-locview-support
7937 Force GCC to assign view numbers internally, if
7938 -gvariable-location-views are explicitly requested.
7939
7940 -gcolumn-info
7941 -gno-column-info
7942 Emit location column information into DWARF debugging information,
7943 rather than just file and line. This option is enabled by default.
7944
7945 -gstatement-frontiers
7946 -gno-statement-frontiers
7947 This option causes GCC to create markers in the internal
7948 representation at the beginning of statements, and to keep them
7949 roughly in place throughout compilation, using them to guide the
7950 output of "is_stmt" markers in the line number table. This is
7951 enabled by default when compiling with optimization (-Os, -O, -O2,
7952 ...), and outputting DWARF 2 debug information at the normal level.
7953
7954 -gvariable-location-views
7955 -gvariable-location-views=incompat5
7956 -gno-variable-location-views
7957 Augment variable location lists with progressive view numbers
7958 implied from the line number table. This enables debug information
7959 consumers to inspect state at certain points of the program, even
7960 if no instructions associated with the corresponding source
7961 locations are present at that point. If the assembler lacks
7962 support for view numbers in line number tables, this will cause the
7963 compiler to emit the line number table, which generally makes them
7964 somewhat less compact. The augmented line number tables and
7965 location lists are fully backward-compatible, so they can be
7966 consumed by debug information consumers that are not aware of these
7967 augmentations, but they won't derive any benefit from them either.
7968
7969 This is enabled by default when outputting DWARF 2 debug
7970 information at the normal level, as long as there is assembler
7971 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
7972 is not. When assembler support is not available, this may still be
7973 enabled, but it will force GCC to output internal line number
7974 tables, and if -ginternal-reset-location-views is not enabled, that
7975 will most certainly lead to silently mismatching location views.
7976
7977 There is a proposed representation for view numbers that is not
7978 backward compatible with the location list format introduced in
7979 DWARF 5, that can be enabled with
7980 -gvariable-location-views=incompat5. This option may be removed in
7981 the future, is only provided as a reference implementation of the
7982 proposed representation. Debug information consumers are not
7983 expected to support this extended format, and they would be
7984 rendered unable to decode location lists using it.
7985
7986 -ginternal-reset-location-views
7987 -gno-internal-reset-location-views
7988 Attempt to determine location views that can be omitted from
7989 location view lists. This requires the compiler to have very
7990 accurate insn length estimates, which isn't always the case, and it
7991 may cause incorrect view lists to be generated silently when using
7992 an assembler that does not support location view lists. The GNU
7993 assembler will flag any such error as a "view number mismatch".
7994 This is only enabled on ports that define a reliable estimation
7995 function.
7996
7997 -ginline-points
7998 -gno-inline-points
7999 Generate extended debug information for inlined functions.
8000 Location view tracking markers are inserted at inlined entry
8001 points, so that address and view numbers can be computed and output
8002 in debug information. This can be enabled independently of
8003 location views, in which case the view numbers won't be output, but
8004 it can only be enabled along with statement frontiers, and it is
8005 only enabled by default if location views are enabled.
8006
8007 -gz[=type]
8008 Produce compressed debug sections in DWARF format, if that is
8009 supported. If type is not given, the default type depends on the
8010 capabilities of the assembler and linker used. type may be one of
8011 none (don't compress debug sections), zlib (use zlib compression in
8012 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8013 GNU format). If the linker doesn't support writing compressed
8014 debug sections, the option is rejected. Otherwise, if the
8015 assembler does not support them, -gz is silently ignored when
8016 producing object files.
8017
8018 -femit-struct-debug-baseonly
8019 Emit debug information for struct-like types only when the base
8020 name of the compilation source file matches the base name of file
8021 in which the struct is defined.
8022
8023 This option substantially reduces the size of debugging
8024 information, but at significant potential loss in type information
8025 to the debugger. See -femit-struct-debug-reduced for a less
8026 aggressive option. See -femit-struct-debug-detailed for more
8027 detailed control.
8028
8029 This option works only with DWARF debug output.
8030
8031 -femit-struct-debug-reduced
8032 Emit debug information for struct-like types only when the base
8033 name of the compilation source file matches the base name of file
8034 in which the type is defined, unless the struct is a template or
8035 defined in a system header.
8036
8037 This option significantly reduces the size of debugging
8038 information, with some potential loss in type information to the
8039 debugger. See -femit-struct-debug-baseonly for a more aggressive
8040 option. See -femit-struct-debug-detailed for more detailed
8041 control.
8042
8043 This option works only with DWARF debug output.
8044
8045 -femit-struct-debug-detailed[=spec-list]
8046 Specify the struct-like types for which the compiler generates
8047 debug information. The intent is to reduce duplicate struct debug
8048 information between different object files within the same program.
8049
8050 This option is a detailed version of -femit-struct-debug-reduced
8051 and -femit-struct-debug-baseonly, which serves for most needs.
8052
8053 A specification has the
8054 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8055
8056 The optional first word limits the specification to structs that
8057 are used directly (dir:) or used indirectly (ind:). A struct type
8058 is used directly when it is the type of a variable, member.
8059 Indirect uses arise through pointers to structs. That is, when use
8060 of an incomplete struct is valid, the use is indirect. An example
8061 is struct one direct; struct two * indirect;.
8062
8063 The optional second word limits the specification to ordinary
8064 structs (ord:) or generic structs (gen:). Generic structs are a
8065 bit complicated to explain. For C++, these are non-explicit
8066 specializations of template classes, or non-template classes within
8067 the above. Other programming languages have generics, but
8068 -femit-struct-debug-detailed does not yet implement them.
8069
8070 The third word specifies the source files for those structs for
8071 which the compiler should emit debug information. The values none
8072 and any have the normal meaning. The value base means that the
8073 base of name of the file in which the type declaration appears must
8074 match the base of the name of the main compilation file. In
8075 practice, this means that when compiling foo.c, debug information
8076 is generated for types declared in that file and foo.h, but not
8077 other header files. The value sys means those types satisfying
8078 base or declared in system or compiler headers.
8079
8080 You may need to experiment to determine the best settings for your
8081 application.
8082
8083 The default is -femit-struct-debug-detailed=all.
8084
8085 This option works only with DWARF debug output.
8086
8087 -fno-dwarf2-cfi-asm
8088 Emit DWARF unwind info as compiler generated ".eh_frame" section
8089 instead of using GAS ".cfi_*" directives.
8090
8091 -fno-eliminate-unused-debug-types
8092 Normally, when producing DWARF output, GCC avoids producing debug
8093 symbol output for types that are nowhere used in the source file
8094 being compiled. Sometimes it is useful to have GCC emit debugging
8095 information for all types declared in a compilation unit,
8096 regardless of whether or not they are actually used in that
8097 compilation unit, for example if, in the debugger, you want to cast
8098 a value to a type that is not actually used in your program (but is
8099 declared). More often, however, this results in a significant
8100 amount of wasted space.
8101
8102 Options That Control Optimization
8103 These options control various sorts of optimizations.
8104
8105 Without any optimization option, the compiler's goal is to reduce the
8106 cost of compilation and to make debugging produce the expected results.
8107 Statements are independent: if you stop the program with a breakpoint
8108 between statements, you can then assign a new value to any variable or
8109 change the program counter to any other statement in the function and
8110 get exactly the results you expect from the source code.
8111
8112 Turning on optimization flags makes the compiler attempt to improve the
8113 performance and/or code size at the expense of compilation time and
8114 possibly the ability to debug the program.
8115
8116 The compiler performs optimization based on the knowledge it has of the
8117 program. Compiling multiple files at once to a single output file mode
8118 allows the compiler to use information gained from all of the files
8119 when compiling each of them.
8120
8121 Not all optimizations are controlled directly by a flag. Only
8122 optimizations that have a flag are listed in this section.
8123
8124 Most optimizations are completely disabled at -O0 or if an -O level is
8125 not set on the command line, even if individual optimization flags are
8126 specified. Similarly, -Og suppresses many optimization passes.
8127
8128 Depending on the target and how GCC was configured, a slightly
8129 different set of optimizations may be enabled at each -O level than
8130 those listed here. You can invoke GCC with -Q --help=optimizers to
8131 find out the exact set of optimizations that are enabled at each level.
8132
8133 -O
8134 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8135 lot more memory for a large function.
8136
8137 With -O, the compiler tries to reduce code size and execution time,
8138 without performing any optimizations that take a great deal of
8139 compilation time.
8140
8141 -O turns on the following optimization flags:
8142
8143 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8144 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8145 -fdse -fforward-propagate -fguess-branch-probability
8146 -fif-conversion -fif-conversion2 -finline-functions-called-once
8147 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8148 -fipa-reference-addressable -fmerge-constants
8149 -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks
8150 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types
8151 -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch
8152 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
8153 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
8154 -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr
8155 -ftree-sra -ftree-ter -funit-at-a-time
8156
8157 -O2 Optimize even more. GCC performs nearly all supported
8158 optimizations that do not involve a space-speed tradeoff. As
8159 compared to -O, this option increases both compilation time and the
8160 performance of the generated code.
8161
8162 -O2 turns on all optimization flags specified by -O. It also turns
8163 on the following optimization flags:
8164
8165 -falign-functions -falign-jumps -falign-labels -falign-loops
8166 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8167 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8168 -fdevirtualize-speculatively -fexpensive-optimizations
8169 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8170 -finline-functions -finline-small-functions -findirect-inlining
8171 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8172 -fisolate-erroneous-paths-dereference -flra-remat
8173 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8174 -fpeephole2 -freorder-blocks-algorithm=stc
8175 -freorder-blocks-and-partition -freorder-functions
8176 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8177 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8178 -fthread-jumps -ftree-builtin-call-dce -ftree-pre
8179 -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
8180
8181 Please note the warning under -fgcse about invoking -O2 on programs
8182 that use computed gotos.
8183
8184 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8185 and also turns on the following optimization flags:
8186
8187 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8188 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8189 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8190 -ftree-loop-vectorize -ftree-partial-pre -ftree-slp-vectorize
8191 -funswitch-loops -fvect-cost-model -fvect-cost-model=dynamic
8192 -fversion-loops-for-strides
8193
8194 -O0 Reduce compilation time and make debugging produce the expected
8195 results. This is the default.
8196
8197 -Os Optimize for size. -Os enables all -O2 optimizations except those
8198 that often increase code size:
8199
8200 -falign-functions -falign-jumps -falign-labels -falign-loops
8201 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8202
8203 It also enables -finline-functions, causes the compiler to tune for
8204 code size rather than execution speed, and performs further
8205 optimizations designed to reduce code size.
8206
8207 -Ofast
8208 Disregard strict standards compliance. -Ofast enables all -O3
8209 optimizations. It also enables optimizations that are not valid
8210 for all standard-compliant programs. It turns on -ffast-math,
8211 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8212 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8213
8214 -Og Optimize debugging experience. -Og should be the optimization
8215 level of choice for the standard edit-compile-debug cycle, offering
8216 a reasonable level of optimization while maintaining fast
8217 compilation and a good debugging experience. It is a better choice
8218 than -O0 for producing debuggable code because some compiler passes
8219 that collect debug information are disabled at -O0.
8220
8221 Like -O0, -Og completely disables a number of optimization passes
8222 so that individual options controlling them have no effect.
8223 Otherwise -Og enables all -O1 optimization flags except for those
8224 that may interfere with debugging:
8225
8226 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8227 -fif-conversion2 -finline-functions-called-once
8228 -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-dse
8229 -ftree-pta -ftree-sra
8230
8231 If you use multiple -O options, with or without level numbers, the last
8232 such option is the one that is effective.
8233
8234 Options of the form -fflag specify machine-independent flags. Most
8235 flags have both positive and negative forms; the negative form of -ffoo
8236 is -fno-foo. In the table below, only one of the forms is listed---the
8237 one you typically use. You can figure out the other form by either
8238 removing no- or adding it.
8239
8240 The following options control specific optimizations. They are either
8241 activated by -O options or are related to ones that are. You can use
8242 the following flags in the rare cases when "fine-tuning" of
8243 optimizations to be performed is desired.
8244
8245 -fno-defer-pop
8246 For machines that must pop arguments after a function call, always
8247 pop the arguments as soon as each function returns. At levels -O1
8248 and higher, -fdefer-pop is the default; this allows the compiler to
8249 let arguments accumulate on the stack for several function calls
8250 and pop them all at once.
8251
8252 -fforward-propagate
8253 Perform a forward propagation pass on RTL. The pass tries to
8254 combine two instructions and checks if the result can be
8255 simplified. If loop unrolling is active, two passes are performed
8256 and the second is scheduled after loop unrolling.
8257
8258 This option is enabled by default at optimization levels -O, -O2,
8259 -O3, -Os.
8260
8261 -ffp-contract=style
8262 -ffp-contract=off disables floating-point expression contraction.
8263 -ffp-contract=fast enables floating-point expression contraction
8264 such as forming of fused multiply-add operations if the target has
8265 native support for them. -ffp-contract=on enables floating-point
8266 expression contraction if allowed by the language standard. This
8267 is currently not implemented and treated equal to
8268 -ffp-contract=off.
8269
8270 The default is -ffp-contract=fast.
8271
8272 -fomit-frame-pointer
8273 Omit the frame pointer in functions that don't need one. This
8274 avoids the instructions to save, set up and restore the frame
8275 pointer; on many targets it also makes an extra register available.
8276
8277 On some targets this flag has no effect because the standard
8278 calling sequence always uses a frame pointer, so it cannot be
8279 omitted.
8280
8281 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8282 pointer is used in all functions. Several targets always omit the
8283 frame pointer in leaf functions.
8284
8285 Enabled by default at -O and higher.
8286
8287 -foptimize-sibling-calls
8288 Optimize sibling and tail recursive calls.
8289
8290 Enabled at levels -O2, -O3, -Os.
8291
8292 -foptimize-strlen
8293 Optimize various standard C string functions (e.g. "strlen",
8294 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8295 faster alternatives.
8296
8297 Enabled at levels -O2, -O3.
8298
8299 -fno-inline
8300 Do not expand any functions inline apart from those marked with the
8301 "always_inline" attribute. This is the default when not
8302 optimizing.
8303
8304 Single functions can be exempted from inlining by marking them with
8305 the "noinline" attribute.
8306
8307 -finline-small-functions
8308 Integrate functions into their callers when their body is smaller
8309 than expected function call code (so overall size of program gets
8310 smaller). The compiler heuristically decides which functions are
8311 simple enough to be worth integrating in this way. This inlining
8312 applies to all functions, even those not declared inline.
8313
8314 Enabled at levels -O2, -O3, -Os.
8315
8316 -findirect-inlining
8317 Inline also indirect calls that are discovered to be known at
8318 compile time thanks to previous inlining. This option has any
8319 effect only when inlining itself is turned on by the
8320 -finline-functions or -finline-small-functions options.
8321
8322 Enabled at levels -O2, -O3, -Os.
8323
8324 -finline-functions
8325 Consider all functions for inlining, even if they are not declared
8326 inline. The compiler heuristically decides which functions are
8327 worth integrating in this way.
8328
8329 If all calls to a given function are integrated, and the function
8330 is declared "static", then the function is normally not output as
8331 assembler code in its own right.
8332
8333 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8334 -fauto-profile.
8335
8336 -finline-functions-called-once
8337 Consider all "static" functions called once for inlining into their
8338 caller even if they are not marked "inline". If a call to a given
8339 function is integrated, then the function is not output as
8340 assembler code in its own right.
8341
8342 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8343
8344 -fearly-inlining
8345 Inline functions marked by "always_inline" and functions whose body
8346 seems smaller than the function call overhead early before doing
8347 -fprofile-generate instrumentation and real inlining pass. Doing
8348 so makes profiling significantly cheaper and usually inlining
8349 faster on programs having large chains of nested wrapper functions.
8350
8351 Enabled by default.
8352
8353 -fipa-sra
8354 Perform interprocedural scalar replacement of aggregates, removal
8355 of unused parameters and replacement of parameters passed by
8356 reference by parameters passed by value.
8357
8358 Enabled at levels -O2, -O3 and -Os.
8359
8360 -finline-limit=n
8361 By default, GCC limits the size of functions that can be inlined.
8362 This flag allows coarse control of this limit. n is the size of
8363 functions that can be inlined in number of pseudo instructions.
8364
8365 Inlining is actually controlled by a number of parameters, which
8366 may be specified individually by using --param name=value. The
8367 -finline-limit=n option sets some of these parameters as follows:
8368
8369 max-inline-insns-single
8370 is set to n/2.
8371
8372 max-inline-insns-auto
8373 is set to n/2.
8374
8375 See below for a documentation of the individual parameters
8376 controlling inlining and for the defaults of these parameters.
8377
8378 Note: there may be no value to -finline-limit that results in
8379 default behavior.
8380
8381 Note: pseudo instruction represents, in this particular context, an
8382 abstract measurement of function's size. In no way does it
8383 represent a count of assembly instructions and as such its exact
8384 meaning might change from one release to an another.
8385
8386 -fno-keep-inline-dllexport
8387 This is a more fine-grained version of -fkeep-inline-functions,
8388 which applies only to functions that are declared using the
8389 "dllexport" attribute or declspec.
8390
8391 -fkeep-inline-functions
8392 In C, emit "static" functions that are declared "inline" into the
8393 object file, even if the function has been inlined into all of its
8394 callers. This switch does not affect functions using the "extern
8395 inline" extension in GNU C90. In C++, emit any and all inline
8396 functions into the object file.
8397
8398 -fkeep-static-functions
8399 Emit "static" functions into the object file, even if the function
8400 is never used.
8401
8402 -fkeep-static-consts
8403 Emit variables declared "static const" when optimization isn't
8404 turned on, even if the variables aren't referenced.
8405
8406 GCC enables this option by default. If you want to force the
8407 compiler to check if a variable is referenced, regardless of
8408 whether or not optimization is turned on, use the
8409 -fno-keep-static-consts option.
8410
8411 -fmerge-constants
8412 Attempt to merge identical constants (string constants and
8413 floating-point constants) across compilation units.
8414
8415 This option is the default for optimized compilation if the
8416 assembler and linker support it. Use -fno-merge-constants to
8417 inhibit this behavior.
8418
8419 Enabled at levels -O, -O2, -O3, -Os.
8420
8421 -fmerge-all-constants
8422 Attempt to merge identical constants and identical variables.
8423
8424 This option implies -fmerge-constants. In addition to
8425 -fmerge-constants this considers e.g. even constant initialized
8426 arrays or initialized constant variables with integral or floating-
8427 point types. Languages like C or C++ require each variable,
8428 including multiple instances of the same variable in recursive
8429 calls, to have distinct locations, so using this option results in
8430 non-conforming behavior.
8431
8432 -fmodulo-sched
8433 Perform swing modulo scheduling immediately before the first
8434 scheduling pass. This pass looks at innermost loops and reorders
8435 their instructions by overlapping different iterations.
8436
8437 -fmodulo-sched-allow-regmoves
8438 Perform more aggressive SMS-based modulo scheduling with register
8439 moves allowed. By setting this flag certain anti-dependences edges
8440 are deleted, which triggers the generation of reg-moves based on
8441 the life-range analysis. This option is effective only with
8442 -fmodulo-sched enabled.
8443
8444 -fno-branch-count-reg
8445 Disable the optimization pass that scans for opportunities to use
8446 "decrement and branch" instructions on a count register instead of
8447 instruction sequences that decrement a register, compare it against
8448 zero, and then branch based upon the result. This option is only
8449 meaningful on architectures that support such instructions, which
8450 include x86, PowerPC, IA-64 and S/390. Note that the
8451 -fno-branch-count-reg option doesn't remove the decrement and
8452 branch instructions from the generated instruction stream
8453 introduced by other optimization passes.
8454
8455 The default is -fbranch-count-reg at -O1 and higher, except for
8456 -Og.
8457
8458 -fno-function-cse
8459 Do not put function addresses in registers; make each instruction
8460 that calls a constant function contain the function's address
8461 explicitly.
8462
8463 This option results in less efficient code, but some strange hacks
8464 that alter the assembler output may be confused by the
8465 optimizations performed when this option is not used.
8466
8467 The default is -ffunction-cse
8468
8469 -fno-zero-initialized-in-bss
8470 If the target supports a BSS section, GCC by default puts variables
8471 that are initialized to zero into BSS. This can save space in the
8472 resulting code.
8473
8474 This option turns off this behavior because some programs
8475 explicitly rely on variables going to the data section---e.g., so
8476 that the resulting executable can find the beginning of that
8477 section and/or make assumptions based on that.
8478
8479 The default is -fzero-initialized-in-bss.
8480
8481 -fthread-jumps
8482 Perform optimizations that check to see if a jump branches to a
8483 location where another comparison subsumed by the first is found.
8484 If so, the first branch is redirected to either the destination of
8485 the second branch or a point immediately following it, depending on
8486 whether the condition is known to be true or false.
8487
8488 Enabled at levels -O2, -O3, -Os.
8489
8490 -fsplit-wide-types
8491 When using a type that occupies multiple registers, such as "long
8492 long" on a 32-bit system, split the registers apart and allocate
8493 them independently. This normally generates better code for those
8494 types, but may make debugging more difficult.
8495
8496 Enabled at levels -O, -O2, -O3, -Os.
8497
8498 -fsplit-wide-types-early
8499 Fully split wide types early, instead of very late. This option
8500 has no effect unless -fsplit-wide-types is turned on.
8501
8502 This is the default on some targets.
8503
8504 -fcse-follow-jumps
8505 In common subexpression elimination (CSE), scan through jump
8506 instructions when the target of the jump is not reached by any
8507 other path. For example, when CSE encounters an "if" statement
8508 with an "else" clause, CSE follows the jump when the condition
8509 tested is false.
8510
8511 Enabled at levels -O2, -O3, -Os.
8512
8513 -fcse-skip-blocks
8514 This is similar to -fcse-follow-jumps, but causes CSE to follow
8515 jumps that conditionally skip over blocks. When CSE encounters a
8516 simple "if" statement with no else clause, -fcse-skip-blocks causes
8517 CSE to follow the jump around the body of the "if".
8518
8519 Enabled at levels -O2, -O3, -Os.
8520
8521 -frerun-cse-after-loop
8522 Re-run common subexpression elimination after loop optimizations
8523 are performed.
8524
8525 Enabled at levels -O2, -O3, -Os.
8526
8527 -fgcse
8528 Perform a global common subexpression elimination pass. This pass
8529 also performs global constant and copy propagation.
8530
8531 Note: When compiling a program using computed gotos, a GCC
8532 extension, you may get better run-time performance if you disable
8533 the global common subexpression elimination pass by adding
8534 -fno-gcse to the command line.
8535
8536 Enabled at levels -O2, -O3, -Os.
8537
8538 -fgcse-lm
8539 When -fgcse-lm is enabled, global common subexpression elimination
8540 attempts to move loads that are only killed by stores into
8541 themselves. This allows a loop containing a load/store sequence to
8542 be changed to a load outside the loop, and a copy/store within the
8543 loop.
8544
8545 Enabled by default when -fgcse is enabled.
8546
8547 -fgcse-sm
8548 When -fgcse-sm is enabled, a store motion pass is run after global
8549 common subexpression elimination. This pass attempts to move
8550 stores out of loops. When used in conjunction with -fgcse-lm,
8551 loops containing a load/store sequence can be changed to a load
8552 before the loop and a store after the loop.
8553
8554 Not enabled at any optimization level.
8555
8556 -fgcse-las
8557 When -fgcse-las is enabled, the global common subexpression
8558 elimination pass eliminates redundant loads that come after stores
8559 to the same memory location (both partial and full redundancies).
8560
8561 Not enabled at any optimization level.
8562
8563 -fgcse-after-reload
8564 When -fgcse-after-reload is enabled, a redundant load elimination
8565 pass is performed after reload. The purpose of this pass is to
8566 clean up redundant spilling.
8567
8568 Enabled by -fprofile-use and -fauto-profile.
8569
8570 -faggressive-loop-optimizations
8571 This option tells the loop optimizer to use language constraints to
8572 derive bounds for the number of iterations of a loop. This assumes
8573 that loop code does not invoke undefined behavior by for example
8574 causing signed integer overflows or out-of-bound array accesses.
8575 The bounds for the number of iterations of a loop are used to guide
8576 loop unrolling and peeling and loop exit test optimizations. This
8577 option is enabled by default.
8578
8579 -funconstrained-commons
8580 This option tells the compiler that variables declared in common
8581 blocks (e.g. Fortran) may later be overridden with longer trailing
8582 arrays. This prevents certain optimizations that depend on knowing
8583 the array bounds.
8584
8585 -fcrossjumping
8586 Perform cross-jumping transformation. This transformation unifies
8587 equivalent code and saves code size. The resulting code may or may
8588 not perform better than without cross-jumping.
8589
8590 Enabled at levels -O2, -O3, -Os.
8591
8592 -fauto-inc-dec
8593 Combine increments or decrements of addresses with memory accesses.
8594 This pass is always skipped on architectures that do not have
8595 instructions to support this. Enabled by default at -O and higher
8596 on architectures that support this.
8597
8598 -fdce
8599 Perform dead code elimination (DCE) on RTL. Enabled by default at
8600 -O and higher.
8601
8602 -fdse
8603 Perform dead store elimination (DSE) on RTL. Enabled by default at
8604 -O and higher.
8605
8606 -fif-conversion
8607 Attempt to transform conditional jumps into branch-less
8608 equivalents. This includes use of conditional moves, min, max, set
8609 flags and abs instructions, and some tricks doable by standard
8610 arithmetics. The use of conditional execution on chips where it is
8611 available is controlled by -fif-conversion2.
8612
8613 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8614
8615 -fif-conversion2
8616 Use conditional execution (where available) to transform
8617 conditional jumps into branch-less equivalents.
8618
8619 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8620
8621 -fdeclone-ctor-dtor
8622 The C++ ABI requires multiple entry points for constructors and
8623 destructors: one for a base subobject, one for a complete object,
8624 and one for a virtual destructor that calls operator delete
8625 afterwards. For a hierarchy with virtual bases, the base and
8626 complete variants are clones, which means two copies of the
8627 function. With this option, the base and complete variants are
8628 changed to be thunks that call a common implementation.
8629
8630 Enabled by -Os.
8631
8632 -fdelete-null-pointer-checks
8633 Assume that programs cannot safely dereference null pointers, and
8634 that no code or data element resides at address zero. This option
8635 enables simple constant folding optimizations at all optimization
8636 levels. In addition, other optimization passes in GCC use this
8637 flag to control global dataflow analyses that eliminate useless
8638 checks for null pointers; these assume that a memory access to
8639 address zero always results in a trap, so that if a pointer is
8640 checked after it has already been dereferenced, it cannot be null.
8641
8642 Note however that in some environments this assumption is not true.
8643 Use -fno-delete-null-pointer-checks to disable this optimization
8644 for programs that depend on that behavior.
8645
8646 This option is enabled by default on most targets. On Nios II ELF,
8647 it defaults to off. On AVR, CR16, and MSP430, this option is
8648 completely disabled.
8649
8650 Passes that use the dataflow information are enabled independently
8651 at different optimization levels.
8652
8653 -fdevirtualize
8654 Attempt to convert calls to virtual functions to direct calls.
8655 This is done both within a procedure and interprocedurally as part
8656 of indirect inlining (-findirect-inlining) and interprocedural
8657 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
8658
8659 -fdevirtualize-speculatively
8660 Attempt to convert calls to virtual functions to speculative direct
8661 calls. Based on the analysis of the type inheritance graph,
8662 determine for a given call the set of likely targets. If the set is
8663 small, preferably of size 1, change the call into a conditional
8664 deciding between direct and indirect calls. The speculative calls
8665 enable more optimizations, such as inlining. When they seem
8666 useless after further optimization, they are converted back into
8667 original form.
8668
8669 -fdevirtualize-at-ltrans
8670 Stream extra information needed for aggressive devirtualization
8671 when running the link-time optimizer in local transformation mode.
8672 This option enables more devirtualization but significantly
8673 increases the size of streamed data. For this reason it is disabled
8674 by default.
8675
8676 -fexpensive-optimizations
8677 Perform a number of minor optimizations that are relatively
8678 expensive.
8679
8680 Enabled at levels -O2, -O3, -Os.
8681
8682 -free
8683 Attempt to remove redundant extension instructions. This is
8684 especially helpful for the x86-64 architecture, which implicitly
8685 zero-extends in 64-bit registers after writing to their lower
8686 32-bit half.
8687
8688 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
8689
8690 -fno-lifetime-dse
8691 In C++ the value of an object is only affected by changes within
8692 its lifetime: when the constructor begins, the object has an
8693 indeterminate value, and any changes during the lifetime of the
8694 object are dead when the object is destroyed. Normally dead store
8695 elimination will take advantage of this; if your code relies on the
8696 value of the object storage persisting beyond the lifetime of the
8697 object, you can use this flag to disable this optimization. To
8698 preserve stores before the constructor starts (e.g. because your
8699 operator new clears the object storage) but still treat the object
8700 as dead after the destructor, you can use -flifetime-dse=1. The
8701 default behavior can be explicitly selected with -flifetime-dse=2.
8702 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
8703
8704 -flive-range-shrinkage
8705 Attempt to decrease register pressure through register live range
8706 shrinkage. This is helpful for fast processors with small or
8707 moderate size register sets.
8708
8709 -fira-algorithm=algorithm
8710 Use the specified coloring algorithm for the integrated register
8711 allocator. The algorithm argument can be priority, which specifies
8712 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
8713 coloring. Chaitin-Briggs coloring is not implemented for all
8714 architectures, but for those targets that do support it, it is the
8715 default because it generates better code.
8716
8717 -fira-region=region
8718 Use specified regions for the integrated register allocator. The
8719 region argument should be one of the following:
8720
8721 all Use all loops as register allocation regions. This can give
8722 the best results for machines with a small and/or irregular
8723 register set.
8724
8725 mixed
8726 Use all loops except for loops with small register pressure as
8727 the regions. This value usually gives the best results in most
8728 cases and for most architectures, and is enabled by default
8729 when compiling with optimization for speed (-O, -O2, ...).
8730
8731 one Use all functions as a single region. This typically results
8732 in the smallest code size, and is enabled by default for -Os or
8733 -O0.
8734
8735 -fira-hoist-pressure
8736 Use IRA to evaluate register pressure in the code hoisting pass for
8737 decisions to hoist expressions. This option usually results in
8738 smaller code, but it can slow the compiler down.
8739
8740 This option is enabled at level -Os for all targets.
8741
8742 -fira-loop-pressure
8743 Use IRA to evaluate register pressure in loops for decisions to
8744 move loop invariants. This option usually results in generation of
8745 faster and smaller code on machines with large register files (>=
8746 32 registers), but it can slow the compiler down.
8747
8748 This option is enabled at level -O3 for some targets.
8749
8750 -fno-ira-share-save-slots
8751 Disable sharing of stack slots used for saving call-used hard
8752 registers living through a call. Each hard register gets a
8753 separate stack slot, and as a result function stack frames are
8754 larger.
8755
8756 -fno-ira-share-spill-slots
8757 Disable sharing of stack slots allocated for pseudo-registers.
8758 Each pseudo-register that does not get a hard register gets a
8759 separate stack slot, and as a result function stack frames are
8760 larger.
8761
8762 -flra-remat
8763 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8764 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8765 values if it is profitable.
8766
8767 Enabled at levels -O2, -O3, -Os.
8768
8769 -fdelayed-branch
8770 If supported for the target machine, attempt to reorder
8771 instructions to exploit instruction slots available after delayed
8772 branch instructions.
8773
8774 Enabled at levels -O, -O2, -O3, -Os, but not at -Og.
8775
8776 -fschedule-insns
8777 If supported for the target machine, attempt to reorder
8778 instructions to eliminate execution stalls due to required data
8779 being unavailable. This helps machines that have slow floating
8780 point or memory load instructions by allowing other instructions to
8781 be issued until the result of the load or floating-point
8782 instruction is required.
8783
8784 Enabled at levels -O2, -O3.
8785
8786 -fschedule-insns2
8787 Similar to -fschedule-insns, but requests an additional pass of
8788 instruction scheduling after register allocation has been done.
8789 This is especially useful on machines with a relatively small
8790 number of registers and where memory load instructions take more
8791 than one cycle.
8792
8793 Enabled at levels -O2, -O3, -Os.
8794
8795 -fno-sched-interblock
8796 Disable instruction scheduling across basic blocks, which is
8797 normally enabled when scheduling before register allocation, i.e.
8798 with -fschedule-insns or at -O2 or higher.
8799
8800 -fno-sched-spec
8801 Disable speculative motion of non-load instructions, which is
8802 normally enabled when scheduling before register allocation, i.e.
8803 with -fschedule-insns or at -O2 or higher.
8804
8805 -fsched-pressure
8806 Enable register pressure sensitive insn scheduling before register
8807 allocation. This only makes sense when scheduling before register
8808 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
8809 higher. Usage of this option can improve the generated code and
8810 decrease its size by preventing register pressure increase above
8811 the number of available hard registers and subsequent spills in
8812 register allocation.
8813
8814 -fsched-spec-load
8815 Allow speculative motion of some load instructions. This only
8816 makes sense when scheduling before register allocation, i.e. with
8817 -fschedule-insns or at -O2 or higher.
8818
8819 -fsched-spec-load-dangerous
8820 Allow speculative motion of more load instructions. This only
8821 makes sense when scheduling before register allocation, i.e. with
8822 -fschedule-insns or at -O2 or higher.
8823
8824 -fsched-stalled-insns
8825 -fsched-stalled-insns=n
8826 Define how many insns (if any) can be moved prematurely from the
8827 queue of stalled insns into the ready list during the second
8828 scheduling pass. -fno-sched-stalled-insns means that no insns are
8829 moved prematurely, -fsched-stalled-insns=0 means there is no limit
8830 on how many queued insns can be moved prematurely.
8831 -fsched-stalled-insns without a value is equivalent to
8832 -fsched-stalled-insns=1.
8833
8834 -fsched-stalled-insns-dep
8835 -fsched-stalled-insns-dep=n
8836 Define how many insn groups (cycles) are examined for a dependency
8837 on a stalled insn that is a candidate for premature removal from
8838 the queue of stalled insns. This has an effect only during the
8839 second scheduling pass, and only if -fsched-stalled-insns is used.
8840 -fno-sched-stalled-insns-dep is equivalent to
8841 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
8842 value is equivalent to -fsched-stalled-insns-dep=1.
8843
8844 -fsched2-use-superblocks
8845 When scheduling after register allocation, use superblock
8846 scheduling. This allows motion across basic block boundaries,
8847 resulting in faster schedules. This option is experimental, as not
8848 all machine descriptions used by GCC model the CPU closely enough
8849 to avoid unreliable results from the algorithm.
8850
8851 This only makes sense when scheduling after register allocation,
8852 i.e. with -fschedule-insns2 or at -O2 or higher.
8853
8854 -fsched-group-heuristic
8855 Enable the group heuristic in the scheduler. This heuristic favors
8856 the instruction that belongs to a schedule group. This is enabled
8857 by default when scheduling is enabled, i.e. with -fschedule-insns
8858 or -fschedule-insns2 or at -O2 or higher.
8859
8860 -fsched-critical-path-heuristic
8861 Enable the critical-path heuristic in the scheduler. This
8862 heuristic favors instructions on the critical path. This is
8863 enabled by default when scheduling is enabled, i.e. with
8864 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
8865
8866 -fsched-spec-insn-heuristic
8867 Enable the speculative instruction heuristic in the scheduler.
8868 This heuristic favors speculative instructions with greater
8869 dependency weakness. This is enabled by default when scheduling is
8870 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8871 or higher.
8872
8873 -fsched-rank-heuristic
8874 Enable the rank heuristic in the scheduler. This heuristic favors
8875 the instruction belonging to a basic block with greater size or
8876 frequency. This is enabled by default when scheduling is enabled,
8877 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
8878 higher.
8879
8880 -fsched-last-insn-heuristic
8881 Enable the last-instruction heuristic in the scheduler. This
8882 heuristic favors the instruction that is less dependent on the last
8883 instruction scheduled. This is enabled by default when scheduling
8884 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
8885 -O2 or higher.
8886
8887 -fsched-dep-count-heuristic
8888 Enable the dependent-count heuristic in the scheduler. This
8889 heuristic favors the instruction that has more instructions
8890 depending on it. This is enabled by default when scheduling is
8891 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8892 or higher.
8893
8894 -freschedule-modulo-scheduled-loops
8895 Modulo scheduling is performed before traditional scheduling. If a
8896 loop is modulo scheduled, later scheduling passes may change its
8897 schedule. Use this option to control that behavior.
8898
8899 -fselective-scheduling
8900 Schedule instructions using selective scheduling algorithm.
8901 Selective scheduling runs instead of the first scheduler pass.
8902
8903 -fselective-scheduling2
8904 Schedule instructions using selective scheduling algorithm.
8905 Selective scheduling runs instead of the second scheduler pass.
8906
8907 -fsel-sched-pipelining
8908 Enable software pipelining of innermost loops during selective
8909 scheduling. This option has no effect unless one of
8910 -fselective-scheduling or -fselective-scheduling2 is turned on.
8911
8912 -fsel-sched-pipelining-outer-loops
8913 When pipelining loops during selective scheduling, also pipeline
8914 outer loops. This option has no effect unless
8915 -fsel-sched-pipelining is turned on.
8916
8917 -fsemantic-interposition
8918 Some object formats, like ELF, allow interposing of symbols by the
8919 dynamic linker. This means that for symbols exported from the DSO,
8920 the compiler cannot perform interprocedural propagation, inlining
8921 and other optimizations in anticipation that the function or
8922 variable in question may change. While this feature is useful, for
8923 example, to rewrite memory allocation functions by a debugging
8924 implementation, it is expensive in the terms of code quality. With
8925 -fno-semantic-interposition the compiler assumes that if
8926 interposition happens for functions the overwriting function will
8927 have precisely the same semantics (and side effects). Similarly if
8928 interposition happens for variables, the constructor of the
8929 variable will be the same. The flag has no effect for functions
8930 explicitly declared inline (where it is never allowed for
8931 interposition to change semantics) and for symbols explicitly
8932 declared weak.
8933
8934 -fshrink-wrap
8935 Emit function prologues only before parts of the function that need
8936 it, rather than at the top of the function. This flag is enabled
8937 by default at -O and higher.
8938
8939 -fshrink-wrap-separate
8940 Shrink-wrap separate parts of the prologue and epilogue separately,
8941 so that those parts are only executed when needed. This option is
8942 on by default, but has no effect unless -fshrink-wrap is also
8943 turned on and the target supports this.
8944
8945 -fcaller-saves
8946 Enable allocation of values to registers that are clobbered by
8947 function calls, by emitting extra instructions to save and restore
8948 the registers around such calls. Such allocation is done only when
8949 it seems to result in better code.
8950
8951 This option is always enabled by default on certain machines,
8952 usually those which have no call-preserved registers to use
8953 instead.
8954
8955 Enabled at levels -O2, -O3, -Os.
8956
8957 -fcombine-stack-adjustments
8958 Tracks stack adjustments (pushes and pops) and stack memory
8959 references and then tries to find ways to combine them.
8960
8961 Enabled by default at -O1 and higher.
8962
8963 -fipa-ra
8964 Use caller save registers for allocation if those registers are not
8965 used by any called function. In that case it is not necessary to
8966 save and restore them around calls. This is only possible if
8967 called functions are part of same compilation unit as current
8968 function and they are compiled before it.
8969
8970 Enabled at levels -O2, -O3, -Os, however the option is disabled if
8971 generated code will be instrumented for profiling (-p, or -pg) or
8972 if callee's register usage cannot be known exactly (this happens on
8973 targets that do not expose prologues and epilogues in RTL).
8974
8975 -fconserve-stack
8976 Attempt to minimize stack usage. The compiler attempts to use less
8977 stack space, even if that makes the program slower. This option
8978 implies setting the large-stack-frame parameter to 100 and the
8979 large-stack-frame-growth parameter to 400.
8980
8981 -ftree-reassoc
8982 Perform reassociation on trees. This flag is enabled by default at
8983 -O and higher.
8984
8985 -fcode-hoisting
8986 Perform code hoisting. Code hoisting tries to move the evaluation
8987 of expressions executed on all paths to the function exit as early
8988 as possible. This is especially useful as a code size
8989 optimization, but it often helps for code speed as well. This flag
8990 is enabled by default at -O2 and higher.
8991
8992 -ftree-pre
8993 Perform partial redundancy elimination (PRE) on trees. This flag
8994 is enabled by default at -O2 and -O3.
8995
8996 -ftree-partial-pre
8997 Make partial redundancy elimination (PRE) more aggressive. This
8998 flag is enabled by default at -O3.
8999
9000 -ftree-forwprop
9001 Perform forward propagation on trees. This flag is enabled by
9002 default at -O and higher.
9003
9004 -ftree-fre
9005 Perform full redundancy elimination (FRE) on trees. The difference
9006 between FRE and PRE is that FRE only considers expressions that are
9007 computed on all paths leading to the redundant computation. This
9008 analysis is faster than PRE, though it exposes fewer redundancies.
9009 This flag is enabled by default at -O and higher.
9010
9011 -ftree-phiprop
9012 Perform hoisting of loads from conditional pointers on trees. This
9013 pass is enabled by default at -O and higher.
9014
9015 -fhoist-adjacent-loads
9016 Speculatively hoist loads from both branches of an if-then-else if
9017 the loads are from adjacent locations in the same structure and the
9018 target architecture has a conditional move instruction. This flag
9019 is enabled by default at -O2 and higher.
9020
9021 -ftree-copy-prop
9022 Perform copy propagation on trees. This pass eliminates
9023 unnecessary copy operations. This flag is enabled by default at -O
9024 and higher.
9025
9026 -fipa-pure-const
9027 Discover which functions are pure or constant. Enabled by default
9028 at -O and higher.
9029
9030 -fipa-reference
9031 Discover which static variables do not escape the compilation unit.
9032 Enabled by default at -O and higher.
9033
9034 -fipa-reference-addressable
9035 Discover read-only, write-only and non-addressable static
9036 variables. Enabled by default at -O and higher.
9037
9038 -fipa-stack-alignment
9039 Reduce stack alignment on call sites if possible. Enabled by
9040 default.
9041
9042 -fipa-pta
9043 Perform interprocedural pointer analysis and interprocedural
9044 modification and reference analysis. This option can cause
9045 excessive memory and compile-time usage on large compilation units.
9046 It is not enabled by default at any optimization level.
9047
9048 -fipa-profile
9049 Perform interprocedural profile propagation. The functions called
9050 only from cold functions are marked as cold. Also functions
9051 executed once (such as "cold", "noreturn", static constructors or
9052 destructors) are identified. Cold functions and loop less parts of
9053 functions executed once are then optimized for size. Enabled by
9054 default at -O and higher.
9055
9056 -fipa-modref
9057 Perform interprocedural mod/ref analysis. This optimization
9058 analyzes the side effects of functions (memory locations that are
9059 modified or referenced) and enables better optimization across the
9060 function call boundary. This flag is enabled by default at -O and
9061 higher.
9062
9063 -fipa-cp
9064 Perform interprocedural constant propagation. This optimization
9065 analyzes the program to determine when values passed to functions
9066 are constants and then optimizes accordingly. This optimization
9067 can substantially increase performance if the application has
9068 constants passed to functions. This flag is enabled by default at
9069 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9070 -fauto-profile.
9071
9072 -fipa-cp-clone
9073 Perform function cloning to make interprocedural constant
9074 propagation stronger. When enabled, interprocedural constant
9075 propagation performs function cloning when externally visible
9076 function can be called with constant arguments. Because this
9077 optimization can create multiple copies of functions, it may
9078 significantly increase code size (see --param
9079 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9080 It is also enabled by -fprofile-use and -fauto-profile.
9081
9082 -fipa-bit-cp
9083 When enabled, perform interprocedural bitwise constant propagation.
9084 This flag is enabled by default at -O2 and by -fprofile-use and
9085 -fauto-profile. It requires that -fipa-cp is enabled.
9086
9087 -fipa-vrp
9088 When enabled, perform interprocedural propagation of value ranges.
9089 This flag is enabled by default at -O2. It requires that -fipa-cp
9090 is enabled.
9091
9092 -fipa-icf
9093 Perform Identical Code Folding for functions and read-only
9094 variables. The optimization reduces code size and may disturb
9095 unwind stacks by replacing a function by equivalent one with a
9096 different name. The optimization works more effectively with link-
9097 time optimization enabled.
9098
9099 Although the behavior is similar to the Gold Linker's ICF
9100 optimization, GCC ICF works on different levels and thus the
9101 optimizations are not same - there are equivalences that are found
9102 only by GCC and equivalences found only by Gold.
9103
9104 This flag is enabled by default at -O2 and -Os.
9105
9106 -flive-patching=level
9107 Control GCC's optimizations to produce output suitable for live-
9108 patching.
9109
9110 If the compiler's optimization uses a function's body or
9111 information extracted from its body to optimize/change another
9112 function, the latter is called an impacted function of the former.
9113 If a function is patched, its impacted functions should be patched
9114 too.
9115
9116 The impacted functions are determined by the compiler's
9117 interprocedural optimizations. For example, a caller is impacted
9118 when inlining a function into its caller, cloning a function and
9119 changing its caller to call this new clone, or extracting a
9120 function's pureness/constness information to optimize its direct or
9121 indirect callers, etc.
9122
9123 Usually, the more IPA optimizations enabled, the larger the number
9124 of impacted functions for each function. In order to control the
9125 number of impacted functions and more easily compute the list of
9126 impacted function, IPA optimizations can be partially enabled at
9127 two different levels.
9128
9129 The level argument should be one of the following:
9130
9131 inline-clone
9132 Only enable inlining and cloning optimizations, which includes
9133 inlining, cloning, interprocedural scalar replacement of
9134 aggregates and partial inlining. As a result, when patching a
9135 function, all its callers and its clones' callers are impacted,
9136 therefore need to be patched as well.
9137
9138 -flive-patching=inline-clone disables the following
9139 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9140 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9141 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9142 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9143
9144 inline-only-static
9145 Only enable inlining of static functions. As a result, when
9146 patching a static function, all its callers are impacted and so
9147 need to be patched as well.
9148
9149 In addition to all the flags that -flive-patching=inline-clone
9150 disables, -flive-patching=inline-only-static disables the
9151 following additional optimization flags: -fipa-cp-clone
9152 -fipa-sra -fpartial-inlining -fipa-cp
9153
9154 When -flive-patching is specified without any value, the default
9155 value is inline-clone.
9156
9157 This flag is disabled by default.
9158
9159 Note that -flive-patching is not supported with link-time
9160 optimization (-flto).
9161
9162 -fisolate-erroneous-paths-dereference
9163 Detect paths that trigger erroneous or undefined behavior due to
9164 dereferencing a null pointer. Isolate those paths from the main
9165 control flow and turn the statement with erroneous or undefined
9166 behavior into a trap. This flag is enabled by default at -O2 and
9167 higher and depends on -fdelete-null-pointer-checks also being
9168 enabled.
9169
9170 -fisolate-erroneous-paths-attribute
9171 Detect paths that trigger erroneous or undefined behavior due to a
9172 null value being used in a way forbidden by a "returns_nonnull" or
9173 "nonnull" attribute. Isolate those paths from the main control
9174 flow and turn the statement with erroneous or undefined behavior
9175 into a trap. This is not currently enabled, but may be enabled by
9176 -O2 in the future.
9177
9178 -ftree-sink
9179 Perform forward store motion on trees. This flag is enabled by
9180 default at -O and higher.
9181
9182 -ftree-bit-ccp
9183 Perform sparse conditional bit constant propagation on trees and
9184 propagate pointer alignment information. This pass only operates
9185 on local scalar variables and is enabled by default at -O1 and
9186 higher, except for -Og. It requires that -ftree-ccp is enabled.
9187
9188 -ftree-ccp
9189 Perform sparse conditional constant propagation (CCP) on trees.
9190 This pass only operates on local scalar variables and is enabled by
9191 default at -O and higher.
9192
9193 -fssa-backprop
9194 Propagate information about uses of a value up the definition chain
9195 in order to simplify the definitions. For example, this pass
9196 strips sign operations if the sign of a value never matters. The
9197 flag is enabled by default at -O and higher.
9198
9199 -fssa-phiopt
9200 Perform pattern matching on SSA PHI nodes to optimize conditional
9201 code. This pass is enabled by default at -O1 and higher, except
9202 for -Og.
9203
9204 -ftree-switch-conversion
9205 Perform conversion of simple initializations in a switch to
9206 initializations from a scalar array. This flag is enabled by
9207 default at -O2 and higher.
9208
9209 -ftree-tail-merge
9210 Look for identical code sequences. When found, replace one with a
9211 jump to the other. This optimization is known as tail merging or
9212 cross jumping. This flag is enabled by default at -O2 and higher.
9213 The compilation time in this pass can be limited using max-tail-
9214 merge-comparisons parameter and max-tail-merge-iterations
9215 parameter.
9216
9217 -ftree-dce
9218 Perform dead code elimination (DCE) on trees. This flag is enabled
9219 by default at -O and higher.
9220
9221 -ftree-builtin-call-dce
9222 Perform conditional dead code elimination (DCE) for calls to built-
9223 in functions that may set "errno" but are otherwise free of side
9224 effects. This flag is enabled by default at -O2 and higher if -Os
9225 is not also specified.
9226
9227 -ffinite-loops
9228 Assume that a loop with an exit will eventually take the exit and
9229 not loop indefinitely. This allows the compiler to remove loops
9230 that otherwise have no side-effects, not considering eventual
9231 endless looping as such.
9232
9233 This option is enabled by default at -O2 for C++ with -std=c++11 or
9234 higher.
9235
9236 -ftree-dominator-opts
9237 Perform a variety of simple scalar cleanups (constant/copy
9238 propagation, redundancy elimination, range propagation and
9239 expression simplification) based on a dominator tree traversal.
9240 This also performs jump threading (to reduce jumps to jumps). This
9241 flag is enabled by default at -O and higher.
9242
9243 -ftree-dse
9244 Perform dead store elimination (DSE) on trees. A dead store is a
9245 store into a memory location that is later overwritten by another
9246 store without any intervening loads. In this case the earlier
9247 store can be deleted. This flag is enabled by default at -O and
9248 higher.
9249
9250 -ftree-ch
9251 Perform loop header copying on trees. This is beneficial since it
9252 increases effectiveness of code motion optimizations. It also
9253 saves one jump. This flag is enabled by default at -O and higher.
9254 It is not enabled for -Os, since it usually increases code size.
9255
9256 -ftree-loop-optimize
9257 Perform loop optimizations on trees. This flag is enabled by
9258 default at -O and higher.
9259
9260 -ftree-loop-linear
9261 -floop-strip-mine
9262 -floop-block
9263 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9264 use this code transformation, GCC has to be configured with
9265 --with-isl to enable the Graphite loop transformation
9266 infrastructure.
9267
9268 -fgraphite-identity
9269 Enable the identity transformation for graphite. For every SCoP we
9270 generate the polyhedral representation and transform it back to
9271 gimple. Using -fgraphite-identity we can check the costs or
9272 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9273 minimal optimizations are also performed by the code generator isl,
9274 like index splitting and dead code elimination in loops.
9275
9276 -floop-nest-optimize
9277 Enable the isl based loop nest optimizer. This is a generic loop
9278 nest optimizer based on the Pluto optimization algorithms. It
9279 calculates a loop structure optimized for data-locality and
9280 parallelism. This option is experimental.
9281
9282 -floop-parallelize-all
9283 Use the Graphite data dependence analysis to identify loops that
9284 can be parallelized. Parallelize all the loops that can be
9285 analyzed to not contain loop carried dependences without checking
9286 that it is profitable to parallelize the loops.
9287
9288 -ftree-coalesce-vars
9289 While transforming the program out of the SSA representation,
9290 attempt to reduce copying by coalescing versions of different user-
9291 defined variables, instead of just compiler temporaries. This may
9292 severely limit the ability to debug an optimized program compiled
9293 with -fno-var-tracking-assignments. In the negated form, this flag
9294 prevents SSA coalescing of user variables. This option is enabled
9295 by default if optimization is enabled, and it does very little
9296 otherwise.
9297
9298 -ftree-loop-if-convert
9299 Attempt to transform conditional jumps in the innermost loops to
9300 branch-less equivalents. The intent is to remove control-flow from
9301 the innermost loops in order to improve the ability of the
9302 vectorization pass to handle these loops. This is enabled by
9303 default if vectorization is enabled.
9304
9305 -ftree-loop-distribution
9306 Perform loop distribution. This flag can improve cache performance
9307 on big loop bodies and allow further loop optimizations, like
9308 parallelization or vectorization, to take place. For example, the
9309 loop
9310
9311 DO I = 1, N
9312 A(I) = B(I) + C
9313 D(I) = E(I) * F
9314 ENDDO
9315
9316 is transformed to
9317
9318 DO I = 1, N
9319 A(I) = B(I) + C
9320 ENDDO
9321 DO I = 1, N
9322 D(I) = E(I) * F
9323 ENDDO
9324
9325 This flag is enabled by default at -O3. It is also enabled by
9326 -fprofile-use and -fauto-profile.
9327
9328 -ftree-loop-distribute-patterns
9329 Perform loop distribution of patterns that can be code generated
9330 with calls to a library. This flag is enabled by default at -O2
9331 and higher, and by -fprofile-use and -fauto-profile.
9332
9333 This pass distributes the initialization loops and generates a call
9334 to memset zero. For example, the loop
9335
9336 DO I = 1, N
9337 A(I) = 0
9338 B(I) = A(I) + I
9339 ENDDO
9340
9341 is transformed to
9342
9343 DO I = 1, N
9344 A(I) = 0
9345 ENDDO
9346 DO I = 1, N
9347 B(I) = A(I) + I
9348 ENDDO
9349
9350 and the initialization loop is transformed into a call to memset
9351 zero. This flag is enabled by default at -O3. It is also enabled
9352 by -fprofile-use and -fauto-profile.
9353
9354 -floop-interchange
9355 Perform loop interchange outside of graphite. This flag can
9356 improve cache performance on loop nest and allow further loop
9357 optimizations, like vectorization, to take place. For example, the
9358 loop
9359
9360 for (int i = 0; i < N; i++)
9361 for (int j = 0; j < N; j++)
9362 for (int k = 0; k < N; k++)
9363 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9364
9365 is transformed to
9366
9367 for (int i = 0; i < N; i++)
9368 for (int k = 0; k < N; k++)
9369 for (int j = 0; j < N; j++)
9370 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9371
9372 This flag is enabled by default at -O3. It is also enabled by
9373 -fprofile-use and -fauto-profile.
9374
9375 -floop-unroll-and-jam
9376 Apply unroll and jam transformations on feasible loops. In a loop
9377 nest this unrolls the outer loop by some factor and fuses the
9378 resulting multiple inner loops. This flag is enabled by default at
9379 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9380
9381 -ftree-loop-im
9382 Perform loop invariant motion on trees. This pass moves only
9383 invariants that are hard to handle at RTL level (function calls,
9384 operations that expand to nontrivial sequences of insns). With
9385 -funswitch-loops it also moves operands of conditions that are
9386 invariant out of the loop, so that we can use just trivial
9387 invariantness analysis in loop unswitching. The pass also includes
9388 store motion.
9389
9390 -ftree-loop-ivcanon
9391 Create a canonical counter for number of iterations in loops for
9392 which determining number of iterations requires complicated
9393 analysis. Later optimizations then may determine the number
9394 easily. Useful especially in connection with unrolling.
9395
9396 -ftree-scev-cprop
9397 Perform final value replacement. If a variable is modified in a
9398 loop in such a way that its value when exiting the loop can be
9399 determined using only its initial value and the number of loop
9400 iterations, replace uses of the final value by such a computation,
9401 provided it is sufficiently cheap. This reduces data dependencies
9402 and may allow further simplifications. Enabled by default at -O
9403 and higher.
9404
9405 -fivopts
9406 Perform induction variable optimizations (strength reduction,
9407 induction variable merging and induction variable elimination) on
9408 trees.
9409
9410 -ftree-parallelize-loops=n
9411 Parallelize loops, i.e., split their iteration space to run in n
9412 threads. This is only possible for loops whose iterations are
9413 independent and can be arbitrarily reordered. The optimization is
9414 only profitable on multiprocessor machines, for loops that are CPU-
9415 intensive, rather than constrained e.g. by memory bandwidth. This
9416 option implies -pthread, and thus is only supported on targets that
9417 have support for -pthread.
9418
9419 -ftree-pta
9420 Perform function-local points-to analysis on trees. This flag is
9421 enabled by default at -O1 and higher, except for -Og.
9422
9423 -ftree-sra
9424 Perform scalar replacement of aggregates. This pass replaces
9425 structure references with scalars to prevent committing structures
9426 to memory too early. This flag is enabled by default at -O1 and
9427 higher, except for -Og.
9428
9429 -fstore-merging
9430 Perform merging of narrow stores to consecutive memory addresses.
9431 This pass merges contiguous stores of immediate values narrower
9432 than a word into fewer wider stores to reduce the number of
9433 instructions. This is enabled by default at -O2 and higher as well
9434 as -Os.
9435
9436 -ftree-ter
9437 Perform temporary expression replacement during the SSA->normal
9438 phase. Single use/single def temporaries are replaced at their use
9439 location with their defining expression. This results in non-
9440 GIMPLE code, but gives the expanders much more complex trees to
9441 work on resulting in better RTL generation. This is enabled by
9442 default at -O and higher.
9443
9444 -ftree-slsr
9445 Perform straight-line strength reduction on trees. This recognizes
9446 related expressions involving multiplications and replaces them by
9447 less expensive calculations when possible. This is enabled by
9448 default at -O and higher.
9449
9450 -ftree-vectorize
9451 Perform vectorization on trees. This flag enables
9452 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
9453 specified.
9454
9455 -ftree-loop-vectorize
9456 Perform loop vectorization on trees. This flag is enabled by
9457 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9458 -fauto-profile.
9459
9460 -ftree-slp-vectorize
9461 Perform basic block vectorization on trees. This flag is enabled by
9462 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9463 -fauto-profile.
9464
9465 -fvect-cost-model=model
9466 Alter the cost model used for vectorization. The model argument
9467 should be one of unlimited, dynamic, cheap or very-cheap. With the
9468 unlimited model the vectorized code-path is assumed to be
9469 profitable while with the dynamic model a runtime check guards the
9470 vectorized code-path to enable it only for iteration counts that
9471 will likely execute faster than when executing the original scalar
9472 loop. The cheap model disables vectorization of loops where doing
9473 so would be cost prohibitive for example due to required runtime
9474 checks for data dependence or alignment but otherwise is equal to
9475 the dynamic model. The very-cheap model only allows vectorization
9476 if the vector code would entirely replace the scalar code that is
9477 being vectorized. For example, if each iteration of a vectorized
9478 loop would only be able to handle exactly four iterations of the
9479 scalar loop, the very-cheap model would only allow vectorization if
9480 the scalar iteration count is known to be a multiple of four.
9481
9482 The default cost model depends on other optimization flags and is
9483 either dynamic or cheap.
9484
9485 -fsimd-cost-model=model
9486 Alter the cost model used for vectorization of loops marked with
9487 the OpenMP simd directive. The model argument should be one of
9488 unlimited, dynamic, cheap. All values of model have the same
9489 meaning as described in -fvect-cost-model and by default a cost
9490 model defined with -fvect-cost-model is used.
9491
9492 -ftree-vrp
9493 Perform Value Range Propagation on trees. This is similar to the
9494 constant propagation pass, but instead of values, ranges of values
9495 are propagated. This allows the optimizers to remove unnecessary
9496 range checks like array bound checks and null pointer checks. This
9497 is enabled by default at -O2 and higher. Null pointer check
9498 elimination is only done if -fdelete-null-pointer-checks is
9499 enabled.
9500
9501 -fsplit-paths
9502 Split paths leading to loop backedges. This can improve dead code
9503 elimination and common subexpression elimination. This is enabled
9504 by default at -O3 and above.
9505
9506 -fsplit-ivs-in-unroller
9507 Enables expression of values of induction variables in later
9508 iterations of the unrolled loop using the value in the first
9509 iteration. This breaks long dependency chains, thus improving
9510 efficiency of the scheduling passes.
9511
9512 A combination of -fweb and CSE is often sufficient to obtain the
9513 same effect. However, that is not reliable in cases where the loop
9514 body is more complicated than a single basic block. It also does
9515 not work at all on some architectures due to restrictions in the
9516 CSE pass.
9517
9518 This optimization is enabled by default.
9519
9520 -fvariable-expansion-in-unroller
9521 With this option, the compiler creates multiple copies of some
9522 local variables when unrolling a loop, which can result in superior
9523 code.
9524
9525 This optimization is enabled by default for PowerPC targets, but
9526 disabled by default otherwise.
9527
9528 -fpartial-inlining
9529 Inline parts of functions. This option has any effect only when
9530 inlining itself is turned on by the -finline-functions or
9531 -finline-small-functions options.
9532
9533 Enabled at levels -O2, -O3, -Os.
9534
9535 -fpredictive-commoning
9536 Perform predictive commoning optimization, i.e., reusing
9537 computations (especially memory loads and stores) performed in
9538 previous iterations of loops.
9539
9540 This option is enabled at level -O3. It is also enabled by
9541 -fprofile-use and -fauto-profile.
9542
9543 -fprefetch-loop-arrays
9544 If supported by the target machine, generate instructions to
9545 prefetch memory to improve the performance of loops that access
9546 large arrays.
9547
9548 This option may generate better or worse code; results are highly
9549 dependent on the structure of loops within the source code.
9550
9551 Disabled at level -Os.
9552
9553 -fno-printf-return-value
9554 Do not substitute constants for known return value of formatted
9555 output functions such as "sprintf", "snprintf", "vsprintf", and
9556 "vsnprintf" (but not "printf" of "fprintf"). This transformation
9557 allows GCC to optimize or even eliminate branches based on the
9558 known return value of these functions called with arguments that
9559 are either constant, or whose values are known to be in a range
9560 that makes determining the exact return value possible. For
9561 example, when -fprintf-return-value is in effect, both the branch
9562 and the body of the "if" statement (but not the call to "snprint")
9563 can be optimized away when "i" is a 32-bit or smaller integer
9564 because the return value is guaranteed to be at most 8.
9565
9566 char buf[9];
9567 if (snprintf (buf, "%08x", i) >= sizeof buf)
9568 ...
9569
9570 The -fprintf-return-value option relies on other optimizations and
9571 yields best results with -O2 and above. It works in tandem with
9572 the -Wformat-overflow and -Wformat-truncation options. The
9573 -fprintf-return-value option is enabled by default.
9574
9575 -fno-peephole
9576 -fno-peephole2
9577 Disable any machine-specific peephole optimizations. The
9578 difference between -fno-peephole and -fno-peephole2 is in how they
9579 are implemented in the compiler; some targets use one, some use the
9580 other, a few use both.
9581
9582 -fpeephole is enabled by default. -fpeephole2 enabled at levels
9583 -O2, -O3, -Os.
9584
9585 -fno-guess-branch-probability
9586 Do not guess branch probabilities using heuristics.
9587
9588 GCC uses heuristics to guess branch probabilities if they are not
9589 provided by profiling feedback (-fprofile-arcs). These heuristics
9590 are based on the control flow graph. If some branch probabilities
9591 are specified by "__builtin_expect", then the heuristics are used
9592 to guess branch probabilities for the rest of the control flow
9593 graph, taking the "__builtin_expect" info into account. The
9594 interactions between the heuristics and "__builtin_expect" can be
9595 complex, and in some cases, it may be useful to disable the
9596 heuristics so that the effects of "__builtin_expect" are easier to
9597 understand.
9598
9599 It is also possible to specify expected probability of the
9600 expression with "__builtin_expect_with_probability" built-in
9601 function.
9602
9603 The default is -fguess-branch-probability at levels -O, -O2, -O3,
9604 -Os.
9605
9606 -freorder-blocks
9607 Reorder basic blocks in the compiled function in order to reduce
9608 number of taken branches and improve code locality.
9609
9610 Enabled at levels -O, -O2, -O3, -Os.
9611
9612 -freorder-blocks-algorithm=algorithm
9613 Use the specified algorithm for basic block reordering. The
9614 algorithm argument can be simple, which does not increase code size
9615 (except sometimes due to secondary effects like alignment), or stc,
9616 the "software trace cache" algorithm, which tries to put all often
9617 executed code together, minimizing the number of branches executed
9618 by making extra copies of code.
9619
9620 The default is simple at levels -O, -Os, and stc at levels -O2,
9621 -O3.
9622
9623 -freorder-blocks-and-partition
9624 In addition to reordering basic blocks in the compiled function, in
9625 order to reduce number of taken branches, partitions hot and cold
9626 basic blocks into separate sections of the assembly and .o files,
9627 to improve paging and cache locality performance.
9628
9629 This optimization is automatically turned off in the presence of
9630 exception handling or unwind tables (on targets using
9631 setjump/longjump or target specific scheme), for linkonce sections,
9632 for functions with a user-defined section attribute and on any
9633 architecture that does not support named sections. When
9634 -fsplit-stack is used this option is not enabled by default (to
9635 avoid linker errors), but may be enabled explicitly (if using a
9636 working linker).
9637
9638 Enabled for x86 at levels -O2, -O3, -Os.
9639
9640 -freorder-functions
9641 Reorder functions in the object file in order to improve code
9642 locality. This is implemented by using special subsections
9643 ".text.hot" for most frequently executed functions and
9644 ".text.unlikely" for unlikely executed functions. Reordering is
9645 done by the linker so object file format must support named
9646 sections and linker must place them in a reasonable way.
9647
9648 This option isn't effective unless you either provide profile
9649 feedback (see -fprofile-arcs for details) or manually annotate
9650 functions with "hot" or "cold" attributes.
9651
9652 Enabled at levels -O2, -O3, -Os.
9653
9654 -fstrict-aliasing
9655 Allow the compiler to assume the strictest aliasing rules
9656 applicable to the language being compiled. For C (and C++), this
9657 activates optimizations based on the type of expressions. In
9658 particular, an object of one type is assumed never to reside at the
9659 same address as an object of a different type, unless the types are
9660 almost the same. For example, an "unsigned int" can alias an
9661 "int", but not a "void*" or a "double". A character type may alias
9662 any other type.
9663
9664 Pay special attention to code like this:
9665
9666 union a_union {
9667 int i;
9668 double d;
9669 };
9670
9671 int f() {
9672 union a_union t;
9673 t.d = 3.0;
9674 return t.i;
9675 }
9676
9677 The practice of reading from a different union member than the one
9678 most recently written to (called "type-punning") is common. Even
9679 with -fstrict-aliasing, type-punning is allowed, provided the
9680 memory is accessed through the union type. So, the code above
9681 works as expected. However, this code might not:
9682
9683 int f() {
9684 union a_union t;
9685 int* ip;
9686 t.d = 3.0;
9687 ip = &t.i;
9688 return *ip;
9689 }
9690
9691 Similarly, access by taking the address, casting the resulting
9692 pointer and dereferencing the result has undefined behavior, even
9693 if the cast uses a union type, e.g.:
9694
9695 int f() {
9696 double d = 3.0;
9697 return ((union a_union *) &d)->i;
9698 }
9699
9700 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
9701
9702 -falign-functions
9703 -falign-functions=n
9704 -falign-functions=n:m
9705 -falign-functions=n:m:n2
9706 -falign-functions=n:m:n2:m2
9707 Align the start of functions to the next power-of-two greater than
9708 or equal to n, skipping up to m-1 bytes. This ensures that at
9709 least the first m bytes of the function can be fetched by the CPU
9710 without crossing an n-byte alignment boundary.
9711
9712 If m is not specified, it defaults to n.
9713
9714 Examples: -falign-functions=32 aligns functions to the next 32-byte
9715 boundary, -falign-functions=24 aligns to the next 32-byte boundary
9716 only if this can be done by skipping 23 bytes or less,
9717 -falign-functions=32:7 aligns to the next 32-byte boundary only if
9718 this can be done by skipping 6 bytes or less.
9719
9720 The second pair of n2:m2 values allows you to specify a secondary
9721 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
9722 boundary if this can be done by skipping 6 bytes or less, otherwise
9723 aligns to the next 32-byte boundary if this can be done by skipping
9724 2 bytes or less. If m2 is not specified, it defaults to n2.
9725
9726 Some assemblers only support this flag when n is a power of two; in
9727 that case, it is rounded up.
9728
9729 -fno-align-functions and -falign-functions=1 are equivalent and
9730 mean that functions are not aligned.
9731
9732 If n is not specified or is zero, use a machine-dependent default.
9733 The maximum allowed n option value is 65536.
9734
9735 Enabled at levels -O2, -O3.
9736
9737 -flimit-function-alignment
9738 If this option is enabled, the compiler tries to avoid
9739 unnecessarily overaligning functions. It attempts to instruct the
9740 assembler to align by the amount specified by -falign-functions,
9741 but not to skip more bytes than the size of the function.
9742
9743 -falign-labels
9744 -falign-labels=n
9745 -falign-labels=n:m
9746 -falign-labels=n:m:n2
9747 -falign-labels=n:m:n2:m2
9748 Align all branch targets to a power-of-two boundary.
9749
9750 Parameters of this option are analogous to the -falign-functions
9751 option. -fno-align-labels and -falign-labels=1 are equivalent and
9752 mean that labels are not aligned.
9753
9754 If -falign-loops or -falign-jumps are applicable and are greater
9755 than this value, then their values are used instead.
9756
9757 If n is not specified or is zero, use a machine-dependent default
9758 which is very likely to be 1, meaning no alignment. The maximum
9759 allowed n option value is 65536.
9760
9761 Enabled at levels -O2, -O3.
9762
9763 -falign-loops
9764 -falign-loops=n
9765 -falign-loops=n:m
9766 -falign-loops=n:m:n2
9767 -falign-loops=n:m:n2:m2
9768 Align loops to a power-of-two boundary. If the loops are executed
9769 many times, this makes up for any execution of the dummy padding
9770 instructions.
9771
9772 If -falign-labels is greater than this value, then its value is
9773 used instead.
9774
9775 Parameters of this option are analogous to the -falign-functions
9776 option. -fno-align-loops and -falign-loops=1 are equivalent and
9777 mean that loops are not aligned. The maximum allowed n option
9778 value is 65536.
9779
9780 If n is not specified or is zero, use a machine-dependent default.
9781
9782 Enabled at levels -O2, -O3.
9783
9784 -falign-jumps
9785 -falign-jumps=n
9786 -falign-jumps=n:m
9787 -falign-jumps=n:m:n2
9788 -falign-jumps=n:m:n2:m2
9789 Align branch targets to a power-of-two boundary, for branch targets
9790 where the targets can only be reached by jumping. In this case, no
9791 dummy operations need be executed.
9792
9793 If -falign-labels is greater than this value, then its value is
9794 used instead.
9795
9796 Parameters of this option are analogous to the -falign-functions
9797 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
9798 mean that loops are not aligned.
9799
9800 If n is not specified or is zero, use a machine-dependent default.
9801 The maximum allowed n option value is 65536.
9802
9803 Enabled at levels -O2, -O3.
9804
9805 -fno-allocation-dce
9806 Do not remove unused C++ allocations in dead code elimination.
9807
9808 -fallow-store-data-races
9809 Allow the compiler to perform optimizations that may introduce new
9810 data races on stores, without proving that the variable cannot be
9811 concurrently accessed by other threads. Does not affect
9812 optimization of local data. It is safe to use this option if it is
9813 known that global data will not be accessed by multiple threads.
9814
9815 Examples of optimizations enabled by -fallow-store-data-races
9816 include hoisting or if-conversions that may cause a value that was
9817 already in memory to be re-written with that same value. Such re-
9818 writing is safe in a single threaded context but may be unsafe in a
9819 multi-threaded context. Note that on some processors, if-
9820 conversions may be required in order to enable vectorization.
9821
9822 Enabled at level -Ofast.
9823
9824 -funit-at-a-time
9825 This option is left for compatibility reasons. -funit-at-a-time has
9826 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
9827 and -fno-section-anchors.
9828
9829 Enabled by default.
9830
9831 -fno-toplevel-reorder
9832 Do not reorder top-level functions, variables, and "asm"
9833 statements. Output them in the same order that they appear in the
9834 input file. When this option is used, unreferenced static
9835 variables are not removed. This option is intended to support
9836 existing code that relies on a particular ordering. For new code,
9837 it is better to use attributes when possible.
9838
9839 -ftoplevel-reorder is the default at -O1 and higher, and also at
9840 -O0 if -fsection-anchors is explicitly requested. Additionally
9841 -fno-toplevel-reorder implies -fno-section-anchors.
9842
9843 -fweb
9844 Constructs webs as commonly used for register allocation purposes
9845 and assign each web individual pseudo register. This allows the
9846 register allocation pass to operate on pseudos directly, but also
9847 strengthens several other optimization passes, such as CSE, loop
9848 optimizer and trivial dead code remover. It can, however, make
9849 debugging impossible, since variables no longer stay in a "home
9850 register".
9851
9852 Enabled by default with -funroll-loops.
9853
9854 -fwhole-program
9855 Assume that the current compilation unit represents the whole
9856 program being compiled. All public functions and variables with
9857 the exception of "main" and those merged by attribute
9858 "externally_visible" become static functions and in effect are
9859 optimized more aggressively by interprocedural optimizers.
9860
9861 This option should not be used in combination with -flto. Instead
9862 relying on a linker plugin should provide safer and more precise
9863 information.
9864
9865 -flto[=n]
9866 This option runs the standard link-time optimizer. When invoked
9867 with source code, it generates GIMPLE (one of GCC's internal
9868 representations) and writes it to special ELF sections in the
9869 object file. When the object files are linked together, all the
9870 function bodies are read from these ELF sections and instantiated
9871 as if they had been part of the same translation unit.
9872
9873 To use the link-time optimizer, -flto and optimization options
9874 should be specified at compile time and during the final link. It
9875 is recommended that you compile all the files participating in the
9876 same link with the same options and also specify those options at
9877 link time. For example:
9878
9879 gcc -c -O2 -flto foo.c
9880 gcc -c -O2 -flto bar.c
9881 gcc -o myprog -flto -O2 foo.o bar.o
9882
9883 The first two invocations to GCC save a bytecode representation of
9884 GIMPLE into special ELF sections inside foo.o and bar.o. The final
9885 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
9886 the two files into a single internal image, and compiles the result
9887 as usual. Since both foo.o and bar.o are merged into a single
9888 image, this causes all the interprocedural analyses and
9889 optimizations in GCC to work across the two files as if they were a
9890 single one. This means, for example, that the inliner is able to
9891 inline functions in bar.o into functions in foo.o and vice-versa.
9892
9893 Another (simpler) way to enable link-time optimization is:
9894
9895 gcc -o myprog -flto -O2 foo.c bar.c
9896
9897 The above generates bytecode for foo.c and bar.c, merges them
9898 together into a single GIMPLE representation and optimizes them as
9899 usual to produce myprog.
9900
9901 The important thing to keep in mind is that to enable link-time
9902 optimizations you need to use the GCC driver to perform the link
9903 step. GCC automatically performs link-time optimization if any of
9904 the objects involved were compiled with the -flto command-line
9905 option. You can always override the automatic decision to do link-
9906 time optimization by passing -fno-lto to the link command.
9907
9908 To make whole program optimization effective, it is necessary to
9909 make certain whole program assumptions. The compiler needs to know
9910 what functions and variables can be accessed by libraries and
9911 runtime outside of the link-time optimized unit. When supported by
9912 the linker, the linker plugin (see -fuse-linker-plugin) passes
9913 information to the compiler about used and externally visible
9914 symbols. When the linker plugin is not available, -fwhole-program
9915 should be used to allow the compiler to make these assumptions,
9916 which leads to more aggressive optimization decisions.
9917
9918 When a file is compiled with -flto without -fuse-linker-plugin, the
9919 generated object file is larger than a regular object file because
9920 it contains GIMPLE bytecodes and the usual final code (see
9921 -ffat-lto-objects). This means that object files with LTO
9922 information can be linked as normal object files; if -fno-lto is
9923 passed to the linker, no interprocedural optimizations are applied.
9924 Note that when -fno-fat-lto-objects is enabled the compile stage is
9925 faster but you cannot perform a regular, non-LTO link on them.
9926
9927 When producing the final binary, GCC only applies link-time
9928 optimizations to those files that contain bytecode. Therefore, you
9929 can mix and match object files and libraries with GIMPLE bytecodes
9930 and final object code. GCC automatically selects which files to
9931 optimize in LTO mode and which files to link without further
9932 processing.
9933
9934 Generally, options specified at link time override those specified
9935 at compile time, although in some cases GCC attempts to infer link-
9936 time options from the settings used to compile the input files.
9937
9938 If you do not specify an optimization level option -O at link time,
9939 then GCC uses the highest optimization level used when compiling
9940 the object files. Note that it is generally ineffective to specify
9941 an optimization level option only at link time and not at compile
9942 time, for two reasons. First, compiling without optimization
9943 suppresses compiler passes that gather information needed for
9944 effective optimization at link time. Second, some early
9945 optimization passes can be performed only at compile time and not
9946 at link time.
9947
9948 There are some code generation flags preserved by GCC when
9949 generating bytecodes, as they need to be used during the final
9950 link. Currently, the following options and their settings are
9951 taken from the first object file that explicitly specifies them:
9952 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
9953 -m target flags.
9954
9955 The following options -fPIC, -fpic, -fpie and -fPIE are combined
9956 based on the following scheme:
9957
9958 B<-fPIC> + B<-fpic> = B<-fpic>
9959 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
9960 B<-fpic/-fPIC> + (no option) = (no option)
9961 B<-fPIC> + B<-fPIE> = B<-fPIE>
9962 B<-fpic> + B<-fPIE> = B<-fpie>
9963 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
9964
9965 Certain ABI-changing flags are required to match in all compilation
9966 units, and trying to override this at link time with a conflicting
9967 value is ignored. This includes options such as
9968 -freg-struct-return and -fpcc-struct-return.
9969
9970 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
9971 -fno-trapv or -fno-strict-aliasing are passed through to the link
9972 stage and merged conservatively for conflicting translation units.
9973 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
9974 precedence; and for example -ffp-contract=off takes precedence over
9975 -ffp-contract=fast. You can override them at link time.
9976
9977 Diagnostic options such as -Wstringop-overflow are passed through
9978 to the link stage and their setting matches that of the compile-
9979 step at function granularity. Note that this matters only for
9980 diagnostics emitted during optimization. Note that code transforms
9981 such as inlining can lead to warnings being enabled or disabled for
9982 regions if code not consistent with the setting at compile time.
9983
9984 When you need to pass options to the assembler via -Wa or
9985 -Xassembler make sure to either compile such translation units with
9986 -fno-lto or consistently use the same assembler options on all
9987 translation units. You can alternatively also specify assembler
9988 options at LTO link time.
9989
9990 To enable debug info generation you need to supply -g at compile
9991 time. If any of the input files at link time were built with debug
9992 info generation enabled the link will enable debug info generation
9993 as well. Any elaborate debug info settings like the dwarf level
9994 -gdwarf-5 need to be explicitly repeated at the linker command line
9995 and mixing different settings in different translation units is
9996 discouraged.
9997
9998 If LTO encounters objects with C linkage declared with incompatible
9999 types in separate translation units to be linked together
10000 (undefined behavior according to ISO C99 6.2.7), a non-fatal
10001 diagnostic may be issued. The behavior is still undefined at run
10002 time. Similar diagnostics may be raised for other languages.
10003
10004 Another feature of LTO is that it is possible to apply
10005 interprocedural optimizations on files written in different
10006 languages:
10007
10008 gcc -c -flto foo.c
10009 g++ -c -flto bar.cc
10010 gfortran -c -flto baz.f90
10011 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10012
10013 Notice that the final link is done with g++ to get the C++ runtime
10014 libraries and -lgfortran is added to get the Fortran runtime
10015 libraries. In general, when mixing languages in LTO mode, you
10016 should use the same link command options as when mixing languages
10017 in a regular (non-LTO) compilation.
10018
10019 If object files containing GIMPLE bytecode are stored in a library
10020 archive, say libfoo.a, it is possible to extract and use them in an
10021 LTO link if you are using a linker with plugin support. To create
10022 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10023 instead of ar and ranlib; to show the symbols of object files with
10024 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10025 ranlib and nm have been compiled with plugin support. At link
10026 time, use the flag -fuse-linker-plugin to ensure that the library
10027 participates in the LTO optimization process:
10028
10029 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10030
10031 With the linker plugin enabled, the linker extracts the needed
10032 GIMPLE files from libfoo.a and passes them on to the running GCC to
10033 make them part of the aggregated GIMPLE image to be optimized.
10034
10035 If you are not using a linker with plugin support and/or do not
10036 enable the linker plugin, then the objects inside libfoo.a are
10037 extracted and linked as usual, but they do not participate in the
10038 LTO optimization process. In order to make a static library
10039 suitable for both LTO optimization and usual linkage, compile its
10040 object files with -flto -ffat-lto-objects.
10041
10042 Link-time optimizations do not require the presence of the whole
10043 program to operate. If the program does not require any symbols to
10044 be exported, it is possible to combine -flto and -fwhole-program to
10045 allow the interprocedural optimizers to use more aggressive
10046 assumptions which may lead to improved optimization opportunities.
10047 Use of -fwhole-program is not needed when linker plugin is active
10048 (see -fuse-linker-plugin).
10049
10050 The current implementation of LTO makes no attempt to generate
10051 bytecode that is portable between different types of hosts. The
10052 bytecode files are versioned and there is a strict version check,
10053 so bytecode files generated in one version of GCC do not work with
10054 an older or newer version of GCC.
10055
10056 Link-time optimization does not work well with generation of
10057 debugging information on systems other than those using a
10058 combination of ELF and DWARF.
10059
10060 If you specify the optional n, the optimization and code generation
10061 done at link time is executed in parallel using n parallel jobs by
10062 utilizing an installed make program. The environment variable MAKE
10063 may be used to override the program used.
10064
10065 You can also specify -flto=jobserver to use GNU make's job server
10066 mode to determine the number of parallel jobs. This is useful when
10067 the Makefile calling GCC is already executing in parallel. You
10068 must prepend a + to the command recipe in the parent Makefile for
10069 this to work. This option likely only works if MAKE is GNU make.
10070 Even without the option value, GCC tries to automatically detect a
10071 running GNU make's job server.
10072
10073 Use -flto=auto to use GNU make's job server, if available, or
10074 otherwise fall back to autodetection of the number of CPU threads
10075 present in your system.
10076
10077 -flto-partition=alg
10078 Specify the partitioning algorithm used by the link-time optimizer.
10079 The value is either 1to1 to specify a partitioning mirroring the
10080 original source files or balanced to specify partitioning into
10081 equally sized chunks (whenever possible) or max to create new
10082 partition for every symbol where possible. Specifying none as an
10083 algorithm disables partitioning and streaming completely. The
10084 default value is balanced. While 1to1 can be used as an workaround
10085 for various code ordering issues, the max partitioning is intended
10086 for internal testing only. The value one specifies that exactly
10087 one partition should be used while the value none bypasses
10088 partitioning and executes the link-time optimization step directly
10089 from the WPA phase.
10090
10091 -flto-compression-level=n
10092 This option specifies the level of compression used for
10093 intermediate language written to LTO object files, and is only
10094 meaningful in conjunction with LTO mode (-flto). GCC currently
10095 supports two LTO compression algorithms. For zstd, valid values are
10096 0 (no compression) to 19 (maximum compression), while zlib supports
10097 values from 0 to 9. Values outside this range are clamped to
10098 either minimum or maximum of the supported values. If the option
10099 is not given, a default balanced compression setting is used.
10100
10101 -fuse-linker-plugin
10102 Enables the use of a linker plugin during link-time optimization.
10103 This option relies on plugin support in the linker, which is
10104 available in gold or in GNU ld 2.21 or newer.
10105
10106 This option enables the extraction of object files with GIMPLE
10107 bytecode out of library archives. This improves the quality of
10108 optimization by exposing more code to the link-time optimizer.
10109 This information specifies what symbols can be accessed externally
10110 (by non-LTO object or during dynamic linking). Resulting code
10111 quality improvements on binaries (and shared libraries that use
10112 hidden visibility) are similar to -fwhole-program. See -flto for a
10113 description of the effect of this flag and how to use it.
10114
10115 This option is enabled by default when LTO support in GCC is
10116 enabled and GCC was configured for use with a linker supporting
10117 plugins (GNU ld 2.21 or newer or gold).
10118
10119 -ffat-lto-objects
10120 Fat LTO objects are object files that contain both the intermediate
10121 language and the object code. This makes them usable for both LTO
10122 linking and normal linking. This option is effective only when
10123 compiling with -flto and is ignored at link time.
10124
10125 -fno-fat-lto-objects improves compilation time over plain LTO, but
10126 requires the complete toolchain to be aware of LTO. It requires a
10127 linker with linker plugin support for basic functionality.
10128 Additionally, nm, ar and ranlib need to support linker plugins to
10129 allow a full-featured build environment (capable of building static
10130 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10131 wrappers to pass the right options to these tools. With non fat LTO
10132 makefiles need to be modified to use them.
10133
10134 Note that modern binutils provide plugin auto-load mechanism.
10135 Installing the linker plugin into $libdir/bfd-plugins has the same
10136 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10137 ranlib).
10138
10139 The default is -fno-fat-lto-objects on targets with linker plugin
10140 support.
10141
10142 -fcompare-elim
10143 After register allocation and post-register allocation instruction
10144 splitting, identify arithmetic instructions that compute processor
10145 flags similar to a comparison operation based on that arithmetic.
10146 If possible, eliminate the explicit comparison operation.
10147
10148 This pass only applies to certain targets that cannot explicitly
10149 represent the comparison operation before register allocation is
10150 complete.
10151
10152 Enabled at levels -O, -O2, -O3, -Os.
10153
10154 -fcprop-registers
10155 After register allocation and post-register allocation instruction
10156 splitting, perform a copy-propagation pass to try to reduce
10157 scheduling dependencies and occasionally eliminate the copy.
10158
10159 Enabled at levels -O, -O2, -O3, -Os.
10160
10161 -fprofile-correction
10162 Profiles collected using an instrumented binary for multi-threaded
10163 programs may be inconsistent due to missed counter updates. When
10164 this option is specified, GCC uses heuristics to correct or smooth
10165 out such inconsistencies. By default, GCC emits an error message
10166 when an inconsistent profile is detected.
10167
10168 This option is enabled by -fauto-profile.
10169
10170 -fprofile-partial-training
10171 With "-fprofile-use" all portions of programs not executed during
10172 train run are optimized agressively for size rather than speed. In
10173 some cases it is not practical to train all possible hot paths in
10174 the program. (For example, program may contain functions specific
10175 for a given hardware and trianing may not cover all hardware
10176 configurations program is run on.) With
10177 "-fprofile-partial-training" profile feedback will be ignored for
10178 all functions not executed during the train run leading them to be
10179 optimized as if they were compiled without profile feedback. This
10180 leads to better performance when train run is not representative
10181 but also leads to significantly bigger code.
10182
10183 -fprofile-use
10184 -fprofile-use=path
10185 Enable profile feedback-directed optimizations, and the following
10186 optimizations, many of which are generally profitable only with
10187 profile feedback available:
10188
10189 -fbranch-probabilities -fprofile-values -funroll-loops
10190 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10191 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10192 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10193 -ftree-slp-vectorize -fvect-cost-model=dynamic
10194 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10195
10196 Before you can use this option, you must first generate profiling
10197 information.
10198
10199 By default, GCC emits an error message if the feedback profiles do
10200 not match the source code. This error can be turned into a warning
10201 by using -Wno-error=coverage-mismatch. Note this may result in
10202 poorly optimized code. Additionally, by default, GCC also emits a
10203 warning message if the feedback profiles do not exist (see
10204 -Wmissing-profile).
10205
10206 If path is specified, GCC looks at the path to find the profile
10207 feedback data files. See -fprofile-dir.
10208
10209 -fauto-profile
10210 -fauto-profile=path
10211 Enable sampling-based feedback-directed optimizations, and the
10212 following optimizations, many of which are generally profitable
10213 only with profile feedback available:
10214
10215 -fbranch-probabilities -fprofile-values -funroll-loops
10216 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10217 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10218 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10219 -ftree-slp-vectorize -fvect-cost-model=dynamic
10220 -ftree-loop-distribute-patterns -fprofile-correction
10221
10222 path is the name of a file containing AutoFDO profile information.
10223 If omitted, it defaults to fbdata.afdo in the current directory.
10224
10225 Producing an AutoFDO profile data file requires running your
10226 program with the perf utility on a supported GNU/Linux target
10227 system. For more information, see <https://perf.wiki.kernel.org/>.
10228
10229 E.g.
10230
10231 perf record -e br_inst_retired:near_taken -b -o perf.data \
10232 -- your_program
10233
10234 Then use the create_gcov tool to convert the raw profile data to a
10235 format that can be used by GCC. You must also supply the
10236 unstripped binary for your program to this tool. See
10237 <https://github.com/google/autofdo>.
10238
10239 E.g.
10240
10241 create_gcov --binary=your_program.unstripped --profile=perf.data \
10242 --gcov=profile.afdo
10243
10244 The following options control compiler behavior regarding floating-
10245 point arithmetic. These options trade off between speed and
10246 correctness. All must be specifically enabled.
10247
10248 -ffloat-store
10249 Do not store floating-point variables in registers, and inhibit
10250 other options that might change whether a floating-point value is
10251 taken from a register or memory.
10252
10253 This option prevents undesirable excess precision on machines such
10254 as the 68000 where the floating registers (of the 68881) keep more
10255 precision than a "double" is supposed to have. Similarly for the
10256 x86 architecture. For most programs, the excess precision does
10257 only good, but a few programs rely on the precise definition of
10258 IEEE floating point. Use -ffloat-store for such programs, after
10259 modifying them to store all pertinent intermediate computations
10260 into variables.
10261
10262 -fexcess-precision=style
10263 This option allows further control over excess precision on
10264 machines where floating-point operations occur in a format with
10265 more precision or range than the IEEE standard and interchange
10266 floating-point types. By default, -fexcess-precision=fast is in
10267 effect; this means that operations may be carried out in a wider
10268 precision than the types specified in the source if that would
10269 result in faster code, and it is unpredictable when rounding to the
10270 types specified in the source code takes place. When compiling C,
10271 if -fexcess-precision=standard is specified then excess precision
10272 follows the rules specified in ISO C99; in particular, both casts
10273 and assignments cause values to be rounded to their semantic types
10274 (whereas -ffloat-store only affects assignments). This option is
10275 enabled by default for C if a strict conformance option such as
10276 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10277 default regardless of whether a strict conformance option is used.
10278
10279 -fexcess-precision=standard is not implemented for languages other
10280 than C. On the x86, it has no effect if -mfpmath=sse or
10281 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10282 apply without excess precision, and in the latter, rounding is
10283 unpredictable.
10284
10285 -ffast-math
10286 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10287 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10288 -fcx-limited-range and -fexcess-precision=fast.
10289
10290 This option causes the preprocessor macro "__FAST_MATH__" to be
10291 defined.
10292
10293 This option is not turned on by any -O option besides -Ofast since
10294 it can result in incorrect output for programs that depend on an
10295 exact implementation of IEEE or ISO rules/specifications for math
10296 functions. It may, however, yield faster code for programs that do
10297 not require the guarantees of these specifications.
10298
10299 -fno-math-errno
10300 Do not set "errno" after calling math functions that are executed
10301 with a single instruction, e.g., "sqrt". A program that relies on
10302 IEEE exceptions for math error handling may want to use this flag
10303 for speed while maintaining IEEE arithmetic compatibility.
10304
10305 This option is not turned on by any -O option since it can result
10306 in incorrect output for programs that depend on an exact
10307 implementation of IEEE or ISO rules/specifications for math
10308 functions. It may, however, yield faster code for programs that do
10309 not require the guarantees of these specifications.
10310
10311 The default is -fmath-errno.
10312
10313 On Darwin systems, the math library never sets "errno". There is
10314 therefore no reason for the compiler to consider the possibility
10315 that it might, and -fno-math-errno is the default.
10316
10317 -funsafe-math-optimizations
10318 Allow optimizations for floating-point arithmetic that (a) assume
10319 that arguments and results are valid and (b) may violate IEEE or
10320 ANSI standards. When used at link time, it may include libraries
10321 or startup files that change the default FPU control word or other
10322 similar optimizations.
10323
10324 This option is not turned on by any -O option since it can result
10325 in incorrect output for programs that depend on an exact
10326 implementation of IEEE or ISO rules/specifications for math
10327 functions. It may, however, yield faster code for programs that do
10328 not require the guarantees of these specifications. Enables
10329 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10330 -freciprocal-math.
10331
10332 The default is -fno-unsafe-math-optimizations.
10333
10334 -fassociative-math
10335 Allow re-association of operands in series of floating-point
10336 operations. This violates the ISO C and C++ language standard by
10337 possibly changing computation result. NOTE: re-ordering may change
10338 the sign of zero as well as ignore NaNs and inhibit or create
10339 underflow or overflow (and thus cannot be used on code that relies
10340 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10341 floating-point comparisons and thus may not be used when ordered
10342 comparisons are required. This option requires that both
10343 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10344 it doesn't make much sense with -frounding-math. For Fortran the
10345 option is automatically enabled when both -fno-signed-zeros and
10346 -fno-trapping-math are in effect.
10347
10348 The default is -fno-associative-math.
10349
10350 -freciprocal-math
10351 Allow the reciprocal of a value to be used instead of dividing by
10352 the value if this enables optimizations. For example "x / y" can
10353 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10354 to common subexpression elimination. Note that this loses
10355 precision and increases the number of flops operating on the value.
10356
10357 The default is -fno-reciprocal-math.
10358
10359 -ffinite-math-only
10360 Allow optimizations for floating-point arithmetic that assume that
10361 arguments and results are not NaNs or +-Infs.
10362
10363 This option is not turned on by any -O option since it can result
10364 in incorrect output for programs that depend on an exact
10365 implementation of IEEE or ISO rules/specifications for math
10366 functions. It may, however, yield faster code for programs that do
10367 not require the guarantees of these specifications.
10368
10369 The default is -fno-finite-math-only.
10370
10371 -fno-signed-zeros
10372 Allow optimizations for floating-point arithmetic that ignore the
10373 signedness of zero. IEEE arithmetic specifies the behavior of
10374 distinct +0.0 and -0.0 values, which then prohibits simplification
10375 of expressions such as x+0.0 or 0.0*x (even with
10376 -ffinite-math-only). This option implies that the sign of a zero
10377 result isn't significant.
10378
10379 The default is -fsigned-zeros.
10380
10381 -fno-trapping-math
10382 Compile code assuming that floating-point operations cannot
10383 generate user-visible traps. These traps include division by zero,
10384 overflow, underflow, inexact result and invalid operation. This
10385 option requires that -fno-signaling-nans be in effect. Setting
10386 this option may allow faster code if one relies on "non-stop" IEEE
10387 arithmetic, for example.
10388
10389 This option should never be turned on by any -O option since it can
10390 result in incorrect output for programs that depend on an exact
10391 implementation of IEEE or ISO rules/specifications for math
10392 functions.
10393
10394 The default is -ftrapping-math.
10395
10396 -frounding-math
10397 Disable transformations and optimizations that assume default
10398 floating-point rounding behavior. This is round-to-zero for all
10399 floating point to integer conversions, and round-to-nearest for all
10400 other arithmetic truncations. This option should be specified for
10401 programs that change the FP rounding mode dynamically, or that may
10402 be executed with a non-default rounding mode. This option disables
10403 constant folding of floating-point expressions at compile time
10404 (which may be affected by rounding mode) and arithmetic
10405 transformations that are unsafe in the presence of sign-dependent
10406 rounding modes.
10407
10408 The default is -fno-rounding-math.
10409
10410 This option is experimental and does not currently guarantee to
10411 disable all GCC optimizations that are affected by rounding mode.
10412 Future versions of GCC may provide finer control of this setting
10413 using C99's "FENV_ACCESS" pragma. This command-line option will be
10414 used to specify the default state for "FENV_ACCESS".
10415
10416 -fsignaling-nans
10417 Compile code assuming that IEEE signaling NaNs may generate user-
10418 visible traps during floating-point operations. Setting this
10419 option disables optimizations that may change the number of
10420 exceptions visible with signaling NaNs. This option implies
10421 -ftrapping-math.
10422
10423 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
10424 defined.
10425
10426 The default is -fno-signaling-nans.
10427
10428 This option is experimental and does not currently guarantee to
10429 disable all GCC optimizations that affect signaling NaN behavior.
10430
10431 -fno-fp-int-builtin-inexact
10432 Do not allow the built-in functions "ceil", "floor", "round" and
10433 "trunc", and their "float" and "long double" variants, to generate
10434 code that raises the "inexact" floating-point exception for
10435 noninteger arguments. ISO C99 and C11 allow these functions to
10436 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
10437 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
10438 allow these functions to do so.
10439
10440 The default is -ffp-int-builtin-inexact, allowing the exception to
10441 be raised, unless C2X or a later C standard is selected. This
10442 option does nothing unless -ftrapping-math is in effect.
10443
10444 Even if -fno-fp-int-builtin-inexact is used, if the functions
10445 generate a call to a library function then the "inexact" exception
10446 may be raised if the library implementation does not follow TS
10447 18661.
10448
10449 -fsingle-precision-constant
10450 Treat floating-point constants as single precision instead of
10451 implicitly converting them to double-precision constants.
10452
10453 -fcx-limited-range
10454 When enabled, this option states that a range reduction step is not
10455 needed when performing complex division. Also, there is no
10456 checking whether the result of a complex multiplication or division
10457 is "NaN + I*NaN", with an attempt to rescue the situation in that
10458 case. The default is -fno-cx-limited-range, but is enabled by
10459 -ffast-math.
10460
10461 This option controls the default setting of the ISO C99
10462 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
10463 languages.
10464
10465 -fcx-fortran-rules
10466 Complex multiplication and division follow Fortran rules. Range
10467 reduction is done as part of complex division, but there is no
10468 checking whether the result of a complex multiplication or division
10469 is "NaN + I*NaN", with an attempt to rescue the situation in that
10470 case.
10471
10472 The default is -fno-cx-fortran-rules.
10473
10474 The following options control optimizations that may improve
10475 performance, but are not enabled by any -O options. This section
10476 includes experimental options that may produce broken code.
10477
10478 -fbranch-probabilities
10479 After running a program compiled with -fprofile-arcs, you can
10480 compile it a second time using -fbranch-probabilities, to improve
10481 optimizations based on the number of times each branch was taken.
10482 When a program compiled with -fprofile-arcs exits, it saves arc
10483 execution counts to a file called sourcename.gcda for each source
10484 file. The information in this data file is very dependent on the
10485 structure of the generated code, so you must use the same source
10486 code and the same optimization options for both compilations.
10487
10488 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
10489 JUMP_INSN and CALL_INSN. These can be used to improve
10490 optimization. Currently, they are only used in one place: in
10491 reorg.c, instead of guessing which path a branch is most likely to
10492 take, the REG_BR_PROB values are used to exactly determine which
10493 path is taken more often.
10494
10495 Enabled by -fprofile-use and -fauto-profile.
10496
10497 -fprofile-values
10498 If combined with -fprofile-arcs, it adds code so that some data
10499 about values of expressions in the program is gathered.
10500
10501 With -fbranch-probabilities, it reads back the data gathered from
10502 profiling values of expressions for usage in optimizations.
10503
10504 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
10505
10506 -fprofile-reorder-functions
10507 Function reordering based on profile instrumentation collects first
10508 time of execution of a function and orders these functions in
10509 ascending order.
10510
10511 Enabled with -fprofile-use.
10512
10513 -fvpt
10514 If combined with -fprofile-arcs, this option instructs the compiler
10515 to add code to gather information about values of expressions.
10516
10517 With -fbranch-probabilities, it reads back the data gathered and
10518 actually performs the optimizations based on them. Currently the
10519 optimizations include specialization of division operations using
10520 the knowledge about the value of the denominator.
10521
10522 Enabled with -fprofile-use and -fauto-profile.
10523
10524 -frename-registers
10525 Attempt to avoid false dependencies in scheduled code by making use
10526 of registers left over after register allocation. This
10527 optimization most benefits processors with lots of registers.
10528 Depending on the debug information format adopted by the target,
10529 however, it can make debugging impossible, since variables no
10530 longer stay in a "home register".
10531
10532 Enabled by default with -funroll-loops.
10533
10534 -fschedule-fusion
10535 Performs a target dependent pass over the instruction stream to
10536 schedule instructions of same type together because target machine
10537 can execute them more efficiently if they are adjacent to each
10538 other in the instruction flow.
10539
10540 Enabled at levels -O2, -O3, -Os.
10541
10542 -ftracer
10543 Perform tail duplication to enlarge superblock size. This
10544 transformation simplifies the control flow of the function allowing
10545 other optimizations to do a better job.
10546
10547 Enabled by -fprofile-use and -fauto-profile.
10548
10549 -funroll-loops
10550 Unroll loops whose number of iterations can be determined at
10551 compile time or upon entry to the loop. -funroll-loops implies
10552 -frerun-cse-after-loop, -fweb and -frename-registers. It also
10553 turns on complete loop peeling (i.e. complete removal of loops with
10554 a small constant number of iterations). This option makes code
10555 larger, and may or may not make it run faster.
10556
10557 Enabled by -fprofile-use and -fauto-profile.
10558
10559 -funroll-all-loops
10560 Unroll all loops, even if their number of iterations is uncertain
10561 when the loop is entered. This usually makes programs run more
10562 slowly. -funroll-all-loops implies the same options as
10563 -funroll-loops.
10564
10565 -fpeel-loops
10566 Peels loops for which there is enough information that they do not
10567 roll much (from profile feedback or static analysis). It also
10568 turns on complete loop peeling (i.e. complete removal of loops with
10569 small constant number of iterations).
10570
10571 Enabled by -O3, -fprofile-use, and -fauto-profile.
10572
10573 -fmove-loop-invariants
10574 Enables the loop invariant motion pass in the RTL loop optimizer.
10575 Enabled at level -O1 and higher, except for -Og.
10576
10577 -fsplit-loops
10578 Split a loop into two if it contains a condition that's always true
10579 for one side of the iteration space and false for the other.
10580
10581 Enabled by -fprofile-use and -fauto-profile.
10582
10583 -funswitch-loops
10584 Move branches with loop invariant conditions out of the loop, with
10585 duplicates of the loop on both branches (modified according to
10586 result of the condition).
10587
10588 Enabled by -fprofile-use and -fauto-profile.
10589
10590 -fversion-loops-for-strides
10591 If a loop iterates over an array with a variable stride, create
10592 another version of the loop that assumes the stride is always one.
10593 For example:
10594
10595 for (int i = 0; i < n; ++i)
10596 x[i * stride] = ...;
10597
10598 becomes:
10599
10600 if (stride == 1)
10601 for (int i = 0; i < n; ++i)
10602 x[i] = ...;
10603 else
10604 for (int i = 0; i < n; ++i)
10605 x[i * stride] = ...;
10606
10607 This is particularly useful for assumed-shape arrays in Fortran
10608 where (for example) it allows better vectorization assuming
10609 contiguous accesses. This flag is enabled by default at -O3. It
10610 is also enabled by -fprofile-use and -fauto-profile.
10611
10612 -ffunction-sections
10613 -fdata-sections
10614 Place each function or data item into its own section in the output
10615 file if the target supports arbitrary sections. The name of the
10616 function or the name of the data item determines the section's name
10617 in the output file.
10618
10619 Use these options on systems where the linker can perform
10620 optimizations to improve locality of reference in the instruction
10621 space. Most systems using the ELF object format have linkers with
10622 such optimizations. On AIX, the linker rearranges sections
10623 (CSECTs) based on the call graph. The performance impact varies.
10624
10625 Together with a linker garbage collection (linker --gc-sections
10626 option) these options may lead to smaller statically-linked
10627 executables (after stripping).
10628
10629 On ELF/DWARF systems these options do not degenerate the quality of
10630 the debug information. There could be issues with other object
10631 files/debug info formats.
10632
10633 Only use these options when there are significant benefits from
10634 doing so. When you specify these options, the assembler and linker
10635 create larger object and executable files and are also slower.
10636 These options affect code generation. They prevent optimizations
10637 by the compiler and assembler using relative locations inside a
10638 translation unit since the locations are unknown until link time.
10639 An example of such an optimization is relaxing calls to short call
10640 instructions.
10641
10642 -fstdarg-opt
10643 Optimize the prologue of variadic argument functions with respect
10644 to usage of those arguments.
10645
10646 -fsection-anchors
10647 Try to reduce the number of symbolic address calculations by using
10648 shared "anchor" symbols to address nearby objects. This
10649 transformation can help to reduce the number of GOT entries and GOT
10650 accesses on some targets.
10651
10652 For example, the implementation of the following function "foo":
10653
10654 static int a, b, c;
10655 int foo (void) { return a + b + c; }
10656
10657 usually calculates the addresses of all three variables, but if you
10658 compile it with -fsection-anchors, it accesses the variables from a
10659 common anchor point instead. The effect is similar to the
10660 following pseudocode (which isn't valid C):
10661
10662 int foo (void)
10663 {
10664 register int *xr = &x;
10665 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10666 }
10667
10668 Not all targets support this option.
10669
10670 -fzero-call-used-regs=choice
10671 Zero call-used registers at function return to increase program
10672 security by either mitigating Return-Oriented Programming (ROP)
10673 attacks or preventing information leakage through registers.
10674
10675 The possible values of choice are the same as for the
10676 "zero_call_used_regs" attribute. The default is skip.
10677
10678 You can control this behavior for a specific function by using the
10679 function attribute "zero_call_used_regs".
10680
10681 --param name=value
10682 In some places, GCC uses various constants to control the amount of
10683 optimization that is done. For example, GCC does not inline
10684 functions that contain more than a certain number of instructions.
10685 You can control some of these constants on the command line using
10686 the --param option.
10687
10688 The names of specific parameters, and the meaning of the values,
10689 are tied to the internals of the compiler, and are subject to
10690 change without notice in future releases.
10691
10692 In order to get minimal, maximal and default value of a parameter,
10693 one can use --help=param -Q options.
10694
10695 In each case, the value is an integer. The following choices of
10696 name are recognized for all targets:
10697
10698 predictable-branch-outcome
10699 When branch is predicted to be taken with probability lower
10700 than this threshold (in percent), then it is considered well
10701 predictable.
10702
10703 max-rtl-if-conversion-insns
10704 RTL if-conversion tries to remove conditional branches around a
10705 block and replace them with conditionally executed
10706 instructions. This parameter gives the maximum number of
10707 instructions in a block which should be considered for if-
10708 conversion. The compiler will also use other heuristics to
10709 decide whether if-conversion is likely to be profitable.
10710
10711 max-rtl-if-conversion-predictable-cost
10712 RTL if-conversion will try to remove conditional branches
10713 around a block and replace them with conditionally executed
10714 instructions. These parameters give the maximum permissible
10715 cost for the sequence that would be generated by if-conversion
10716 depending on whether the branch is statically determined to be
10717 predictable or not. The units for this parameter are the same
10718 as those for the GCC internal seq_cost metric. The compiler
10719 will try to provide a reasonable default for this parameter
10720 using the BRANCH_COST target macro.
10721
10722 max-crossjump-edges
10723 The maximum number of incoming edges to consider for cross-
10724 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
10725 number of edges incoming to each block. Increasing values mean
10726 more aggressive optimization, making the compilation time
10727 increase with probably small improvement in executable size.
10728
10729 min-crossjump-insns
10730 The minimum number of instructions that must be matched at the
10731 end of two blocks before cross-jumping is performed on them.
10732 This value is ignored in the case where all instructions in the
10733 block being cross-jumped from are matched.
10734
10735 max-grow-copy-bb-insns
10736 The maximum code size expansion factor when copying basic
10737 blocks instead of jumping. The expansion is relative to a jump
10738 instruction.
10739
10740 max-goto-duplication-insns
10741 The maximum number of instructions to duplicate to a block that
10742 jumps to a computed goto. To avoid O(N^2) behavior in a number
10743 of passes, GCC factors computed gotos early in the compilation
10744 process, and unfactors them as late as possible. Only computed
10745 jumps at the end of a basic blocks with no more than max-goto-
10746 duplication-insns are unfactored.
10747
10748 max-delay-slot-insn-search
10749 The maximum number of instructions to consider when looking for
10750 an instruction to fill a delay slot. If more than this
10751 arbitrary number of instructions are searched, the time savings
10752 from filling the delay slot are minimal, so stop searching.
10753 Increasing values mean more aggressive optimization, making the
10754 compilation time increase with probably small improvement in
10755 execution time.
10756
10757 max-delay-slot-live-search
10758 When trying to fill delay slots, the maximum number of
10759 instructions to consider when searching for a block with valid
10760 live register information. Increasing this arbitrarily chosen
10761 value means more aggressive optimization, increasing the
10762 compilation time. This parameter should be removed when the
10763 delay slot code is rewritten to maintain the control-flow
10764 graph.
10765
10766 max-gcse-memory
10767 The approximate maximum amount of memory in "kB" that can be
10768 allocated in order to perform the global common subexpression
10769 elimination optimization. If more memory than specified is
10770 required, the optimization is not done.
10771
10772 max-gcse-insertion-ratio
10773 If the ratio of expression insertions to deletions is larger
10774 than this value for any expression, then RTL PRE inserts or
10775 removes the expression and thus leaves partially redundant
10776 computations in the instruction stream.
10777
10778 max-pending-list-length
10779 The maximum number of pending dependencies scheduling allows
10780 before flushing the current state and starting over. Large
10781 functions with few branches or calls can create excessively
10782 large lists which needlessly consume memory and resources.
10783
10784 max-modulo-backtrack-attempts
10785 The maximum number of backtrack attempts the scheduler should
10786 make when modulo scheduling a loop. Larger values can
10787 exponentially increase compilation time.
10788
10789 max-inline-insns-single
10790 Several parameters control the tree inliner used in GCC. This
10791 number sets the maximum number of instructions (counted in
10792 GCC's internal representation) in a single function that the
10793 tree inliner considers for inlining. This only affects
10794 functions declared inline and methods implemented in a class
10795 declaration (C++).
10796
10797 max-inline-insns-auto
10798 When you use -finline-functions (included in -O3), a lot of
10799 functions that would otherwise not be considered for inlining
10800 by the compiler are investigated. To those functions, a
10801 different (more restrictive) limit compared to functions
10802 declared inline can be applied (--param max-inline-insns-auto).
10803
10804 max-inline-insns-small
10805 This is bound applied to calls which are considered relevant
10806 with -finline-small-functions.
10807
10808 max-inline-insns-size
10809 This is bound applied to calls which are optimized for size.
10810 Small growth may be desirable to anticipate optimization
10811 oppurtunities exposed by inlining.
10812
10813 uninlined-function-insns
10814 Number of instructions accounted by inliner for function
10815 overhead such as function prologue and epilogue.
10816
10817 uninlined-function-time
10818 Extra time accounted by inliner for function overhead such as
10819 time needed to execute function prologue and epilogue
10820
10821 inline-heuristics-hint-percent
10822 The scale (in percents) applied to inline-insns-single,
10823 inline-insns-single-O2, inline-insns-auto when inline
10824 heuristics hints that inlining is very profitable (will enable
10825 later optimizations).
10826
10827 uninlined-thunk-insns
10828 uninlined-thunk-time
10829 Same as --param uninlined-function-insns and --param uninlined-
10830 function-time but applied to function thunks
10831
10832 inline-min-speedup
10833 When estimated performance improvement of caller + callee
10834 runtime exceeds this threshold (in percent), the function can
10835 be inlined regardless of the limit on --param max-inline-insns-
10836 single and --param max-inline-insns-auto.
10837
10838 large-function-insns
10839 The limit specifying really large functions. For functions
10840 larger than this limit after inlining, inlining is constrained
10841 by --param large-function-growth. This parameter is useful
10842 primarily to avoid extreme compilation time caused by non-
10843 linear algorithms used by the back end.
10844
10845 large-function-growth
10846 Specifies maximal growth of large function caused by inlining
10847 in percents. For example, parameter value 100 limits large
10848 function growth to 2.0 times the original size.
10849
10850 large-unit-insns
10851 The limit specifying large translation unit. Growth caused by
10852 inlining of units larger than this limit is limited by --param
10853 inline-unit-growth. For small units this might be too tight.
10854 For example, consider a unit consisting of function A that is
10855 inline and B that just calls A three times. If B is small
10856 relative to A, the growth of unit is 300\% and yet such
10857 inlining is very sane. For very large units consisting of
10858 small inlineable functions, however, the overall unit growth
10859 limit is needed to avoid exponential explosion of code size.
10860 Thus for smaller units, the size is increased to --param large-
10861 unit-insns before applying --param inline-unit-growth.
10862
10863 lazy-modules
10864 Maximum number of concurrently open C++ module files when lazy
10865 loading.
10866
10867 inline-unit-growth
10868 Specifies maximal overall growth of the compilation unit caused
10869 by inlining. For example, parameter value 20 limits unit
10870 growth to 1.2 times the original size. Cold functions (either
10871 marked cold via an attribute or by profile feedback) are not
10872 accounted into the unit size.
10873
10874 ipa-cp-unit-growth
10875 Specifies maximal overall growth of the compilation unit caused
10876 by interprocedural constant propagation. For example,
10877 parameter value 10 limits unit growth to 1.1 times the original
10878 size.
10879
10880 ipa-cp-large-unit-insns
10881 The size of translation unit that IPA-CP pass considers large.
10882
10883 large-stack-frame
10884 The limit specifying large stack frames. While inlining the
10885 algorithm is trying to not grow past this limit too much.
10886
10887 large-stack-frame-growth
10888 Specifies maximal growth of large stack frames caused by
10889 inlining in percents. For example, parameter value 1000 limits
10890 large stack frame growth to 11 times the original size.
10891
10892 max-inline-insns-recursive
10893 max-inline-insns-recursive-auto
10894 Specifies the maximum number of instructions an out-of-line
10895 copy of a self-recursive inline function can grow into by
10896 performing recursive inlining.
10897
10898 --param max-inline-insns-recursive applies to functions
10899 declared inline. For functions not declared inline, recursive
10900 inlining happens only when -finline-functions (included in -O3)
10901 is enabled; --param max-inline-insns-recursive-auto applies
10902 instead.
10903
10904 max-inline-recursive-depth
10905 max-inline-recursive-depth-auto
10906 Specifies the maximum recursion depth used for recursive
10907 inlining.
10908
10909 --param max-inline-recursive-depth applies to functions
10910 declared inline. For functions not declared inline, recursive
10911 inlining happens only when -finline-functions (included in -O3)
10912 is enabled; --param max-inline-recursive-depth-auto applies
10913 instead.
10914
10915 min-inline-recursive-probability
10916 Recursive inlining is profitable only for function having deep
10917 recursion in average and can hurt for function having little
10918 recursion depth by increasing the prologue size or complexity
10919 of function body to other optimizers.
10920
10921 When profile feedback is available (see -fprofile-generate) the
10922 actual recursion depth can be guessed from the probability that
10923 function recurses via a given call expression. This parameter
10924 limits inlining only to call expressions whose probability
10925 exceeds the given threshold (in percents).
10926
10927 early-inlining-insns
10928 Specify growth that the early inliner can make. In effect it
10929 increases the amount of inlining for code having a large
10930 abstraction penalty.
10931
10932 max-early-inliner-iterations
10933 Limit of iterations of the early inliner. This basically
10934 bounds the number of nested indirect calls the early inliner
10935 can resolve. Deeper chains are still handled by late inlining.
10936
10937 comdat-sharing-probability
10938 Probability (in percent) that C++ inline function with comdat
10939 visibility are shared across multiple compilation units.
10940
10941 modref-max-bases
10942 modref-max-refs
10943 modref-max-accesses
10944 Specifies the maximal number of base pointers, references and
10945 accesses stored for a single function by mod/ref analysis.
10946
10947 modref-max-tests
10948 Specifies the maxmal number of tests alias oracle can perform
10949 to disambiguate memory locations using the mod/ref information.
10950 This parameter ought to be bigger than --param modref-max-bases
10951 and --param modref-max-refs.
10952
10953 modref-max-depth
10954 Specifies the maximum depth of DFS walk used by modref escape
10955 analysis. Setting to 0 disables the analysis completely.
10956
10957 modref-max-escape-points
10958 Specifies the maximum number of escape points tracked by modref
10959 per SSA-name.
10960
10961 profile-func-internal-id
10962 A parameter to control whether to use function internal id in
10963 profile database lookup. If the value is 0, the compiler uses
10964 an id that is based on function assembler name and filename,
10965 which makes old profile data more tolerant to source changes
10966 such as function reordering etc.
10967
10968 min-vect-loop-bound
10969 The minimum number of iterations under which loops are not
10970 vectorized when -ftree-vectorize is used. The number of
10971 iterations after vectorization needs to be greater than the
10972 value specified by this option to allow vectorization.
10973
10974 gcse-cost-distance-ratio
10975 Scaling factor in calculation of maximum distance an expression
10976 can be moved by GCSE optimizations. This is currently
10977 supported only in the code hoisting pass. The bigger the
10978 ratio, the more aggressive code hoisting is with simple
10979 expressions, i.e., the expressions that have cost less than
10980 gcse-unrestricted-cost. Specifying 0 disables hoisting of
10981 simple expressions.
10982
10983 gcse-unrestricted-cost
10984 Cost, roughly measured as the cost of a single typical machine
10985 instruction, at which GCSE optimizations do not constrain the
10986 distance an expression can travel. This is currently supported
10987 only in the code hoisting pass. The lesser the cost, the more
10988 aggressive code hoisting is. Specifying 0 allows all
10989 expressions to travel unrestricted distances.
10990
10991 max-hoist-depth
10992 The depth of search in the dominator tree for expressions to
10993 hoist. This is used to avoid quadratic behavior in hoisting
10994 algorithm. The value of 0 does not limit on the search, but
10995 may slow down compilation of huge functions.
10996
10997 max-tail-merge-comparisons
10998 The maximum amount of similar bbs to compare a bb with. This
10999 is used to avoid quadratic behavior in tree tail merging.
11000
11001 max-tail-merge-iterations
11002 The maximum amount of iterations of the pass over the function.
11003 This is used to limit compilation time in tree tail merging.
11004
11005 store-merging-allow-unaligned
11006 Allow the store merging pass to introduce unaligned stores if
11007 it is legal to do so.
11008
11009 max-stores-to-merge
11010 The maximum number of stores to attempt to merge into wider
11011 stores in the store merging pass.
11012
11013 max-store-chains-to-track
11014 The maximum number of store chains to track at the same time in
11015 the attempt to merge them into wider stores in the store
11016 merging pass.
11017
11018 max-stores-to-track
11019 The maximum number of stores to track at the same time in the
11020 attemt to to merge them into wider stores in the store merging
11021 pass.
11022
11023 max-unrolled-insns
11024 The maximum number of instructions that a loop may have to be
11025 unrolled. If a loop is unrolled, this parameter also
11026 determines how many times the loop code is unrolled.
11027
11028 max-average-unrolled-insns
11029 The maximum number of instructions biased by probabilities of
11030 their execution that a loop may have to be unrolled. If a loop
11031 is unrolled, this parameter also determines how many times the
11032 loop code is unrolled.
11033
11034 max-unroll-times
11035 The maximum number of unrollings of a single loop.
11036
11037 max-peeled-insns
11038 The maximum number of instructions that a loop may have to be
11039 peeled. If a loop is peeled, this parameter also determines
11040 how many times the loop code is peeled.
11041
11042 max-peel-times
11043 The maximum number of peelings of a single loop.
11044
11045 max-peel-branches
11046 The maximum number of branches on the hot path through the
11047 peeled sequence.
11048
11049 max-completely-peeled-insns
11050 The maximum number of insns of a completely peeled loop.
11051
11052 max-completely-peel-times
11053 The maximum number of iterations of a loop to be suitable for
11054 complete peeling.
11055
11056 max-completely-peel-loop-nest-depth
11057 The maximum depth of a loop nest suitable for complete peeling.
11058
11059 max-unswitch-insns
11060 The maximum number of insns of an unswitched loop.
11061
11062 max-unswitch-level
11063 The maximum number of branches unswitched in a single loop.
11064
11065 lim-expensive
11066 The minimum cost of an expensive expression in the loop
11067 invariant motion.
11068
11069 min-loop-cond-split-prob
11070 When FDO profile information is available, min-loop-cond-split-
11071 prob specifies minimum threshold for probability of semi-
11072 invariant condition statement to trigger loop split.
11073
11074 iv-consider-all-candidates-bound
11075 Bound on number of candidates for induction variables, below
11076 which all candidates are considered for each use in induction
11077 variable optimizations. If there are more candidates than
11078 this, only the most relevant ones are considered to avoid
11079 quadratic time complexity.
11080
11081 iv-max-considered-uses
11082 The induction variable optimizations give up on loops that
11083 contain more induction variable uses.
11084
11085 iv-always-prune-cand-set-bound
11086 If the number of candidates in the set is smaller than this
11087 value, always try to remove unnecessary ivs from the set when
11088 adding a new one.
11089
11090 avg-loop-niter
11091 Average number of iterations of a loop.
11092
11093 dse-max-object-size
11094 Maximum size (in bytes) of objects tracked bytewise by dead
11095 store elimination. Larger values may result in larger
11096 compilation times.
11097
11098 dse-max-alias-queries-per-store
11099 Maximum number of queries into the alias oracle per store.
11100 Larger values result in larger compilation times and may result
11101 in more removed dead stores.
11102
11103 scev-max-expr-size
11104 Bound on size of expressions used in the scalar evolutions
11105 analyzer. Large expressions slow the analyzer.
11106
11107 scev-max-expr-complexity
11108 Bound on the complexity of the expressions in the scalar
11109 evolutions analyzer. Complex expressions slow the analyzer.
11110
11111 max-tree-if-conversion-phi-args
11112 Maximum number of arguments in a PHI supported by TREE if
11113 conversion unless the loop is marked with simd pragma.
11114
11115 vect-max-version-for-alignment-checks
11116 The maximum number of run-time checks that can be performed
11117 when doing loop versioning for alignment in the vectorizer.
11118
11119 vect-max-version-for-alias-checks
11120 The maximum number of run-time checks that can be performed
11121 when doing loop versioning for alias in the vectorizer.
11122
11123 vect-max-peeling-for-alignment
11124 The maximum number of loop peels to enhance access alignment
11125 for vectorizer. Value -1 means no limit.
11126
11127 max-iterations-to-track
11128 The maximum number of iterations of a loop the brute-force
11129 algorithm for analysis of the number of iterations of the loop
11130 tries to evaluate.
11131
11132 hot-bb-count-fraction
11133 The denominator n of fraction 1/n of the maximal execution
11134 count of a basic block in the entire program that a basic block
11135 needs to at least have in order to be considered hot. The
11136 default is 10000, which means that a basic block is considered
11137 hot if its execution count is greater than 1/10000 of the
11138 maximal execution count. 0 means that it is never considered
11139 hot. Used in non-LTO mode.
11140
11141 hot-bb-count-ws-permille
11142 The number of most executed permilles, ranging from 0 to 1000,
11143 of the profiled execution of the entire program to which the
11144 execution count of a basic block must be part of in order to be
11145 considered hot. The default is 990, which means that a basic
11146 block is considered hot if its execution count contributes to
11147 the upper 990 permilles, or 99.0%, of the profiled execution of
11148 the entire program. 0 means that it is never considered hot.
11149 Used in LTO mode.
11150
11151 hot-bb-frequency-fraction
11152 The denominator n of fraction 1/n of the execution frequency of
11153 the entry block of a function that a basic block of this
11154 function needs to at least have in order to be considered hot.
11155 The default is 1000, which means that a basic block is
11156 considered hot in a function if it is executed more frequently
11157 than 1/1000 of the frequency of the entry block of the
11158 function. 0 means that it is never considered hot.
11159
11160 unlikely-bb-count-fraction
11161 The denominator n of fraction 1/n of the number of profiled
11162 runs of the entire program below which the execution count of a
11163 basic block must be in order for the basic block to be
11164 considered unlikely executed. The default is 20, which means
11165 that a basic block is considered unlikely executed if it is
11166 executed in fewer than 1/20, or 5%, of the runs of the program.
11167 0 means that it is always considered unlikely executed.
11168
11169 max-predicted-iterations
11170 The maximum number of loop iterations we predict statically.
11171 This is useful in cases where a function contains a single loop
11172 with known bound and another loop with unknown bound. The
11173 known number of iterations is predicted correctly, while the
11174 unknown number of iterations average to roughly 10. This means
11175 that the loop without bounds appears artificially cold relative
11176 to the other one.
11177
11178 builtin-expect-probability
11179 Control the probability of the expression having the specified
11180 value. This parameter takes a percentage (i.e. 0 ... 100) as
11181 input.
11182
11183 builtin-string-cmp-inline-length
11184 The maximum length of a constant string for a builtin string
11185 cmp call eligible for inlining.
11186
11187 align-threshold
11188 Select fraction of the maximal frequency of executions of a
11189 basic block in a function to align the basic block.
11190
11191 align-loop-iterations
11192 A loop expected to iterate at least the selected number of
11193 iterations is aligned.
11194
11195 tracer-dynamic-coverage
11196 tracer-dynamic-coverage-feedback
11197 This value is used to limit superblock formation once the given
11198 percentage of executed instructions is covered. This limits
11199 unnecessary code size expansion.
11200
11201 The tracer-dynamic-coverage-feedback parameter is used only
11202 when profile feedback is available. The real profiles (as
11203 opposed to statically estimated ones) are much less balanced
11204 allowing the threshold to be larger value.
11205
11206 tracer-max-code-growth
11207 Stop tail duplication once code growth has reached given
11208 percentage. This is a rather artificial limit, as most of the
11209 duplicates are eliminated later in cross jumping, so it may be
11210 set to much higher values than is the desired code growth.
11211
11212 tracer-min-branch-ratio
11213 Stop reverse growth when the reverse probability of best edge
11214 is less than this threshold (in percent).
11215
11216 tracer-min-branch-probability
11217 tracer-min-branch-probability-feedback
11218 Stop forward growth if the best edge has probability lower than
11219 this threshold.
11220
11221 Similarly to tracer-dynamic-coverage two parameters are
11222 provided. tracer-min-branch-probability-feedback is used for
11223 compilation with profile feedback and tracer-min-branch-
11224 probability compilation without. The value for compilation
11225 with profile feedback needs to be more conservative (higher) in
11226 order to make tracer effective.
11227
11228 stack-clash-protection-guard-size
11229 Specify the size of the operating system provided stack guard
11230 as 2 raised to num bytes. Higher values may reduce the number
11231 of explicit probes, but a value larger than the operating
11232 system provided guard will leave code vulnerable to stack clash
11233 style attacks.
11234
11235 stack-clash-protection-probe-interval
11236 Stack clash protection involves probing stack space as it is
11237 allocated. This param controls the maximum distance between
11238 probes into the stack as 2 raised to num bytes. Higher values
11239 may reduce the number of explicit probes, but a value larger
11240 than the operating system provided guard will leave code
11241 vulnerable to stack clash style attacks.
11242
11243 max-cse-path-length
11244 The maximum number of basic blocks on path that CSE considers.
11245
11246 max-cse-insns
11247 The maximum number of instructions CSE processes before
11248 flushing.
11249
11250 ggc-min-expand
11251 GCC uses a garbage collector to manage its own memory
11252 allocation. This parameter specifies the minimum percentage by
11253 which the garbage collector's heap should be allowed to expand
11254 between collections. Tuning this may improve compilation
11255 speed; it has no effect on code generation.
11256
11257 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11258 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11259 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11260 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11261 particular platform, the lower bound of 30% is used. Setting
11262 this parameter and ggc-min-heapsize to zero causes a full
11263 collection to occur at every opportunity. This is extremely
11264 slow, but can be useful for debugging.
11265
11266 ggc-min-heapsize
11267 Minimum size of the garbage collector's heap before it begins
11268 bothering to collect garbage. The first collection occurs
11269 after the heap expands by ggc-min-expand% beyond ggc-min-
11270 heapsize. Again, tuning this may improve compilation speed,
11271 and has no effect on code generation.
11272
11273 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11274 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11275 exceeded, but with a lower bound of 4096 (four megabytes) and
11276 an upper bound of 131072 (128 megabytes). If GCC is not able
11277 to calculate RAM on a particular platform, the lower bound is
11278 used. Setting this parameter very large effectively disables
11279 garbage collection. Setting this parameter and ggc-min-expand
11280 to zero causes a full collection to occur at every opportunity.
11281
11282 max-reload-search-insns
11283 The maximum number of instruction reload should look backward
11284 for equivalent register. Increasing values mean more
11285 aggressive optimization, making the compilation time increase
11286 with probably slightly better performance.
11287
11288 max-cselib-memory-locations
11289 The maximum number of memory locations cselib should take into
11290 account. Increasing values mean more aggressive optimization,
11291 making the compilation time increase with probably slightly
11292 better performance.
11293
11294 max-sched-ready-insns
11295 The maximum number of instructions ready to be issued the
11296 scheduler should consider at any given time during the first
11297 scheduling pass. Increasing values mean more thorough
11298 searches, making the compilation time increase with probably
11299 little benefit.
11300
11301 max-sched-region-blocks
11302 The maximum number of blocks in a region to be considered for
11303 interblock scheduling.
11304
11305 max-pipeline-region-blocks
11306 The maximum number of blocks in a region to be considered for
11307 pipelining in the selective scheduler.
11308
11309 max-sched-region-insns
11310 The maximum number of insns in a region to be considered for
11311 interblock scheduling.
11312
11313 max-pipeline-region-insns
11314 The maximum number of insns in a region to be considered for
11315 pipelining in the selective scheduler.
11316
11317 min-spec-prob
11318 The minimum probability (in percents) of reaching a source
11319 block for interblock speculative scheduling.
11320
11321 max-sched-extend-regions-iters
11322 The maximum number of iterations through CFG to extend regions.
11323 A value of 0 disables region extensions.
11324
11325 max-sched-insn-conflict-delay
11326 The maximum conflict delay for an insn to be considered for
11327 speculative motion.
11328
11329 sched-spec-prob-cutoff
11330 The minimal probability of speculation success (in percents),
11331 so that speculative insns are scheduled.
11332
11333 sched-state-edge-prob-cutoff
11334 The minimum probability an edge must have for the scheduler to
11335 save its state across it.
11336
11337 sched-mem-true-dep-cost
11338 Minimal distance (in CPU cycles) between store and load
11339 targeting same memory locations.
11340
11341 selsched-max-lookahead
11342 The maximum size of the lookahead window of selective
11343 scheduling. It is a depth of search for available
11344 instructions.
11345
11346 selsched-max-sched-times
11347 The maximum number of times that an instruction is scheduled
11348 during selective scheduling. This is the limit on the number
11349 of iterations through which the instruction may be pipelined.
11350
11351 selsched-insns-to-rename
11352 The maximum number of best instructions in the ready list that
11353 are considered for renaming in the selective scheduler.
11354
11355 sms-min-sc
11356 The minimum value of stage count that swing modulo scheduler
11357 generates.
11358
11359 max-last-value-rtl
11360 The maximum size measured as number of RTLs that can be
11361 recorded in an expression in combiner for a pseudo register as
11362 last known value of that register.
11363
11364 max-combine-insns
11365 The maximum number of instructions the RTL combiner tries to
11366 combine.
11367
11368 integer-share-limit
11369 Small integer constants can use a shared data structure,
11370 reducing the compiler's memory usage and increasing its speed.
11371 This sets the maximum value of a shared integer constant.
11372
11373 ssp-buffer-size
11374 The minimum size of buffers (i.e. arrays) that receive stack
11375 smashing protection when -fstack-protection is used.
11376
11377 min-size-for-stack-sharing
11378 The minimum size of variables taking part in stack slot sharing
11379 when not optimizing.
11380
11381 max-jump-thread-duplication-stmts
11382 Maximum number of statements allowed in a block that needs to
11383 be duplicated when threading jumps.
11384
11385 max-fields-for-field-sensitive
11386 Maximum number of fields in a structure treated in a field
11387 sensitive manner during pointer analysis.
11388
11389 prefetch-latency
11390 Estimate on average number of instructions that are executed
11391 before prefetch finishes. The distance prefetched ahead is
11392 proportional to this constant. Increasing this number may also
11393 lead to less streams being prefetched (see simultaneous-
11394 prefetches).
11395
11396 simultaneous-prefetches
11397 Maximum number of prefetches that can run at the same time.
11398
11399 l1-cache-line-size
11400 The size of cache line in L1 data cache, in bytes.
11401
11402 l1-cache-size
11403 The size of L1 data cache, in kilobytes.
11404
11405 l2-cache-size
11406 The size of L2 data cache, in kilobytes.
11407
11408 prefetch-dynamic-strides
11409 Whether the loop array prefetch pass should issue software
11410 prefetch hints for strides that are non-constant. In some
11411 cases this may be beneficial, though the fact the stride is
11412 non-constant may make it hard to predict when there is clear
11413 benefit to issuing these hints.
11414
11415 Set to 1 if the prefetch hints should be issued for non-
11416 constant strides. Set to 0 if prefetch hints should be issued
11417 only for strides that are known to be constant and below
11418 prefetch-minimum-stride.
11419
11420 prefetch-minimum-stride
11421 Minimum constant stride, in bytes, to start using prefetch
11422 hints for. If the stride is less than this threshold, prefetch
11423 hints will not be issued.
11424
11425 This setting is useful for processors that have hardware
11426 prefetchers, in which case there may be conflicts between the
11427 hardware prefetchers and the software prefetchers. If the
11428 hardware prefetchers have a maximum stride they can handle, it
11429 should be used here to improve the use of software prefetchers.
11430
11431 A value of -1 means we don't have a threshold and therefore
11432 prefetch hints can be issued for any constant stride.
11433
11434 This setting is only useful for strides that are known and
11435 constant.
11436
11437 loop-interchange-max-num-stmts
11438 The maximum number of stmts in a loop to be interchanged.
11439
11440 loop-interchange-stride-ratio
11441 The minimum ratio between stride of two loops for interchange
11442 to be profitable.
11443
11444 min-insn-to-prefetch-ratio
11445 The minimum ratio between the number of instructions and the
11446 number of prefetches to enable prefetching in a loop.
11447
11448 prefetch-min-insn-to-mem-ratio
11449 The minimum ratio between the number of instructions and the
11450 number of memory references to enable prefetching in a loop.
11451
11452 use-canonical-types
11453 Whether the compiler should use the "canonical" type system.
11454 Should always be 1, which uses a more efficient internal
11455 mechanism for comparing types in C++ and Objective-C++.
11456 However, if bugs in the canonical type system are causing
11457 compilation failures, set this value to 0 to disable canonical
11458 types.
11459
11460 switch-conversion-max-branch-ratio
11461 Switch initialization conversion refuses to create arrays that
11462 are bigger than switch-conversion-max-branch-ratio times the
11463 number of branches in the switch.
11464
11465 max-partial-antic-length
11466 Maximum length of the partial antic set computed during the
11467 tree partial redundancy elimination optimization (-ftree-pre)
11468 when optimizing at -O3 and above. For some sorts of source
11469 code the enhanced partial redundancy elimination optimization
11470 can run away, consuming all of the memory available on the host
11471 machine. This parameter sets a limit on the length of the sets
11472 that are computed, which prevents the runaway behavior.
11473 Setting a value of 0 for this parameter allows an unlimited set
11474 length.
11475
11476 rpo-vn-max-loop-depth
11477 Maximum loop depth that is value-numbered optimistically. When
11478 the limit hits the innermost rpo-vn-max-loop-depth loops and
11479 the outermost loop in the loop nest are value-numbered
11480 optimistically and the remaining ones not.
11481
11482 sccvn-max-alias-queries-per-access
11483 Maximum number of alias-oracle queries we perform when looking
11484 for redundancies for loads and stores. If this limit is hit
11485 the search is aborted and the load or store is not considered
11486 redundant. The number of queries is algorithmically limited to
11487 the number of stores on all paths from the load to the function
11488 entry.
11489
11490 ira-max-loops-num
11491 IRA uses regional register allocation by default. If a
11492 function contains more loops than the number given by this
11493 parameter, only at most the given number of the most
11494 frequently-executed loops form regions for regional register
11495 allocation.
11496
11497 ira-max-conflict-table-size
11498 Although IRA uses a sophisticated algorithm to compress the
11499 conflict table, the table can still require excessive amounts
11500 of memory for huge functions. If the conflict table for a
11501 function could be more than the size in MB given by this
11502 parameter, the register allocator instead uses a faster,
11503 simpler, and lower-quality algorithm that does not require
11504 building a pseudo-register conflict table.
11505
11506 ira-loop-reserved-regs
11507 IRA can be used to evaluate more accurate register pressure in
11508 loops for decisions to move loop invariants (see -O3). The
11509 number of available registers reserved for some other purposes
11510 is given by this parameter. Default of the parameter is the
11511 best found from numerous experiments.
11512
11513 lra-inheritance-ebb-probability-cutoff
11514 LRA tries to reuse values reloaded in registers in subsequent
11515 insns. This optimization is called inheritance. EBB is used
11516 as a region to do this optimization. The parameter defines a
11517 minimal fall-through edge probability in percentage used to add
11518 BB to inheritance EBB in LRA. The default value was chosen
11519 from numerous runs of SPEC2000 on x86-64.
11520
11521 loop-invariant-max-bbs-in-loop
11522 Loop invariant motion can be very expensive, both in
11523 compilation time and in amount of needed compile-time memory,
11524 with very large loops. Loops with more basic blocks than this
11525 parameter won't have loop invariant motion optimization
11526 performed on them.
11527
11528 loop-max-datarefs-for-datadeps
11529 Building data dependencies is expensive for very large loops.
11530 This parameter limits the number of data references in loops
11531 that are considered for data dependence analysis. These large
11532 loops are no handled by the optimizations using loop data
11533 dependencies.
11534
11535 max-vartrack-size
11536 Sets a maximum number of hash table slots to use during
11537 variable tracking dataflow analysis of any function. If this
11538 limit is exceeded with variable tracking at assignments
11539 enabled, analysis for that function is retried without it,
11540 after removing all debug insns from the function. If the limit
11541 is exceeded even without debug insns, var tracking analysis is
11542 completely disabled for the function. Setting the parameter to
11543 zero makes it unlimited.
11544
11545 max-vartrack-expr-depth
11546 Sets a maximum number of recursion levels when attempting to
11547 map variable names or debug temporaries to value expressions.
11548 This trades compilation time for more complete debug
11549 information. If this is set too low, value expressions that
11550 are available and could be represented in debug information may
11551 end up not being used; setting this higher may enable the
11552 compiler to find more complex debug expressions, but compile
11553 time and memory use may grow.
11554
11555 max-debug-marker-count
11556 Sets a threshold on the number of debug markers (e.g. begin
11557 stmt markers) to avoid complexity explosion at inlining or
11558 expanding to RTL. If a function has more such gimple stmts
11559 than the set limit, such stmts will be dropped from the inlined
11560 copy of a function, and from its RTL expansion.
11561
11562 min-nondebug-insn-uid
11563 Use uids starting at this parameter for nondebug insns. The
11564 range below the parameter is reserved exclusively for debug
11565 insns created by -fvar-tracking-assignments, but debug insns
11566 may get (non-overlapping) uids above it if the reserved range
11567 is exhausted.
11568
11569 ipa-sra-ptr-growth-factor
11570 IPA-SRA replaces a pointer to an aggregate with one or more new
11571 parameters only when their cumulative size is less or equal to
11572 ipa-sra-ptr-growth-factor times the size of the original
11573 pointer parameter.
11574
11575 ipa-sra-max-replacements
11576 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11577 consequence, it is also the maximum number of replacements of a
11578 formal parameter.
11579
11580 sra-max-scalarization-size-Ospeed
11581 sra-max-scalarization-size-Osize
11582 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
11583 aim to replace scalar parts of aggregates with uses of
11584 independent scalar variables. These parameters control the
11585 maximum size, in storage units, of aggregate which is
11586 considered for replacement when compiling for speed (sra-max-
11587 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
11588 Osize) respectively.
11589
11590 sra-max-propagations
11591 The maximum number of artificial accesses that Scalar
11592 Replacement of Aggregates (SRA) will track, per one local
11593 variable, in order to facilitate copy propagation.
11594
11595 tm-max-aggregate-size
11596 When making copies of thread-local variables in a transaction,
11597 this parameter specifies the size in bytes after which
11598 variables are saved with the logging functions as opposed to
11599 save/restore code sequence pairs. This option only applies
11600 when using -fgnu-tm.
11601
11602 graphite-max-nb-scop-params
11603 To avoid exponential effects in the Graphite loop transforms,
11604 the number of parameters in a Static Control Part (SCoP) is
11605 bounded. A value of zero can be used to lift the bound. A
11606 variable whose value is unknown at compilation time and defined
11607 outside a SCoP is a parameter of the SCoP.
11608
11609 loop-block-tile-size
11610 Loop blocking or strip mining transforms, enabled with
11611 -floop-block or -floop-strip-mine, strip mine each loop in the
11612 loop nest by a given number of iterations. The strip length
11613 can be changed using the loop-block-tile-size parameter.
11614
11615 ipa-jump-function-lookups
11616 Specifies number of statements visited during jump function
11617 offset discovery.
11618
11619 ipa-cp-value-list-size
11620 IPA-CP attempts to track all possible values and types passed
11621 to a function's parameter in order to propagate them and
11622 perform devirtualization. ipa-cp-value-list-size is the
11623 maximum number of values and types it stores per one formal
11624 parameter of a function.
11625
11626 ipa-cp-eval-threshold
11627 IPA-CP calculates its own score of cloning profitability
11628 heuristics and performs those cloning opportunities with scores
11629 that exceed ipa-cp-eval-threshold.
11630
11631 ipa-cp-max-recursive-depth
11632 Maximum depth of recursive cloning for self-recursive function.
11633
11634 ipa-cp-min-recursive-probability
11635 Recursive cloning only when the probability of call being
11636 executed exceeds the parameter.
11637
11638 ipa-cp-recursion-penalty
11639 Percentage penalty the recursive functions will receive when
11640 they are evaluated for cloning.
11641
11642 ipa-cp-single-call-penalty
11643 Percentage penalty functions containing a single call to
11644 another function will receive when they are evaluated for
11645 cloning.
11646
11647 ipa-max-agg-items
11648 IPA-CP is also capable to propagate a number of scalar values
11649 passed in an aggregate. ipa-max-agg-items controls the maximum
11650 number of such values per one parameter.
11651
11652 ipa-cp-loop-hint-bonus
11653 When IPA-CP determines that a cloning candidate would make the
11654 number of iterations of a loop known, it adds a bonus of ipa-
11655 cp-loop-hint-bonus to the profitability score of the candidate.
11656
11657 ipa-max-loop-predicates
11658 The maximum number of different predicates IPA will use to
11659 describe when loops in a function have known properties.
11660
11661 ipa-max-aa-steps
11662 During its analysis of function bodies, IPA-CP employs alias
11663 analysis in order to track values pointed to by function
11664 parameters. In order not spend too much time analyzing huge
11665 functions, it gives up and consider all memory clobbered after
11666 examining ipa-max-aa-steps statements modifying memory.
11667
11668 ipa-max-switch-predicate-bounds
11669 Maximal number of boundary endpoints of case ranges of switch
11670 statement. For switch exceeding this limit, IPA-CP will not
11671 construct cloning cost predicate, which is used to estimate
11672 cloning benefit, for default case of the switch statement.
11673
11674 ipa-max-param-expr-ops
11675 IPA-CP will analyze conditional statement that references some
11676 function parameter to estimate benefit for cloning upon certain
11677 constant value. But if number of operations in a parameter
11678 expression exceeds ipa-max-param-expr-ops, the expression is
11679 treated as complicated one, and is not handled by IPA analysis.
11680
11681 lto-partitions
11682 Specify desired number of partitions produced during WHOPR
11683 compilation. The number of partitions should exceed the number
11684 of CPUs used for compilation.
11685
11686 lto-min-partition
11687 Size of minimal partition for WHOPR (in estimated
11688 instructions). This prevents expenses of splitting very small
11689 programs into too many partitions.
11690
11691 lto-max-partition
11692 Size of max partition for WHOPR (in estimated instructions).
11693 to provide an upper bound for individual size of partition.
11694 Meant to be used only with balanced partitioning.
11695
11696 lto-max-streaming-parallelism
11697 Maximal number of parallel processes used for LTO streaming.
11698
11699 cxx-max-namespaces-for-diagnostic-help
11700 The maximum number of namespaces to consult for suggestions
11701 when C++ name lookup fails for an identifier.
11702
11703 sink-frequency-threshold
11704 The maximum relative execution frequency (in percents) of the
11705 target block relative to a statement's original block to allow
11706 statement sinking of a statement. Larger numbers result in
11707 more aggressive statement sinking. A small positive adjustment
11708 is applied for statements with memory operands as those are
11709 even more profitable so sink.
11710
11711 max-stores-to-sink
11712 The maximum number of conditional store pairs that can be sunk.
11713 Set to 0 if either vectorization (-ftree-vectorize) or if-
11714 conversion (-ftree-loop-if-convert) is disabled.
11715
11716 case-values-threshold
11717 The smallest number of different values for which it is best to
11718 use a jump-table instead of a tree of conditional branches. If
11719 the value is 0, use the default for the machine.
11720
11721 jump-table-max-growth-ratio-for-size
11722 The maximum code size growth ratio when expanding into a jump
11723 table (in percent). The parameter is used when optimizing for
11724 size.
11725
11726 jump-table-max-growth-ratio-for-speed
11727 The maximum code size growth ratio when expanding into a jump
11728 table (in percent). The parameter is used when optimizing for
11729 speed.
11730
11731 tree-reassoc-width
11732 Set the maximum number of instructions executed in parallel in
11733 reassociated tree. This parameter overrides target dependent
11734 heuristics used by default if has non zero value.
11735
11736 sched-pressure-algorithm
11737 Choose between the two available implementations of
11738 -fsched-pressure. Algorithm 1 is the original implementation
11739 and is the more likely to prevent instructions from being
11740 reordered. Algorithm 2 was designed to be a compromise between
11741 the relatively conservative approach taken by algorithm 1 and
11742 the rather aggressive approach taken by the default scheduler.
11743 It relies more heavily on having a regular register file and
11744 accurate register pressure classes. See haifa-sched.c in the
11745 GCC sources for more details.
11746
11747 The default choice depends on the target.
11748
11749 max-slsr-cand-scan
11750 Set the maximum number of existing candidates that are
11751 considered when seeking a basis for a new straight-line
11752 strength reduction candidate.
11753
11754 asan-globals
11755 Enable buffer overflow detection for global objects. This kind
11756 of protection is enabled by default if you are using
11757 -fsanitize=address option. To disable global objects
11758 protection use --param asan-globals=0.
11759
11760 asan-stack
11761 Enable buffer overflow detection for stack objects. This kind
11762 of protection is enabled by default when using
11763 -fsanitize=address. To disable stack protection use --param
11764 asan-stack=0 option.
11765
11766 asan-instrument-reads
11767 Enable buffer overflow detection for memory reads. This kind
11768 of protection is enabled by default when using
11769 -fsanitize=address. To disable memory reads protection use
11770 --param asan-instrument-reads=0.
11771
11772 asan-instrument-writes
11773 Enable buffer overflow detection for memory writes. This kind
11774 of protection is enabled by default when using
11775 -fsanitize=address. To disable memory writes protection use
11776 --param asan-instrument-writes=0 option.
11777
11778 asan-memintrin
11779 Enable detection for built-in functions. This kind of
11780 protection is enabled by default when using -fsanitize=address.
11781 To disable built-in functions protection use --param
11782 asan-memintrin=0.
11783
11784 asan-use-after-return
11785 Enable detection of use-after-return. This kind of protection
11786 is enabled by default when using the -fsanitize=address option.
11787 To disable it use --param asan-use-after-return=0.
11788
11789 Note: By default the check is disabled at run time. To enable
11790 it, add "detect_stack_use_after_return=1" to the environment
11791 variable ASAN_OPTIONS.
11792
11793 asan-instrumentation-with-call-threshold
11794 If number of memory accesses in function being instrumented is
11795 greater or equal to this number, use callbacks instead of
11796 inline checks. E.g. to disable inline code use --param
11797 asan-instrumentation-with-call-threshold=0.
11798
11799 hwasan-instrument-stack
11800 Enable hwasan instrumentation of statically sized stack-
11801 allocated variables. This kind of instrumentation is enabled
11802 by default when using -fsanitize=hwaddress and disabled by
11803 default when using -fsanitize=kernel-hwaddress. To disable
11804 stack instrumentation use --param hwasan-instrument-stack=0,
11805 and to enable it use --param hwasan-instrument-stack=1.
11806
11807 hwasan-random-frame-tag
11808 When using stack instrumentation, decide tags for stack
11809 variables using a deterministic sequence beginning at a random
11810 tag for each frame. With this parameter unset tags are chosen
11811 using the same sequence but beginning from 1. This is enabled
11812 by default for -fsanitize=hwaddress and unavailable for
11813 -fsanitize=kernel-hwaddress. To disable it use --param
11814 hwasan-random-frame-tag=0.
11815
11816 hwasan-instrument-allocas
11817 Enable hwasan instrumentation of dynamically sized stack-
11818 allocated variables. This kind of instrumentation is enabled
11819 by default when using -fsanitize=hwaddress and disabled by
11820 default when using -fsanitize=kernel-hwaddress. To disable
11821 instrumentation of such variables use --param
11822 hwasan-instrument-allocas=0, and to enable it use --param
11823 hwasan-instrument-allocas=1.
11824
11825 hwasan-instrument-reads
11826 Enable hwasan checks on memory reads. Instrumentation of reads
11827 is enabled by default for both -fsanitize=hwaddress and
11828 -fsanitize=kernel-hwaddress. To disable checking memory reads
11829 use --param hwasan-instrument-reads=0.
11830
11831 hwasan-instrument-writes
11832 Enable hwasan checks on memory writes. Instrumentation of
11833 writes is enabled by default for both -fsanitize=hwaddress and
11834 -fsanitize=kernel-hwaddress. To disable checking memory writes
11835 use --param hwasan-instrument-writes=0.
11836
11837 hwasan-instrument-mem-intrinsics
11838 Enable hwasan instrumentation of builtin functions.
11839 Instrumentation of these builtin functions is enabled by
11840 default for both -fsanitize=hwaddress and
11841 -fsanitize=kernel-hwaddress. To disable instrumentation of
11842 builtin functions use --param
11843 hwasan-instrument-mem-intrinsics=0.
11844
11845 use-after-scope-direct-emission-threshold
11846 If the size of a local variable in bytes is smaller or equal to
11847 this number, directly poison (or unpoison) shadow memory
11848 instead of using run-time callbacks.
11849
11850 tsan-distinguish-volatile
11851 Emit special instrumentation for accesses to volatiles.
11852
11853 tsan-instrument-func-entry-exit
11854 Emit instrumentation calls to __tsan_func_entry() and
11855 __tsan_func_exit().
11856
11857 max-fsm-thread-path-insns
11858 Maximum number of instructions to copy when duplicating blocks
11859 on a finite state automaton jump thread path.
11860
11861 max-fsm-thread-length
11862 Maximum number of basic blocks on a finite state automaton jump
11863 thread path.
11864
11865 max-fsm-thread-paths
11866 Maximum number of new jump thread paths to create for a finite
11867 state automaton.
11868
11869 parloops-chunk-size
11870 Chunk size of omp schedule for loops parallelized by parloops.
11871
11872 parloops-schedule
11873 Schedule type of omp schedule for loops parallelized by
11874 parloops (static, dynamic, guided, auto, runtime).
11875
11876 parloops-min-per-thread
11877 The minimum number of iterations per thread of an innermost
11878 parallelized loop for which the parallelized variant is
11879 preferred over the single threaded one. Note that for a
11880 parallelized loop nest the minimum number of iterations of the
11881 outermost loop per thread is two.
11882
11883 max-ssa-name-query-depth
11884 Maximum depth of recursion when querying properties of SSA
11885 names in things like fold routines. One level of recursion
11886 corresponds to following a use-def chain.
11887
11888 max-speculative-devirt-maydefs
11889 The maximum number of may-defs we analyze when looking for a
11890 must-def specifying the dynamic type of an object that invokes
11891 a virtual call we may be able to devirtualize speculatively.
11892
11893 max-vrp-switch-assertions
11894 The maximum number of assertions to add along the default edge
11895 of a switch statement during VRP.
11896
11897 evrp-mode
11898 Specifies the mode Early VRP should operate in.
11899
11900 unroll-jam-min-percent
11901 The minimum percentage of memory references that must be
11902 optimized away for the unroll-and-jam transformation to be
11903 considered profitable.
11904
11905 unroll-jam-max-unroll
11906 The maximum number of times the outer loop should be unrolled
11907 by the unroll-and-jam transformation.
11908
11909 max-rtl-if-conversion-unpredictable-cost
11910 Maximum permissible cost for the sequence that would be
11911 generated by the RTL if-conversion pass for a branch that is
11912 considered unpredictable.
11913
11914 max-variable-expansions-in-unroller
11915 If -fvariable-expansion-in-unroller is used, the maximum number
11916 of times that an individual variable will be expanded during
11917 loop unrolling.
11918
11919 tracer-min-branch-probability-feedback
11920 Stop forward growth if the probability of best edge is less
11921 than this threshold (in percent). Used when profile feedback is
11922 available.
11923
11924 partial-inlining-entry-probability
11925 Maximum probability of the entry BB of split region (in percent
11926 relative to entry BB of the function) to make partial inlining
11927 happen.
11928
11929 max-tracked-strlens
11930 Maximum number of strings for which strlen optimization pass
11931 will track string lengths.
11932
11933 gcse-after-reload-partial-fraction
11934 The threshold ratio for performing partial redundancy
11935 elimination after reload.
11936
11937 gcse-after-reload-critical-fraction
11938 The threshold ratio of critical edges execution count that
11939 permit performing redundancy elimination after reload.
11940
11941 max-loop-header-insns
11942 The maximum number of insns in loop header duplicated by the
11943 copy loop headers pass.
11944
11945 vect-epilogues-nomask
11946 Enable loop epilogue vectorization using smaller vector size.
11947
11948 vect-partial-vector-usage
11949 Controls when the loop vectorizer considers using partial
11950 vector loads and stores as an alternative to falling back to
11951 scalar code. 0 stops the vectorizer from ever using partial
11952 vector loads and stores. 1 allows partial vector loads and
11953 stores if vectorization removes the need for the code to
11954 iterate. 2 allows partial vector loads and stores in all
11955 loops. The parameter only has an effect on targets that
11956 support partial vector loads and stores.
11957
11958 avoid-fma-max-bits
11959 Maximum number of bits for which we avoid creating FMAs.
11960
11961 sms-loop-average-count-threshold
11962 A threshold on the average loop count considered by the swing
11963 modulo scheduler.
11964
11965 sms-dfa-history
11966 The number of cycles the swing modulo scheduler considers when
11967 checking conflicts using DFA.
11968
11969 max-inline-insns-recursive-auto
11970 The maximum number of instructions non-inline function can grow
11971 to via recursive inlining.
11972
11973 graphite-allow-codegen-errors
11974 Whether codegen errors should be ICEs when -fchecking.
11975
11976 sms-max-ii-factor
11977 A factor for tuning the upper bound that swing modulo scheduler
11978 uses for scheduling a loop.
11979
11980 lra-max-considered-reload-pseudos
11981 The max number of reload pseudos which are considered during
11982 spilling a non-reload pseudo.
11983
11984 max-pow-sqrt-depth
11985 Maximum depth of sqrt chains to use when synthesizing
11986 exponentiation by a real constant.
11987
11988 max-dse-active-local-stores
11989 Maximum number of active local stores in RTL dead store
11990 elimination.
11991
11992 asan-instrument-allocas
11993 Enable asan allocas/VLAs protection.
11994
11995 max-iterations-computation-cost
11996 Bound on the cost of an expression to compute the number of
11997 iterations.
11998
11999 max-isl-operations
12000 Maximum number of isl operations, 0 means unlimited.
12001
12002 graphite-max-arrays-per-scop
12003 Maximum number of arrays per scop.
12004
12005 max-vartrack-reverse-op-size
12006 Max. size of loc list for which reverse ops should be added.
12007
12008 tracer-dynamic-coverage-feedback
12009 The percentage of function, weighted by execution frequency,
12010 that must be covered by trace formation. Used when profile
12011 feedback is available.
12012
12013 max-inline-recursive-depth-auto
12014 The maximum depth of recursive inlining for non-inline
12015 functions.
12016
12017 fsm-scale-path-stmts
12018 Scale factor to apply to the number of statements in a
12019 threading path when comparing to the number of (scaled) blocks.
12020
12021 fsm-maximum-phi-arguments
12022 Maximum number of arguments a PHI may have before the FSM
12023 threader will not try to thread through its block.
12024
12025 uninit-control-dep-attempts
12026 Maximum number of nested calls to search for control
12027 dependencies during uninitialized variable analysis.
12028
12029 sra-max-scalarization-size-Osize
12030 Maximum size, in storage units, of an aggregate which should be
12031 considered for scalarization when compiling for size.
12032
12033 fsm-scale-path-blocks
12034 Scale factor to apply to the number of blocks in a threading
12035 path when comparing to the number of (scaled) statements.
12036
12037 sched-autopref-queue-depth
12038 Hardware autoprefetcher scheduler model control flag. Number
12039 of lookahead cycles the model looks into; at ' ' only enable
12040 instruction sorting heuristic.
12041
12042 loop-versioning-max-inner-insns
12043 The maximum number of instructions that an inner loop can have
12044 before the loop versioning pass considers it too big to copy.
12045
12046 loop-versioning-max-outer-insns
12047 The maximum number of instructions that an outer loop can have
12048 before the loop versioning pass considers it too big to copy,
12049 discounting any instructions in inner loops that directly
12050 benefit from versioning.
12051
12052 ssa-name-def-chain-limit
12053 The maximum number of SSA_NAME assignments to follow in
12054 determining a property of a variable such as its value. This
12055 limits the number of iterations or recursive calls GCC performs
12056 when optimizing certain statements or when determining their
12057 validity prior to issuing diagnostics.
12058
12059 store-merging-max-size
12060 Maximum size of a single store merging region in bytes.
12061
12062 hash-table-verification-limit
12063 The number of elements for which hash table verification is
12064 done for each searched element.
12065
12066 max-find-base-term-values
12067 Maximum number of VALUEs handled during a single find_base_term
12068 call.
12069
12070 analyzer-max-enodes-per-program-point
12071 The maximum number of exploded nodes per program point within
12072 the analyzer, before terminating analysis of that point.
12073
12074 analyzer-max-constraints
12075 The maximum number of constraints per state.
12076
12077 analyzer-min-snodes-for-call-summary
12078 The minimum number of supernodes within a function for the
12079 analyzer to consider summarizing its effects at call sites.
12080
12081 analyzer-max-enodes-for-full-dump
12082 The maximum depth of exploded nodes that should appear in a dot
12083 dump before switching to a less verbose format.
12084
12085 analyzer-max-recursion-depth
12086 The maximum number of times a callsite can appear in a call
12087 stack within the analyzer, before terminating analysis of a
12088 call that would recurse deeper.
12089
12090 analyzer-max-svalue-depth
12091 The maximum depth of a symbolic value, before approximating the
12092 value as unknown.
12093
12094 analyzer-max-infeasible-edges
12095 The maximum number of infeasible edges to reject before
12096 declaring a diagnostic as infeasible.
12097
12098 gimple-fe-computed-hot-bb-threshold
12099 The number of executions of a basic block which is considered
12100 hot. The parameter is used only in GIMPLE FE.
12101
12102 analyzer-bb-explosion-factor
12103 The maximum number of 'after supernode' exploded nodes within
12104 the analyzer per supernode, before terminating analysis.
12105
12106 ranger-logical-depth
12107 Maximum depth of logical expression evaluation ranger will look
12108 through when evaluating outgoing edge ranges.
12109
12110 openacc-kernels
12111 Specify mode of OpenACC `kernels' constructs handling. With
12112 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12113 are decomposed into parts, a sequence of compute constructs,
12114 each then handled individually. This is work in progress.
12115 With --param=openacc-kernels=parloops, OpenACC `kernels'
12116 constructs are handled by the parloops pass, en bloc. This is
12117 the current default.
12118
12119 The following choices of name are available on AArch64 targets:
12120
12121 aarch64-sve-compare-costs
12122 When vectorizing for SVE, consider using "unpacked" vectors for
12123 smaller elements and use the cost model to pick the cheapest
12124 approach. Also use the cost model to choose between SVE and
12125 Advanced SIMD vectorization.
12126
12127 Using unpacked vectors includes storing smaller elements in
12128 larger containers and accessing elements with extending loads
12129 and truncating stores.
12130
12131 aarch64-float-recp-precision
12132 The number of Newton iterations for calculating the reciprocal
12133 for float type. The precision of division is proportional to
12134 this param when division approximation is enabled. The default
12135 value is 1.
12136
12137 aarch64-double-recp-precision
12138 The number of Newton iterations for calculating the reciprocal
12139 for double type. The precision of division is propotional to
12140 this param when division approximation is enabled. The default
12141 value is 2.
12142
12143 aarch64-autovec-preference
12144 Force an ISA selection strategy for auto-vectorization.
12145 Accepts values from 0 to 4, inclusive.
12146
12147 0 Use the default heuristics.
12148
12149 1 Use only Advanced SIMD for auto-vectorization.
12150
12151 2 Use only SVE for auto-vectorization.
12152
12153 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12154 the costs are deemed equal.
12155
12156 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12157 are deemed equal.
12158
12159 The default value is 0.
12160
12161 aarch64-loop-vect-issue-rate-niters
12162 The tuning for some AArch64 CPUs tries to take both latencies
12163 and issue rates into account when deciding whether a loop
12164 should be vectorized using SVE, vectorized using Advanced SIMD,
12165 or not vectorized at all. If this parameter is set to n, GCC
12166 will not use this heuristic for loops that are known to execute
12167 in fewer than n Advanced SIMD iterations.
12168
12169 Program Instrumentation Options
12170 GCC supports a number of command-line options that control adding run-
12171 time instrumentation to the code it normally generates. For example,
12172 one purpose of instrumentation is collect profiling statistics for use
12173 in finding program hot spots, code coverage analysis, or profile-guided
12174 optimizations. Another class of program instrumentation is adding run-
12175 time checking to detect programming errors like invalid pointer
12176 dereferences or out-of-bounds array accesses, as well as deliberately
12177 hostile attacks such as stack smashing or C++ vtable hijacking. There
12178 is also a general hook which can be used to implement other forms of
12179 tracing or function-level instrumentation for debug or program analysis
12180 purposes.
12181
12182 -p
12183 -pg Generate extra code to write profile information suitable for the
12184 analysis program prof (for -p) or gprof (for -pg). You must use
12185 this option when compiling the source files you want data about,
12186 and you must also use it when linking.
12187
12188 You can use the function attribute "no_instrument_function" to
12189 suppress profiling of individual functions when compiling with
12190 these options.
12191
12192 -fprofile-arcs
12193 Add code so that program flow arcs are instrumented. During
12194 execution the program records how many times each branch and call
12195 is executed and how many times it is taken or returns. On targets
12196 that support constructors with priority support, profiling properly
12197 handles constructors, destructors and C++ constructors (and
12198 destructors) of classes which are used as a type of a global
12199 variable.
12200
12201 When the compiled program exits it saves this data to a file called
12202 auxname.gcda for each source file. The data may be used for
12203 profile-directed optimizations (-fbranch-probabilities), or for
12204 test coverage analysis (-ftest-coverage). Each object file's
12205 auxname is generated from the name of the output file, if
12206 explicitly specified and it is not the final executable, otherwise
12207 it is the basename of the source file. In both cases any suffix is
12208 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12209 for output file specified as -o dir/foo.o).
12210
12211 --coverage
12212 This option is used to compile and link code instrumented for
12213 coverage analysis. The option is a synonym for -fprofile-arcs
12214 -ftest-coverage (when compiling) and -lgcov (when linking). See
12215 the documentation for those options for more details.
12216
12217 * Compile the source files with -fprofile-arcs plus optimization
12218 and code generation options. For test coverage analysis, use
12219 the additional -ftest-coverage option. You do not need to
12220 profile every source file in a program.
12221
12222 * Compile the source files additionally with -fprofile-abs-path
12223 to create absolute path names in the .gcno files. This allows
12224 gcov to find the correct sources in projects where compilations
12225 occur with different working directories.
12226
12227 * Link your object files with -lgcov or -fprofile-arcs (the
12228 latter implies the former).
12229
12230 * Run the program on a representative workload to generate the
12231 arc profile information. This may be repeated any number of
12232 times. You can run concurrent instances of your program, and
12233 provided that the file system supports locking, the data files
12234 will be correctly updated. Unless a strict ISO C dialect
12235 option is in effect, "fork" calls are detected and correctly
12236 handled without double counting.
12237
12238 * For profile-directed optimizations, compile the source files
12239 again with the same optimization and code generation options
12240 plus -fbranch-probabilities.
12241
12242 * For test coverage analysis, use gcov to produce human readable
12243 information from the .gcno and .gcda files. Refer to the gcov
12244 documentation for further information.
12245
12246 With -fprofile-arcs, for each function of your program GCC creates
12247 a program flow graph, then finds a spanning tree for the graph.
12248 Only arcs that are not on the spanning tree have to be
12249 instrumented: the compiler adds code to count the number of times
12250 that these arcs are executed. When an arc is the only exit or only
12251 entrance to a block, the instrumentation code can be added to the
12252 block; otherwise, a new basic block must be created to hold the
12253 instrumentation code.
12254
12255 -ftest-coverage
12256 Produce a notes file that the gcov code-coverage utility can use to
12257 show program coverage. Each source file's note file is called
12258 auxname.gcno. Refer to the -fprofile-arcs option above for a
12259 description of auxname and instructions on how to generate test
12260 coverage data. Coverage data matches the source files more closely
12261 if you do not optimize.
12262
12263 -fprofile-abs-path
12264 Automatically convert relative source file names to absolute path
12265 names in the .gcno files. This allows gcov to find the correct
12266 sources in projects where compilations occur with different working
12267 directories.
12268
12269 -fprofile-dir=path
12270 Set the directory to search for the profile data files in to path.
12271 This option affects only the profile data generated by
12272 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12273 -fprofile-use and -fbranch-probabilities and its related options.
12274 Both absolute and relative paths can be used. By default, GCC uses
12275 the current directory as path, thus the profile data file appears
12276 in the same directory as the object file. In order to prevent the
12277 file name clashing, if the object file name is not an absolute
12278 path, we mangle the absolute path of the sourcename.gcda file and
12279 use it as the file name of a .gcda file. See similar option
12280 -fprofile-note.
12281
12282 When an executable is run in a massive parallel environment, it is
12283 recommended to save profile to different folders. That can be done
12284 with variables in path that are exported during run-time:
12285
12286 %p process ID.
12287
12288 %q{VAR}
12289 value of environment variable VAR
12290
12291 -fprofile-generate
12292 -fprofile-generate=path
12293 Enable options usually used for instrumenting application to
12294 produce profile useful for later recompilation with profile
12295 feedback based optimization. You must use -fprofile-generate both
12296 when compiling and when linking your program.
12297
12298 The following options are enabled: -fprofile-arcs,
12299 -fprofile-values, -finline-functions, and -fipa-bit-cp.
12300
12301 If path is specified, GCC looks at the path to find the profile
12302 feedback data files. See -fprofile-dir.
12303
12304 To optimize the program based on the collected profile information,
12305 use -fprofile-use.
12306
12307 -fprofile-info-section
12308 -fprofile-info-section=name
12309 Register the profile information in the specified section instead
12310 of using a constructor/destructor. The section name is name if it
12311 is specified, otherwise the section name defaults to ".gcov_info".
12312 A pointer to the profile information generated by -fprofile-arcs or
12313 -ftest-coverage is placed in the specified section for each
12314 translation unit. This option disables the profile information
12315 registration through a constructor and it disables the profile
12316 information processing through a destructor. This option is not
12317 intended to be used in hosted environments such as GNU/Linux. It
12318 targets systems with limited resources which do not support
12319 constructors and destructors. The linker could collect the input
12320 sections in a continuous memory block and define start and end
12321 symbols. The runtime support could dump the profiling information
12322 registered in this linker set during program termination to a
12323 serial line for example. A GNU linker script example which defines
12324 a linker output section follows:
12325
12326 .gcov_info :
12327 {
12328 PROVIDE (__gcov_info_start = .);
12329 KEEP (*(.gcov_info))
12330 PROVIDE (__gcov_info_end = .);
12331 }
12332
12333 -fprofile-note=path
12334 If path is specified, GCC saves .gcno file into path location. If
12335 you combine the option with multiple source files, the .gcno file
12336 will be overwritten.
12337
12338 -fprofile-prefix-path=path
12339 This option can be used in combination with
12340 profile-generate=profile_dir and profile-use=profile_dir to inform
12341 GCC where is the base directory of built source tree. By default
12342 profile_dir will contain files with mangled absolute paths of all
12343 object files in the built project. This is not desirable when
12344 directory used to build the instrumented binary differs from the
12345 directory used to build the binary optimized with profile feedback
12346 because the profile data will not be found during the optimized
12347 build. In such setups -fprofile-prefix-path=path with path
12348 pointing to the base directory of the build can be used to strip
12349 the irrelevant part of the path and keep all file names relative to
12350 the main build directory.
12351
12352 -fprofile-update=method
12353 Alter the update method for an application instrumented for profile
12354 feedback based optimization. The method argument should be one of
12355 single, atomic or prefer-atomic. The first one is useful for
12356 single-threaded applications, while the second one prevents profile
12357 corruption by emitting thread-safe code.
12358
12359 Warning: When an application does not properly join all threads (or
12360 creates an detached thread), a profile file can be still corrupted.
12361
12362 Using prefer-atomic would be transformed either to atomic, when
12363 supported by a target, or to single otherwise. The GCC driver
12364 automatically selects prefer-atomic when -pthread is present in the
12365 command line.
12366
12367 -fprofile-filter-files=regex
12368 Instrument only functions from files whose name matches any of the
12369 regular expressions (separated by semi-colons).
12370
12371 For example, -fprofile-filter-files=main\.c;module.*\.c will
12372 instrument only main.c and all C files starting with 'module'.
12373
12374 -fprofile-exclude-files=regex
12375 Instrument only functions from files whose name does not match any
12376 of the regular expressions (separated by semi-colons).
12377
12378 For example, -fprofile-exclude-files=/usr/.* will prevent
12379 instrumentation of all files that are located in the /usr/ folder.
12380
12381 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
12382 Control level of reproducibility of profile gathered by
12383 "-fprofile-generate". This makes it possible to rebuild program
12384 with same outcome which is useful, for example, for distribution
12385 packages.
12386
12387 With -fprofile-reproducible=serial the profile gathered by
12388 -fprofile-generate is reproducible provided the trained program
12389 behaves the same at each invocation of the train run, it is not
12390 multi-threaded and profile data streaming is always done in the
12391 same order. Note that profile streaming happens at the end of
12392 program run but also before "fork" function is invoked.
12393
12394 Note that it is quite common that execution counts of some part of
12395 programs depends, for example, on length of temporary file names or
12396 memory space randomization (that may affect hash-table collision
12397 rate). Such non-reproducible part of programs may be annotated by
12398 "no_instrument_function" function attribute. gcov-dump with -l can
12399 be used to dump gathered data and verify that they are indeed
12400 reproducible.
12401
12402 With -fprofile-reproducible=parallel-runs collected profile stays
12403 reproducible regardless the order of streaming of the data into
12404 gcda files. This setting makes it possible to run multiple
12405 instances of instrumented program in parallel (such as with "make
12406 -j"). This reduces quality of gathered data, in particular of
12407 indirect call profiling.
12408
12409 -fsanitize=address
12410 Enable AddressSanitizer, a fast memory error detector. Memory
12411 access instructions are instrumented to detect out-of-bounds and
12412 use-after-free bugs. The option enables
12413 -fsanitize-address-use-after-scope. See
12414 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
12415 more details. The run-time behavior can be influenced using the
12416 ASAN_OPTIONS environment variable. When set to "help=1", the
12417 available options are shown at startup of the instrumented program.
12418 See
12419 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
12420 for a list of supported options. The option cannot be combined
12421 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
12422 target -fsanitize=hwaddress is currently supported on is AArch64.
12423
12424 -fsanitize=kernel-address
12425 Enable AddressSanitizer for Linux kernel. See
12426 <https://github.com/google/kasan> for more details.
12427
12428 -fsanitize=hwaddress
12429 Enable Hardware-assisted AddressSanitizer, which uses a hardware
12430 ability to ignore the top byte of a pointer to allow the detection
12431 of memory errors with a low memory overhead. Memory access
12432 instructions are instrumented to detect out-of-bounds and use-
12433 after-free bugs. The option enables
12434 -fsanitize-address-use-after-scope. See
12435 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
12436 for more details. The run-time behavior can be influenced using
12437 the HWASAN_OPTIONS environment variable. When set to "help=1", the
12438 available options are shown at startup of the instrumented program.
12439 The option cannot be combined with -fsanitize=thread or
12440 -fsanitize=address, and is currently only available on AArch64.
12441
12442 -fsanitize=kernel-hwaddress
12443 Enable Hardware-assisted AddressSanitizer for compilation of the
12444 Linux kernel. Similar to -fsanitize=kernel-address but using an
12445 alternate instrumentation method, and similar to
12446 -fsanitize=hwaddress but with instrumentation differences necessary
12447 for compiling the Linux kernel. These differences are to avoid
12448 hwasan library initialization calls and to account for the stack
12449 pointer having a different value in its top byte.
12450
12451 Note: This option has different defaults to the
12452 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
12453 not on by default but are still possible by specifying the command-
12454 line options --param hwasan-instrument-stack=1 and --param
12455 hwasan-instrument-allocas=1 respectively. Using a random frame tag
12456 is not implemented for kernel instrumentation.
12457
12458 -fsanitize=pointer-compare
12459 Instrument comparison operation (<, <=, >, >=) with pointer
12460 operands. The option must be combined with either
12461 -fsanitize=kernel-address or -fsanitize=address The option cannot
12462 be combined with -fsanitize=thread. Note: By default the check is
12463 disabled at run time. To enable it, add
12464 "detect_invalid_pointer_pairs=2" to the environment variable
12465 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
12466 invalid operation only when both pointers are non-null.
12467
12468 -fsanitize=pointer-subtract
12469 Instrument subtraction with pointer operands. The option must be
12470 combined with either -fsanitize=kernel-address or
12471 -fsanitize=address The option cannot be combined with
12472 -fsanitize=thread. Note: By default the check is disabled at run
12473 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
12474 environment variable ASAN_OPTIONS. Using
12475 "detect_invalid_pointer_pairs=1" detects invalid operation only
12476 when both pointers are non-null.
12477
12478 -fsanitize=thread
12479 Enable ThreadSanitizer, a fast data race detector. Memory access
12480 instructions are instrumented to detect data race bugs. See
12481 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
12482 more details. The run-time behavior can be influenced using the
12483 TSAN_OPTIONS environment variable; see
12484 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
12485 for a list of supported options. The option cannot be combined
12486 with -fsanitize=address, -fsanitize=leak.
12487
12488 Note that sanitized atomic builtins cannot throw exceptions when
12489 operating on invalid memory addresses with non-call exceptions
12490 (-fnon-call-exceptions).
12491
12492 -fsanitize=leak
12493 Enable LeakSanitizer, a memory leak detector. This option only
12494 matters for linking of executables and the executable is linked
12495 against a library that overrides "malloc" and other allocator
12496 functions. See
12497 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
12498 for more details. The run-time behavior can be influenced using
12499 the LSAN_OPTIONS environment variable. The option cannot be
12500 combined with -fsanitize=thread.
12501
12502 -fsanitize=undefined
12503 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
12504 detector. Various computations are instrumented to detect
12505 undefined behavior at runtime. See
12506 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
12507 more details. The run-time behavior can be influenced using the
12508 UBSAN_OPTIONS environment variable. Current suboptions are:
12509
12510 -fsanitize=shift
12511 This option enables checking that the result of a shift
12512 operation is not undefined. Note that what exactly is
12513 considered undefined differs slightly between C and C++, as
12514 well as between ISO C90 and C99, etc. This option has two
12515 suboptions, -fsanitize=shift-base and
12516 -fsanitize=shift-exponent.
12517
12518 -fsanitize=shift-exponent
12519 This option enables checking that the second argument of a
12520 shift operation is not negative and is smaller than the
12521 precision of the promoted first argument.
12522
12523 -fsanitize=shift-base
12524 If the second argument of a shift operation is within range,
12525 check that the result of a shift operation is not undefined.
12526 Note that what exactly is considered undefined differs slightly
12527 between C and C++, as well as between ISO C90 and C99, etc.
12528
12529 -fsanitize=integer-divide-by-zero
12530 Detect integer division by zero as well as "INT_MIN / -1"
12531 division.
12532
12533 -fsanitize=unreachable
12534 With this option, the compiler turns the
12535 "__builtin_unreachable" call into a diagnostics message call
12536 instead. When reaching the "__builtin_unreachable" call, the
12537 behavior is undefined.
12538
12539 -fsanitize=vla-bound
12540 This option instructs the compiler to check that the size of a
12541 variable length array is positive.
12542
12543 -fsanitize=null
12544 This option enables pointer checking. Particularly, the
12545 application built with this option turned on will issue an
12546 error message when it tries to dereference a NULL pointer, or
12547 if a reference (possibly an rvalue reference) is bound to a
12548 NULL pointer, or if a method is invoked on an object pointed by
12549 a NULL pointer.
12550
12551 -fsanitize=return
12552 This option enables return statement checking. Programs built
12553 with this option turned on will issue an error message when the
12554 end of a non-void function is reached without actually
12555 returning a value. This option works in C++ only.
12556
12557 -fsanitize=signed-integer-overflow
12558 This option enables signed integer overflow checking. We check
12559 that the result of "+", "*", and both unary and binary "-" does
12560 not overflow in the signed arithmetics. Note, integer
12561 promotion rules must be taken into account. That is, the
12562 following is not an overflow:
12563
12564 signed char a = SCHAR_MAX;
12565 a++;
12566
12567 -fsanitize=bounds
12568 This option enables instrumentation of array bounds. Various
12569 out of bounds accesses are detected. Flexible array members,
12570 flexible array member-like arrays, and initializers of
12571 variables with static storage are not instrumented.
12572
12573 -fsanitize=bounds-strict
12574 This option enables strict instrumentation of array bounds.
12575 Most out of bounds accesses are detected, including flexible
12576 array members and flexible array member-like arrays.
12577 Initializers of variables with static storage are not
12578 instrumented.
12579
12580 -fsanitize=alignment
12581 This option enables checking of alignment of pointers when they
12582 are dereferenced, or when a reference is bound to
12583 insufficiently aligned target, or when a method or constructor
12584 is invoked on insufficiently aligned object.
12585
12586 -fsanitize=object-size
12587 This option enables instrumentation of memory references using
12588 the "__builtin_object_size" function. Various out of bounds
12589 pointer accesses are detected.
12590
12591 -fsanitize=float-divide-by-zero
12592 Detect floating-point division by zero. Unlike other similar
12593 options, -fsanitize=float-divide-by-zero is not enabled by
12594 -fsanitize=undefined, since floating-point division by zero can
12595 be a legitimate way of obtaining infinities and NaNs.
12596
12597 -fsanitize=float-cast-overflow
12598 This option enables floating-point type to integer conversion
12599 checking. We check that the result of the conversion does not
12600 overflow. Unlike other similar options,
12601 -fsanitize=float-cast-overflow is not enabled by
12602 -fsanitize=undefined. This option does not work well with
12603 "FE_INVALID" exceptions enabled.
12604
12605 -fsanitize=nonnull-attribute
12606 This option enables instrumentation of calls, checking whether
12607 null values are not passed to arguments marked as requiring a
12608 non-null value by the "nonnull" function attribute.
12609
12610 -fsanitize=returns-nonnull-attribute
12611 This option enables instrumentation of return statements in
12612 functions marked with "returns_nonnull" function attribute, to
12613 detect returning of null values from such functions.
12614
12615 -fsanitize=bool
12616 This option enables instrumentation of loads from bool. If a
12617 value other than 0/1 is loaded, a run-time error is issued.
12618
12619 -fsanitize=enum
12620 This option enables instrumentation of loads from an enum type.
12621 If a value outside the range of values for the enum type is
12622 loaded, a run-time error is issued.
12623
12624 -fsanitize=vptr
12625 This option enables instrumentation of C++ member function
12626 calls, member accesses and some conversions between pointers to
12627 base and derived classes, to verify the referenced object has
12628 the correct dynamic type.
12629
12630 -fsanitize=pointer-overflow
12631 This option enables instrumentation of pointer arithmetics. If
12632 the pointer arithmetics overflows, a run-time error is issued.
12633
12634 -fsanitize=builtin
12635 This option enables instrumentation of arguments to selected
12636 builtin functions. If an invalid value is passed to such
12637 arguments, a run-time error is issued. E.g. passing 0 as the
12638 argument to "__builtin_ctz" or "__builtin_clz" invokes
12639 undefined behavior and is diagnosed by this option.
12640
12641 While -ftrapv causes traps for signed overflows to be emitted,
12642 -fsanitize=undefined gives a diagnostic message. This currently
12643 works only for the C family of languages.
12644
12645 -fno-sanitize=all
12646 This option disables all previously enabled sanitizers.
12647 -fsanitize=all is not allowed, as some sanitizers cannot be used
12648 together.
12649
12650 -fasan-shadow-offset=number
12651 This option forces GCC to use custom shadow offset in
12652 AddressSanitizer checks. It is useful for experimenting with
12653 different shadow memory layouts in Kernel AddressSanitizer.
12654
12655 -fsanitize-sections=s1,s2,...
12656 Sanitize global variables in selected user-defined sections. si
12657 may contain wildcards.
12658
12659 -fsanitize-recover[=opts]
12660 -fsanitize-recover= controls error recovery mode for sanitizers
12661 mentioned in comma-separated list of opts. Enabling this option
12662 for a sanitizer component causes it to attempt to continue running
12663 the program as if no error happened. This means multiple runtime
12664 errors can be reported in a single program run, and the exit code
12665 of the program may indicate success even when errors have been
12666 reported. The -fno-sanitize-recover= option can be used to alter
12667 this behavior: only the first detected error is reported and
12668 program then exits with a non-zero exit code.
12669
12670 Currently this feature only works for -fsanitize=undefined (and its
12671 suboptions except for -fsanitize=unreachable and
12672 -fsanitize=return), -fsanitize=float-cast-overflow,
12673 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
12674 -fsanitize=kernel-address and -fsanitize=address. For these
12675 sanitizers error recovery is turned on by default, except
12676 -fsanitize=address, for which this feature is experimental.
12677 -fsanitize-recover=all and -fno-sanitize-recover=all is also
12678 accepted, the former enables recovery for all sanitizers that
12679 support it, the latter disables recovery for all sanitizers that
12680 support it.
12681
12682 Even if a recovery mode is turned on the compiler side, it needs to
12683 be also enabled on the runtime library side, otherwise the failures
12684 are still fatal. The runtime library defaults to "halt_on_error=0"
12685 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
12686 value for AddressSanitizer is "halt_on_error=1". This can be
12687 overridden through setting the "halt_on_error" flag in the
12688 corresponding environment variable.
12689
12690 Syntax without an explicit opts parameter is deprecated. It is
12691 equivalent to specifying an opts list of:
12692
12693 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12694
12695 -fsanitize-address-use-after-scope
12696 Enable sanitization of local variables to detect use-after-scope
12697 bugs. The option sets -fstack-reuse to none.
12698
12699 -fsanitize-undefined-trap-on-error
12700 The -fsanitize-undefined-trap-on-error option instructs the
12701 compiler to report undefined behavior using "__builtin_trap" rather
12702 than a "libubsan" library routine. The advantage of this is that
12703 the "libubsan" library is not needed and is not linked in, so this
12704 is usable even in freestanding environments.
12705
12706 -fsanitize-coverage=trace-pc
12707 Enable coverage-guided fuzzing code instrumentation. Inserts a
12708 call to "__sanitizer_cov_trace_pc" into every basic block.
12709
12710 -fsanitize-coverage=trace-cmp
12711 Enable dataflow guided fuzzing code instrumentation. Inserts a
12712 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
12713 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
12714 integral comparison with both operands variable or
12715 "__sanitizer_cov_trace_const_cmp1",
12716 "__sanitizer_cov_trace_const_cmp2",
12717 "__sanitizer_cov_trace_const_cmp4" or
12718 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
12719 operand constant, "__sanitizer_cov_trace_cmpf" or
12720 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
12721 "__sanitizer_cov_trace_switch" for switch statements.
12722
12723 -fcf-protection=[full|branch|return|none|check]
12724 Enable code instrumentation of control-flow transfers to increase
12725 program security by checking that target addresses of control-flow
12726 transfer instructions (such as indirect function call, function
12727 return, indirect jump) are valid. This prevents diverting the flow
12728 of control to an unexpected target. This is intended to protect
12729 against such threats as Return-oriented Programming (ROP), and
12730 similarly call/jmp-oriented programming (COP/JOP).
12731
12732 The value "branch" tells the compiler to implement checking of
12733 validity of control-flow transfer at the point of indirect branch
12734 instructions, i.e. call/jmp instructions. The value "return"
12735 implements checking of validity at the point of returning from a
12736 function. The value "full" is an alias for specifying both
12737 "branch" and "return". The value "none" turns off instrumentation.
12738
12739 The value "check" is used for the final link with link-time
12740 optimization (LTO). An error is issued if LTO object files are
12741 compiled with different -fcf-protection values. The value "check"
12742 is ignored at the compile time.
12743
12744 The macro "__CET__" is defined when -fcf-protection is used. The
12745 first bit of "__CET__" is set to 1 for the value "branch" and the
12746 second bit of "__CET__" is set to 1 for the "return".
12747
12748 You can also use the "nocf_check" attribute to identify which
12749 functions and calls should be skipped from instrumentation.
12750
12751 Currently the x86 GNU/Linux target provides an implementation based
12752 on Intel Control-flow Enforcement Technology (CET).
12753
12754 -fstack-protector
12755 Emit extra code to check for buffer overflows, such as stack
12756 smashing attacks. This is done by adding a guard variable to
12757 functions with vulnerable objects. This includes functions that
12758 call "alloca", and functions with buffers larger than or equal to 8
12759 bytes. The guards are initialized when a function is entered and
12760 then checked when the function exits. If a guard check fails, an
12761 error message is printed and the program exits. Only variables
12762 that are actually allocated on the stack are considered, optimized
12763 away variables or variables allocated in registers don't count.
12764
12765 -fstack-protector-all
12766 Like -fstack-protector except that all functions are protected.
12767
12768 -fstack-protector-strong
12769 Like -fstack-protector but includes additional functions to be
12770 protected --- those that have local array definitions, or have
12771 references to local frame addresses. Only variables that are
12772 actually allocated on the stack are considered, optimized away
12773 variables or variables allocated in registers don't count.
12774
12775 -fstack-protector-explicit
12776 Like -fstack-protector but only protects those functions which have
12777 the "stack_protect" attribute.
12778
12779 -fstack-check
12780 Generate code to verify that you do not go beyond the boundary of
12781 the stack. You should specify this flag if you are running in an
12782 environment with multiple threads, but you only rarely need to
12783 specify it in a single-threaded environment since stack overflow is
12784 automatically detected on nearly all systems if there is only one
12785 stack.
12786
12787 Note that this switch does not actually cause checking to be done;
12788 the operating system or the language runtime must do that. The
12789 switch causes generation of code to ensure that they see the stack
12790 being extended.
12791
12792 You can additionally specify a string parameter: no means no
12793 checking, generic means force the use of old-style checking,
12794 specific means use the best checking method and is equivalent to
12795 bare -fstack-check.
12796
12797 Old-style checking is a generic mechanism that requires no specific
12798 target support in the compiler but comes with the following
12799 drawbacks:
12800
12801 1. Modified allocation strategy for large objects: they are always
12802 allocated dynamically if their size exceeds a fixed threshold.
12803 Note this may change the semantics of some code.
12804
12805 2. Fixed limit on the size of the static frame of functions: when
12806 it is topped by a particular function, stack checking is not
12807 reliable and a warning is issued by the compiler.
12808
12809 3. Inefficiency: because of both the modified allocation strategy
12810 and the generic implementation, code performance is hampered.
12811
12812 Note that old-style stack checking is also the fallback method for
12813 specific if no target support has been added in the compiler.
12814
12815 -fstack-check= is designed for Ada's needs to detect infinite
12816 recursion and stack overflows. specific is an excellent choice
12817 when compiling Ada code. It is not generally sufficient to protect
12818 against stack-clash attacks. To protect against those you want
12819 -fstack-clash-protection.
12820
12821 -fstack-clash-protection
12822 Generate code to prevent stack clash style attacks. When this
12823 option is enabled, the compiler will only allocate one page of
12824 stack space at a time and each page is accessed immediately after
12825 allocation. Thus, it prevents allocations from jumping over any
12826 stack guard page provided by the operating system.
12827
12828 Most targets do not fully support stack clash protection. However,
12829 on those targets -fstack-clash-protection will protect dynamic
12830 stack allocations. -fstack-clash-protection may also provide
12831 limited protection for static stack allocations if the target
12832 supports -fstack-check=specific.
12833
12834 -fstack-limit-register=reg
12835 -fstack-limit-symbol=sym
12836 -fno-stack-limit
12837 Generate code to ensure that the stack does not grow beyond a
12838 certain value, either the value of a register or the address of a
12839 symbol. If a larger stack is required, a signal is raised at run
12840 time. For most targets, the signal is raised before the stack
12841 overruns the boundary, so it is possible to catch the signal
12842 without taking special precautions.
12843
12844 For instance, if the stack starts at absolute address 0x80000000
12845 and grows downwards, you can use the flags
12846 -fstack-limit-symbol=__stack_limit and
12847 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
12848 128KB. Note that this may only work with the GNU linker.
12849
12850 You can locally override stack limit checking by using the
12851 "no_stack_limit" function attribute.
12852
12853 -fsplit-stack
12854 Generate code to automatically split the stack before it overflows.
12855 The resulting program has a discontiguous stack which can only
12856 overflow if the program is unable to allocate any more memory.
12857 This is most useful when running threaded programs, as it is no
12858 longer necessary to calculate a good stack size to use for each
12859 thread. This is currently only implemented for the x86 targets
12860 running GNU/Linux.
12861
12862 When code compiled with -fsplit-stack calls code compiled without
12863 -fsplit-stack, there may not be much stack space available for the
12864 latter code to run. If compiling all code, including library code,
12865 with -fsplit-stack is not an option, then the linker can fix up
12866 these calls so that the code compiled without -fsplit-stack always
12867 has a large stack. Support for this is implemented in the gold
12868 linker in GNU binutils release 2.21 and later.
12869
12870 -fvtable-verify=[std|preinit|none]
12871 This option is only available when compiling C++ code. It turns on
12872 (or off, if using -fvtable-verify=none) the security feature that
12873 verifies at run time, for every virtual call, that the vtable
12874 pointer through which the call is made is valid for the type of the
12875 object, and has not been corrupted or overwritten. If an invalid
12876 vtable pointer is detected at run time, an error is reported and
12877 execution of the program is immediately halted.
12878
12879 This option causes run-time data structures to be built at program
12880 startup, which are used for verifying the vtable pointers. The
12881 options std and preinit control the timing of when these data
12882 structures are built. In both cases the data structures are built
12883 before execution reaches "main". Using -fvtable-verify=std causes
12884 the data structures to be built after shared libraries have been
12885 loaded and initialized. -fvtable-verify=preinit causes them to be
12886 built before shared libraries have been loaded and initialized.
12887
12888 If this option appears multiple times in the command line with
12889 different values specified, none takes highest priority over both
12890 std and preinit; preinit takes priority over std.
12891
12892 -fvtv-debug
12893 When used in conjunction with -fvtable-verify=std or
12894 -fvtable-verify=preinit, causes debug versions of the runtime
12895 functions for the vtable verification feature to be called. This
12896 flag also causes the compiler to log information about which vtable
12897 pointers it finds for each class. This information is written to a
12898 file named vtv_set_ptr_data.log in the directory named by the
12899 environment variable VTV_LOGS_DIR if that is defined or the current
12900 working directory otherwise.
12901
12902 Note: This feature appends data to the log file. If you want a
12903 fresh log file, be sure to delete any existing one.
12904
12905 -fvtv-counts
12906 This is a debugging flag. When used in conjunction with
12907 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
12908 compiler to keep track of the total number of virtual calls it
12909 encounters and the number of verifications it inserts. It also
12910 counts the number of calls to certain run-time library functions
12911 that it inserts and logs this information for each compilation
12912 unit. The compiler writes this information to a file named
12913 vtv_count_data.log in the directory named by the environment
12914 variable VTV_LOGS_DIR if that is defined or the current working
12915 directory otherwise. It also counts the size of the vtable pointer
12916 sets for each class, and writes this information to
12917 vtv_class_set_sizes.log in the same directory.
12918
12919 Note: This feature appends data to the log files. To get fresh
12920 log files, be sure to delete any existing ones.
12921
12922 -finstrument-functions
12923 Generate instrumentation calls for entry and exit to functions.
12924 Just after function entry and just before function exit, the
12925 following profiling functions are called with the address of the
12926 current function and its call site. (On some platforms,
12927 "__builtin_return_address" does not work beyond the current
12928 function, so the call site information may not be available to the
12929 profiling functions otherwise.)
12930
12931 void __cyg_profile_func_enter (void *this_fn,
12932 void *call_site);
12933 void __cyg_profile_func_exit (void *this_fn,
12934 void *call_site);
12935
12936 The first argument is the address of the start of the current
12937 function, which may be looked up exactly in the symbol table.
12938
12939 This instrumentation is also done for functions expanded inline in
12940 other functions. The profiling calls indicate where, conceptually,
12941 the inline function is entered and exited. This means that
12942 addressable versions of such functions must be available. If all
12943 your uses of a function are expanded inline, this may mean an
12944 additional expansion of code size. If you use "extern inline" in
12945 your C code, an addressable version of such functions must be
12946 provided. (This is normally the case anyway, but if you get lucky
12947 and the optimizer always expands the functions inline, you might
12948 have gotten away without providing static copies.)
12949
12950 A function may be given the attribute "no_instrument_function", in
12951 which case this instrumentation is not done. This can be used, for
12952 example, for the profiling functions listed above, high-priority
12953 interrupt routines, and any functions from which the profiling
12954 functions cannot safely be called (perhaps signal handlers, if the
12955 profiling routines generate output or allocate memory).
12956
12957 -finstrument-functions-exclude-file-list=file,file,...
12958 Set the list of functions that are excluded from instrumentation
12959 (see the description of -finstrument-functions). If the file that
12960 contains a function definition matches with one of file, then that
12961 function is not instrumented. The match is done on substrings: if
12962 the file parameter is a substring of the file name, it is
12963 considered to be a match.
12964
12965 For example:
12966
12967 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12968
12969 excludes any inline function defined in files whose pathnames
12970 contain /bits/stl or include/sys.
12971
12972 If, for some reason, you want to include letter , in one of sym,
12973 write ,. For example,
12974 -finstrument-functions-exclude-file-list=',,tmp' (note the single
12975 quote surrounding the option).
12976
12977 -finstrument-functions-exclude-function-list=sym,sym,...
12978 This is similar to -finstrument-functions-exclude-file-list, but
12979 this option sets the list of function names to be excluded from
12980 instrumentation. The function name to be matched is its user-
12981 visible name, such as "vector<int> blah(const vector<int> &)", not
12982 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
12983 match is done on substrings: if the sym parameter is a substring of
12984 the function name, it is considered to be a match. For C99 and C++
12985 extended identifiers, the function name must be given in UTF-8, not
12986 using universal character names.
12987
12988 -fpatchable-function-entry=N[,M]
12989 Generate N NOPs right at the beginning of each function, with the
12990 function entry point before the Mth NOP. If M is omitted, it
12991 defaults to 0 so the function entry points to the address just at
12992 the first NOP. The NOP instructions reserve extra space which can
12993 be used to patch in any desired instrumentation at run time,
12994 provided that the code segment is writable. The amount of space is
12995 controllable indirectly via the number of NOPs; the NOP instruction
12996 used corresponds to the instruction emitted by the internal GCC
12997 back-end interface "gen_nop". This behavior is target-specific and
12998 may also depend on the architecture variant and/or other
12999 compilation options.
13000
13001 For run-time identification, the starting addresses of these areas,
13002 which correspond to their respective function entries minus M, are
13003 additionally collected in the "__patchable_function_entries"
13004 section of the resulting binary.
13005
13006 Note that the value of "__attribute__ ((patchable_function_entry
13007 (N,M)))" takes precedence over command-line option
13008 -fpatchable-function-entry=N,M. This can be used to increase the
13009 area size or to remove it completely on a single function. If
13010 "N=0", no pad location is recorded.
13011
13012 The NOP instructions are inserted at---and maybe before, depending
13013 on M---the function entry address, even before the prologue.
13014
13015 The maximum value of N and M is 65535.
13016
13017 Options Controlling the Preprocessor
13018 These options control the C preprocessor, which is run on each C source
13019 file before actual compilation.
13020
13021 If you use the -E option, nothing is done except preprocessing. Some
13022 of these options make sense only together with -E because they cause
13023 the preprocessor output to be unsuitable for actual compilation.
13024
13025 In addition to the options listed here, there are a number of options
13026 to control search paths for include files documented in Directory
13027 Options. Options to control preprocessor diagnostics are listed in
13028 Warning Options.
13029
13030 -D name
13031 Predefine name as a macro, with definition 1.
13032
13033 -D name=definition
13034 The contents of definition are tokenized and processed as if they
13035 appeared during translation phase three in a #define directive. In
13036 particular, the definition is truncated by embedded newline
13037 characters.
13038
13039 If you are invoking the preprocessor from a shell or shell-like
13040 program you may need to use the shell's quoting syntax to protect
13041 characters such as spaces that have a meaning in the shell syntax.
13042
13043 If you wish to define a function-like macro on the command line,
13044 write its argument list with surrounding parentheses before the
13045 equals sign (if any). Parentheses are meaningful to most shells,
13046 so you should quote the option. With sh and csh,
13047 -D'name(args...)=definition' works.
13048
13049 -D and -U options are processed in the order they are given on the
13050 command line. All -imacros file and -include file options are
13051 processed after all -D and -U options.
13052
13053 -U name
13054 Cancel any previous definition of name, either built in or provided
13055 with a -D option.
13056
13057 -include file
13058 Process file as if "#include "file"" appeared as the first line of
13059 the primary source file. However, the first directory searched for
13060 file is the preprocessor's working directory instead of the
13061 directory containing the main source file. If not found there, it
13062 is searched for in the remainder of the "#include "..."" search
13063 chain as normal.
13064
13065 If multiple -include options are given, the files are included in
13066 the order they appear on the command line.
13067
13068 -imacros file
13069 Exactly like -include, except that any output produced by scanning
13070 file is thrown away. Macros it defines remain defined. This
13071 allows you to acquire all the macros from a header without also
13072 processing its declarations.
13073
13074 All files specified by -imacros are processed before all files
13075 specified by -include.
13076
13077 -undef
13078 Do not predefine any system-specific or GCC-specific macros. The
13079 standard predefined macros remain defined.
13080
13081 -pthread
13082 Define additional macros required for using the POSIX threads
13083 library. You should use this option consistently for both
13084 compilation and linking. This option is supported on GNU/Linux
13085 targets, most other Unix derivatives, and also on x86 Cygwin and
13086 MinGW targets.
13087
13088 -M Instead of outputting the result of preprocessing, output a rule
13089 suitable for make describing the dependencies of the main source
13090 file. The preprocessor outputs one make rule containing the object
13091 file name for that source file, a colon, and the names of all the
13092 included files, including those coming from -include or -imacros
13093 command-line options.
13094
13095 Unless specified explicitly (with -MT or -MQ), the object file name
13096 consists of the name of the source file with any suffix replaced
13097 with object file suffix and with any leading directory parts
13098 removed. If there are many included files then the rule is split
13099 into several lines using \-newline. The rule has no commands.
13100
13101 This option does not suppress the preprocessor's debug output, such
13102 as -dM. To avoid mixing such debug output with the dependency
13103 rules you should explicitly specify the dependency output file with
13104 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13105 Debug output is still sent to the regular output stream as normal.
13106
13107 Passing -M to the driver implies -E, and suppresses warnings with
13108 an implicit -w.
13109
13110 -MM Like -M but do not mention header files that are found in system
13111 header directories, nor header files that are included, directly or
13112 indirectly, from such a header.
13113
13114 This implies that the choice of angle brackets or double quotes in
13115 an #include directive does not in itself determine whether that
13116 header appears in -MM dependency output.
13117
13118 -MF file
13119 When used with -M or -MM, specifies a file to write the
13120 dependencies to. If no -MF switch is given the preprocessor sends
13121 the rules to the same place it would send preprocessed output.
13122
13123 When used with the driver options -MD or -MMD, -MF overrides the
13124 default dependency output file.
13125
13126 If file is -, then the dependencies are written to stdout.
13127
13128 -MG In conjunction with an option such as -M requesting dependency
13129 generation, -MG assumes missing header files are generated files
13130 and adds them to the dependency list without raising an error. The
13131 dependency filename is taken directly from the "#include" directive
13132 without prepending any path. -MG also suppresses preprocessed
13133 output, as a missing header file renders this useless.
13134
13135 This feature is used in automatic updating of makefiles.
13136
13137 -Mno-modules
13138 Disable dependency generation for compiled module interfaces.
13139
13140 -MP This option instructs CPP to add a phony target for each dependency
13141 other than the main file, causing each to depend on nothing. These
13142 dummy rules work around errors make gives if you remove header
13143 files without updating the Makefile to match.
13144
13145 This is typical output:
13146
13147 test.o: test.c test.h
13148
13149 test.h:
13150
13151 -MT target
13152 Change the target of the rule emitted by dependency generation. By
13153 default CPP takes the name of the main input file, deletes any
13154 directory components and any file suffix such as .c, and appends
13155 the platform's usual object suffix. The result is the target.
13156
13157 An -MT option sets the target to be exactly the string you specify.
13158 If you want multiple targets, you can specify them as a single
13159 argument to -MT, or use multiple -MT options.
13160
13161 For example, -MT '$(objpfx)foo.o' might give
13162
13163 $(objpfx)foo.o: foo.c
13164
13165 -MQ target
13166 Same as -MT, but it quotes any characters which are special to
13167 Make. -MQ '$(objpfx)foo.o' gives
13168
13169 $$(objpfx)foo.o: foo.c
13170
13171 The default target is automatically quoted, as if it were given
13172 with -MQ.
13173
13174 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
13175 The driver determines file based on whether an -o option is given.
13176 If it is, the driver uses its argument but with a suffix of .d,
13177 otherwise it takes the name of the input file, removes any
13178 directory components and suffix, and applies a .d suffix.
13179
13180 If -MD is used in conjunction with -E, any -o switch is understood
13181 to specify the dependency output file, but if used without -E, each
13182 -o is understood to specify a target object file.
13183
13184 Since -E is not implied, -MD can be used to generate a dependency
13185 output file as a side effect of the compilation process.
13186
13187 -MMD
13188 Like -MD except mention only user header files, not system header
13189 files.
13190
13191 -fpreprocessed
13192 Indicate to the preprocessor that the input file has already been
13193 preprocessed. This suppresses things like macro expansion,
13194 trigraph conversion, escaped newline splicing, and processing of
13195 most directives. The preprocessor still recognizes and removes
13196 comments, so that you can pass a file preprocessed with -C to the
13197 compiler without problems. In this mode the integrated
13198 preprocessor is little more than a tokenizer for the front ends.
13199
13200 -fpreprocessed is implicit if the input file has one of the
13201 extensions .i, .ii or .mi. These are the extensions that GCC uses
13202 for preprocessed files created by -save-temps.
13203
13204 -fdirectives-only
13205 When preprocessing, handle directives, but do not expand macros.
13206
13207 The option's behavior depends on the -E and -fpreprocessed options.
13208
13209 With -E, preprocessing is limited to the handling of directives
13210 such as "#define", "#ifdef", and "#error". Other preprocessor
13211 operations, such as macro expansion and trigraph conversion are not
13212 performed. In addition, the -dD option is implicitly enabled.
13213
13214 With -fpreprocessed, predefinition of command line and most builtin
13215 macros is disabled. Macros such as "__LINE__", which are
13216 contextually dependent, are handled normally. This enables
13217 compilation of files previously preprocessed with "-E
13218 -fdirectives-only".
13219
13220 With both -E and -fpreprocessed, the rules for -fpreprocessed take
13221 precedence. This enables full preprocessing of files previously
13222 preprocessed with "-E -fdirectives-only".
13223
13224 -fdollars-in-identifiers
13225 Accept $ in identifiers.
13226
13227 -fextended-identifiers
13228 Accept universal character names and extended characters in
13229 identifiers. This option is enabled by default for C99 (and later
13230 C standard versions) and C++.
13231
13232 -fno-canonical-system-headers
13233 When preprocessing, do not shorten system header paths with
13234 canonicalization.
13235
13236 -fmax-include-depth=depth
13237 Set the maximum depth of the nested #include. The default is 200.
13238
13239 -ftabstop=width
13240 Set the distance between tab stops. This helps the preprocessor
13241 report correct column numbers in warnings or errors, even if tabs
13242 appear on the line. If the value is less than 1 or greater than
13243 100, the option is ignored. The default is 8.
13244
13245 -ftrack-macro-expansion[=level]
13246 Track locations of tokens across macro expansions. This allows the
13247 compiler to emit diagnostic about the current macro expansion stack
13248 when a compilation error occurs in a macro expansion. Using this
13249 option makes the preprocessor and the compiler consume more memory.
13250 The level parameter can be used to choose the level of precision of
13251 token location tracking thus decreasing the memory consumption if
13252 necessary. Value 0 of level de-activates this option. Value 1
13253 tracks tokens locations in a degraded mode for the sake of minimal
13254 memory overhead. In this mode all tokens resulting from the
13255 expansion of an argument of a function-like macro have the same
13256 location. Value 2 tracks tokens locations completely. This value is
13257 the most memory hungry. When this option is given no argument, the
13258 default parameter value is 2.
13259
13260 Note that "-ftrack-macro-expansion=2" is activated by default.
13261
13262 -fmacro-prefix-map=old=new
13263 When preprocessing files residing in directory old, expand the
13264 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
13265 directory new instead. This can be used to change an absolute path
13266 to a relative path by using . for new which can result in more
13267 reproducible builds that are location independent. This option
13268 also affects "__builtin_FILE()" during compilation. See also
13269 -ffile-prefix-map.
13270
13271 -fexec-charset=charset
13272 Set the execution character set, used for string and character
13273 constants. The default is UTF-8. charset can be any encoding
13274 supported by the system's "iconv" library routine.
13275
13276 -fwide-exec-charset=charset
13277 Set the wide execution character set, used for wide string and
13278 character constants. The default is UTF-32 or UTF-16, whichever
13279 corresponds to the width of "wchar_t". As with -fexec-charset,
13280 charset can be any encoding supported by the system's "iconv"
13281 library routine; however, you will have problems with encodings
13282 that do not fit exactly in "wchar_t".
13283
13284 -finput-charset=charset
13285 Set the input character set, used for translation from the
13286 character set of the input file to the source character set used by
13287 GCC. If the locale does not specify, or GCC cannot get this
13288 information from the locale, the default is UTF-8. This can be
13289 overridden by either the locale or this command-line option.
13290 Currently the command-line option takes precedence if there's a
13291 conflict. charset can be any encoding supported by the system's
13292 "iconv" library routine.
13293
13294 -fpch-deps
13295 When using precompiled headers, this flag causes the dependency-
13296 output flags to also list the files from the precompiled header's
13297 dependencies. If not specified, only the precompiled header are
13298 listed and not the files that were used to create it, because those
13299 files are not consulted when a precompiled header is used.
13300
13301 -fpch-preprocess
13302 This option allows use of a precompiled header together with -E.
13303 It inserts a special "#pragma", "#pragma GCC pch_preprocess
13304 "filename"" in the output to mark the place where the precompiled
13305 header was found, and its filename. When -fpreprocessed is in use,
13306 GCC recognizes this "#pragma" and loads the PCH.
13307
13308 This option is off by default, because the resulting preprocessed
13309 output is only really suitable as input to GCC. It is switched on
13310 by -save-temps.
13311
13312 You should not write this "#pragma" in your own code, but it is
13313 safe to edit the filename if the PCH file is available in a
13314 different location. The filename may be absolute or it may be
13315 relative to GCC's current directory.
13316
13317 -fworking-directory
13318 Enable generation of linemarkers in the preprocessor output that
13319 let the compiler know the current working directory at the time of
13320 preprocessing. When this option is enabled, the preprocessor
13321 emits, after the initial linemarker, a second linemarker with the
13322 current working directory followed by two slashes. GCC uses this
13323 directory, when it's present in the preprocessed input, as the
13324 directory emitted as the current working directory in some
13325 debugging information formats. This option is implicitly enabled
13326 if debugging information is enabled, but this can be inhibited with
13327 the negated form -fno-working-directory. If the -P flag is present
13328 in the command line, this option has no effect, since no "#line"
13329 directives are emitted whatsoever.
13330
13331 -A predicate=answer
13332 Make an assertion with the predicate predicate and answer answer.
13333 This form is preferred to the older form -A predicate(answer),
13334 which is still supported, because it does not use shell special
13335 characters.
13336
13337 -A -predicate=answer
13338 Cancel an assertion with the predicate predicate and answer answer.
13339
13340 -C Do not discard comments. All comments are passed through to the
13341 output file, except for comments in processed directives, which are
13342 deleted along with the directive.
13343
13344 You should be prepared for side effects when using -C; it causes
13345 the preprocessor to treat comments as tokens in their own right.
13346 For example, comments appearing at the start of what would be a
13347 directive line have the effect of turning that line into an
13348 ordinary source line, since the first token on the line is no
13349 longer a #.
13350
13351 -CC Do not discard comments, including during macro expansion. This is
13352 like -C, except that comments contained within macros are also
13353 passed through to the output file where the macro is expanded.
13354
13355 In addition to the side effects of the -C option, the -CC option
13356 causes all C++-style comments inside a macro to be converted to
13357 C-style comments. This is to prevent later use of that macro from
13358 inadvertently commenting out the remainder of the source line.
13359
13360 The -CC option is generally used to support lint comments.
13361
13362 -P Inhibit generation of linemarkers in the output from the
13363 preprocessor. This might be useful when running the preprocessor
13364 on something that is not C code, and will be sent to a program
13365 which might be confused by the linemarkers.
13366
13367 -traditional
13368 -traditional-cpp
13369 Try to imitate the behavior of pre-standard C preprocessors, as
13370 opposed to ISO C preprocessors. See the GNU CPP manual for
13371 details.
13372
13373 Note that GCC does not otherwise attempt to emulate a pre-standard
13374 C compiler, and these options are only supported with the -E
13375 switch, or when invoking CPP explicitly.
13376
13377 -trigraphs
13378 Support ISO C trigraphs. These are three-character sequences, all
13379 starting with ??, that are defined by ISO C to stand for single
13380 characters. For example, ??/ stands for \, so '??/n' is a
13381 character constant for a newline.
13382
13383 The nine trigraphs and their replacements are
13384
13385 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
13386 Replacement: [ ] { } # \ ^ | ~
13387
13388 By default, GCC ignores trigraphs, but in standard-conforming modes
13389 it converts them. See the -std and -ansi options.
13390
13391 -remap
13392 Enable special code to work around file systems which only permit
13393 very short file names, such as MS-DOS.
13394
13395 -H Print the name of each header file used, in addition to other
13396 normal activities. Each name is indented to show how deep in the
13397 #include stack it is. Precompiled header files are also printed,
13398 even if they are found to be invalid; an invalid precompiled header
13399 file is printed with ...x and a valid one with ...! .
13400
13401 -dletters
13402 Says to make debugging dumps during compilation as specified by
13403 letters. The flags documented here are those relevant to the
13404 preprocessor. Other letters are interpreted by the compiler
13405 proper, or reserved for future versions of GCC, and so are silently
13406 ignored. If you specify letters whose behavior conflicts, the
13407 result is undefined.
13408
13409 -dM Instead of the normal output, generate a list of #define
13410 directives for all the macros defined during the execution of
13411 the preprocessor, including predefined macros. This gives you
13412 a way of finding out what is predefined in your version of the
13413 preprocessor. Assuming you have no file foo.h, the command
13414
13415 touch foo.h; cpp -dM foo.h
13416
13417 shows all the predefined macros.
13418
13419 If you use -dM without the -E option, -dM is interpreted as a
13420 synonym for -fdump-rtl-mach.
13421
13422 -dD Like -dM except in two respects: it does not include the
13423 predefined macros, and it outputs both the #define directives
13424 and the result of preprocessing. Both kinds of output go to
13425 the standard output file.
13426
13427 -dN Like -dD, but emit only the macro names, not their expansions.
13428
13429 -dI Output #include directives in addition to the result of
13430 preprocessing.
13431
13432 -dU Like -dD except that only macros that are expanded, or whose
13433 definedness is tested in preprocessor directives, are output;
13434 the output is delayed until the use or test of the macro; and
13435 #undef directives are also output for macros tested but
13436 undefined at the time.
13437
13438 -fdebug-cpp
13439 This option is only useful for debugging GCC. When used from CPP
13440 or with -E, it dumps debugging information about location maps.
13441 Every token in the output is preceded by the dump of the map its
13442 location belongs to.
13443
13444 When used from GCC without -E, this option has no effect.
13445
13446 -Wp,option
13447 You can use -Wp,option to bypass the compiler driver and pass
13448 option directly through to the preprocessor. If option contains
13449 commas, it is split into multiple options at the commas. However,
13450 many options are modified, translated or interpreted by the
13451 compiler driver before being passed to the preprocessor, and -Wp
13452 forcibly bypasses this phase. The preprocessor's direct interface
13453 is undocumented and subject to change, so whenever possible you
13454 should avoid using -Wp and let the driver handle the options
13455 instead.
13456
13457 -Xpreprocessor option
13458 Pass option as an option to the preprocessor. You can use this to
13459 supply system-specific preprocessor options that GCC does not
13460 recognize.
13461
13462 If you want to pass an option that takes an argument, you must use
13463 -Xpreprocessor twice, once for the option and once for the
13464 argument.
13465
13466 -no-integrated-cpp
13467 Perform preprocessing as a separate pass before compilation. By
13468 default, GCC performs preprocessing as an integrated part of input
13469 tokenization and parsing. If this option is provided, the
13470 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
13471 and Objective-C, respectively) is instead invoked twice, once for
13472 preprocessing only and once for actual compilation of the
13473 preprocessed input. This option may be useful in conjunction with
13474 the -B or -wrapper options to specify an alternate preprocessor or
13475 perform additional processing of the program source between normal
13476 preprocessing and compilation.
13477
13478 -flarge-source-files
13479 Adjust GCC to expect large source files, at the expense of slower
13480 compilation and higher memory usage.
13481
13482 Specifically, GCC normally tracks both column numbers and line
13483 numbers within source files and it normally prints both of these
13484 numbers in diagnostics. However, once it has processed a certain
13485 number of source lines, it stops tracking column numbers and only
13486 tracks line numbers. This means that diagnostics for later lines
13487 do not include column numbers. It also means that options like
13488 -Wmisleading-indentation cease to work at that point, although the
13489 compiler prints a note if this happens. Passing
13490 -flarge-source-files significantly increases the number of source
13491 lines that GCC can process before it stops tracking columns.
13492
13493 Passing Options to the Assembler
13494 You can pass options to the assembler.
13495
13496 -Wa,option
13497 Pass option as an option to the assembler. If option contains
13498 commas, it is split into multiple options at the commas.
13499
13500 -Xassembler option
13501 Pass option as an option to the assembler. You can use this to
13502 supply system-specific assembler options that GCC does not
13503 recognize.
13504
13505 If you want to pass an option that takes an argument, you must use
13506 -Xassembler twice, once for the option and once for the argument.
13507
13508 Options for Linking
13509 These options come into play when the compiler links object files into
13510 an executable output file. They are meaningless if the compiler is not
13511 doing a link step.
13512
13513 object-file-name
13514 A file name that does not end in a special recognized suffix is
13515 considered to name an object file or library. (Object files are
13516 distinguished from libraries by the linker according to the file
13517 contents.) If linking is done, these object files are used as
13518 input to the linker.
13519
13520 -c
13521 -S
13522 -E If any of these options is used, then the linker is not run, and
13523 object file names should not be used as arguments.
13524
13525 -flinker-output=type
13526 This option controls code generation of the link-time optimizer.
13527 By default the linker output is automatically determined by the
13528 linker plugin. For debugging the compiler and if incremental
13529 linking with a non-LTO object file is desired, it may be useful to
13530 control the type manually.
13531
13532 If type is exec, code generation produces a static binary. In this
13533 case -fpic and -fpie are both disabled.
13534
13535 If type is dyn, code generation produces a shared library. In this
13536 case -fpic or -fPIC is preserved, but not enabled automatically.
13537 This allows to build shared libraries without position-independent
13538 code on architectures where this is possible, i.e. on x86.
13539
13540 If type is pie, code generation produces an -fpie executable. This
13541 results in similar optimizations as exec except that -fpie is not
13542 disabled if specified at compilation time.
13543
13544 If type is rel, the compiler assumes that incremental linking is
13545 done. The sections containing intermediate code for link-time
13546 optimization are merged, pre-optimized, and output to the resulting
13547 object file. In addition, if -ffat-lto-objects is specified, binary
13548 code is produced for future non-LTO linking. The object file
13549 produced by incremental linking is smaller than a static library
13550 produced from the same object files. At link time the result of
13551 incremental linking also loads faster than a static library
13552 assuming that the majority of objects in the library are used.
13553
13554 Finally nolto-rel configures the compiler for incremental linking
13555 where code generation is forced, a final binary is produced, and
13556 the intermediate code for later link-time optimization is stripped.
13557 When multiple object files are linked together the resulting code
13558 is better optimized than with link-time optimizations disabled (for
13559 example, cross-module inlining happens), but most of benefits of
13560 whole program optimizations are lost.
13561
13562 During the incremental link (by -r) the linker plugin defaults to
13563 rel. With current interfaces to GNU Binutils it is however not
13564 possible to incrementally link LTO objects and non-LTO objects into
13565 a single mixed object file. If any of object files in incremental
13566 link cannot be used for link-time optimization, the linker plugin
13567 issues a warning and uses nolto-rel. To maintain whole program
13568 optimization, it is recommended to link such objects into static
13569 library instead. Alternatively it is possible to use H.J. Lu's
13570 binutils with support for mixed objects.
13571
13572 -fuse-ld=bfd
13573 Use the bfd linker instead of the default linker.
13574
13575 -fuse-ld=gold
13576 Use the gold linker instead of the default linker.
13577
13578 -fuse-ld=lld
13579 Use the LLVM lld linker instead of the default linker.
13580
13581 -llibrary
13582 -l library
13583 Search the library named library when linking. (The second
13584 alternative with the library as a separate argument is only for
13585 POSIX compliance and is not recommended.)
13586
13587 The -l option is passed directly to the linker by GCC. Refer to
13588 your linker documentation for exact details. The general
13589 description below applies to the GNU linker.
13590
13591 The linker searches a standard list of directories for the library.
13592 The directories searched include several standard system
13593 directories plus any that you specify with -L.
13594
13595 Static libraries are archives of object files, and have file names
13596 like liblibrary.a. Some targets also support shared libraries,
13597 which typically have names like liblibrary.so. If both static and
13598 shared libraries are found, the linker gives preference to linking
13599 with the shared library unless the -static option is used.
13600
13601 It makes a difference where in the command you write this option;
13602 the linker searches and processes libraries and object files in the
13603 order they are specified. Thus, foo.o -lz bar.o searches library z
13604 after file foo.o but before bar.o. If bar.o refers to functions in
13605 z, those functions may not be loaded.
13606
13607 -lobjc
13608 You need this special case of the -l option in order to link an
13609 Objective-C or Objective-C++ program.
13610
13611 -nostartfiles
13612 Do not use the standard system startup files when linking. The
13613 standard system libraries are used normally, unless -nostdlib,
13614 -nolibc, or -nodefaultlibs is used.
13615
13616 -nodefaultlibs
13617 Do not use the standard system libraries when linking. Only the
13618 libraries you specify are passed to the linker, and options
13619 specifying linkage of the system libraries, such as -static-libgcc
13620 or -shared-libgcc, are ignored. The standard startup files are
13621 used normally, unless -nostartfiles is used.
13622
13623 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13624 "memmove". These entries are usually resolved by entries in libc.
13625 These entry points should be supplied through some other mechanism
13626 when this option is specified.
13627
13628 -nolibc
13629 Do not use the C library or system libraries tightly coupled with
13630 it when linking. Still link with the startup files, libgcc or
13631 toolchain provided language support libraries such as libgnat,
13632 libgfortran or libstdc++ unless options preventing their inclusion
13633 are used as well. This typically removes -lc from the link command
13634 line, as well as system libraries that normally go with it and
13635 become meaningless when absence of a C library is assumed, for
13636 example -lpthread or -lm in some configurations. This is intended
13637 for bare-board targets when there is indeed no C library available.
13638
13639 -nostdlib
13640 Do not use the standard system startup files or libraries when
13641 linking. No startup files and only the libraries you specify are
13642 passed to the linker, and options specifying linkage of the system
13643 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
13644
13645 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13646 "memmove". These entries are usually resolved by entries in libc.
13647 These entry points should be supplied through some other mechanism
13648 when this option is specified.
13649
13650 One of the standard libraries bypassed by -nostdlib and
13651 -nodefaultlibs is libgcc.a, a library of internal subroutines which
13652 GCC uses to overcome shortcomings of particular machines, or
13653 special needs for some languages.
13654
13655 In most cases, you need libgcc.a even when you want to avoid other
13656 standard libraries. In other words, when you specify -nostdlib or
13657 -nodefaultlibs you should usually specify -lgcc as well. This
13658 ensures that you have no unresolved references to internal GCC
13659 library subroutines. (An example of such an internal subroutine is
13660 "__main", used to ensure C++ constructors are called.)
13661
13662 -e entry
13663 --entry=entry
13664 Specify that the program entry point is entry. The argument is
13665 interpreted by the linker; the GNU linker accepts either a symbol
13666 name or an address.
13667
13668 -pie
13669 Produce a dynamically linked position independent executable on
13670 targets that support it. For predictable results, you must also
13671 specify the same set of options used for compilation (-fpie, -fPIE,
13672 or model suboptions) when you specify this linker option.
13673
13674 -no-pie
13675 Don't produce a dynamically linked position independent executable.
13676
13677 -static-pie
13678 Produce a static position independent executable on targets that
13679 support it. A static position independent executable is similar to
13680 a static executable, but can be loaded at any address without a
13681 dynamic linker. For predictable results, you must also specify the
13682 same set of options used for compilation (-fpie, -fPIE, or model
13683 suboptions) when you specify this linker option.
13684
13685 -pthread
13686 Link with the POSIX threads library. This option is supported on
13687 GNU/Linux targets, most other Unix derivatives, and also on x86
13688 Cygwin and MinGW targets. On some targets this option also sets
13689 flags for the preprocessor, so it should be used consistently for
13690 both compilation and linking.
13691
13692 -r Produce a relocatable object as output. This is also known as
13693 partial linking.
13694
13695 -rdynamic
13696 Pass the flag -export-dynamic to the ELF linker, on targets that
13697 support it. This instructs the linker to add all symbols, not only
13698 used ones, to the dynamic symbol table. This option is needed for
13699 some uses of "dlopen" or to allow obtaining backtraces from within
13700 a program.
13701
13702 -s Remove all symbol table and relocation information from the
13703 executable.
13704
13705 -static
13706 On systems that support dynamic linking, this overrides -pie and
13707 prevents linking with the shared libraries. On other systems, this
13708 option has no effect.
13709
13710 -shared
13711 Produce a shared object which can then be linked with other objects
13712 to form an executable. Not all systems support this option. For
13713 predictable results, you must also specify the same set of options
13714 used for compilation (-fpic, -fPIC, or model suboptions) when you
13715 specify this linker option.[1]
13716
13717 -shared-libgcc
13718 -static-libgcc
13719 On systems that provide libgcc as a shared library, these options
13720 force the use of either the shared or static version, respectively.
13721 If no shared version of libgcc was built when the compiler was
13722 configured, these options have no effect.
13723
13724 There are several situations in which an application should use the
13725 shared libgcc instead of the static version. The most common of
13726 these is when the application wishes to throw and catch exceptions
13727 across different shared libraries. In that case, each of the
13728 libraries as well as the application itself should use the shared
13729 libgcc.
13730
13731 Therefore, the G++ driver automatically adds -shared-libgcc
13732 whenever you build a shared library or a main executable, because
13733 C++ programs typically use exceptions, so this is the right thing
13734 to do.
13735
13736 If, instead, you use the GCC driver to create shared libraries, you
13737 may find that they are not always linked with the shared libgcc.
13738 If GCC finds, at its configuration time, that you have a non-GNU
13739 linker or a GNU linker that does not support option --eh-frame-hdr,
13740 it links the shared version of libgcc into shared libraries by
13741 default. Otherwise, it takes advantage of the linker and optimizes
13742 away the linking with the shared version of libgcc, linking with
13743 the static version of libgcc by default. This allows exceptions to
13744 propagate through such shared libraries, without incurring
13745 relocation costs at library load time.
13746
13747 However, if a library or main executable is supposed to throw or
13748 catch exceptions, you must link it using the G++ driver, or using
13749 the option -shared-libgcc, such that it is linked with the shared
13750 libgcc.
13751
13752 -static-libasan
13753 When the -fsanitize=address option is used to link a program, the
13754 GCC driver automatically links against libasan. If libasan is
13755 available as a shared library, and the -static option is not used,
13756 then this links against the shared version of libasan. The
13757 -static-libasan option directs the GCC driver to link libasan
13758 statically, without necessarily linking other libraries statically.
13759
13760 -static-libtsan
13761 When the -fsanitize=thread option is used to link a program, the
13762 GCC driver automatically links against libtsan. If libtsan is
13763 available as a shared library, and the -static option is not used,
13764 then this links against the shared version of libtsan. The
13765 -static-libtsan option directs the GCC driver to link libtsan
13766 statically, without necessarily linking other libraries statically.
13767
13768 -static-liblsan
13769 When the -fsanitize=leak option is used to link a program, the GCC
13770 driver automatically links against liblsan. If liblsan is
13771 available as a shared library, and the -static option is not used,
13772 then this links against the shared version of liblsan. The
13773 -static-liblsan option directs the GCC driver to link liblsan
13774 statically, without necessarily linking other libraries statically.
13775
13776 -static-libubsan
13777 When the -fsanitize=undefined option is used to link a program, the
13778 GCC driver automatically links against libubsan. If libubsan is
13779 available as a shared library, and the -static option is not used,
13780 then this links against the shared version of libubsan. The
13781 -static-libubsan option directs the GCC driver to link libubsan
13782 statically, without necessarily linking other libraries statically.
13783
13784 -static-libstdc++
13785 When the g++ program is used to link a C++ program, it normally
13786 automatically links against libstdc++. If libstdc++ is available
13787 as a shared library, and the -static option is not used, then this
13788 links against the shared version of libstdc++. That is normally
13789 fine. However, it is sometimes useful to freeze the version of
13790 libstdc++ used by the program without going all the way to a fully
13791 static link. The -static-libstdc++ option directs the g++ driver
13792 to link libstdc++ statically, without necessarily linking other
13793 libraries statically.
13794
13795 -symbolic
13796 Bind references to global symbols when building a shared object.
13797 Warn about any unresolved references (unless overridden by the link
13798 editor option -Xlinker -z -Xlinker defs). Only a few systems
13799 support this option.
13800
13801 -T script
13802 Use script as the linker script. This option is supported by most
13803 systems using the GNU linker. On some targets, such as bare-board
13804 targets without an operating system, the -T option may be required
13805 when linking to avoid references to undefined symbols.
13806
13807 -Xlinker option
13808 Pass option as an option to the linker. You can use this to supply
13809 system-specific linker options that GCC does not recognize.
13810
13811 If you want to pass an option that takes a separate argument, you
13812 must use -Xlinker twice, once for the option and once for the
13813 argument. For example, to pass -assert definitions, you must write
13814 -Xlinker -assert -Xlinker definitions. It does not work to write
13815 -Xlinker "-assert definitions", because this passes the entire
13816 string as a single argument, which is not what the linker expects.
13817
13818 When using the GNU linker, it is usually more convenient to pass
13819 arguments to linker options using the option=value syntax than as
13820 separate arguments. For example, you can specify -Xlinker
13821 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
13822 Other linkers may not support this syntax for command-line options.
13823
13824 -Wl,option
13825 Pass option as an option to the linker. If option contains commas,
13826 it is split into multiple options at the commas. You can use this
13827 syntax to pass an argument to the option. For example,
13828 -Wl,-Map,output.map passes -Map output.map to the linker. When
13829 using the GNU linker, you can also get the same effect with
13830 -Wl,-Map=output.map.
13831
13832 -u symbol
13833 Pretend the symbol symbol is undefined, to force linking of library
13834 modules to define it. You can use -u multiple times with different
13835 symbols to force loading of additional library modules.
13836
13837 -z keyword
13838 -z is passed directly on to the linker along with the keyword
13839 keyword. See the section in the documentation of your linker for
13840 permitted values and their meanings.
13841
13842 Options for Directory Search
13843 These options specify directories to search for header files, for
13844 libraries and for parts of the compiler:
13845
13846 -I dir
13847 -iquote dir
13848 -isystem dir
13849 -idirafter dir
13850 Add the directory dir to the list of directories to be searched for
13851 header files during preprocessing. If dir begins with = or
13852 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
13853 see --sysroot and -isysroot.
13854
13855 Directories specified with -iquote apply only to the quote form of
13856 the directive, "#include "file"". Directories specified with -I,
13857 -isystem, or -idirafter apply to lookup for both the
13858 "#include "file"" and "#include <file>" directives.
13859
13860 You can specify any number or combination of these options on the
13861 command line to search for header files in several directories.
13862 The lookup order is as follows:
13863
13864 1. For the quote form of the include directive, the directory of
13865 the current file is searched first.
13866
13867 2. For the quote form of the include directive, the directories
13868 specified by -iquote options are searched in left-to-right
13869 order, as they appear on the command line.
13870
13871 3. Directories specified with -I options are scanned in left-to-
13872 right order.
13873
13874 4. Directories specified with -isystem options are scanned in
13875 left-to-right order.
13876
13877 5. Standard system directories are scanned.
13878
13879 6. Directories specified with -idirafter options are scanned in
13880 left-to-right order.
13881
13882 You can use -I to override a system header file, substituting your
13883 own version, since these directories are searched before the
13884 standard system header file directories. However, you should not
13885 use this option to add directories that contain vendor-supplied
13886 system header files; use -isystem for that.
13887
13888 The -isystem and -idirafter options also mark the directory as a
13889 system directory, so that it gets the same special treatment that
13890 is applied to the standard system directories.
13891
13892 If a standard system include directory, or a directory specified
13893 with -isystem, is also specified with -I, the -I option is ignored.
13894 The directory is still searched but as a system directory at its
13895 normal position in the system include chain. This is to ensure
13896 that GCC's procedure to fix buggy system headers and the ordering
13897 for the "#include_next" directive are not inadvertently changed.
13898 If you really need to change the search order for system
13899 directories, use the -nostdinc and/or -isystem options.
13900
13901 -I- Split the include path. This option has been deprecated. Please
13902 use -iquote instead for -I directories before the -I- and remove
13903 the -I- option.
13904
13905 Any directories specified with -I options before -I- are searched
13906 only for headers requested with "#include "file""; they are not
13907 searched for "#include <file>". If additional directories are
13908 specified with -I options after the -I-, those directories are
13909 searched for all #include directives.
13910
13911 In addition, -I- inhibits the use of the directory of the current
13912 file directory as the first search directory for "#include "file"".
13913 There is no way to override this effect of -I-.
13914
13915 -iprefix prefix
13916 Specify prefix as the prefix for subsequent -iwithprefix options.
13917 If the prefix represents a directory, you should include the final
13918 /.
13919
13920 -iwithprefix dir
13921 -iwithprefixbefore dir
13922 Append dir to the prefix specified previously with -iprefix, and
13923 add the resulting directory to the include search path.
13924 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
13925 puts it where -idirafter would.
13926
13927 -isysroot dir
13928 This option is like the --sysroot option, but applies only to
13929 header files (except for Darwin targets, where it applies to both
13930 header files and libraries). See the --sysroot option for more
13931 information.
13932
13933 -imultilib dir
13934 Use dir as a subdirectory of the directory containing target-
13935 specific C++ headers.
13936
13937 -nostdinc
13938 Do not search the standard system directories for header files.
13939 Only the directories explicitly specified with -I, -iquote,
13940 -isystem, and/or -idirafter options (and the directory of the
13941 current file, if appropriate) are searched.
13942
13943 -nostdinc++
13944 Do not search for header files in the C++-specific standard
13945 directories, but do still search the other standard directories.
13946 (This option is used when building the C++ library.)
13947
13948 -iplugindir=dir
13949 Set the directory to search for plugins that are passed by
13950 -fplugin=name instead of -fplugin=path/name.so. This option is not
13951 meant to be used by the user, but only passed by the driver.
13952
13953 -Ldir
13954 Add directory dir to the list of directories to be searched for -l.
13955
13956 -Bprefix
13957 This option specifies where to find the executables, libraries,
13958 include files, and data files of the compiler itself.
13959
13960 The compiler driver program runs one or more of the subprograms
13961 cpp, cc1, as and ld. It tries prefix as a prefix for each program
13962 it tries to run, both with and without machine/version/ for the
13963 corresponding target machine and compiler version.
13964
13965 For each subprogram to be run, the compiler driver first tries the
13966 -B prefix, if any. If that name is not found, or if -B is not
13967 specified, the driver tries two standard prefixes, /usr/lib/gcc/
13968 and /usr/local/lib/gcc/. If neither of those results in a file
13969 name that is found, the unmodified program name is searched for
13970 using the directories specified in your PATH environment variable.
13971
13972 The compiler checks to see if the path provided by -B refers to a
13973 directory, and if necessary it adds a directory separator character
13974 at the end of the path.
13975
13976 -B prefixes that effectively specify directory names also apply to
13977 libraries in the linker, because the compiler translates these
13978 options into -L options for the linker. They also apply to include
13979 files in the preprocessor, because the compiler translates these
13980 options into -isystem options for the preprocessor. In this case,
13981 the compiler appends include to the prefix.
13982
13983 The runtime support file libgcc.a can also be searched for using
13984 the -B prefix, if needed. If it is not found there, the two
13985 standard prefixes above are tried, and that is all. The file is
13986 left out of the link if it is not found by those means.
13987
13988 Another way to specify a prefix much like the -B prefix is to use
13989 the environment variable GCC_EXEC_PREFIX.
13990
13991 As a special kludge, if the path provided by -B is [dir/]stageN/,
13992 where N is a number in the range 0 to 9, then it is replaced by
13993 [dir/]include. This is to help with boot-strapping the compiler.
13994
13995 -no-canonical-prefixes
13996 Do not expand any symbolic links, resolve references to /../ or
13997 /./, or make the path absolute when generating a relative prefix.
13998
13999 --sysroot=dir
14000 Use dir as the logical root directory for headers and libraries.
14001 For example, if the compiler normally searches for headers in
14002 /usr/include and libraries in /usr/lib, it instead searches
14003 dir/usr/include and dir/usr/lib.
14004
14005 If you use both this option and the -isysroot option, then the
14006 --sysroot option applies to libraries, but the -isysroot option
14007 applies to header files.
14008
14009 The GNU linker (beginning with version 2.16) has the necessary
14010 support for this option. If your linker does not support this
14011 option, the header file aspect of --sysroot still works, but the
14012 library aspect does not.
14013
14014 --no-sysroot-suffix
14015 For some targets, a suffix is added to the root directory specified
14016 with --sysroot, depending on the other options used, so that
14017 headers may for example be found in dir/suffix/usr/include instead
14018 of dir/usr/include. This option disables the addition of such a
14019 suffix.
14020
14021 Options for Code Generation Conventions
14022 These machine-independent options control the interface conventions
14023 used in code generation.
14024
14025 Most of them have both positive and negative forms; the negative form
14026 of -ffoo is -fno-foo. In the table below, only one of the forms is
14027 listed---the one that is not the default. You can figure out the other
14028 form by either removing no- or adding it.
14029
14030 -fstack-reuse=reuse-level
14031 This option controls stack space reuse for user declared local/auto
14032 variables and compiler generated temporaries. reuse_level can be
14033 all, named_vars, or none. all enables stack reuse for all local
14034 variables and temporaries, named_vars enables the reuse only for
14035 user defined local variables with names, and none disables stack
14036 reuse completely. The default value is all. The option is needed
14037 when the program extends the lifetime of a scoped local variable or
14038 a compiler generated temporary beyond the end point defined by the
14039 language. When a lifetime of a variable ends, and if the variable
14040 lives in memory, the optimizing compiler has the freedom to reuse
14041 its stack space with other temporaries or scoped local variables
14042 whose live range does not overlap with it. Legacy code extending
14043 local lifetime is likely to break with the stack reuse
14044 optimization.
14045
14046 For example,
14047
14048 int *p;
14049 {
14050 int local1;
14051
14052 p = &local1;
14053 local1 = 10;
14054 ....
14055 }
14056 {
14057 int local2;
14058 local2 = 20;
14059 ...
14060 }
14061
14062 if (*p == 10) // out of scope use of local1
14063 {
14064
14065 }
14066
14067 Another example:
14068
14069 struct A
14070 {
14071 A(int k) : i(k), j(k) { }
14072 int i;
14073 int j;
14074 };
14075
14076 A *ap;
14077
14078 void foo(const A& ar)
14079 {
14080 ap = &ar;
14081 }
14082
14083 void bar()
14084 {
14085 foo(A(10)); // temp object's lifetime ends when foo returns
14086
14087 {
14088 A a(20);
14089 ....
14090 }
14091 ap->i+= 10; // ap references out of scope temp whose space
14092 // is reused with a. What is the value of ap->i?
14093 }
14094
14095 The lifetime of a compiler generated temporary is well defined by
14096 the C++ standard. When a lifetime of a temporary ends, and if the
14097 temporary lives in memory, the optimizing compiler has the freedom
14098 to reuse its stack space with other temporaries or scoped local
14099 variables whose live range does not overlap with it. However some
14100 of the legacy code relies on the behavior of older compilers in
14101 which temporaries' stack space is not reused, the aggressive stack
14102 reuse can lead to runtime errors. This option is used to control
14103 the temporary stack reuse optimization.
14104
14105 -ftrapv
14106 This option generates traps for signed overflow on addition,
14107 subtraction, multiplication operations. The options -ftrapv and
14108 -fwrapv override each other, so using -ftrapv -fwrapv on the
14109 command-line results in -fwrapv being effective. Note that only
14110 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14111 command-line results in -ftrapv being effective.
14112
14113 -fwrapv
14114 This option instructs the compiler to assume that signed arithmetic
14115 overflow of addition, subtraction and multiplication wraps around
14116 using twos-complement representation. This flag enables some
14117 optimizations and disables others. The options -ftrapv and -fwrapv
14118 override each other, so using -ftrapv -fwrapv on the command-line
14119 results in -fwrapv being effective. Note that only active options
14120 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14121 results in -ftrapv being effective.
14122
14123 -fwrapv-pointer
14124 This option instructs the compiler to assume that pointer
14125 arithmetic overflow on addition and subtraction wraps around using
14126 twos-complement representation. This flag disables some
14127 optimizations which assume pointer overflow is invalid.
14128
14129 -fstrict-overflow
14130 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14131 implies -fwrapv -fwrapv-pointer.
14132
14133 -fexceptions
14134 Enable exception handling. Generates extra code needed to
14135 propagate exceptions. For some targets, this implies GCC generates
14136 frame unwind information for all functions, which can produce
14137 significant data size overhead, although it does not affect
14138 execution. If you do not specify this option, GCC enables it by
14139 default for languages like C++ that normally require exception
14140 handling, and disables it for languages like C that do not normally
14141 require it. However, you may need to enable this option when
14142 compiling C code that needs to interoperate properly with exception
14143 handlers written in C++. You may also wish to disable this option
14144 if you are compiling older C++ programs that don't use exception
14145 handling.
14146
14147 -fnon-call-exceptions
14148 Generate code that allows trapping instructions to throw
14149 exceptions. Note that this requires platform-specific runtime
14150 support that does not exist everywhere. Moreover, it only allows
14151 trapping instructions to throw exceptions, i.e. memory references
14152 or floating-point instructions. It does not allow exceptions to be
14153 thrown from arbitrary signal handlers such as "SIGALRM".
14154
14155 -fdelete-dead-exceptions
14156 Consider that instructions that may throw exceptions but don't
14157 otherwise contribute to the execution of the program can be
14158 optimized away. This option is enabled by default for the Ada
14159 compiler, as permitted by the Ada language specification.
14160 Optimization passes that cause dead exceptions to be removed are
14161 enabled independently at different optimization levels.
14162
14163 -funwind-tables
14164 Similar to -fexceptions, except that it just generates any needed
14165 static data, but does not affect the generated code in any other
14166 way. You normally do not need to enable this option; instead, a
14167 language processor that needs this handling enables it on your
14168 behalf.
14169
14170 -fasynchronous-unwind-tables
14171 Generate unwind table in DWARF format, if supported by target
14172 machine. The table is exact at each instruction boundary, so it
14173 can be used for stack unwinding from asynchronous events (such as
14174 debugger or garbage collector).
14175
14176 -fno-gnu-unique
14177 On systems with recent GNU assembler and C library, the C++
14178 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
14179 definitions of template static data members and static local
14180 variables in inline functions are unique even in the presence of
14181 "RTLD_LOCAL"; this is necessary to avoid problems with a library
14182 used by two different "RTLD_LOCAL" plugins depending on a
14183 definition in one of them and therefore disagreeing with the other
14184 one about the binding of the symbol. But this causes "dlclose" to
14185 be ignored for affected DSOs; if your program relies on
14186 reinitialization of a DSO via "dlclose" and "dlopen", you can use
14187 -fno-gnu-unique.
14188
14189 -fpcc-struct-return
14190 Return "short" "struct" and "union" values in memory like longer
14191 ones, rather than in registers. This convention is less efficient,
14192 but it has the advantage of allowing intercallability between GCC-
14193 compiled files and files compiled with other compilers,
14194 particularly the Portable C Compiler (pcc).
14195
14196 The precise convention for returning structures in memory depends
14197 on the target configuration macros.
14198
14199 Short structures and unions are those whose size and alignment
14200 match that of some integer type.
14201
14202 Warning: code compiled with the -fpcc-struct-return switch is not
14203 binary compatible with code compiled with the -freg-struct-return
14204 switch. Use it to conform to a non-default application binary
14205 interface.
14206
14207 -freg-struct-return
14208 Return "struct" and "union" values in registers when possible.
14209 This is more efficient for small structures than
14210 -fpcc-struct-return.
14211
14212 If you specify neither -fpcc-struct-return nor -freg-struct-return,
14213 GCC defaults to whichever convention is standard for the target.
14214 If there is no standard convention, GCC defaults to
14215 -fpcc-struct-return, except on targets where GCC is the principal
14216 compiler. In those cases, we can choose the standard, and we chose
14217 the more efficient register return alternative.
14218
14219 Warning: code compiled with the -freg-struct-return switch is not
14220 binary compatible with code compiled with the -fpcc-struct-return
14221 switch. Use it to conform to a non-default application binary
14222 interface.
14223
14224 -fshort-enums
14225 Allocate to an "enum" type only as many bytes as it needs for the
14226 declared range of possible values. Specifically, the "enum" type
14227 is equivalent to the smallest integer type that has enough room.
14228
14229 Warning: the -fshort-enums switch causes GCC to generate code that
14230 is not binary compatible with code generated without that switch.
14231 Use it to conform to a non-default application binary interface.
14232
14233 -fshort-wchar
14234 Override the underlying type for "wchar_t" to be "short unsigned
14235 int" instead of the default for the target. This option is useful
14236 for building programs to run under WINE.
14237
14238 Warning: the -fshort-wchar switch causes GCC to generate code that
14239 is not binary compatible with code generated without that switch.
14240 Use it to conform to a non-default application binary interface.
14241
14242 -fcommon
14243 In C code, this option controls the placement of global variables
14244 defined without an initializer, known as tentative definitions in
14245 the C standard. Tentative definitions are distinct from
14246 declarations of a variable with the "extern" keyword, which do not
14247 allocate storage.
14248
14249 The default is -fno-common, which specifies that the compiler
14250 places uninitialized global variables in the BSS section of the
14251 object file. This inhibits the merging of tentative definitions by
14252 the linker so you get a multiple-definition error if the same
14253 variable is accidentally defined in more than one compilation unit.
14254
14255 The -fcommon places uninitialized global variables in a common
14256 block. This allows the linker to resolve all tentative definitions
14257 of the same variable in different compilation units to the same
14258 object, or to a non-tentative definition. This behavior is
14259 inconsistent with C++, and on many targets implies a speed and code
14260 size penalty on global variable references. It is mainly useful to
14261 enable legacy code to link without errors.
14262
14263 -fno-ident
14264 Ignore the "#ident" directive.
14265
14266 -finhibit-size-directive
14267 Don't output a ".size" assembler directive, or anything else that
14268 would cause trouble if the function is split in the middle, and the
14269 two halves are placed at locations far apart in memory. This
14270 option is used when compiling crtstuff.c; you should not need to
14271 use it for anything else.
14272
14273 -fverbose-asm
14274 Put extra commentary information in the generated assembly code to
14275 make it more readable. This option is generally only of use to
14276 those who actually need to read the generated assembly code
14277 (perhaps while debugging the compiler itself).
14278
14279 -fno-verbose-asm, the default, causes the extra information to be
14280 omitted and is useful when comparing two assembler files.
14281
14282 The added comments include:
14283
14284 * information on the compiler version and command-line options,
14285
14286 * the source code lines associated with the assembly
14287 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14288
14289 * hints on which high-level expressions correspond to the various
14290 assembly instruction operands.
14291
14292 For example, given this C source file:
14293
14294 int test (int n)
14295 {
14296 int i;
14297 int total = 0;
14298
14299 for (i = 0; i < n; i++)
14300 total += i * i;
14301
14302 return total;
14303 }
14304
14305 compiling to (x86_64) assembly via -S and emitting the result
14306 direct to stdout via -o -
14307
14308 gcc -S test.c -fverbose-asm -Os -o -
14309
14310 gives output similar to this:
14311
14312 .file "test.c"
14313 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14314 [...snip...]
14315 # options passed:
14316 [...snip...]
14317
14318 .text
14319 .globl test
14320 .type test, @function
14321 test:
14322 .LFB0:
14323 .cfi_startproc
14324 # test.c:4: int total = 0;
14325 xorl %eax, %eax # <retval>
14326 # test.c:6: for (i = 0; i < n; i++)
14327 xorl %edx, %edx # i
14328 .L2:
14329 # test.c:6: for (i = 0; i < n; i++)
14330 cmpl %edi, %edx # n, i
14331 jge .L5 #,
14332 # test.c:7: total += i * i;
14333 movl %edx, %ecx # i, tmp92
14334 imull %edx, %ecx # i, tmp92
14335 # test.c:6: for (i = 0; i < n; i++)
14336 incl %edx # i
14337 # test.c:7: total += i * i;
14338 addl %ecx, %eax # tmp92, <retval>
14339 jmp .L2 #
14340 .L5:
14341 # test.c:10: }
14342 ret
14343 .cfi_endproc
14344 .LFE0:
14345 .size test, .-test
14346 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14347 .section .note.GNU-stack,"",@progbits
14348
14349 The comments are intended for humans rather than machines and hence
14350 the precise format of the comments is subject to change.
14351
14352 -frecord-gcc-switches
14353 This switch causes the command line used to invoke the compiler to
14354 be recorded into the object file that is being created. This
14355 switch is only implemented on some targets and the exact format of
14356 the recording is target and binary file format dependent, but it
14357 usually takes the form of a section containing ASCII text. This
14358 switch is related to the -fverbose-asm switch, but that switch only
14359 records information in the assembler output file as comments, so it
14360 never reaches the object file. See also -grecord-gcc-switches for
14361 another way of storing compiler options into the object file.
14362
14363 -fpic
14364 Generate position-independent code (PIC) suitable for use in a
14365 shared library, if supported for the target machine. Such code
14366 accesses all constant addresses through a global offset table
14367 (GOT). The dynamic loader resolves the GOT entries when the
14368 program starts (the dynamic loader is not part of GCC; it is part
14369 of the operating system). If the GOT size for the linked
14370 executable exceeds a machine-specific maximum size, you get an
14371 error message from the linker indicating that -fpic does not work;
14372 in that case, recompile with -fPIC instead. (These maximums are 8k
14373 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
14374 x86 has no such limit.)
14375
14376 Position-independent code requires special support, and therefore
14377 works only on certain machines. For the x86, GCC supports PIC for
14378 System V but not for the Sun 386i. Code generated for the IBM
14379 RS/6000 is always position-independent.
14380
14381 When this flag is set, the macros "__pic__" and "__PIC__" are
14382 defined to 1.
14383
14384 -fPIC
14385 If supported for the target machine, emit position-independent
14386 code, suitable for dynamic linking and avoiding any limit on the
14387 size of the global offset table. This option makes a difference on
14388 AArch64, m68k, PowerPC and SPARC.
14389
14390 Position-independent code requires special support, and therefore
14391 works only on certain machines.
14392
14393 When this flag is set, the macros "__pic__" and "__PIC__" are
14394 defined to 2.
14395
14396 -fpie
14397 -fPIE
14398 These options are similar to -fpic and -fPIC, but the generated
14399 position-independent code can be only linked into executables.
14400 Usually these options are used to compile code that will be linked
14401 using the -pie GCC option.
14402
14403 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
14404 The macros have the value 1 for -fpie and 2 for -fPIE.
14405
14406 -fno-plt
14407 Do not use the PLT for external function calls in position-
14408 independent code. Instead, load the callee address at call sites
14409 from the GOT and branch to it. This leads to more efficient code
14410 by eliminating PLT stubs and exposing GOT loads to optimizations.
14411 On architectures such as 32-bit x86 where PLT stubs expect the GOT
14412 pointer in a specific register, this gives more register allocation
14413 freedom to the compiler. Lazy binding requires use of the PLT;
14414 with -fno-plt all external symbols are resolved at load time.
14415
14416 Alternatively, the function attribute "noplt" can be used to avoid
14417 calls through the PLT for specific external functions.
14418
14419 In position-dependent code, a few targets also convert calls to
14420 functions that are marked to not use the PLT to use the GOT
14421 instead.
14422
14423 -fno-jump-tables
14424 Do not use jump tables for switch statements even where it would be
14425 more efficient than other code generation strategies. This option
14426 is of use in conjunction with -fpic or -fPIC for building code that
14427 forms part of a dynamic linker and cannot reference the address of
14428 a jump table. On some targets, jump tables do not require a GOT
14429 and this option is not needed.
14430
14431 -fno-bit-tests
14432 Do not use bit tests for switch statements even where it would be
14433 more efficient than other code generation strategies.
14434
14435 -ffixed-reg
14436 Treat the register named reg as a fixed register; generated code
14437 should never refer to it (except perhaps as a stack pointer, frame
14438 pointer or in some other fixed role).
14439
14440 reg must be the name of a register. The register names accepted
14441 are machine-specific and are defined in the "REGISTER_NAMES" macro
14442 in the machine description macro file.
14443
14444 This flag does not have a negative form, because it specifies a
14445 three-way choice.
14446
14447 -fcall-used-reg
14448 Treat the register named reg as an allocable register that is
14449 clobbered by function calls. It may be allocated for temporaries
14450 or variables that do not live across a call. Functions compiled
14451 this way do not save and restore the register reg.
14452
14453 It is an error to use this flag with the frame pointer or stack
14454 pointer. Use of this flag for other registers that have fixed
14455 pervasive roles in the machine's execution model produces
14456 disastrous results.
14457
14458 This flag does not have a negative form, because it specifies a
14459 three-way choice.
14460
14461 -fcall-saved-reg
14462 Treat the register named reg as an allocable register saved by
14463 functions. It may be allocated even for temporaries or variables
14464 that live across a call. Functions compiled this way save and
14465 restore the register reg if they use it.
14466
14467 It is an error to use this flag with the frame pointer or stack
14468 pointer. Use of this flag for other registers that have fixed
14469 pervasive roles in the machine's execution model produces
14470 disastrous results.
14471
14472 A different sort of disaster results from the use of this flag for
14473 a register in which function values may be returned.
14474
14475 This flag does not have a negative form, because it specifies a
14476 three-way choice.
14477
14478 -fpack-struct[=n]
14479 Without a value specified, pack all structure members together
14480 without holes. When a value is specified (which must be a small
14481 power of two), pack structure members according to this value,
14482 representing the maximum alignment (that is, objects with default
14483 alignment requirements larger than this are output potentially
14484 unaligned at the next fitting location.
14485
14486 Warning: the -fpack-struct switch causes GCC to generate code that
14487 is not binary compatible with code generated without that switch.
14488 Additionally, it makes the code suboptimal. Use it to conform to a
14489 non-default application binary interface.
14490
14491 -fleading-underscore
14492 This option and its counterpart, -fno-leading-underscore, forcibly
14493 change the way C symbols are represented in the object file. One
14494 use is to help link with legacy assembly code.
14495
14496 Warning: the -fleading-underscore switch causes GCC to generate
14497 code that is not binary compatible with code generated without that
14498 switch. Use it to conform to a non-default application binary
14499 interface. Not all targets provide complete support for this
14500 switch.
14501
14502 -ftls-model=model
14503 Alter the thread-local storage model to be used. The model
14504 argument should be one of global-dynamic, local-dynamic, initial-
14505 exec or local-exec. Note that the choice is subject to
14506 optimization: the compiler may use a more efficient model for
14507 symbols not visible outside of the translation unit, or if -fpic is
14508 not given on the command line.
14509
14510 The default without -fpic is initial-exec; with -fpic the default
14511 is global-dynamic.
14512
14513 -ftrampolines
14514 For targets that normally need trampolines for nested functions,
14515 always generate them instead of using descriptors. Otherwise, for
14516 targets that do not need them, like for example HP-PA or IA-64, do
14517 nothing.
14518
14519 A trampoline is a small piece of code that is created at run time
14520 on the stack when the address of a nested function is taken, and is
14521 used to call the nested function indirectly. Therefore, it
14522 requires the stack to be made executable in order for the program
14523 to work properly.
14524
14525 -fno-trampolines is enabled by default on a language by language
14526 basis to let the compiler avoid generating them, if it computes
14527 that this is safe, and replace them with descriptors. Descriptors
14528 are made up of data only, but the generated code must be prepared
14529 to deal with them. As of this writing, -fno-trampolines is enabled
14530 by default only for Ada.
14531
14532 Moreover, code compiled with -ftrampolines and code compiled with
14533 -fno-trampolines are not binary compatible if nested functions are
14534 present. This option must therefore be used on a program-wide
14535 basis and be manipulated with extreme care.
14536
14537 -fvisibility=[default|internal|hidden|protected]
14538 Set the default ELF image symbol visibility to the specified
14539 option---all symbols are marked with this unless overridden within
14540 the code. Using this feature can very substantially improve
14541 linking and load times of shared object libraries, produce more
14542 optimized code, provide near-perfect API export and prevent symbol
14543 clashes. It is strongly recommended that you use this in any
14544 shared objects you distribute.
14545
14546 Despite the nomenclature, default always means public; i.e.,
14547 available to be linked against from outside the shared object.
14548 protected and internal are pretty useless in real-world usage so
14549 the only other commonly used option is hidden. The default if
14550 -fvisibility isn't specified is default, i.e., make every symbol
14551 public.
14552
14553 A good explanation of the benefits offered by ensuring ELF symbols
14554 have the correct visibility is given by "How To Write Shared
14555 Libraries" by Ulrich Drepper (which can be found at
14556 <https://www.akkadia.org/drepper/>)---however a superior solution
14557 made possible by this option to marking things hidden when the
14558 default is public is to make the default hidden and mark things
14559 public. This is the norm with DLLs on Windows and with
14560 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
14561 instead of "__declspec(dllexport)" you get almost identical
14562 semantics with identical syntax. This is a great boon to those
14563 working with cross-platform projects.
14564
14565 For those adding visibility support to existing code, you may find
14566 "#pragma GCC visibility" of use. This works by you enclosing the
14567 declarations you wish to set visibility for with (for example)
14568 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
14569 pop". Bear in mind that symbol visibility should be viewed as part
14570 of the API interface contract and thus all new code should always
14571 specify visibility when it is not the default; i.e., declarations
14572 only for use within the local DSO should always be marked
14573 explicitly as hidden as so to avoid PLT indirection
14574 overheads---making this abundantly clear also aids readability and
14575 self-documentation of the code. Note that due to ISO C++
14576 specification requirements, "operator new" and "operator delete"
14577 must always be of default visibility.
14578
14579 Be aware that headers from outside your project, in particular
14580 system headers and headers from any other library you use, may not
14581 be expecting to be compiled with visibility other than the default.
14582 You may need to explicitly say "#pragma GCC visibility
14583 push(default)" before including any such headers.
14584
14585 "extern" declarations are not affected by -fvisibility, so a lot of
14586 code can be recompiled with -fvisibility=hidden with no
14587 modifications. However, this means that calls to "extern"
14588 functions with no explicit visibility use the PLT, so it is more
14589 effective to use "__attribute ((visibility))" and/or "#pragma GCC
14590 visibility" to tell the compiler which "extern" declarations should
14591 be treated as hidden.
14592
14593 Note that -fvisibility does affect C++ vague linkage entities. This
14594 means that, for instance, an exception class that is be thrown
14595 between DSOs must be explicitly marked with default visibility so
14596 that the type_info nodes are unified between the DSOs.
14597
14598 An overview of these techniques, their benefits and how to use them
14599 is at <http://gcc.gnu.org/wiki/Visibility>.
14600
14601 -fstrict-volatile-bitfields
14602 This option should be used if accesses to volatile bit-fields (or
14603 other structure fields, although the compiler usually honors those
14604 types anyway) should use a single access of the width of the
14605 field's type, aligned to a natural alignment if possible. For
14606 example, targets with memory-mapped peripheral registers might
14607 require all such accesses to be 16 bits wide; with this flag you
14608 can declare all peripheral bit-fields as "unsigned short" (assuming
14609 short is 16 bits on these targets) to force GCC to use 16-bit
14610 accesses instead of, perhaps, a more efficient 32-bit access.
14611
14612 If this option is disabled, the compiler uses the most efficient
14613 instruction. In the previous example, that might be a 32-bit load
14614 instruction, even though that accesses bytes that do not contain
14615 any portion of the bit-field, or memory-mapped registers unrelated
14616 to the one being updated.
14617
14618 In some cases, such as when the "packed" attribute is applied to a
14619 structure field, it may not be possible to access the field with a
14620 single read or write that is correctly aligned for the target
14621 machine. In this case GCC falls back to generating multiple
14622 accesses rather than code that will fault or truncate the result at
14623 run time.
14624
14625 Note: Due to restrictions of the C/C++11 memory model, write
14626 accesses are not allowed to touch non bit-field members. It is
14627 therefore recommended to define all bits of the field's type as
14628 bit-field members.
14629
14630 The default value of this option is determined by the application
14631 binary interface for the target processor.
14632
14633 -fsync-libcalls
14634 This option controls whether any out-of-line instance of the
14635 "__sync" family of functions may be used to implement the C++11
14636 "__atomic" family of functions.
14637
14638 The default value of this option is enabled, thus the only useful
14639 form of the option is -fno-sync-libcalls. This option is used in
14640 the implementation of the libatomic runtime library.
14641
14642 GCC Developer Options
14643 This section describes command-line options that are primarily of
14644 interest to GCC developers, including options to support compiler
14645 testing and investigation of compiler bugs and compile-time performance
14646 problems. This includes options that produce debug dumps at various
14647 points in the compilation; that print statistics such as memory use and
14648 execution time; and that print information about GCC's configuration,
14649 such as where it searches for libraries. You should rarely need to use
14650 any of these options for ordinary compilation and linking tasks.
14651
14652 Many developer options that cause GCC to dump output to a file take an
14653 optional =filename suffix. You can specify stdout or - to dump to
14654 standard output, and stderr for standard error.
14655
14656 If =filename is omitted, a default dump file name is constructed by
14657 concatenating the base dump file name, a pass number, phase letter, and
14658 pass name. The base dump file name is the name of output file produced
14659 by the compiler if explicitly specified and not an executable;
14660 otherwise it is the source file name. The pass number is determined by
14661 the order passes are registered with the compiler's pass manager. This
14662 is generally the same as the order of execution, but passes registered
14663 by plugins, target-specific passes, or passes that are otherwise
14664 registered late are numbered higher than the pass named final, even if
14665 they are executed earlier. The phase letter is one of i (inter-
14666 procedural analysis), l (language-specific), r (RTL), or t (tree). The
14667 files are created in the directory of the output file.
14668
14669 -fcallgraph-info
14670 -fcallgraph-info=MARKERS
14671 Makes the compiler output callgraph information for the program, on
14672 a per-object-file basis. The information is generated in the
14673 common VCG format. It can be decorated with additional, per-node
14674 and/or per-edge information, if a list of comma-separated markers
14675 is additionally specified. When the "su" marker is specified, the
14676 callgraph is decorated with stack usage information; it is
14677 equivalent to -fstack-usage. When the "da" marker is specified,
14678 the callgraph is decorated with information about dynamically
14679 allocated objects.
14680
14681 When compiling with -flto, no callgraph information is output along
14682 with the object file. At LTO link time, -fcallgraph-info may
14683 generate multiple callgraph information files next to intermediate
14684 LTO output files.
14685
14686 -dletters
14687 -fdump-rtl-pass
14688 -fdump-rtl-pass=filename
14689 Says to make debugging dumps during compilation at times specified
14690 by letters. This is used for debugging the RTL-based passes of the
14691 compiler.
14692
14693 Some -dletters switches have different meaning when -E is used for
14694 preprocessing.
14695
14696 Debug dumps can be enabled with a -fdump-rtl switch or some -d
14697 option letters. Here are the possible letters for use in pass and
14698 letters, and their meanings:
14699
14700 -fdump-rtl-alignments
14701 Dump after branch alignments have been computed.
14702
14703 -fdump-rtl-asmcons
14704 Dump after fixing rtl statements that have unsatisfied in/out
14705 constraints.
14706
14707 -fdump-rtl-auto_inc_dec
14708 Dump after auto-inc-dec discovery. This pass is only run on
14709 architectures that have auto inc or auto dec instructions.
14710
14711 -fdump-rtl-barriers
14712 Dump after cleaning up the barrier instructions.
14713
14714 -fdump-rtl-bbpart
14715 Dump after partitioning hot and cold basic blocks.
14716
14717 -fdump-rtl-bbro
14718 Dump after block reordering.
14719
14720 -fdump-rtl-btl1
14721 -fdump-rtl-btl2
14722 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
14723 two branch target load optimization passes.
14724
14725 -fdump-rtl-bypass
14726 Dump after jump bypassing and control flow optimizations.
14727
14728 -fdump-rtl-combine
14729 Dump after the RTL instruction combination pass.
14730
14731 -fdump-rtl-compgotos
14732 Dump after duplicating the computed gotos.
14733
14734 -fdump-rtl-ce1
14735 -fdump-rtl-ce2
14736 -fdump-rtl-ce3
14737 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
14738 dumping after the three if conversion passes.
14739
14740 -fdump-rtl-cprop_hardreg
14741 Dump after hard register copy propagation.
14742
14743 -fdump-rtl-csa
14744 Dump after combining stack adjustments.
14745
14746 -fdump-rtl-cse1
14747 -fdump-rtl-cse2
14748 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
14749 two common subexpression elimination passes.
14750
14751 -fdump-rtl-dce
14752 Dump after the standalone dead code elimination passes.
14753
14754 -fdump-rtl-dbr
14755 Dump after delayed branch scheduling.
14756
14757 -fdump-rtl-dce1
14758 -fdump-rtl-dce2
14759 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
14760 two dead store elimination passes.
14761
14762 -fdump-rtl-eh
14763 Dump after finalization of EH handling code.
14764
14765 -fdump-rtl-eh_ranges
14766 Dump after conversion of EH handling range regions.
14767
14768 -fdump-rtl-expand
14769 Dump after RTL generation.
14770
14771 -fdump-rtl-fwprop1
14772 -fdump-rtl-fwprop2
14773 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
14774 the two forward propagation passes.
14775
14776 -fdump-rtl-gcse1
14777 -fdump-rtl-gcse2
14778 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
14779 global common subexpression elimination.
14780
14781 -fdump-rtl-init-regs
14782 Dump after the initialization of the registers.
14783
14784 -fdump-rtl-initvals
14785 Dump after the computation of the initial value sets.
14786
14787 -fdump-rtl-into_cfglayout
14788 Dump after converting to cfglayout mode.
14789
14790 -fdump-rtl-ira
14791 Dump after iterated register allocation.
14792
14793 -fdump-rtl-jump
14794 Dump after the second jump optimization.
14795
14796 -fdump-rtl-loop2
14797 -fdump-rtl-loop2 enables dumping after the rtl loop
14798 optimization passes.
14799
14800 -fdump-rtl-mach
14801 Dump after performing the machine dependent reorganization
14802 pass, if that pass exists.
14803
14804 -fdump-rtl-mode_sw
14805 Dump after removing redundant mode switches.
14806
14807 -fdump-rtl-rnreg
14808 Dump after register renumbering.
14809
14810 -fdump-rtl-outof_cfglayout
14811 Dump after converting from cfglayout mode.
14812
14813 -fdump-rtl-peephole2
14814 Dump after the peephole pass.
14815
14816 -fdump-rtl-postreload
14817 Dump after post-reload optimizations.
14818
14819 -fdump-rtl-pro_and_epilogue
14820 Dump after generating the function prologues and epilogues.
14821
14822 -fdump-rtl-sched1
14823 -fdump-rtl-sched2
14824 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
14825 the basic block scheduling passes.
14826
14827 -fdump-rtl-ree
14828 Dump after sign/zero extension elimination.
14829
14830 -fdump-rtl-seqabstr
14831 Dump after common sequence discovery.
14832
14833 -fdump-rtl-shorten
14834 Dump after shortening branches.
14835
14836 -fdump-rtl-sibling
14837 Dump after sibling call optimizations.
14838
14839 -fdump-rtl-split1
14840 -fdump-rtl-split2
14841 -fdump-rtl-split3
14842 -fdump-rtl-split4
14843 -fdump-rtl-split5
14844 These options enable dumping after five rounds of instruction
14845 splitting.
14846
14847 -fdump-rtl-sms
14848 Dump after modulo scheduling. This pass is only run on some
14849 architectures.
14850
14851 -fdump-rtl-stack
14852 Dump after conversion from GCC's "flat register file" registers
14853 to the x87's stack-like registers. This pass is only run on
14854 x86 variants.
14855
14856 -fdump-rtl-subreg1
14857 -fdump-rtl-subreg2
14858 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
14859 the two subreg expansion passes.
14860
14861 -fdump-rtl-unshare
14862 Dump after all rtl has been unshared.
14863
14864 -fdump-rtl-vartrack
14865 Dump after variable tracking.
14866
14867 -fdump-rtl-vregs
14868 Dump after converting virtual registers to hard registers.
14869
14870 -fdump-rtl-web
14871 Dump after live range splitting.
14872
14873 -fdump-rtl-regclass
14874 -fdump-rtl-subregs_of_mode_init
14875 -fdump-rtl-subregs_of_mode_finish
14876 -fdump-rtl-dfinit
14877 -fdump-rtl-dfinish
14878 These dumps are defined but always produce empty files.
14879
14880 -da
14881 -fdump-rtl-all
14882 Produce all the dumps listed above.
14883
14884 -dA Annotate the assembler output with miscellaneous debugging
14885 information.
14886
14887 -dD Dump all macro definitions, at the end of preprocessing, in
14888 addition to normal output.
14889
14890 -dH Produce a core dump whenever an error occurs.
14891
14892 -dp Annotate the assembler output with a comment indicating which
14893 pattern and alternative is used. The length and cost of each
14894 instruction are also printed.
14895
14896 -dP Dump the RTL in the assembler output as a comment before each
14897 instruction. Also turns on -dp annotation.
14898
14899 -dx Just generate RTL for a function instead of compiling it.
14900 Usually used with -fdump-rtl-expand.
14901
14902 -fdump-debug
14903 Dump debugging information generated during the debug generation
14904 phase.
14905
14906 -fdump-earlydebug
14907 Dump debugging information generated during the early debug
14908 generation phase.
14909
14910 -fdump-noaddr
14911 When doing debugging dumps, suppress address output. This makes it
14912 more feasible to use diff on debugging dumps for compiler
14913 invocations with different compiler binaries and/or different text
14914 / bss / data / heap / stack / dso start locations.
14915
14916 -freport-bug
14917 Collect and dump debug information into a temporary file if an
14918 internal compiler error (ICE) occurs.
14919
14920 -fdump-unnumbered
14921 When doing debugging dumps, suppress instruction numbers and
14922 address output. This makes it more feasible to use diff on
14923 debugging dumps for compiler invocations with different options, in
14924 particular with and without -g.
14925
14926 -fdump-unnumbered-links
14927 When doing debugging dumps (see -d option above), suppress
14928 instruction numbers for the links to the previous and next
14929 instructions in a sequence.
14930
14931 -fdump-ipa-switch
14932 -fdump-ipa-switch-options
14933 Control the dumping at various stages of inter-procedural analysis
14934 language tree to a file. The file name is generated by appending a
14935 switch specific suffix to the source file name, and the file is
14936 created in the same directory as the output file. The following
14937 dumps are possible:
14938
14939 all Enables all inter-procedural analysis dumps.
14940
14941 cgraph
14942 Dumps information about call-graph optimization, unused
14943 function removal, and inlining decisions.
14944
14945 inline
14946 Dump after function inlining.
14947
14948 Additionally, the options -optimized, -missed, -note, and -all can
14949 be provided, with the same meaning as for -fopt-info, defaulting to
14950 -optimized.
14951
14952 For example, -fdump-ipa-inline-optimized-missed will emit
14953 information on callsites that were inlined, along with callsites
14954 that were not inlined.
14955
14956 By default, the dump will contain messages about successful
14957 optimizations (equivalent to -optimized) together with low-level
14958 details about the analysis.
14959
14960 -fdump-lang
14961 Dump language-specific information. The file name is made by
14962 appending .lang to the source file name.
14963
14964 -fdump-lang-all
14965 -fdump-lang-switch
14966 -fdump-lang-switch-options
14967 -fdump-lang-switch-options=filename
14968 Control the dumping of language-specific information. The options
14969 and filename portions behave as described in the -fdump-tree
14970 option. The following switch values are accepted:
14971
14972 all Enable all language-specific dumps.
14973
14974 class
14975 Dump class hierarchy information. Virtual table information is
14976 emitted unless 'slim' is specified. This option is applicable
14977 to C++ only.
14978
14979 module
14980 Dump module information. Options lineno (locations), graph
14981 (reachability), blocks (clusters), uid (serialization), alias
14982 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
14983 provide additional information. This option is applicable to
14984 C++ only.
14985
14986 raw Dump the raw internal tree data. This option is applicable to
14987 C++ only.
14988
14989 -fdump-passes
14990 Print on stderr the list of optimization passes that are turned on
14991 and off by the current command-line options.
14992
14993 -fdump-statistics-option
14994 Enable and control dumping of pass statistics in a separate file.
14995 The file name is generated by appending a suffix ending in
14996 .statistics to the source file name, and the file is created in the
14997 same directory as the output file. If the -option form is used,
14998 -stats causes counters to be summed over the whole compilation unit
14999 while -details dumps every event as the passes generate them. The
15000 default with no option is to sum counters for each function
15001 compiled.
15002
15003 -fdump-tree-all
15004 -fdump-tree-switch
15005 -fdump-tree-switch-options
15006 -fdump-tree-switch-options=filename
15007 Control the dumping at various stages of processing the
15008 intermediate language tree to a file. If the -options form is
15009 used, options is a list of - separated options which control the
15010 details of the dump. Not all options are applicable to all dumps;
15011 those that are not meaningful are ignored. The following options
15012 are available
15013
15014 address
15015 Print the address of each node. Usually this is not meaningful
15016 as it changes according to the environment and source file.
15017 Its primary use is for tying up a dump file with a debug
15018 environment.
15019
15020 asmname
15021 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15022 that in the dump instead of "DECL_NAME". Its primary use is
15023 ease of use working backward from mangled names in the assembly
15024 file.
15025
15026 slim
15027 When dumping front-end intermediate representations, inhibit
15028 dumping of members of a scope or body of a function merely
15029 because that scope has been reached. Only dump such items when
15030 they are directly reachable by some other path.
15031
15032 When dumping pretty-printed trees, this option inhibits dumping
15033 the bodies of control structures.
15034
15035 When dumping RTL, print the RTL in slim (condensed) form
15036 instead of the default LISP-like representation.
15037
15038 raw Print a raw representation of the tree. By default, trees are
15039 pretty-printed into a C-like representation.
15040
15041 details
15042 Enable more detailed dumps (not honored by every dump option).
15043 Also include information from the optimization passes.
15044
15045 stats
15046 Enable dumping various statistics about the pass (not honored
15047 by every dump option).
15048
15049 blocks
15050 Enable showing basic block boundaries (disabled in raw dumps).
15051
15052 graph
15053 For each of the other indicated dump files (-fdump-rtl-pass),
15054 dump a representation of the control flow graph suitable for
15055 viewing with GraphViz to file.passid.pass.dot. Each function
15056 in the file is pretty-printed as a subgraph, so that GraphViz
15057 can render them all in a single plot.
15058
15059 This option currently only works for RTL dumps, and the RTL is
15060 always dumped in slim form.
15061
15062 vops
15063 Enable showing virtual operands for every statement.
15064
15065 lineno
15066 Enable showing line numbers for statements.
15067
15068 uid Enable showing the unique ID ("DECL_UID") for each variable.
15069
15070 verbose
15071 Enable showing the tree dump for each statement.
15072
15073 eh Enable showing the EH region number holding each statement.
15074
15075 scev
15076 Enable showing scalar evolution analysis details.
15077
15078 optimized
15079 Enable showing optimization information (only available in
15080 certain passes).
15081
15082 missed
15083 Enable showing missed optimization information (only available
15084 in certain passes).
15085
15086 note
15087 Enable other detailed optimization information (only available
15088 in certain passes).
15089
15090 all Turn on all options, except raw, slim, verbose and lineno.
15091
15092 optall
15093 Turn on all optimization options, i.e., optimized, missed, and
15094 note.
15095
15096 To determine what tree dumps are available or find the dump for a
15097 pass of interest follow the steps below.
15098
15099 1. Invoke GCC with -fdump-passes and in the stderr output look for
15100 a code that corresponds to the pass you are interested in. For
15101 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15102 correspond to the three Value Range Propagation passes. The
15103 number at the end distinguishes distinct invocations of the
15104 same pass.
15105
15106 2. To enable the creation of the dump file, append the pass code
15107 to the -fdump- option prefix and invoke GCC with it. For
15108 example, to enable the dump from the Early Value Range
15109 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15110 Optionally, you may specify the name of the dump file. If you
15111 don't specify one, GCC creates as described below.
15112
15113 3. Find the pass dump in a file whose name is composed of three
15114 components separated by a period: the name of the source file
15115 GCC was invoked to compile, a numeric suffix indicating the
15116 pass number followed by the letter t for tree passes (and the
15117 letter r for RTL passes), and finally the pass code. For
15118 example, the Early VRP pass dump might be in a file named
15119 myfile.c.038t.evrp in the current working directory. Note that
15120 the numeric codes are not stable and may change from one
15121 version of GCC to another.
15122
15123 -fopt-info
15124 -fopt-info-options
15125 -fopt-info-options=filename
15126 Controls optimization dumps from various optimization passes. If
15127 the -options form is used, options is a list of - separated option
15128 keywords to select the dump details and optimizations.
15129
15130 The options can be divided into three groups:
15131
15132 1. options describing what kinds of messages should be emitted,
15133
15134 2. options describing the verbosity of the dump, and
15135
15136 3. options describing which optimizations should be included.
15137
15138 The options from each group can be freely mixed as they are non-
15139 overlapping. However, in case of any conflicts, the later options
15140 override the earlier options on the command line.
15141
15142 The following options control which kinds of messages should be
15143 emitted:
15144
15145 optimized
15146 Print information when an optimization is successfully applied.
15147 It is up to a pass to decide which information is relevant. For
15148 example, the vectorizer passes print the source location of
15149 loops which are successfully vectorized.
15150
15151 missed
15152 Print information about missed optimizations. Individual passes
15153 control which information to include in the output.
15154
15155 note
15156 Print verbose information about optimizations, such as certain
15157 transformations, more detailed messages about decisions etc.
15158
15159 all Print detailed optimization information. This includes
15160 optimized, missed, and note.
15161
15162 The following option controls the dump verbosity:
15163
15164 internals
15165 By default, only "high-level" messages are emitted. This option
15166 enables additional, more detailed, messages, which are likely
15167 to only be of interest to GCC developers.
15168
15169 One or more of the following option keywords can be used to
15170 describe a group of optimizations:
15171
15172 ipa Enable dumps from all interprocedural optimizations.
15173
15174 loop
15175 Enable dumps from all loop optimizations.
15176
15177 inline
15178 Enable dumps from all inlining optimizations.
15179
15180 omp Enable dumps from all OMP (Offloading and Multi Processing)
15181 optimizations.
15182
15183 vec Enable dumps from all vectorization optimizations.
15184
15185 optall
15186 Enable dumps from all optimizations. This is a superset of the
15187 optimization groups listed above.
15188
15189 If options is omitted, it defaults to optimized-optall, which means
15190 to dump messages about successful optimizations from all the
15191 passes, omitting messages that are treated as "internals".
15192
15193 If the filename is provided, then the dumps from all the applicable
15194 optimizations are concatenated into the filename. Otherwise the
15195 dump is output onto stderr. Though multiple -fopt-info options are
15196 accepted, only one of them can include a filename. If other
15197 filenames are provided then all but the first such option are
15198 ignored.
15199
15200 Note that the output filename is overwritten in case of multiple
15201 translation units. If a combined output from multiple translation
15202 units is desired, stderr should be used instead.
15203
15204 In the following example, the optimization info is output to
15205 stderr:
15206
15207 gcc -O3 -fopt-info
15208
15209 This example:
15210
15211 gcc -O3 -fopt-info-missed=missed.all
15212
15213 outputs missed optimization report from all the passes into
15214 missed.all, and this one:
15215
15216 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15217
15218 prints information about missed optimization opportunities from
15219 vectorization passes on stderr. Note that -fopt-info-vec-missed is
15220 equivalent to -fopt-info-missed-vec. The order of the optimization
15221 group names and message types listed after -fopt-info does not
15222 matter.
15223
15224 As another example,
15225
15226 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15227
15228 outputs information about missed optimizations as well as optimized
15229 locations from all the inlining passes into inline.txt.
15230
15231 Finally, consider:
15232
15233 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15234
15235 Here the two output filenames vec.miss and loop.opt are in conflict
15236 since only one output file is allowed. In this case, only the first
15237 option takes effect and the subsequent options are ignored. Thus
15238 only vec.miss is produced which contains dumps from the vectorizer
15239 about missed opportunities.
15240
15241 -fsave-optimization-record
15242 Write a SRCFILE.opt-record.json.gz file detailing what
15243 optimizations were performed, for those optimizations that support
15244 -fopt-info.
15245
15246 This option is experimental and the format of the data within the
15247 compressed JSON file is subject to change.
15248
15249 It is roughly equivalent to a machine-readable version of
15250 -fopt-info-all, as a collection of messages with source file, line
15251 number and column number, with the following additional data for
15252 each message:
15253
15254 * the execution count of the code being optimized, along with
15255 metadata about whether this was from actual profile data, or
15256 just an estimate, allowing consumers to prioritize messages by
15257 code hotness,
15258
15259 * the function name of the code being optimized, where
15260 applicable,
15261
15262 * the "inlining chain" for the code being optimized, so that when
15263 a function is inlined into several different places (which
15264 might themselves be inlined), the reader can distinguish
15265 between the copies,
15266
15267 * objects identifying those parts of the message that refer to
15268 expressions, statements or symbol-table nodes, which of these
15269 categories they are, and, when available, their source code
15270 location,
15271
15272 * the GCC pass that emitted the message, and
15273
15274 * the location in GCC's own code from which the message was
15275 emitted
15276
15277 Additionally, some messages are logically nested within other
15278 messages, reflecting implementation details of the optimization
15279 passes.
15280
15281 -fsched-verbose=n
15282 On targets that use instruction scheduling, this option controls
15283 the amount of debugging output the scheduler prints to the dump
15284 files.
15285
15286 For n greater than zero, -fsched-verbose outputs the same
15287 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
15288 greater than one, it also output basic block probabilities,
15289 detailed ready list information and unit/insn info. For n greater
15290 than two, it includes RTL at abort point, control-flow and regions
15291 info. And for n over four, -fsched-verbose also includes
15292 dependence info.
15293
15294 -fenable-kind-pass
15295 -fdisable-kind-pass=range-list
15296 This is a set of options that are used to explicitly disable/enable
15297 optimization passes. These options are intended for use for
15298 debugging GCC. Compiler users should use regular options for
15299 enabling/disabling passes instead.
15300
15301 -fdisable-ipa-pass
15302 Disable IPA pass pass. pass is the pass name. If the same pass
15303 is statically invoked in the compiler multiple times, the pass
15304 name should be appended with a sequential number starting from
15305 1.
15306
15307 -fdisable-rtl-pass
15308 -fdisable-rtl-pass=range-list
15309 Disable RTL pass pass. pass is the pass name. If the same
15310 pass is statically invoked in the compiler multiple times, the
15311 pass name should be appended with a sequential number starting
15312 from 1. range-list is a comma-separated list of function
15313 ranges or assembler names. Each range is a number pair
15314 separated by a colon. The range is inclusive in both ends. If
15315 the range is trivial, the number pair can be simplified as a
15316 single number. If the function's call graph node's uid falls
15317 within one of the specified ranges, the pass is disabled for
15318 that function. The uid is shown in the function header of a
15319 dump file, and the pass names can be dumped by using option
15320 -fdump-passes.
15321
15322 -fdisable-tree-pass
15323 -fdisable-tree-pass=range-list
15324 Disable tree pass pass. See -fdisable-rtl for the description
15325 of option arguments.
15326
15327 -fenable-ipa-pass
15328 Enable IPA pass pass. pass is the pass name. If the same pass
15329 is statically invoked in the compiler multiple times, the pass
15330 name should be appended with a sequential number starting from
15331 1.
15332
15333 -fenable-rtl-pass
15334 -fenable-rtl-pass=range-list
15335 Enable RTL pass pass. See -fdisable-rtl for option argument
15336 description and examples.
15337
15338 -fenable-tree-pass
15339 -fenable-tree-pass=range-list
15340 Enable tree pass pass. See -fdisable-rtl for the description
15341 of option arguments.
15342
15343 Here are some examples showing uses of these options.
15344
15345 # disable ccp1 for all functions
15346 -fdisable-tree-ccp1
15347 # disable complete unroll for function whose cgraph node uid is 1
15348 -fenable-tree-cunroll=1
15349 # disable gcse2 for functions at the following ranges [1,1],
15350 # [300,400], and [400,1000]
15351 # disable gcse2 for functions foo and foo2
15352 -fdisable-rtl-gcse2=foo,foo2
15353 # disable early inlining
15354 -fdisable-tree-einline
15355 # disable ipa inlining
15356 -fdisable-ipa-inline
15357 # enable tree full unroll
15358 -fenable-tree-unroll
15359
15360 -fchecking
15361 -fchecking=n
15362 Enable internal consistency checking. The default depends on the
15363 compiler configuration. -fchecking=2 enables further internal
15364 consistency checking that might affect code generation.
15365
15366 -frandom-seed=string
15367 This option provides a seed that GCC uses in place of random
15368 numbers in generating certain symbol names that have to be
15369 different in every compiled file. It is also used to place unique
15370 stamps in coverage data files and the object files that produce
15371 them. You can use the -frandom-seed option to produce reproducibly
15372 identical object files.
15373
15374 The string can either be a number (decimal, octal or hex) or an
15375 arbitrary string (in which case it's converted to a number by
15376 computing CRC32).
15377
15378 The string should be different for every file you compile.
15379
15380 -save-temps
15381 Store the usual "temporary" intermediate files permanently; name
15382 them as auxiliary output files, as specified described under
15383 -dumpbase and -dumpdir.
15384
15385 When used in combination with the -x command-line option,
15386 -save-temps is sensible enough to avoid overwriting an input source
15387 file with the same extension as an intermediate file. The
15388 corresponding intermediate file may be obtained by renaming the
15389 source file before using -save-temps.
15390
15391 -save-temps=cwd
15392 Equivalent to -save-temps -dumpdir ./.
15393
15394 -save-temps=obj
15395 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
15396 directory of the output file specified after the -o option,
15397 including any directory separators. If the -o option is not used,
15398 the -save-temps=obj switch behaves like -save-temps=cwd.
15399
15400 -time[=file]
15401 Report the CPU time taken by each subprocess in the compilation
15402 sequence. For C source files, this is the compiler proper and
15403 assembler (plus the linker if linking is done).
15404
15405 Without the specification of an output file, the output looks like
15406 this:
15407
15408 # cc1 0.12 0.01
15409 # as 0.00 0.01
15410
15411 The first number on each line is the "user time", that is time
15412 spent executing the program itself. The second number is "system
15413 time", time spent executing operating system routines on behalf of
15414 the program. Both numbers are in seconds.
15415
15416 With the specification of an output file, the output is appended to
15417 the named file, and it looks like this:
15418
15419 0.12 0.01 cc1 <options>
15420 0.00 0.01 as <options>
15421
15422 The "user time" and the "system time" are moved before the program
15423 name, and the options passed to the program are displayed, so that
15424 one can later tell what file was being compiled, and with which
15425 options.
15426
15427 -fdump-final-insns[=file]
15428 Dump the final internal representation (RTL) to file. If the
15429 optional argument is omitted (or if file is "."), the name of the
15430 dump file is determined by appending ".gkd" to the dump base name,
15431 see -dumpbase.
15432
15433 -fcompare-debug[=opts]
15434 If no error occurs during compilation, run the compiler a second
15435 time, adding opts and -fcompare-debug-second to the arguments
15436 passed to the second compilation. Dump the final internal
15437 representation in both compilations, and print an error if they
15438 differ.
15439
15440 If the equal sign is omitted, the default -gtoggle is used.
15441
15442 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
15443 and nonzero, implicitly enables -fcompare-debug. If
15444 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
15445 it is used for opts, otherwise the default -gtoggle is used.
15446
15447 -fcompare-debug=, with the equal sign but without opts, is
15448 equivalent to -fno-compare-debug, which disables the dumping of the
15449 final representation and the second compilation, preventing even
15450 GCC_COMPARE_DEBUG from taking effect.
15451
15452 To verify full coverage during -fcompare-debug testing, set
15453 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
15454 rejects as an invalid option in any actual compilation (rather than
15455 preprocessing, assembly or linking). To get just a warning,
15456 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
15457 will do.
15458
15459 -fcompare-debug-second
15460 This option is implicitly passed to the compiler for the second
15461 compilation requested by -fcompare-debug, along with options to
15462 silence warnings, and omitting other options that would cause the
15463 compiler to produce output to files or to standard output as a side
15464 effect. Dump files and preserved temporary files are renamed so as
15465 to contain the ".gk" additional extension during the second
15466 compilation, to avoid overwriting those generated by the first.
15467
15468 When this option is passed to the compiler driver, it causes the
15469 first compilation to be skipped, which makes it useful for little
15470 other than debugging the compiler proper.
15471
15472 -gtoggle
15473 Turn off generation of debug info, if leaving out this option
15474 generates it, or turn it on at level 2 otherwise. The position of
15475 this argument in the command line does not matter; it takes effect
15476 after all other options are processed, and it does so only once, no
15477 matter how many times it is given. This is mainly intended to be
15478 used with -fcompare-debug.
15479
15480 -fvar-tracking-assignments-toggle
15481 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
15482 toggles -g.
15483
15484 -Q Makes the compiler print out each function name as it is compiled,
15485 and print some statistics about each pass when it finishes.
15486
15487 -ftime-report
15488 Makes the compiler print some statistics about the time consumed by
15489 each pass when it finishes.
15490
15491 -ftime-report-details
15492 Record the time consumed by infrastructure parts separately for
15493 each pass.
15494
15495 -fira-verbose=n
15496 Control the verbosity of the dump file for the integrated register
15497 allocator. The default value is 5. If the value n is greater or
15498 equal to 10, the dump output is sent to stderr using the same
15499 format as n minus 10.
15500
15501 -flto-report
15502 Prints a report with internal details on the workings of the link-
15503 time optimizer. The contents of this report vary from version to
15504 version. It is meant to be useful to GCC developers when
15505 processing object files in LTO mode (via -flto).
15506
15507 Disabled by default.
15508
15509 -flto-report-wpa
15510 Like -flto-report, but only print for the WPA phase of link-time
15511 optimization.
15512
15513 -fmem-report
15514 Makes the compiler print some statistics about permanent memory
15515 allocation when it finishes.
15516
15517 -fmem-report-wpa
15518 Makes the compiler print some statistics about permanent memory
15519 allocation for the WPA phase only.
15520
15521 -fpre-ipa-mem-report
15522 -fpost-ipa-mem-report
15523 Makes the compiler print some statistics about permanent memory
15524 allocation before or after interprocedural optimization.
15525
15526 -fprofile-report
15527 Makes the compiler print some statistics about consistency of the
15528 (estimated) profile and effect of individual passes.
15529
15530 -fstack-usage
15531 Makes the compiler output stack usage information for the program,
15532 on a per-function basis. The filename for the dump is made by
15533 appending .su to the auxname. auxname is generated from the name
15534 of the output file, if explicitly specified and it is not an
15535 executable, otherwise it is the basename of the source file. An
15536 entry is made up of three fields:
15537
15538 * The name of the function.
15539
15540 * A number of bytes.
15541
15542 * One or more qualifiers: "static", "dynamic", "bounded".
15543
15544 The qualifier "static" means that the function manipulates the
15545 stack statically: a fixed number of bytes are allocated for the
15546 frame on function entry and released on function exit; no stack
15547 adjustments are otherwise made in the function. The second field
15548 is this fixed number of bytes.
15549
15550 The qualifier "dynamic" means that the function manipulates the
15551 stack dynamically: in addition to the static allocation described
15552 above, stack adjustments are made in the body of the function, for
15553 example to push/pop arguments around function calls. If the
15554 qualifier "bounded" is also present, the amount of these
15555 adjustments is bounded at compile time and the second field is an
15556 upper bound of the total amount of stack used by the function. If
15557 it is not present, the amount of these adjustments is not bounded
15558 at compile time and the second field only represents the bounded
15559 part.
15560
15561 -fstats
15562 Emit statistics about front-end processing at the end of the
15563 compilation. This option is supported only by the C++ front end,
15564 and the information is generally only useful to the G++ development
15565 team.
15566
15567 -fdbg-cnt-list
15568 Print the name and the counter upper bound for all debug counters.
15569
15570 -fdbg-cnt=counter-value-list
15571 Set the internal debug counter lower and upper bound. counter-
15572 value-list is a comma-separated list of
15573 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
15574 tuples which sets the name of the counter and list of closed
15575 intervals. The lower_bound is optional and is zero initialized if
15576 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
15577 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
15578 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
15579 for first 10 invocations.
15580
15581 -print-file-name=library
15582 Print the full absolute name of the library file library that would
15583 be used when linking---and don't do anything else. With this
15584 option, GCC does not compile or link anything; it just prints the
15585 file name.
15586
15587 -print-multi-directory
15588 Print the directory name corresponding to the multilib selected by
15589 any other switches present in the command line. This directory is
15590 supposed to exist in GCC_EXEC_PREFIX.
15591
15592 -print-multi-lib
15593 Print the mapping from multilib directory names to compiler
15594 switches that enable them. The directory name is separated from
15595 the switches by ;, and each switch starts with an @ instead of the
15596 -, without spaces between multiple switches. This is supposed to
15597 ease shell processing.
15598
15599 -print-multi-os-directory
15600 Print the path to OS libraries for the selected multilib, relative
15601 to some lib subdirectory. If OS libraries are present in the lib
15602 subdirectory and no multilibs are used, this is usually just ., if
15603 OS libraries are present in libsuffix sibling directories this
15604 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
15605 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
15606 or ev6.
15607
15608 -print-multiarch
15609 Print the path to OS libraries for the selected multiarch, relative
15610 to some lib subdirectory.
15611
15612 -print-prog-name=program
15613 Like -print-file-name, but searches for a program such as cpp.
15614
15615 -print-libgcc-file-name
15616 Same as -print-file-name=libgcc.a.
15617
15618 This is useful when you use -nostdlib or -nodefaultlibs but you do
15619 want to link with libgcc.a. You can do:
15620
15621 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
15622
15623 -print-search-dirs
15624 Print the name of the configured installation directory and a list
15625 of program and library directories gcc searches---and don't do
15626 anything else.
15627
15628 This is useful when gcc prints the error message installation
15629 problem, cannot exec cpp0: No such file or directory. To resolve
15630 this you either need to put cpp0 and the other compiler components
15631 where gcc expects to find them, or you can set the environment
15632 variable GCC_EXEC_PREFIX to the directory where you installed them.
15633 Don't forget the trailing /.
15634
15635 -print-sysroot
15636 Print the target sysroot directory that is used during compilation.
15637 This is the target sysroot specified either at configure time or
15638 using the --sysroot option, possibly with an extra suffix that
15639 depends on compilation options. If no target sysroot is specified,
15640 the option prints nothing.
15641
15642 -print-sysroot-headers-suffix
15643 Print the suffix added to the target sysroot when searching for
15644 headers, or give an error if the compiler is not configured with
15645 such a suffix---and don't do anything else.
15646
15647 -dumpmachine
15648 Print the compiler's target machine (for example,
15649 i686-pc-linux-gnu)---and don't do anything else.
15650
15651 -dumpversion
15652 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
15653 don't do anything else. This is the compiler version used in
15654 filesystem paths and specs. Depending on how the compiler has been
15655 configured it can be just a single number (major version), two
15656 numbers separated by a dot (major and minor version) or three
15657 numbers separated by dots (major, minor and patchlevel version).
15658
15659 -dumpfullversion
15660 Print the full compiler version---and don't do anything else. The
15661 output is always three numbers separated by dots, major, minor and
15662 patchlevel version.
15663
15664 -dumpspecs
15665 Print the compiler's built-in specs---and don't do anything else.
15666 (This is used when GCC itself is being built.)
15667
15668 Machine-Dependent Options
15669 Each target machine supported by GCC can have its own options---for
15670 example, to allow you to compile for a particular processor variant or
15671 ABI, or to control optimizations specific to that machine. By
15672 convention, the names of machine-specific options start with -m.
15673
15674 Some configurations of the compiler also support additional target-
15675 specific options, usually for compatibility with other compilers on the
15676 same platform.
15677
15678 AArch64 Options
15679
15680 These options are defined for AArch64 implementations:
15681
15682 -mabi=name
15683 Generate code for the specified data model. Permissible values are
15684 ilp32 for SysV-like data model where int, long int and pointers are
15685 32 bits, and lp64 for SysV-like data model where int is 32 bits,
15686 but long int and pointers are 64 bits.
15687
15688 The default depends on the specific target configuration. Note
15689 that the LP64 and ILP32 ABIs are not link-compatible; you must
15690 compile your entire program with the same ABI, and link with a
15691 compatible set of libraries.
15692
15693 -mbig-endian
15694 Generate big-endian code. This is the default when GCC is
15695 configured for an aarch64_be-*-* target.
15696
15697 -mgeneral-regs-only
15698 Generate code which uses only the general-purpose registers. This
15699 will prevent the compiler from using floating-point and Advanced
15700 SIMD registers but will not impose any restrictions on the
15701 assembler.
15702
15703 -mlittle-endian
15704 Generate little-endian code. This is the default when GCC is
15705 configured for an aarch64-*-* but not an aarch64_be-*-* target.
15706
15707 -mcmodel=tiny
15708 Generate code for the tiny code model. The program and its
15709 statically defined symbols must be within 1MB of each other.
15710 Programs can be statically or dynamically linked.
15711
15712 -mcmodel=small
15713 Generate code for the small code model. The program and its
15714 statically defined symbols must be within 4GB of each other.
15715 Programs can be statically or dynamically linked. This is the
15716 default code model.
15717
15718 -mcmodel=large
15719 Generate code for the large code model. This makes no assumptions
15720 about addresses and sizes of sections. Programs can be statically
15721 linked only. The -mcmodel=large option is incompatible with
15722 -mabi=ilp32, -fpic and -fPIC.
15723
15724 -mstrict-align
15725 -mno-strict-align
15726 Avoid or allow generating memory accesses that may not be aligned
15727 on a natural object boundary as described in the architecture
15728 specification.
15729
15730 -momit-leaf-frame-pointer
15731 -mno-omit-leaf-frame-pointer
15732 Omit or keep the frame pointer in leaf functions. The former
15733 behavior is the default.
15734
15735 -mstack-protector-guard=guard
15736 -mstack-protector-guard-reg=reg
15737 -mstack-protector-guard-offset=offset
15738 Generate stack protection code using canary at guard. Supported
15739 locations are global for a global canary or sysreg for a canary in
15740 an appropriate system register.
15741
15742 With the latter choice the options -mstack-protector-guard-reg=reg
15743 and -mstack-protector-guard-offset=offset furthermore specify which
15744 system register to use as base register for reading the canary, and
15745 from what offset from that base register. There is no default
15746 register or offset as this is entirely for use within the Linux
15747 kernel.
15748
15749 -mtls-dialect=desc
15750 Use TLS descriptors as the thread-local storage mechanism for
15751 dynamic accesses of TLS variables. This is the default.
15752
15753 -mtls-dialect=traditional
15754 Use traditional TLS as the thread-local storage mechanism for
15755 dynamic accesses of TLS variables.
15756
15757 -mtls-size=size
15758 Specify bit size of immediate TLS offsets. Valid values are 12,
15759 24, 32, 48. This option requires binutils 2.26 or newer.
15760
15761 -mfix-cortex-a53-835769
15762 -mno-fix-cortex-a53-835769
15763 Enable or disable the workaround for the ARM Cortex-A53 erratum
15764 number 835769. This involves inserting a NOP instruction between
15765 memory instructions and 64-bit integer multiply-accumulate
15766 instructions.
15767
15768 -mfix-cortex-a53-843419
15769 -mno-fix-cortex-a53-843419
15770 Enable or disable the workaround for the ARM Cortex-A53 erratum
15771 number 843419. This erratum workaround is made at link time and
15772 this will only pass the corresponding flag to the linker.
15773
15774 -mlow-precision-recip-sqrt
15775 -mno-low-precision-recip-sqrt
15776 Enable or disable the reciprocal square root approximation. This
15777 option only has an effect if -ffast-math or
15778 -funsafe-math-optimizations is used as well. Enabling this reduces
15779 precision of reciprocal square root results to about 16 bits for
15780 single precision and to 32 bits for double precision.
15781
15782 -mlow-precision-sqrt
15783 -mno-low-precision-sqrt
15784 Enable or disable the square root approximation. This option only
15785 has an effect if -ffast-math or -funsafe-math-optimizations is used
15786 as well. Enabling this reduces precision of square root results to
15787 about 16 bits for single precision and to 32 bits for double
15788 precision. If enabled, it implies -mlow-precision-recip-sqrt.
15789
15790 -mlow-precision-div
15791 -mno-low-precision-div
15792 Enable or disable the division approximation. This option only has
15793 an effect if -ffast-math or -funsafe-math-optimizations is used as
15794 well. Enabling this reduces precision of division results to about
15795 16 bits for single precision and to 32 bits for double precision.
15796
15797 -mtrack-speculation
15798 -mno-track-speculation
15799 Enable or disable generation of additional code to track
15800 speculative execution through conditional branches. The tracking
15801 state can then be used by the compiler when expanding calls to
15802 "__builtin_speculation_safe_copy" to permit a more efficient code
15803 sequence to be generated.
15804
15805 -moutline-atomics
15806 -mno-outline-atomics
15807 Enable or disable calls to out-of-line helpers to implement atomic
15808 operations. These helpers will, at runtime, determine if the LSE
15809 instructions from ARMv8.1-A can be used; if not, they will use the
15810 load/store-exclusive instructions that are present in the base
15811 ARMv8.0 ISA.
15812
15813 This option is only applicable when compiling for the base ARMv8.0
15814 instruction set. If using a later revision, e.g. -march=armv8.1-a
15815 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
15816 used directly. The same applies when using -mcpu= when the
15817 selected cpu supports the lse feature. This option is on by
15818 default.
15819
15820 -march=name
15821 Specify the name of the target architecture and, optionally, one or
15822 more feature modifiers. This option has the form
15823 -march=arch{+[no]feature}*.
15824
15825 The table below summarizes the permissible values for arch and the
15826 features that they enable by default:
15827
15828 arch value : Architecture : Includes by default
15829 armv8-a : Armv8-A : +fp, +simd
15830 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
15831 armv8.2-a : Armv8.2-A : armv8.1-a
15832 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
15833 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
15834 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
15835 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
15836 armv8-r : Armv8-R : armv8-r
15837
15838 The value native is available on native AArch64 GNU/Linux and
15839 causes the compiler to pick the architecture of the host system.
15840 This option has no effect if the compiler is unable to recognize
15841 the architecture of the host system,
15842
15843 The permissible values for feature are listed in the sub-section on
15844 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
15845 Where conflicting feature modifiers are specified, the right-most
15846 feature is used.
15847
15848 GCC uses name to determine what kind of instructions it can emit
15849 when generating assembly code. If -march is specified without
15850 either of -mtune or -mcpu also being specified, the code is tuned
15851 to perform well across a range of target processors implementing
15852 the target architecture.
15853
15854 -mtune=name
15855 Specify the name of the target processor for which GCC should tune
15856 the performance of the code. Permissible values for this option
15857 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
15858 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
15859 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
15860 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
15861 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
15862 neoverse-v1, qdf24xx, saphira, phecda, xgene1, vulcan, octeontx,
15863 octeontx81, octeontx83, octeontx2, octeontx2t98, octeontx2t96
15864 octeontx2t93, octeontx2f95, octeontx2f95n, octeontx2f95mm, a64fx,
15865 thunderx, thunderxt88, thunderxt88p1, thunderxt81, tsv110,
15866 thunderxt83, thunderx2t99, thunderx3t110, zeus,
15867 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, cortex-r82,
15870 cortex-x1, native.
15871
15872 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15873 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
15874 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
15875 should tune for a big.LITTLE system.
15876
15877 The value neoverse-512tvb specifies that GCC should tune for
15878 Neoverse cores that (a) implement SVE and (b) have a total vector
15879 bandwidth of 512 bits per cycle. In other words, the option tells
15880 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
15881 SIMD arithmetic instructions a cycle and that can execute an
15882 equivalent number of SVE arithmetic instructions per cycle (2 for
15883 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
15884 for a specific core like Neoverse V1 but is more specific than the
15885 default tuning described below.
15886
15887 Additionally on native AArch64 GNU/Linux systems the value native
15888 tunes performance to the host system. This option has no effect if
15889 the compiler is unable to recognize the processor of the host
15890 system.
15891
15892 Where none of -mtune=, -mcpu= or -march= are specified, the code is
15893 tuned to perform well across a range of target processors.
15894
15895 This option cannot be suffixed by feature modifiers.
15896
15897 -mcpu=name
15898 Specify the name of the target processor, optionally suffixed by
15899 one or more feature modifiers. This option has the form
15900 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
15901 the same as those available for -mtune. The permissible values for
15902 feature are documented in the sub-section on
15903 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
15904 Where conflicting feature modifiers are specified, the right-most
15905 feature is used.
15906
15907 GCC uses name to determine what kind of instructions it can emit
15908 when generating assembly code (as if by -march) and to determine
15909 the target processor for which to tune for performance (as if by
15910 -mtune). Where this option is used in conjunction with -march or
15911 -mtune, those options take precedence over the appropriate part of
15912 this option.
15913
15914 -mcpu=neoverse-512tvb is special in that it does not refer to a
15915 specific core, but instead refers to all Neoverse cores that (a)
15916 implement SVE and (b) have a total vector bandwidth of 512 bits a
15917 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
15918 generates code that can run on a Neoverse V1 core, since Neoverse
15919 V1 is the first Neoverse core with these properties. Unless
15920 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
15921 way as for -mtune=neoverse-512tvb.
15922
15923 -moverride=string
15924 Override tuning decisions made by the back-end in response to a
15925 -mtune= switch. The syntax, semantics, and accepted values for
15926 string in this option are not guaranteed to be consistent across
15927 releases.
15928
15929 This option is only intended to be useful when developing GCC.
15930
15931 -mverbose-cost-dump
15932 Enable verbose cost model dumping in the debug dump files. This
15933 option is provided for use in debugging the compiler.
15934
15935 -mpc-relative-literal-loads
15936 -mno-pc-relative-literal-loads
15937 Enable or disable PC-relative literal loads. With this option
15938 literal pools are accessed using a single instruction and emitted
15939 after each function. This limits the maximum size of functions to
15940 1MB. This is enabled by default for -mcmodel=tiny.
15941
15942 -msign-return-address=scope
15943 Select the function scope on which return address signing will be
15944 applied. Permissible values are none, which disables return
15945 address signing, non-leaf, which enables pointer signing for
15946 functions which are not leaf functions, and all, which enables
15947 pointer signing for all functions. The default value is none. This
15948 option has been deprecated by -mbranch-protection.
15949
15950 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
15951 Select the branch protection features to use. none is the default
15952 and turns off all types of branch protection. standard turns on
15953 all types of branch protection features. If a feature has
15954 additional tuning options, then standard sets it to its standard
15955 level. pac-ret[+leaf] turns on return address signing to its
15956 standard level: signing functions that save the return address to
15957 memory (non-leaf functions will practically always do this) using
15958 the a-key. The optional argument leaf can be used to extend the
15959 signing to include leaf functions. The optional argument b-key can
15960 be used to sign the functions with the B-key instead of the A-key.
15961 bti turns on branch target identification mechanism.
15962
15963 -mharden-sls=opts
15964 Enable compiler hardening against straight line speculation (SLS).
15965 opts is a comma-separated list of the following options:
15966
15967 retbr
15968 blr
15969
15970 In addition, -mharden-sls=all enables all SLS hardening while
15971 -mharden-sls=none disables all SLS hardening.
15972
15973 -msve-vector-bits=bits
15974 Specify the number of bits in an SVE vector register. This option
15975 only has an effect when SVE is enabled.
15976
15977 GCC supports two forms of SVE code generation: "vector-length
15978 agnostic" output that works with any size of vector register and
15979 "vector-length specific" output that allows GCC to make assumptions
15980 about the vector length when it is useful for optimization reasons.
15981 The possible values of bits are: scalable, 128, 256, 512, 1024 and
15982 2048. Specifying scalable selects vector-length agnostic output.
15983 At present -msve-vector-bits=128 also generates vector-length
15984 agnostic output for big-endian targets. All other values generate
15985 vector-length specific code. The behavior of these values may
15986 change in future releases and no value except scalable should be
15987 relied on for producing code that is portable across different
15988 hardware SVE vector lengths.
15989
15990 The default is -msve-vector-bits=scalable, which produces vector-
15991 length agnostic code.
15992
15993 -march and -mcpu Feature Modifiers
15994
15995 Feature modifiers used with -march and -mcpu can be any of the
15996 following and their inverses nofeature:
15997
15998 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
15999
16000 crypto
16001 Enable Crypto extension. This also enables Advanced SIMD and
16002 floating-point instructions.
16003
16004 fp Enable floating-point instructions. This is on by default for all
16005 possible values for options -march and -mcpu.
16006
16007 simd
16008 Enable Advanced SIMD instructions. This also enables floating-
16009 point instructions. This is on by default for all possible values
16010 for options -march and -mcpu.
16011
16012 sve Enable Scalable Vector Extension instructions. This also enables
16013 Advanced SIMD and floating-point instructions.
16014
16015 lse Enable Large System Extension instructions. This is on by default
16016 for -march=armv8.1-a.
16017
16018 rdma
16019 Enable Round Double Multiply Accumulate instructions. This is on
16020 by default for -march=armv8.1-a.
16021
16022 fp16
16023 Enable FP16 extension. This also enables floating-point
16024 instructions.
16025
16026 fp16fml
16027 Enable FP16 fmla extension. This also enables FP16 extensions and
16028 floating-point instructions. This option is enabled by default for
16029 -march=armv8.4-a. Use of this option with architectures prior to
16030 Armv8.2-A is not supported.
16031
16032 rcpc
16033 Enable the RcPc extension. This does not change code generation
16034 from GCC, but is passed on to the assembler, enabling inline asm
16035 statements to use instructions from the RcPc extension.
16036
16037 dotprod
16038 Enable the Dot Product extension. This also enables Advanced SIMD
16039 instructions.
16040
16041 aes Enable the Armv8-a aes and pmull crypto extension. This also
16042 enables Advanced SIMD instructions.
16043
16044 sha2
16045 Enable the Armv8-a sha2 crypto extension. This also enables
16046 Advanced SIMD instructions.
16047
16048 sha3
16049 Enable the sha512 and sha3 crypto extension. This also enables
16050 Advanced SIMD instructions. Use of this option with architectures
16051 prior to Armv8.2-A is not supported.
16052
16053 sm4 Enable the sm3 and sm4 crypto extension. This also enables
16054 Advanced SIMD instructions. Use of this option with architectures
16055 prior to Armv8.2-A is not supported.
16056
16057 profile
16058 Enable the Statistical Profiling extension. This option is only to
16059 enable the extension at the assembler level and does not affect
16060 code generation.
16061
16062 rng Enable the Armv8.5-a Random Number instructions. This option is
16063 only to enable the extension at the assembler level and does not
16064 affect code generation.
16065
16066 memtag
16067 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16068 with architectures prior to Armv8.5-A is not supported.
16069
16070 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16071 only to enable the extension at the assembler level and does not
16072 affect code generation. This option is enabled by default for
16073 -march=armv8.5-a.
16074
16075 ssbs
16076 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16077 option is only to enable the extension at the assembler level and
16078 does not affect code generation. This option is enabled by default
16079 for -march=armv8.5-a.
16080
16081 predres
16082 Enable the Armv8-a Execution and Data Prediction Restriction
16083 instructions. This option is only to enable the extension at the
16084 assembler level and does not affect code generation. This option
16085 is enabled by default for -march=armv8.5-a.
16086
16087 sve2
16088 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16089 SVE instructions.
16090
16091 sve2-bitperm
16092 Enable SVE2 bitperm instructions. This also enables SVE2
16093 instructions.
16094
16095 sve2-sm4
16096 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16097
16098 sve2-aes
16099 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16100
16101 sve2-sha3
16102 Enable SVE2 sha3 instructions. This also enables SVE2
16103 instructions.
16104
16105 tme Enable the Transactional Memory Extension.
16106
16107 i8mm
16108 Enable 8-bit Integer Matrix Multiply instructions. This also
16109 enables Advanced SIMD and floating-point instructions. This option
16110 is enabled by default for -march=armv8.6-a. Use of this option
16111 with architectures prior to Armv8.2-A is not supported.
16112
16113 f32mm
16114 Enable 32-bit Floating point Matrix Multiply instructions. This
16115 also enables SVE instructions. Use of this option with
16116 architectures prior to Armv8.2-A is not supported.
16117
16118 f64mm
16119 Enable 64-bit Floating point Matrix Multiply instructions. This
16120 also enables SVE instructions. Use of this option with
16121 architectures prior to Armv8.2-A is not supported.
16122
16123 bf16
16124 Enable brain half-precision floating-point instructions. This also
16125 enables Advanced SIMD and floating-point instructions. This option
16126 is enabled by default for -march=armv8.6-a. Use of this option
16127 with architectures prior to Armv8.2-A is not supported.
16128
16129 flagm
16130 Enable the Flag Manipulation instructions Extension.
16131
16132 pauth
16133 Enable the Pointer Authentication Extension.
16134
16135 Feature crypto implies aes, sha2, and simd, which implies fp.
16136 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16137 nosha2.
16138
16139 Adapteva Epiphany Options
16140
16141 These -m options are defined for Adapteva Epiphany:
16142
16143 -mhalf-reg-file
16144 Don't allocate any register in the range "r32"..."r63". That
16145 allows code to run on hardware variants that lack these registers.
16146
16147 -mprefer-short-insn-regs
16148 Preferentially allocate registers that allow short instruction
16149 generation. This can result in increased instruction count, so
16150 this may either reduce or increase overall code size.
16151
16152 -mbranch-cost=num
16153 Set the cost of branches to roughly num "simple" instructions.
16154 This cost is only a heuristic and is not guaranteed to produce
16155 consistent results across releases.
16156
16157 -mcmove
16158 Enable the generation of conditional moves.
16159
16160 -mnops=num
16161 Emit num NOPs before every other generated instruction.
16162
16163 -mno-soft-cmpsf
16164 For single-precision floating-point comparisons, emit an "fsub"
16165 instruction and test the flags. This is faster than a software
16166 comparison, but can get incorrect results in the presence of NaNs,
16167 or when two different small numbers are compared such that their
16168 difference is calculated as zero. The default is -msoft-cmpsf,
16169 which uses slower, but IEEE-compliant, software comparisons.
16170
16171 -mstack-offset=num
16172 Set the offset between the top of the stack and the stack pointer.
16173 E.g., a value of 8 means that the eight bytes in the range
16174 "sp+0...sp+7" can be used by leaf functions without stack
16175 allocation. Values other than 8 or 16 are untested and unlikely to
16176 work. Note also that this option changes the ABI; compiling a
16177 program with a different stack offset than the libraries have been
16178 compiled with generally does not work. This option can be useful
16179 if you want to evaluate if a different stack offset would give you
16180 better code, but to actually use a different stack offset to build
16181 working programs, it is recommended to configure the toolchain with
16182 the appropriate --with-stack-offset=num option.
16183
16184 -mno-round-nearest
16185 Make the scheduler assume that the rounding mode has been set to
16186 truncating. The default is -mround-nearest.
16187
16188 -mlong-calls
16189 If not otherwise specified by an attribute, assume all calls might
16190 be beyond the offset range of the "b" / "bl" instructions, and
16191 therefore load the function address into a register before
16192 performing a (otherwise direct) call. This is the default.
16193
16194 -mshort-calls
16195 If not otherwise specified by an attribute, assume all direct calls
16196 are in the range of the "b" / "bl" instructions, so use these
16197 instructions for direct calls. The default is -mlong-calls.
16198
16199 -msmall16
16200 Assume addresses can be loaded as 16-bit unsigned values. This
16201 does not apply to function addresses for which -mlong-calls
16202 semantics are in effect.
16203
16204 -mfp-mode=mode
16205 Set the prevailing mode of the floating-point unit. This
16206 determines the floating-point mode that is provided and expected at
16207 function call and return time. Making this mode match the mode you
16208 predominantly need at function start can make your programs smaller
16209 and faster by avoiding unnecessary mode switches.
16210
16211 mode can be set to one the following values:
16212
16213 caller
16214 Any mode at function entry is valid, and retained or restored
16215 when the function returns, and when it calls other functions.
16216 This mode is useful for compiling libraries or other
16217 compilation units you might want to incorporate into different
16218 programs with different prevailing FPU modes, and the
16219 convenience of being able to use a single object file outweighs
16220 the size and speed overhead for any extra mode switching that
16221 might be needed, compared with what would be needed with a more
16222 specific choice of prevailing FPU mode.
16223
16224 truncate
16225 This is the mode used for floating-point calculations with
16226 truncating (i.e. round towards zero) rounding mode. That
16227 includes conversion from floating point to integer.
16228
16229 round-nearest
16230 This is the mode used for floating-point calculations with
16231 round-to-nearest-or-even rounding mode.
16232
16233 int This is the mode used to perform integer calculations in the
16234 FPU, e.g. integer multiply, or integer multiply-and-
16235 accumulate.
16236
16237 The default is -mfp-mode=caller
16238
16239 -mno-split-lohi
16240 -mno-postinc
16241 -mno-postmodify
16242 Code generation tweaks that disable, respectively, splitting of
16243 32-bit loads, generation of post-increment addresses, and
16244 generation of post-modify addresses. The defaults are msplit-lohi,
16245 -mpost-inc, and -mpost-modify.
16246
16247 -mnovect-double
16248 Change the preferred SIMD mode to SImode. The default is
16249 -mvect-double, which uses DImode as preferred SIMD mode.
16250
16251 -max-vect-align=num
16252 The maximum alignment for SIMD vector mode types. num may be 4 or
16253 8. The default is 8. Note that this is an ABI change, even though
16254 many library function interfaces are unaffected if they don't use
16255 SIMD vector modes in places that affect size and/or alignment of
16256 relevant types.
16257
16258 -msplit-vecmove-early
16259 Split vector moves into single word moves before reload. In theory
16260 this can give better register allocation, but so far the reverse
16261 seems to be generally the case.
16262
16263 -m1reg-reg
16264 Specify a register to hold the constant -1, which makes loading
16265 small negative constants and certain bitmasks faster. Allowable
16266 values for reg are r43 and r63, which specify use of that register
16267 as a fixed register, and none, which means that no register is used
16268 for this purpose. The default is -m1reg-none.
16269
16270 AMD GCN Options
16271
16272 These options are defined specifically for the AMD GCN port.
16273
16274 -march=gpu
16275 -mtune=gpu
16276 Set architecture type or tuning for gpu. Supported values for gpu
16277 are
16278
16279 fiji
16280 Compile for GCN3 Fiji devices (gfx803).
16281
16282 gfx900
16283 Compile for GCN5 Vega 10 devices (gfx900).
16284
16285 gfx906
16286 Compile for GCN5 Vega 20 devices (gfx906).
16287
16288 -msram-ecc=on
16289 -msram-ecc=off
16290 -msram-ecc=any
16291 Compile binaries suitable for devices with the SRAM-ECC feature
16292 enabled, disabled, or either mode. This feature can be enabled
16293 per-process on some devices. The compiled code must match the
16294 device mode. The default is any, for devices that support it.
16295
16296 -mstack-size=bytes
16297 Specify how many bytes of stack space will be requested for each
16298 GPU thread (wave-front). Beware that there may be many threads and
16299 limited memory available. The size of the stack allocation may
16300 also have an impact on run-time performance. The default is 32KB
16301 when using OpenACC or OpenMP, and 1MB otherwise.
16302
16303 -mxnack
16304 Compile binaries suitable for devices with the XNACK feature
16305 enabled. Some devices always require XNACK and some allow the user
16306 to configure XNACK. The compiled code must match the device mode.
16307 The default is -mno-xnack. At present this option is a placeholder
16308 for support that is not yet implemented.
16309
16310 ARC Options
16311
16312 The following options control the architecture variant for which code
16313 is being compiled:
16314
16315 -mbarrel-shifter
16316 Generate instructions supported by barrel shifter. This is the
16317 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
16318
16319 -mjli-always
16320 Force to call a function using jli_s instruction. This option is
16321 valid only for ARCv2 architecture.
16322
16323 -mcpu=cpu
16324 Set architecture type, register usage, and instruction scheduling
16325 parameters for cpu. There are also shortcut alias options
16326 available for backward compatibility and convenience. Supported
16327 values for cpu are
16328
16329 arc600
16330 Compile for ARC600. Aliases: -mA6, -mARC600.
16331
16332 arc601
16333 Compile for ARC601. Alias: -mARC601.
16334
16335 arc700
16336 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
16337 default when configured with --with-cpu=arc700.
16338
16339 arcem
16340 Compile for ARC EM.
16341
16342 archs
16343 Compile for ARC HS.
16344
16345 em Compile for ARC EM CPU with no hardware extensions.
16346
16347 em4 Compile for ARC EM4 CPU.
16348
16349 em4_dmips
16350 Compile for ARC EM4 DMIPS CPU.
16351
16352 em4_fpus
16353 Compile for ARC EM4 DMIPS CPU with the single-precision
16354 floating-point extension.
16355
16356 em4_fpuda
16357 Compile for ARC EM4 DMIPS CPU with single-precision floating-
16358 point and double assist instructions.
16359
16360 hs Compile for ARC HS CPU with no hardware extensions except the
16361 atomic instructions.
16362
16363 hs34
16364 Compile for ARC HS34 CPU.
16365
16366 hs38
16367 Compile for ARC HS38 CPU.
16368
16369 hs38_linux
16370 Compile for ARC HS38 CPU with all hardware extensions on.
16371
16372 arc600_norm
16373 Compile for ARC 600 CPU with "norm" instructions enabled.
16374
16375 arc600_mul32x16
16376 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
16377 instructions enabled.
16378
16379 arc600_mul64
16380 Compile for ARC 600 CPU with "norm" and "mul64"-family
16381 instructions enabled.
16382
16383 arc601_norm
16384 Compile for ARC 601 CPU with "norm" instructions enabled.
16385
16386 arc601_mul32x16
16387 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
16388 instructions enabled.
16389
16390 arc601_mul64
16391 Compile for ARC 601 CPU with "norm" and "mul64"-family
16392 instructions enabled.
16393
16394 nps400
16395 Compile for ARC 700 on NPS400 chip.
16396
16397 em_mini
16398 Compile for ARC EM minimalist configuration featuring reduced
16399 register set.
16400
16401 -mdpfp
16402 -mdpfp-compact
16403 Generate double-precision FPX instructions, tuned for the compact
16404 implementation.
16405
16406 -mdpfp-fast
16407 Generate double-precision FPX instructions, tuned for the fast
16408 implementation.
16409
16410 -mno-dpfp-lrsr
16411 Disable "lr" and "sr" instructions from using FPX extension aux
16412 registers.
16413
16414 -mea
16415 Generate extended arithmetic instructions. Currently only "divaw",
16416 "adds", "subs", and "sat16" are supported. Only valid for
16417 -mcpu=ARC700.
16418
16419 -mno-mpy
16420 Do not generate "mpy"-family instructions for ARC700. This option
16421 is deprecated.
16422
16423 -mmul32x16
16424 Generate 32x16-bit multiply and multiply-accumulate instructions.
16425
16426 -mmul64
16427 Generate "mul64" and "mulu64" instructions. Only valid for
16428 -mcpu=ARC600.
16429
16430 -mnorm
16431 Generate "norm" instructions. This is the default if -mcpu=ARC700
16432 is in effect.
16433
16434 -mspfp
16435 -mspfp-compact
16436 Generate single-precision FPX instructions, tuned for the compact
16437 implementation.
16438
16439 -mspfp-fast
16440 Generate single-precision FPX instructions, tuned for the fast
16441 implementation.
16442
16443 -msimd
16444 Enable generation of ARC SIMD instructions via target-specific
16445 builtins. Only valid for -mcpu=ARC700.
16446
16447 -msoft-float
16448 This option ignored; it is provided for compatibility purposes
16449 only. Software floating-point code is emitted by default, and this
16450 default can overridden by FPX options; -mspfp, -mspfp-compact, or
16451 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
16452 -mdpfp-fast for double precision.
16453
16454 -mswap
16455 Generate "swap" instructions.
16456
16457 -matomic
16458 This enables use of the locked load/store conditional extension to
16459 implement atomic memory built-in functions. Not available for ARC
16460 6xx or ARC EM cores.
16461
16462 -mdiv-rem
16463 Enable "div" and "rem" instructions for ARCv2 cores.
16464
16465 -mcode-density
16466 Enable code density instructions for ARC EM. This option is on by
16467 default for ARC HS.
16468
16469 -mll64
16470 Enable double load/store operations for ARC HS cores.
16471
16472 -mtp-regno=regno
16473 Specify thread pointer register number.
16474
16475 -mmpy-option=multo
16476 Compile ARCv2 code with a multiplier design option. You can
16477 specify the option using either a string or numeric value for
16478 multo. wlh1 is the default value. The recognized values are:
16479
16480 0
16481 none
16482 No multiplier available.
16483
16484 1
16485 w 16x16 multiplier, fully pipelined. The following instructions
16486 are enabled: "mpyw" and "mpyuw".
16487
16488 2
16489 wlh1
16490 32x32 multiplier, fully pipelined (1 stage). The following
16491 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16492 "mpymu", and "mpy_s".
16493
16494 3
16495 wlh2
16496 32x32 multiplier, fully pipelined (2 stages). The following
16497 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16498 "mpymu", and "mpy_s".
16499
16500 4
16501 wlh3
16502 Two 16x16 multipliers, blocking, sequential. The following
16503 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16504 "mpymu", and "mpy_s".
16505
16506 5
16507 wlh4
16508 One 16x16 multiplier, blocking, sequential. The following
16509 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16510 "mpymu", and "mpy_s".
16511
16512 6
16513 wlh5
16514 One 32x4 multiplier, blocking, sequential. The following
16515 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16516 "mpymu", and "mpy_s".
16517
16518 7
16519 plus_dmpy
16520 ARC HS SIMD support.
16521
16522 8
16523 plus_macd
16524 ARC HS SIMD support.
16525
16526 9
16527 plus_qmacw
16528 ARC HS SIMD support.
16529
16530 This option is only available for ARCv2 cores.
16531
16532 -mfpu=fpu
16533 Enables support for specific floating-point hardware extensions for
16534 ARCv2 cores. Supported values for fpu are:
16535
16536 fpus
16537 Enables support for single-precision floating-point hardware
16538 extensions.
16539
16540 fpud
16541 Enables support for double-precision floating-point hardware
16542 extensions. The single-precision floating-point extension is
16543 also enabled. Not available for ARC EM.
16544
16545 fpuda
16546 Enables support for double-precision floating-point hardware
16547 extensions using double-precision assist instructions. The
16548 single-precision floating-point extension is also enabled.
16549 This option is only available for ARC EM.
16550
16551 fpuda_div
16552 Enables support for double-precision floating-point hardware
16553 extensions using double-precision assist instructions. The
16554 single-precision floating-point, square-root, and divide
16555 extensions are also enabled. This option is only available for
16556 ARC EM.
16557
16558 fpuda_fma
16559 Enables support for double-precision floating-point hardware
16560 extensions using double-precision assist instructions. The
16561 single-precision floating-point and fused multiply and add
16562 hardware extensions are also enabled. This option is only
16563 available for ARC EM.
16564
16565 fpuda_all
16566 Enables support for double-precision floating-point hardware
16567 extensions using double-precision assist instructions. All
16568 single-precision floating-point hardware extensions are also
16569 enabled. This option is only available for ARC EM.
16570
16571 fpus_div
16572 Enables support for single-precision floating-point, square-
16573 root and divide hardware extensions.
16574
16575 fpud_div
16576 Enables support for double-precision floating-point, square-
16577 root and divide hardware extensions. This option includes
16578 option fpus_div. Not available for ARC EM.
16579
16580 fpus_fma
16581 Enables support for single-precision floating-point and fused
16582 multiply and add hardware extensions.
16583
16584 fpud_fma
16585 Enables support for double-precision floating-point and fused
16586 multiply and add hardware extensions. This option includes
16587 option fpus_fma. Not available for ARC EM.
16588
16589 fpus_all
16590 Enables support for all single-precision floating-point
16591 hardware extensions.
16592
16593 fpud_all
16594 Enables support for all single- and double-precision floating-
16595 point hardware extensions. Not available for ARC EM.
16596
16597 -mirq-ctrl-saved=register-range, blink, lp_count
16598 Specifies general-purposes registers that the processor
16599 automatically saves/restores on interrupt entry and exit.
16600 register-range is specified as two registers separated by a dash.
16601 The register range always starts with "r0", the upper limit is "fp"
16602 register. blink and lp_count are optional. This option is only
16603 valid for ARC EM and ARC HS cores.
16604
16605 -mrgf-banked-regs=number
16606 Specifies the number of registers replicated in second register
16607 bank on entry to fast interrupt. Fast interrupts are interrupts
16608 with the highest priority level P0. These interrupts save only PC
16609 and STATUS32 registers to avoid memory transactions during
16610 interrupt entry and exit sequences. Use this option when you are
16611 using fast interrupts in an ARC V2 family processor. Permitted
16612 values are 4, 8, 16, and 32.
16613
16614 -mlpc-width=width
16615 Specify the width of the "lp_count" register. Valid values for
16616 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
16617 fixed to 32 bits. If the width is less than 32, the compiler does
16618 not attempt to transform loops in your program to use the zero-
16619 delay loop mechanism unless it is known that the "lp_count"
16620 register can hold the required loop-counter value. Depending on
16621 the width specified, the compiler and run-time library might
16622 continue to use the loop mechanism for various needs. This option
16623 defines macro "__ARC_LPC_WIDTH__" with the value of width.
16624
16625 -mrf16
16626 This option instructs the compiler to generate code for a 16-entry
16627 register file. This option defines the "__ARC_RF16__" preprocessor
16628 macro.
16629
16630 -mbranch-index
16631 Enable use of "bi" or "bih" instructions to implement jump tables.
16632
16633 The following options are passed through to the assembler, and also
16634 define preprocessor macro symbols.
16635
16636 -mdsp-packa
16637 Passed down to the assembler to enable the DSP Pack A extensions.
16638 Also sets the preprocessor symbol "__Xdsp_packa". This option is
16639 deprecated.
16640
16641 -mdvbf
16642 Passed down to the assembler to enable the dual Viterbi butterfly
16643 extension. Also sets the preprocessor symbol "__Xdvbf". This
16644 option is deprecated.
16645
16646 -mlock
16647 Passed down to the assembler to enable the locked load/store
16648 conditional extension. Also sets the preprocessor symbol
16649 "__Xlock".
16650
16651 -mmac-d16
16652 Passed down to the assembler. Also sets the preprocessor symbol
16653 "__Xxmac_d16". This option is deprecated.
16654
16655 -mmac-24
16656 Passed down to the assembler. Also sets the preprocessor symbol
16657 "__Xxmac_24". This option is deprecated.
16658
16659 -mrtsc
16660 Passed down to the assembler to enable the 64-bit time-stamp
16661 counter extension instruction. Also sets the preprocessor symbol
16662 "__Xrtsc". This option is deprecated.
16663
16664 -mswape
16665 Passed down to the assembler to enable the swap byte ordering
16666 extension instruction. Also sets the preprocessor symbol
16667 "__Xswape".
16668
16669 -mtelephony
16670 Passed down to the assembler to enable dual- and single-operand
16671 instructions for telephony. Also sets the preprocessor symbol
16672 "__Xtelephony". This option is deprecated.
16673
16674 -mxy
16675 Passed down to the assembler to enable the XY memory extension.
16676 Also sets the preprocessor symbol "__Xxy".
16677
16678 The following options control how the assembly code is annotated:
16679
16680 -misize
16681 Annotate assembler instructions with estimated addresses.
16682
16683 -mannotate-align
16684 Explain what alignment considerations lead to the decision to make
16685 an instruction short or long.
16686
16687 The following options are passed through to the linker:
16688
16689 -marclinux
16690 Passed through to the linker, to specify use of the "arclinux"
16691 emulation. This option is enabled by default in tool chains built
16692 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16693 profiling is not requested.
16694
16695 -marclinux_prof
16696 Passed through to the linker, to specify use of the "arclinux_prof"
16697 emulation. This option is enabled by default in tool chains built
16698 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16699 profiling is requested.
16700
16701 The following options control the semantics of generated code:
16702
16703 -mlong-calls
16704 Generate calls as register indirect calls, thus providing access to
16705 the full 32-bit address range.
16706
16707 -mmedium-calls
16708 Don't use less than 25-bit addressing range for calls, which is the
16709 offset available for an unconditional branch-and-link instruction.
16710 Conditional execution of function calls is suppressed, to allow use
16711 of the 25-bit range, rather than the 21-bit range with conditional
16712 branch-and-link. This is the default for tool chains built for
16713 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
16714
16715 -G num
16716 Put definitions of externally-visible data in a small data section
16717 if that data is no bigger than num bytes. The default value of num
16718 is 4 for any ARC configuration, or 8 when we have double load/store
16719 operations.
16720
16721 -mno-sdata
16722 Do not generate sdata references. This is the default for tool
16723 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
16724 targets.
16725
16726 -mvolatile-cache
16727 Use ordinarily cached memory accesses for volatile references.
16728 This is the default.
16729
16730 -mno-volatile-cache
16731 Enable cache bypass for volatile references.
16732
16733 The following options fine tune code generation:
16734
16735 -malign-call
16736 Do alignment optimizations for call instructions.
16737
16738 -mauto-modify-reg
16739 Enable the use of pre/post modify with register displacement.
16740
16741 -mbbit-peephole
16742 Enable bbit peephole2.
16743
16744 -mno-brcc
16745 This option disables a target-specific pass in arc_reorg to
16746 generate compare-and-branch ("brcc") instructions. It has no
16747 effect on generation of these instructions driven by the combiner
16748 pass.
16749
16750 -mcase-vector-pcrel
16751 Use PC-relative switch case tables to enable case table shortening.
16752 This is the default for -Os.
16753
16754 -mcompact-casesi
16755 Enable compact "casesi" pattern. This is the default for -Os, and
16756 only available for ARCv1 cores. This option is deprecated.
16757
16758 -mno-cond-exec
16759 Disable the ARCompact-specific pass to generate conditional
16760 execution instructions.
16761
16762 Due to delay slot scheduling and interactions between operand
16763 numbers, literal sizes, instruction lengths, and the support for
16764 conditional execution, the target-independent pass to generate
16765 conditional execution is often lacking, so the ARC port has kept a
16766 special pass around that tries to find more conditional execution
16767 generation opportunities after register allocation, branch
16768 shortening, and delay slot scheduling have been done. This pass
16769 generally, but not always, improves performance and code size, at
16770 the cost of extra compilation time, which is why there is an option
16771 to switch it off. If you have a problem with call instructions
16772 exceeding their allowable offset range because they are
16773 conditionalized, you should consider using -mmedium-calls instead.
16774
16775 -mearly-cbranchsi
16776 Enable pre-reload use of the "cbranchsi" pattern.
16777
16778 -mexpand-adddi
16779 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
16780 "adc" etc. This option is deprecated.
16781
16782 -mindexed-loads
16783 Enable the use of indexed loads. This can be problematic because
16784 some optimizers then assume that indexed stores exist, which is not
16785 the case.
16786
16787 -mlra
16788 Enable Local Register Allocation. This is still experimental for
16789 ARC, so by default the compiler uses standard reload (i.e.
16790 -mno-lra).
16791
16792 -mlra-priority-none
16793 Don't indicate any priority for target registers.
16794
16795 -mlra-priority-compact
16796 Indicate target register priority for r0..r3 / r12..r15.
16797
16798 -mlra-priority-noncompact
16799 Reduce target register priority for r0..r3 / r12..r15.
16800
16801 -mmillicode
16802 When optimizing for size (using -Os), prologues and epilogues that
16803 have to save or restore a large number of registers are often
16804 shortened by using call to a special function in libgcc; this is
16805 referred to as a millicode call. As these calls can pose
16806 performance issues, and/or cause linking issues when linking in a
16807 nonstandard way, this option is provided to turn on or off
16808 millicode call generation.
16809
16810 -mcode-density-frame
16811 This option enable the compiler to emit "enter" and "leave"
16812 instructions. These instructions are only valid for CPUs with
16813 code-density feature.
16814
16815 -mmixed-code
16816 Tweak register allocation to help 16-bit instruction generation.
16817 This generally has the effect of decreasing the average instruction
16818 size while increasing the instruction count.
16819
16820 -mq-class
16821 Ths option is deprecated. Enable q instruction alternatives. This
16822 is the default for -Os.
16823
16824 -mRcq
16825 Enable Rcq constraint handling. Most short code generation depends
16826 on this. This is the default.
16827
16828 -mRcw
16829 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
16830 on this. This is the default.
16831
16832 -msize-level=level
16833 Fine-tune size optimization with regards to instruction lengths and
16834 alignment. The recognized values for level are:
16835
16836 0 No size optimization. This level is deprecated and treated
16837 like 1.
16838
16839 1 Short instructions are used opportunistically.
16840
16841 2 In addition, alignment of loops and of code after barriers are
16842 dropped.
16843
16844 3 In addition, optional data alignment is dropped, and the option
16845 Os is enabled.
16846
16847 This defaults to 3 when -Os is in effect. Otherwise, the behavior
16848 when this is not set is equivalent to level 1.
16849
16850 -mtune=cpu
16851 Set instruction scheduling parameters for cpu, overriding any
16852 implied by -mcpu=.
16853
16854 Supported values for cpu are
16855
16856 ARC600
16857 Tune for ARC600 CPU.
16858
16859 ARC601
16860 Tune for ARC601 CPU.
16861
16862 ARC700
16863 Tune for ARC700 CPU with standard multiplier block.
16864
16865 ARC700-xmac
16866 Tune for ARC700 CPU with XMAC block.
16867
16868 ARC725D
16869 Tune for ARC725D CPU.
16870
16871 ARC750D
16872 Tune for ARC750D CPU.
16873
16874 -mmultcost=num
16875 Cost to assume for a multiply instruction, with 4 being equal to a
16876 normal instruction.
16877
16878 -munalign-prob-threshold=probability
16879 Set probability threshold for unaligning branches. When tuning for
16880 ARC700 and optimizing for speed, branches without filled delay slot
16881 are preferably emitted unaligned and long, unless profiling
16882 indicates that the probability for the branch to be taken is below
16883 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
16884
16885 The following options are maintained for backward compatibility, but
16886 are now deprecated and will be removed in a future release:
16887
16888 -margonaut
16889 Obsolete FPX.
16890
16891 -mbig-endian
16892 -EB Compile code for big-endian targets. Use of these options is now
16893 deprecated. Big-endian code is supported by configuring GCC to
16894 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
16895 endian is the default.
16896
16897 -mlittle-endian
16898 -EL Compile code for little-endian targets. Use of these options is
16899 now deprecated. Little-endian code is supported by configuring GCC
16900 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
16901 little endian is the default.
16902
16903 -mbarrel_shifter
16904 Replaced by -mbarrel-shifter.
16905
16906 -mdpfp_compact
16907 Replaced by -mdpfp-compact.
16908
16909 -mdpfp_fast
16910 Replaced by -mdpfp-fast.
16911
16912 -mdsp_packa
16913 Replaced by -mdsp-packa.
16914
16915 -mEA
16916 Replaced by -mea.
16917
16918 -mmac_24
16919 Replaced by -mmac-24.
16920
16921 -mmac_d16
16922 Replaced by -mmac-d16.
16923
16924 -mspfp_compact
16925 Replaced by -mspfp-compact.
16926
16927 -mspfp_fast
16928 Replaced by -mspfp-fast.
16929
16930 -mtune=cpu
16931 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
16932 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
16933
16934 -multcost=num
16935 Replaced by -mmultcost.
16936
16937 ARM Options
16938
16939 These -m options are defined for the ARM port:
16940
16941 -mabi=name
16942 Generate code for the specified ABI. Permissible values are: apcs-
16943 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
16944
16945 -mapcs-frame
16946 Generate a stack frame that is compliant with the ARM Procedure
16947 Call Standard for all functions, even if this is not strictly
16948 necessary for correct execution of the code. Specifying
16949 -fomit-frame-pointer with this option causes the stack frames not
16950 to be generated for leaf functions. The default is
16951 -mno-apcs-frame. This option is deprecated.
16952
16953 -mapcs
16954 This is a synonym for -mapcs-frame and is deprecated.
16955
16956 -mthumb-interwork
16957 Generate code that supports calling between the ARM and Thumb
16958 instruction sets. Without this option, on pre-v5 architectures,
16959 the two instruction sets cannot be reliably used inside one
16960 program. The default is -mno-thumb-interwork, since slightly
16961 larger code is generated when -mthumb-interwork is specified. In
16962 AAPCS configurations this option is meaningless.
16963
16964 -mno-sched-prolog
16965 Prevent the reordering of instructions in the function prologue, or
16966 the merging of those instruction with the instructions in the
16967 function's body. This means that all functions start with a
16968 recognizable set of instructions (or in fact one of a choice from a
16969 small set of different function prologues), and this information
16970 can be used to locate the start of functions inside an executable
16971 piece of code. The default is -msched-prolog.
16972
16973 -mfloat-abi=name
16974 Specifies which floating-point ABI to use. Permissible values are:
16975 soft, softfp and hard.
16976
16977 Specifying soft causes GCC to generate output containing library
16978 calls for floating-point operations. softfp allows the generation
16979 of code using hardware floating-point instructions, but still uses
16980 the soft-float calling conventions. hard allows generation of
16981 floating-point instructions and uses FPU-specific calling
16982 conventions.
16983
16984 The default depends on the specific target configuration. Note
16985 that the hard-float and soft-float ABIs are not link-compatible;
16986 you must compile your entire program with the same ABI, and link
16987 with a compatible set of libraries.
16988
16989 -mgeneral-regs-only
16990 Generate code which uses only the general-purpose registers. This
16991 will prevent the compiler from using floating-point and Advanced
16992 SIMD registers but will not impose any restrictions on the
16993 assembler.
16994
16995 -mlittle-endian
16996 Generate code for a processor running in little-endian mode. This
16997 is the default for all standard configurations.
16998
16999 -mbig-endian
17000 Generate code for a processor running in big-endian mode; the
17001 default is to compile code for a little-endian processor.
17002
17003 -mbe8
17004 -mbe32
17005 When linking a big-endian image select between BE8 and BE32
17006 formats. The option has no effect for little-endian images and is
17007 ignored. The default is dependent on the selected target
17008 architecture. For ARMv6 and later architectures the default is
17009 BE8, for older architectures the default is BE32. BE32 format has
17010 been deprecated by ARM.
17011
17012 -march=name[+extension...]
17013 This specifies the name of the target ARM architecture. GCC uses
17014 this name to determine what kind of instructions it can emit when
17015 generating assembly code. This option can be used in conjunction
17016 with or instead of the -mcpu= option.
17017
17018 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
17019 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
17020 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
17021 armv8.6-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
17022 armv8-m.base, armv8-m.main, armv8.1-m.main, iwmmxt and iwmmxt2.
17023
17024 Additionally, the following architectures, which lack support for
17025 the Thumb execution state, are recognized but support is
17026 deprecated: armv4.
17027
17028 Many of the architectures support extensions. These can be added
17029 by appending +extension to the architecture name. Extension
17030 options are processed in order and capabilities accumulate. An
17031 extension will also enable any necessary base extensions upon which
17032 it depends. For example, the +crypto extension will always enable
17033 the +simd extension. The exception to the additive construction is
17034 for extensions that are prefixed with +no...: these extensions
17035 disable the specified option and any other extensions that may
17036 depend on the presence of that extension.
17037
17038 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
17039 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17040 disabled by the +nofp option that follows it.
17041
17042 Most extension names are generically named, but have an effect that
17043 is dependent upon the architecture to which it is applied. For
17044 example, the +simd option can be applied to both armv7-a and
17045 armv8-a architectures, but will enable the original ARMv7-A
17046 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17047 for armv8-a.
17048
17049 The table below lists the supported extensions for each
17050 architecture. Architectures not mentioned do not support any
17051 extensions.
17052
17053 armv5te
17054 armv6
17055 armv6j
17056 armv6k
17057 armv6kz
17058 armv6t2
17059 armv6z
17060 armv6zk
17061 +fp The VFPv2 floating-point instructions. The extension
17062 +vfpv2 can be used as an alias for this extension.
17063
17064 +nofp
17065 Disable the floating-point instructions.
17066
17067 armv7
17068 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17069 architectures.
17070
17071 +fp The VFPv3 floating-point instructions, with 16 double-
17072 precision registers. The extension +vfpv3-d16 can be used
17073 as an alias for this extension. Note that floating-point
17074 is not supported by the base ARMv7-M architecture, but is
17075 compatible with both the ARMv7-A and ARMv7-R architectures.
17076
17077 +nofp
17078 Disable the floating-point instructions.
17079
17080 armv7-a
17081 +mp The multiprocessing extension.
17082
17083 +sec
17084 The security extension.
17085
17086 +fp The VFPv3 floating-point instructions, with 16 double-
17087 precision registers. The extension +vfpv3-d16 can be used
17088 as an alias for this extension.
17089
17090 +simd
17091 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17092 instructions. The extensions +neon and +neon-vfpv3 can be
17093 used as aliases for this extension.
17094
17095 +vfpv3
17096 The VFPv3 floating-point instructions, with 32 double-
17097 precision registers.
17098
17099 +vfpv3-d16-fp16
17100 The VFPv3 floating-point instructions, with 16 double-
17101 precision registers and the half-precision floating-point
17102 conversion operations.
17103
17104 +vfpv3-fp16
17105 The VFPv3 floating-point instructions, with 32 double-
17106 precision registers and the half-precision floating-point
17107 conversion operations.
17108
17109 +vfpv4-d16
17110 The VFPv4 floating-point instructions, with 16 double-
17111 precision registers.
17112
17113 +vfpv4
17114 The VFPv4 floating-point instructions, with 32 double-
17115 precision registers.
17116
17117 +neon-fp16
17118 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17119 instructions, with the half-precision floating-point
17120 conversion operations.
17121
17122 +neon-vfpv4
17123 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17124 instructions.
17125
17126 +nosimd
17127 Disable the Advanced SIMD instructions (does not disable
17128 floating point).
17129
17130 +nofp
17131 Disable the floating-point and Advanced SIMD instructions.
17132
17133 armv7ve
17134 The extended version of the ARMv7-A architecture with support
17135 for virtualization.
17136
17137 +fp The VFPv4 floating-point instructions, with 16 double-
17138 precision registers. The extension +vfpv4-d16 can be used
17139 as an alias for this extension.
17140
17141 +simd
17142 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17143 instructions. The extension +neon-vfpv4 can be used as an
17144 alias for this extension.
17145
17146 +vfpv3-d16
17147 The VFPv3 floating-point instructions, with 16 double-
17148 precision registers.
17149
17150 +vfpv3
17151 The VFPv3 floating-point instructions, with 32 double-
17152 precision registers.
17153
17154 +vfpv3-d16-fp16
17155 The VFPv3 floating-point instructions, with 16 double-
17156 precision registers and the half-precision floating-point
17157 conversion operations.
17158
17159 +vfpv3-fp16
17160 The VFPv3 floating-point instructions, with 32 double-
17161 precision registers and the half-precision floating-point
17162 conversion operations.
17163
17164 +vfpv4-d16
17165 The VFPv4 floating-point instructions, with 16 double-
17166 precision registers.
17167
17168 +vfpv4
17169 The VFPv4 floating-point instructions, with 32 double-
17170 precision registers.
17171
17172 +neon
17173 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17174 instructions. The extension +neon-vfpv3 can be used as an
17175 alias for this extension.
17176
17177 +neon-fp16
17178 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17179 instructions, with the half-precision floating-point
17180 conversion operations.
17181
17182 +nosimd
17183 Disable the Advanced SIMD instructions (does not disable
17184 floating point).
17185
17186 +nofp
17187 Disable the floating-point and Advanced SIMD instructions.
17188
17189 armv8-a
17190 +crc
17191 The Cyclic Redundancy Check (CRC) instructions.
17192
17193 +simd
17194 The ARMv8-A Advanced SIMD and floating-point instructions.
17195
17196 +crypto
17197 The cryptographic instructions.
17198
17199 +nocrypto
17200 Disable the cryptographic instructions.
17201
17202 +nofp
17203 Disable the floating-point, Advanced SIMD and cryptographic
17204 instructions.
17205
17206 +sb Speculation Barrier Instruction.
17207
17208 +predres
17209 Execution and Data Prediction Restriction Instructions.
17210
17211 armv8.1-a
17212 +simd
17213 The ARMv8.1-A Advanced SIMD and floating-point
17214 instructions.
17215
17216 +crypto
17217 The cryptographic instructions. This also enables the
17218 Advanced SIMD and floating-point instructions.
17219
17220 +nocrypto
17221 Disable the cryptographic instructions.
17222
17223 +nofp
17224 Disable the floating-point, Advanced SIMD and cryptographic
17225 instructions.
17226
17227 +sb Speculation Barrier Instruction.
17228
17229 +predres
17230 Execution and Data Prediction Restriction Instructions.
17231
17232 armv8.2-a
17233 armv8.3-a
17234 +fp16
17235 The half-precision floating-point data processing
17236 instructions. This also enables the Advanced SIMD and
17237 floating-point instructions.
17238
17239 +fp16fml
17240 The half-precision floating-point fmla extension. This
17241 also enables the half-precision floating-point extension
17242 and Advanced SIMD and floating-point instructions.
17243
17244 +simd
17245 The ARMv8.1-A Advanced SIMD and floating-point
17246 instructions.
17247
17248 +crypto
17249 The cryptographic instructions. This also enables the
17250 Advanced SIMD and floating-point instructions.
17251
17252 +dotprod
17253 Enable the Dot Product extension. This also enables
17254 Advanced SIMD instructions.
17255
17256 +nocrypto
17257 Disable the cryptographic extension.
17258
17259 +nofp
17260 Disable the floating-point, Advanced SIMD and cryptographic
17261 instructions.
17262
17263 +sb Speculation Barrier Instruction.
17264
17265 +predres
17266 Execution and Data Prediction Restriction Instructions.
17267
17268 +i8mm
17269 8-bit Integer Matrix Multiply instructions. This also
17270 enables Advanced SIMD and floating-point instructions.
17271
17272 +bf16
17273 Brain half-precision floating-point instructions. This
17274 also enables Advanced SIMD and floating-point instructions.
17275
17276 armv8.4-a
17277 +fp16
17278 The half-precision floating-point data processing
17279 instructions. This also enables the Advanced SIMD and
17280 floating-point instructions as well as the Dot Product
17281 extension and the half-precision floating-point fmla
17282 extension.
17283
17284 +simd
17285 The ARMv8.3-A Advanced SIMD and floating-point instructions
17286 as well as the Dot Product extension.
17287
17288 +crypto
17289 The cryptographic instructions. This also enables the
17290 Advanced SIMD and floating-point instructions as well as
17291 the Dot Product extension.
17292
17293 +nocrypto
17294 Disable the cryptographic extension.
17295
17296 +nofp
17297 Disable the floating-point, Advanced SIMD and cryptographic
17298 instructions.
17299
17300 +sb Speculation Barrier Instruction.
17301
17302 +predres
17303 Execution and Data Prediction Restriction Instructions.
17304
17305 +i8mm
17306 8-bit Integer Matrix Multiply instructions. This also
17307 enables Advanced SIMD and floating-point instructions.
17308
17309 +bf16
17310 Brain half-precision floating-point instructions. This
17311 also enables Advanced SIMD and floating-point instructions.
17312
17313 armv8.5-a
17314 +fp16
17315 The half-precision floating-point data processing
17316 instructions. This also enables the Advanced SIMD and
17317 floating-point instructions as well as the Dot Product
17318 extension and the half-precision floating-point fmla
17319 extension.
17320
17321 +simd
17322 The ARMv8.3-A Advanced SIMD and floating-point instructions
17323 as well as the Dot Product extension.
17324
17325 +crypto
17326 The cryptographic instructions. This also enables the
17327 Advanced SIMD and floating-point instructions as well as
17328 the Dot Product extension.
17329
17330 +nocrypto
17331 Disable the cryptographic extension.
17332
17333 +nofp
17334 Disable the floating-point, Advanced SIMD and cryptographic
17335 instructions.
17336
17337 +i8mm
17338 8-bit Integer Matrix Multiply instructions. This also
17339 enables Advanced SIMD and floating-point instructions.
17340
17341 +bf16
17342 Brain half-precision floating-point instructions. This
17343 also enables Advanced SIMD and floating-point instructions.
17344
17345 armv8.6-a
17346 +fp16
17347 The half-precision floating-point data processing
17348 instructions. This also enables the Advanced SIMD and
17349 floating-point instructions as well as the Dot Product
17350 extension and the half-precision floating-point fmla
17351 extension.
17352
17353 +simd
17354 The ARMv8.3-A Advanced SIMD and floating-point instructions
17355 as well as the Dot Product extension.
17356
17357 +crypto
17358 The cryptographic instructions. This also enables the
17359 Advanced SIMD and floating-point instructions as well as
17360 the Dot Product extension.
17361
17362 +nocrypto
17363 Disable the cryptographic extension.
17364
17365 +nofp
17366 Disable the floating-point, Advanced SIMD and cryptographic
17367 instructions.
17368
17369 +i8mm
17370 8-bit Integer Matrix Multiply instructions. This also
17371 enables Advanced SIMD and floating-point instructions.
17372
17373 +bf16
17374 Brain half-precision floating-point instructions. This
17375 also enables Advanced SIMD and floating-point instructions.
17376
17377 armv7-r
17378 +fp.sp
17379 The single-precision VFPv3 floating-point instructions.
17380 The extension +vfpv3xd can be used as an alias for this
17381 extension.
17382
17383 +fp The VFPv3 floating-point instructions with 16 double-
17384 precision registers. The extension +vfpv3-d16 can be used
17385 as an alias for this extension.
17386
17387 +vfpv3xd-d16-fp16
17388 The single-precision VFPv3 floating-point instructions with
17389 16 double-precision registers and the half-precision
17390 floating-point conversion operations.
17391
17392 +vfpv3-d16-fp16
17393 The VFPv3 floating-point instructions with 16 double-
17394 precision registers and the half-precision floating-point
17395 conversion operations.
17396
17397 +nofp
17398 Disable the floating-point extension.
17399
17400 +idiv
17401 The ARM-state integer division instructions.
17402
17403 +noidiv
17404 Disable the ARM-state integer division extension.
17405
17406 armv7e-m
17407 +fp The single-precision VFPv4 floating-point instructions.
17408
17409 +fpv5
17410 The single-precision FPv5 floating-point instructions.
17411
17412 +fp.dp
17413 The single- and double-precision FPv5 floating-point
17414 instructions.
17415
17416 +nofp
17417 Disable the floating-point extensions.
17418
17419 armv8.1-m.main
17420 +dsp
17421 The DSP instructions.
17422
17423 +mve
17424 The M-Profile Vector Extension (MVE) integer instructions.
17425
17426 +mve.fp
17427 The M-Profile Vector Extension (MVE) integer and single
17428 precision floating-point instructions.
17429
17430 +fp The single-precision floating-point instructions.
17431
17432 +fp.dp
17433 The single- and double-precision floating-point
17434 instructions.
17435
17436 +nofp
17437 Disable the floating-point extension.
17438
17439 +cdecp0, +cdecp1, ... , +cdecp7
17440 Enable the Custom Datapath Extension (CDE) on selected
17441 coprocessors according to the numbers given in the options
17442 in the range 0 to 7.
17443
17444 armv8-m.main
17445 +dsp
17446 The DSP instructions.
17447
17448 +nodsp
17449 Disable the DSP extension.
17450
17451 +fp The single-precision floating-point instructions.
17452
17453 +fp.dp
17454 The single- and double-precision floating-point
17455 instructions.
17456
17457 +nofp
17458 Disable the floating-point extension.
17459
17460 +cdecp0, +cdecp1, ... , +cdecp7
17461 Enable the Custom Datapath Extension (CDE) on selected
17462 coprocessors according to the numbers given in the options
17463 in the range 0 to 7.
17464
17465 armv8-r
17466 +crc
17467 The Cyclic Redundancy Check (CRC) instructions.
17468
17469 +fp.sp
17470 The single-precision FPv5 floating-point instructions.
17471
17472 +simd
17473 The ARMv8-A Advanced SIMD and floating-point instructions.
17474
17475 +crypto
17476 The cryptographic instructions.
17477
17478 +nocrypto
17479 Disable the cryptographic instructions.
17480
17481 +nofp
17482 Disable the floating-point, Advanced SIMD and cryptographic
17483 instructions.
17484
17485 -march=native causes the compiler to auto-detect the architecture
17486 of the build computer. At present, this feature is only supported
17487 on GNU/Linux, and not all architectures are recognized. If the
17488 auto-detect is unsuccessful the option has no effect.
17489
17490 -mtune=name
17491 This option specifies the name of the target ARM processor for
17492 which GCC should tune the performance of the code. For some ARM
17493 implementations better performance can be obtained by using this
17494 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
17495 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
17496 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
17497 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
17498 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
17499 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
17500 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
17501 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
17502 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
17503 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
17504 cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78,
17505 cortex-a78ae, cortex-a78c, ares, cortex-r4, cortex-r4f, cortex-r5,
17506 cortex-r7, cortex-r8, cortex-r52, cortex-m0, cortex-m0plus,
17507 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
17508 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
17509 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
17510 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
17511 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
17512 xgene1.
17513
17514 Additionally, this option can specify that GCC should tune the
17515 performance of the code for a big.LITTLE system. Permissible names
17516 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17517 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17518 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
17519 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
17520
17521 -mtune=generic-arch specifies that GCC should tune the performance
17522 for a blend of processors within architecture arch. The aim is to
17523 generate code that run well on the current most popular processors,
17524 balancing between optimizations that benefit some CPUs in the
17525 range, and avoiding performance pitfalls of other CPUs. The
17526 effects of this option may change in future GCC versions as CPU
17527 models come and go.
17528
17529 -mtune permits the same extension options as -mcpu, but the
17530 extension options do not affect the tuning of the generated code.
17531
17532 -mtune=native causes the compiler to auto-detect the CPU of the
17533 build computer. At present, this feature is only supported on
17534 GNU/Linux, and not all architectures are recognized. If the auto-
17535 detect is unsuccessful the option has no effect.
17536
17537 -mcpu=name[+extension...]
17538 This specifies the name of the target ARM processor. GCC uses this
17539 name to derive the name of the target ARM architecture (as if
17540 specified by -march) and the ARM processor type for which to tune
17541 for performance (as if specified by -mtune). Where this option is
17542 used in conjunction with -march or -mtune, those options take
17543 precedence over the appropriate part of this option.
17544
17545 Many of the supported CPUs implement optional architectural
17546 extensions. Where this is so the architectural extensions are
17547 normally enabled by default. If implementations that lack the
17548 extension exist, then the extension syntax can be used to disable
17549 those extensions that have been omitted. For floating-point and
17550 Advanced SIMD (Neon) instructions, the settings of the options
17551 -mfloat-abi and -mfpu must also be considered: floating-point and
17552 Advanced SIMD instructions will only be used if -mfloat-abi is not
17553 set to soft; and any setting of -mfpu other than auto will override
17554 the available floating-point and SIMD extension instructions.
17555
17556 For example, cortex-a9 can be found in three major configurations:
17557 integer only, with just a floating-point unit or with floating-
17558 point and Advanced SIMD. The default is to enable all the
17559 instructions, but the extensions +nosimd and +nofp can be used to
17560 disable just the SIMD or both the SIMD and floating-point
17561 instructions respectively.
17562
17563 Permissible names for this option are the same as those for -mtune.
17564
17565 The following extension options are common to the listed CPUs:
17566
17567 +nodsp
17568 Disable the DSP instructions on cortex-m33, cortex-m35p.
17569
17570 +nofp
17571 Disables the floating-point instructions on arm9e, arm946e-s,
17572 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
17573 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
17574 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
17575 point and SIMD instructions on generic-armv7-a, cortex-a5,
17576 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
17577 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17578 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
17579
17580 +nofp.dp
17581 Disables the double-precision component of the floating-point
17582 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
17583 cortex-m7.
17584
17585 +nosimd
17586 Disables the SIMD (but not floating-point) instructions on
17587 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
17588
17589 +crypto
17590 Enables the cryptographic instructions on cortex-a32,
17591 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
17592 cortex-a73, cortex-a75, exynos-m1, xgene1,
17593 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17594 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
17595 cortex-a75.cortex-a55.
17596
17597 Additionally the generic-armv7-a pseudo target defaults to VFPv3
17598 with 16 double-precision registers. It supports the following
17599 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
17600 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
17601 neon-vfpv4. The meanings are the same as for the extensions to
17602 -march=armv7-a.
17603
17604 -mcpu=generic-arch is also permissible, and is equivalent to
17605 -march=arch -mtune=generic-arch. See -mtune for more information.
17606
17607 -mcpu=native causes the compiler to auto-detect the CPU of the
17608 build computer. At present, this feature is only supported on
17609 GNU/Linux, and not all architectures are recognized. If the auto-
17610 detect is unsuccessful the option has no effect.
17611
17612 -mfpu=name
17613 This specifies what floating-point hardware (or hardware emulation)
17614 is available on the target. Permissible names are: auto, vfpv2,
17615 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
17616 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
17617 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
17618 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
17619 and vfp is an alias for vfpv2.
17620
17621 The setting auto is the default and is special. It causes the
17622 compiler to select the floating-point and Advanced SIMD
17623 instructions based on the settings of -mcpu and -march.
17624
17625 If the selected floating-point hardware includes the NEON extension
17626 (e.g. -mfpu=neon), note that floating-point operations are not
17627 generated by GCC's auto-vectorization pass unless
17628 -funsafe-math-optimizations is also specified. This is because
17629 NEON hardware does not fully implement the IEEE 754 standard for
17630 floating-point arithmetic (in particular denormal values are
17631 treated as zero), so the use of NEON instructions may lead to a
17632 loss of precision.
17633
17634 You can also set the fpu name at function level by using the
17635 "target("fpu=")" function attributes or pragmas.
17636
17637 -mfp16-format=name
17638 Specify the format of the "__fp16" half-precision floating-point
17639 type. Permissible names are none, ieee, and alternative; the
17640 default is none, in which case the "__fp16" type is not defined.
17641
17642 -mstructure-size-boundary=n
17643 The sizes of all structures and unions are rounded up to a multiple
17644 of the number of bits set by this option. Permissible values are
17645 8, 32 and 64. The default value varies for different toolchains.
17646 For the COFF targeted toolchain the default value is 8. A value of
17647 64 is only allowed if the underlying ABI supports it.
17648
17649 Specifying a larger number can produce faster, more efficient code,
17650 but can also increase the size of the program. Different values
17651 are potentially incompatible. Code compiled with one value cannot
17652 necessarily expect to work with code or libraries compiled with
17653 another value, if they exchange information using structures or
17654 unions.
17655
17656 This option is deprecated.
17657
17658 -mabort-on-noreturn
17659 Generate a call to the function "abort" at the end of a "noreturn"
17660 function. It is executed if the function tries to return.
17661
17662 -mlong-calls
17663 -mno-long-calls
17664 Tells the compiler to perform function calls by first loading the
17665 address of the function into a register and then performing a
17666 subroutine call on this register. This switch is needed if the
17667 target function lies outside of the 64-megabyte addressing range of
17668 the offset-based version of subroutine call instruction.
17669
17670 Even if this switch is enabled, not all function calls are turned
17671 into long calls. The heuristic is that static functions, functions
17672 that have the "short_call" attribute, functions that are inside the
17673 scope of a "#pragma no_long_calls" directive, and functions whose
17674 definitions have already been compiled within the current
17675 compilation unit are not turned into long calls. The exceptions to
17676 this rule are that weak function definitions, functions with the
17677 "long_call" attribute or the "section" attribute, and functions
17678 that are within the scope of a "#pragma long_calls" directive are
17679 always turned into long calls.
17680
17681 This feature is not enabled by default. Specifying -mno-long-calls
17682 restores the default behavior, as does placing the function calls
17683 within the scope of a "#pragma long_calls_off" directive. Note
17684 these switches have no effect on how the compiler generates code to
17685 handle function calls via function pointers.
17686
17687 -msingle-pic-base
17688 Treat the register used for PIC addressing as read-only, rather
17689 than loading it in the prologue for each function. The runtime
17690 system is responsible for initializing this register with an
17691 appropriate value before execution begins.
17692
17693 -mpic-register=reg
17694 Specify the register to be used for PIC addressing. For standard
17695 PIC base case, the default is any suitable register determined by
17696 compiler. For single PIC base case, the default is R9 if target is
17697 EABI based or stack-checking is enabled, otherwise the default is
17698 R10.
17699
17700 -mpic-data-is-text-relative
17701 Assume that the displacement between the text and data segments is
17702 fixed at static link time. This permits using PC-relative
17703 addressing operations to access data known to be in the data
17704 segment. For non-VxWorks RTP targets, this option is enabled by
17705 default. When disabled on such targets, it will enable
17706 -msingle-pic-base by default.
17707
17708 -mpoke-function-name
17709 Write the name of each function into the text section, directly
17710 preceding the function prologue. The generated code is similar to
17711 this:
17712
17713 t0
17714 .ascii "arm_poke_function_name", 0
17715 .align
17716 t1
17717 .word 0xff000000 + (t1 - t0)
17718 arm_poke_function_name
17719 mov ip, sp
17720 stmfd sp!, {fp, ip, lr, pc}
17721 sub fp, ip, #4
17722
17723 When performing a stack backtrace, code can inspect the value of
17724 "pc" stored at "fp + 0". If the trace function then looks at
17725 location "pc - 12" and the top 8 bits are set, then we know that
17726 there is a function name embedded immediately preceding this
17727 location and has length "((pc[-3]) & 0xff000000)".
17728
17729 -mthumb
17730 -marm
17731 Select between generating code that executes in ARM and Thumb
17732 states. The default for most configurations is to generate code
17733 that executes in ARM state, but the default can be changed by
17734 configuring GCC with the --with-mode=state configure option.
17735
17736 You can also override the ARM and Thumb mode for each function by
17737 using the "target("thumb")" and "target("arm")" function attributes
17738 or pragmas.
17739
17740 -mflip-thumb
17741 Switch ARM/Thumb modes on alternating functions. This option is
17742 provided for regression testing of mixed Thumb/ARM code generation,
17743 and is not intended for ordinary use in compiling code.
17744
17745 -mtpcs-frame
17746 Generate a stack frame that is compliant with the Thumb Procedure
17747 Call Standard for all non-leaf functions. (A leaf function is one
17748 that does not call any other functions.) The default is
17749 -mno-tpcs-frame.
17750
17751 -mtpcs-leaf-frame
17752 Generate a stack frame that is compliant with the Thumb Procedure
17753 Call Standard for all leaf functions. (A leaf function is one that
17754 does not call any other functions.) The default is
17755 -mno-apcs-leaf-frame.
17756
17757 -mcallee-super-interworking
17758 Gives all externally visible functions in the file being compiled
17759 an ARM instruction set header which switches to Thumb mode before
17760 executing the rest of the function. This allows these functions to
17761 be called from non-interworking code. This option is not valid in
17762 AAPCS configurations because interworking is enabled by default.
17763
17764 -mcaller-super-interworking
17765 Allows calls via function pointers (including virtual functions) to
17766 execute correctly regardless of whether the target code has been
17767 compiled for interworking or not. There is a small overhead in the
17768 cost of executing a function pointer if this option is enabled.
17769 This option is not valid in AAPCS configurations because
17770 interworking is enabled by default.
17771
17772 -mtp=name
17773 Specify the access model for the thread local storage pointer. The
17774 valid models are soft, which generates calls to "__aeabi_read_tp",
17775 cp15, which fetches the thread pointer from "cp15" directly
17776 (supported in the arm6k architecture), and auto, which uses the
17777 best available method for the selected processor. The default
17778 setting is auto.
17779
17780 -mtls-dialect=dialect
17781 Specify the dialect to use for accessing thread local storage. Two
17782 dialects are supported---gnu and gnu2. The gnu dialect selects the
17783 original GNU scheme for supporting local and global dynamic TLS
17784 models. The gnu2 dialect selects the GNU descriptor scheme, which
17785 provides better performance for shared libraries. The GNU
17786 descriptor scheme is compatible with the original scheme, but does
17787 require new assembler, linker and library support. Initial and
17788 local exec TLS models are unaffected by this option and always use
17789 the original scheme.
17790
17791 -mword-relocations
17792 Only generate absolute relocations on word-sized values (i.e.
17793 R_ARM_ABS32). This is enabled by default on targets (uClinux,
17794 SymbianOS) where the runtime loader imposes this restriction, and
17795 when -fpic or -fPIC is specified. This option conflicts with
17796 -mslow-flash-data.
17797
17798 -mfix-cortex-m3-ldrd
17799 Some Cortex-M3 cores can cause data corruption when "ldrd"
17800 instructions with overlapping destination and base registers are
17801 used. This option avoids generating these instructions. This
17802 option is enabled by default when -mcpu=cortex-m3 is specified.
17803
17804 -munaligned-access
17805 -mno-unaligned-access
17806 Enables (or disables) reading and writing of 16- and 32- bit values
17807 from addresses that are not 16- or 32- bit aligned. By default
17808 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17809 ARMv8-M Baseline architectures, and enabled for all other
17810 architectures. If unaligned access is not enabled then words in
17811 packed data structures are accessed a byte at a time.
17812
17813 The ARM attribute "Tag_CPU_unaligned_access" is set in the
17814 generated object file to either true or false, depending upon the
17815 setting of this option. If unaligned access is enabled then the
17816 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
17817
17818 -mneon-for-64bits
17819 This option is deprecated and has no effect.
17820
17821 -mslow-flash-data
17822 Assume loading data from flash is slower than fetching instruction.
17823 Therefore literal load is minimized for better performance. This
17824 option is only supported when compiling for ARMv7 M-profile and off
17825 by default. It conflicts with -mword-relocations.
17826
17827 -masm-syntax-unified
17828 Assume inline assembler is using unified asm syntax. The default
17829 is currently off which implies divided syntax. This option has no
17830 impact on Thumb2. However, this may change in future releases of
17831 GCC. Divided syntax should be considered deprecated.
17832
17833 -mrestrict-it
17834 Restricts generation of IT blocks to conform to the rules of
17835 ARMv8-A. IT blocks can only contain a single 16-bit instruction
17836 from a select set of instructions. This option is on by default for
17837 ARMv8-A Thumb mode.
17838
17839 -mprint-tune-info
17840 Print CPU tuning information as comment in assembler file. This is
17841 an option used only for regression testing of the compiler and not
17842 intended for ordinary use in compiling code. This option is
17843 disabled by default.
17844
17845 -mverbose-cost-dump
17846 Enable verbose cost model dumping in the debug dump files. This
17847 option is provided for use in debugging the compiler.
17848
17849 -mpure-code
17850 Do not allow constant data to be placed in code sections.
17851 Additionally, when compiling for ELF object format give all text
17852 sections the ELF processor-specific section attribute
17853 "SHF_ARM_PURECODE". This option is only available when generating
17854 non-pic code for M-profile targets.
17855
17856 -mcmse
17857 Generate secure code as per the "ARMv8-M Security Extensions:
17858 Requirements on Development Tools Engineering Specification", which
17859 can be found on
17860 <https://developer.arm.com/documentation/ecm0359818/latest/>.
17861
17862 -mfix-cmse-cve-2021-35465
17863 Mitigate against a potential security issue with the "VLLDM"
17864 instruction in some M-profile devices when using CMSE
17865 (CVE-2021-365465). This option is enabled by default when the
17866 option -mcpu= is used with "cortex-m33", "cortex-m35p" or
17867 "cortex-m55". The option -mno-fix-cmse-cve-2021-35465 can be used
17868 to disable the mitigation.
17869
17870 -mfdpic
17871 -mno-fdpic
17872 Select the FDPIC ABI, which uses 64-bit function descriptors to
17873 represent pointers to functions. When the compiler is configured
17874 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
17875 and implies -fPIE if none of the PIC/PIE-related options is
17876 provided. On other targets, it only enables the FDPIC-specific
17877 code generation features, and the user should explicitly provide
17878 the PIC/PIE-related options as needed.
17879
17880 Note that static linking is not supported because it would still
17881 involve the dynamic linker when the program self-relocates. If
17882 such behavior is acceptable, use -static and -Wl,-dynamic-linker
17883 options.
17884
17885 The opposite -mno-fdpic option is useful (and required) to build
17886 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
17887 toolchain as the one used to build the userland programs.
17888
17889 AVR Options
17890
17891 These options are defined for AVR implementations:
17892
17893 -mmcu=mcu
17894 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17895
17896 The default for this option is avr2.
17897
17898 GCC supports the following AVR devices and ISAs:
17899
17900 "avr2"
17901 "Classic" devices with up to 8 KiB of program memory. mcu =
17902 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
17903 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
17904 "at90c8534", "at90s8515", "at90s8535".
17905
17906 "avr25"
17907 "Classic" devices with up to 8 KiB of program memory and with
17908 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
17909 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
17910 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
17911 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
17912 "attiny461a", "attiny4313", "attiny84", "attiny84a",
17913 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
17914 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
17915
17916 "avr3"
17917 "Classic" devices with 16 KiB up to 64 KiB of program memory.
17918 mcu = "at76c711", "at43usb355".
17919
17920 "avr31"
17921 "Classic" devices with 128 KiB of program memory. mcu =
17922 "atmega103", "at43usb320".
17923
17924 "avr35"
17925 "Classic" devices with 16 KiB up to 64 KiB of program memory
17926 and with the "MOVW" instruction. mcu = "attiny167",
17927 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
17928 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
17929
17930 "avr4"
17931 "Enhanced" devices with up to 8 KiB of program memory. mcu =
17932 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
17933 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
17934 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
17935 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
17936 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
17937 "at90pwm3b", "at90pwm81".
17938
17939 "avr5"
17940 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
17941 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
17942 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
17943 "atmega161", "atmega162", "atmega163", "atmega164a",
17944 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
17945 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
17946 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
17947 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
17948 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
17949 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
17950 "atmega324a", "atmega324p", "atmega324pa", "atmega325",
17951 "atmega325a", "atmega325p", "atmega325pa", "atmega328",
17952 "atmega328p", "atmega328pb", "atmega329", "atmega329a",
17953 "atmega329p", "atmega329pa", "atmega3250", "atmega3250a",
17954 "atmega3250p", "atmega3250pa", "atmega3290", "atmega3290a",
17955 "atmega3290p", "atmega3290pa", "atmega406", "atmega64",
17956 "atmega64a", "atmega64c1", "atmega64hve", "atmega64hve2",
17957 "atmega64m1", "atmega64rfr2", "atmega640", "atmega644",
17958 "atmega644a", "atmega644p", "atmega644pa", "atmega644rfr2",
17959 "atmega645", "atmega645a", "atmega645p", "atmega649",
17960 "atmega649a", "atmega649p", "atmega6450", "atmega6450a",
17961 "atmega6450p", "atmega6490", "atmega6490a", "atmega6490p",
17962 "ata5795", "ata5790", "ata5790n", "ata5791", "ata6613c",
17963 "ata6614q", "ata5782", "ata5831", "ata8210", "ata8510",
17964 "ata5702m322", "at90pwm161", "at90pwm216", "at90pwm316",
17965 "at90can32", "at90can64", "at90scr100", "at90usb646",
17966 "at90usb647", "at94k", "m3000".
17967
17968 "avr51"
17969 "Enhanced" devices with 128 KiB of program memory. mcu =
17970 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
17971 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
17972 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
17973
17974 "avr6"
17975 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
17976 of program memory. mcu = "atmega256rfr2", "atmega2560",
17977 "atmega2561", "atmega2564rfr2".
17978
17979 "avrxmega2"
17980 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
17981 program memory. mcu = "atxmega8e5", "atxmega16a4",
17982 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
17983 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
17984 "atxmega32d3", "atxmega32d4", "atxmega32e5".
17985
17986 "avrxmega3"
17987 "XMEGA" devices with up to 64 KiB of combined program memory
17988 and RAM, and with program memory visible in the RAM address
17989 space. mcu = "attiny202", "attiny204", "attiny212",
17990 "attiny214", "attiny402", "attiny404", "attiny406",
17991 "attiny412", "attiny414", "attiny416", "attiny417",
17992 "attiny804", "attiny806", "attiny807", "attiny814",
17993 "attiny816", "attiny817", "attiny1604", "attiny1606",
17994 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
17995 "attiny3214", "attiny3216", "attiny3217", "atmega808",
17996 "atmega809", "atmega1608", "atmega1609", "atmega3208",
17997 "atmega3209", "atmega4808", "atmega4809".
17998
17999 "avrxmega4"
18000 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18001 program memory. mcu = "atxmega64a3", "atxmega64a3u",
18002 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
18003 "atxmega64d3", "atxmega64d4".
18004
18005 "avrxmega5"
18006 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18007 program memory and more than 64 KiB of RAM. mcu =
18008 "atxmega64a1", "atxmega64a1u".
18009
18010 "avrxmega6"
18011 "XMEGA" devices with more than 128 KiB of program memory. mcu
18012 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
18013 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
18014 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
18015 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
18016 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
18017 "atxmega256d3", "atxmega384c3", "atxmega384d3".
18018
18019 "avrxmega7"
18020 "XMEGA" devices with more than 128 KiB of program memory and
18021 more than 64 KiB of RAM. mcu = "atxmega128a1",
18022 "atxmega128a1u", "atxmega128a4u".
18023
18024 "avrtiny"
18025 "TINY" Tiny core devices with 512 B up to 4 KiB of program
18026 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
18027 "attiny20", "attiny40".
18028
18029 "avr1"
18030 This ISA is implemented by the minimal AVR core and supported
18031 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
18032 "attiny28", "at90s1200".
18033
18034 -mabsdata
18035 Assume that all data in static storage can be accessed by LDS / STS
18036 instructions. This option has only an effect on reduced Tiny
18037 devices like ATtiny40. See also the "absdata" AVR Variable
18038 Attributes,variable attribute.
18039
18040 -maccumulate-args
18041 Accumulate outgoing function arguments and acquire/release the
18042 needed stack space for outgoing function arguments once in function
18043 prologue/epilogue. Without this option, outgoing arguments are
18044 pushed before calling a function and popped afterwards.
18045
18046 Popping the arguments after the function call can be expensive on
18047 AVR so that accumulating the stack space might lead to smaller
18048 executables because arguments need not be removed from the stack
18049 after such a function call.
18050
18051 This option can lead to reduced code size for functions that
18052 perform several calls to functions that get their arguments on the
18053 stack like calls to printf-like functions.
18054
18055 -mbranch-cost=cost
18056 Set the branch costs for conditional branch instructions to cost.
18057 Reasonable values for cost are small, non-negative integers. The
18058 default branch cost is 0.
18059
18060 -mcall-prologues
18061 Functions prologues/epilogues are expanded as calls to appropriate
18062 subroutines. Code size is smaller.
18063
18064 -mdouble=bits
18065 -mlong-double=bits
18066 Set the size (in bits) of the "double" or "long double" type,
18067 respectively. Possible values for bits are 32 and 64. Whether or
18068 not a specific value for bits is allowed depends on the
18069 "--with-double=" and "--with-long-double=" configure options
18070 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18071 applies for the default values of the options.
18072
18073 -mgas-isr-prologues
18074 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18075 instruction supported by GNU Binutils. If this option is on, the
18076 feature can still be disabled for individual ISRs by means of the
18077 AVR Function Attributes,,"no_gccisr" function attribute. This
18078 feature is activated per default if optimization is on (but not
18079 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18080 PR21683 ("https://sourceware.org/PR21683").
18081
18082 -mint8
18083 Assume "int" to be 8-bit integer. This affects the sizes of all
18084 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18085 and "long long" is 4 bytes. Please note that this option does not
18086 conform to the C standards, but it results in smaller code size.
18087
18088 -mmain-is-OS_task
18089 Do not save registers in "main". The effect is the same like
18090 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18091 It is activated per default if optimization is on.
18092
18093 -mn-flash=num
18094 Assume that the flash memory has a size of num times 64 KiB.
18095
18096 -mno-interrupts
18097 Generated code is not compatible with hardware interrupts. Code
18098 size is smaller.
18099
18100 -mrelax
18101 Try to replace "CALL" resp. "JMP" instruction by the shorter
18102 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18103 just adds the --mlink-relax option to the assembler's command line
18104 and the --relax option to the linker's command line.
18105
18106 Jump relaxing is performed by the linker because jump offsets are
18107 not known before code is located. Therefore, the assembler code
18108 generated by the compiler is the same, but the instructions in the
18109 executable may differ from instructions in the assembler code.
18110
18111 Relaxing must be turned on if linker stubs are needed, see the
18112 section on "EIND" and linker stubs below.
18113
18114 -mrmw
18115 Assume that the device supports the Read-Modify-Write instructions
18116 "XCH", "LAC", "LAS" and "LAT".
18117
18118 -mshort-calls
18119 Assume that "RJMP" and "RCALL" can target the whole program memory.
18120
18121 This option is used internally for multilib selection. It is not
18122 an optimization option, and you don't need to set it by hand.
18123
18124 -msp8
18125 Treat the stack pointer register as an 8-bit register, i.e. assume
18126 the high byte of the stack pointer is zero. In general, you don't
18127 need to set this option by hand.
18128
18129 This option is used internally by the compiler to select and build
18130 multilibs for architectures "avr2" and "avr25". These
18131 architectures mix devices with and without "SPH". For any setting
18132 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
18133 removes this option from the compiler proper's command line,
18134 because the compiler then knows if the device or architecture has
18135 an 8-bit stack pointer and thus no "SPH" register or not.
18136
18137 -mstrict-X
18138 Use address register "X" in a way proposed by the hardware. This
18139 means that "X" is only used in indirect, post-increment or pre-
18140 decrement addressing.
18141
18142 Without this option, the "X" register may be used in the same way
18143 as "Y" or "Z" which then is emulated by additional instructions.
18144 For example, loading a value with "X+const" addressing with a small
18145 non-negative "const < 64" to a register Rn is performed as
18146
18147 adiw r26, const ; X += const
18148 ld <Rn>, X ; <Rn> = *X
18149 sbiw r26, const ; X -= const
18150
18151 -mtiny-stack
18152 Only change the lower 8 bits of the stack pointer.
18153
18154 -mfract-convert-truncate
18155 Allow to use truncation instead of rounding towards zero for
18156 fractional fixed-point types.
18157
18158 -nodevicelib
18159 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
18160
18161 -nodevicespecs
18162 Don't add -specs=device-specs/specs-mcu to the compiler driver's
18163 command line. The user takes responsibility for supplying the sub-
18164 processes like compiler proper, assembler and linker with
18165 appropriate command line options. This means that the user has to
18166 supply her private device specs file by means of -specs=path-to-
18167 specs-file. There is no more need for option -mmcu=mcu.
18168
18169 This option can also serve as a replacement for the older way of
18170 specifying custom device-specs files that needed -B some-path to
18171 point to a directory which contains a folder named "device-specs"
18172 which contains a specs file named "specs-mcu", where mcu was
18173 specified by -mmcu=mcu.
18174
18175 -Waddr-space-convert
18176 Warn about conversions between address spaces in the case where the
18177 resulting address space is not contained in the incoming address
18178 space.
18179
18180 -Wmisspelled-isr
18181 Warn if the ISR is misspelled, i.e. without __vector prefix.
18182 Enabled by default.
18183
18184 "EIND" and Devices with More Than 128 Ki Bytes of Flash
18185
18186 Pointers in the implementation are 16 bits wide. The address of a
18187 function or label is represented as word address so that indirect jumps
18188 and calls can target any code address in the range of 64 Ki words.
18189
18190 In order to facilitate indirect jump on devices with more than 128 Ki
18191 bytes of program memory space, there is a special function register
18192 called "EIND" that serves as most significant part of the target
18193 address when "EICALL" or "EIJMP" instructions are used.
18194
18195 Indirect jumps and calls on these devices are handled as follows by the
18196 compiler and are subject to some limitations:
18197
18198 * The compiler never sets "EIND".
18199
18200 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
18201 instructions or might read "EIND" directly in order to emulate an
18202 indirect call/jump by means of a "RET" instruction.
18203
18204 * The compiler assumes that "EIND" never changes during the startup
18205 code or during the application. In particular, "EIND" is not
18206 saved/restored in function or interrupt service routine
18207 prologue/epilogue.
18208
18209 * For indirect calls to functions and computed goto, the linker
18210 generates stubs. Stubs are jump pads sometimes also called
18211 trampolines. Thus, the indirect call/jump jumps to such a stub.
18212 The stub contains a direct jump to the desired address.
18213
18214 * Linker relaxation must be turned on so that the linker generates
18215 the stubs correctly in all situations. See the compiler option
18216 -mrelax and the linker option --relax. There are corner cases
18217 where the linker is supposed to generate stubs but aborts without
18218 relaxation and without a helpful error message.
18219
18220 * The default linker script is arranged for code with "EIND = 0". If
18221 code is supposed to work for a setup with "EIND != 0", a custom
18222 linker script has to be used in order to place the sections whose
18223 name start with ".trampolines" into the segment where "EIND" points
18224 to.
18225
18226 * The startup code from libgcc never sets "EIND". Notice that
18227 startup code is a blend of code from libgcc and AVR-LibC. For the
18228 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
18229 ("http://nongnu.org/avr-libc/user-manual/").
18230
18231 * It is legitimate for user-specific startup code to set up "EIND"
18232 early, for example by means of initialization code located in
18233 section ".init3". Such code runs prior to general startup code that
18234 initializes RAM and calls constructors, but after the bit of
18235 startup code from AVR-LibC that sets "EIND" to the segment where
18236 the vector table is located.
18237
18238 #include <avr/io.h>
18239
18240 static void
18241 __attribute__((section(".init3"),naked,used,no_instrument_function))
18242 init3_set_eind (void)
18243 {
18244 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18245 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18246 }
18247
18248 The "__trampolines_start" symbol is defined in the linker script.
18249
18250 * Stubs are generated automatically by the linker if the following
18251 two conditions are met:
18252
18253 -<The address of a label is taken by means of the "gs" modifier>
18254 (short for generate stubs) like so:
18255
18256 LDI r24, lo8(gs(<func>))
18257 LDI r25, hi8(gs(<func>))
18258
18259 -<The final location of that label is in a code segment>
18260 outside the segment where the stubs are located.
18261
18262 * The compiler emits such "gs" modifiers for code labels in the
18263 following situations:
18264
18265 -<Taking address of a function or code label.>
18266 -<Computed goto.>
18267 -<If prologue-save function is used, see -mcall-prologues>
18268 command-line option.
18269
18270 -<Switch/case dispatch tables. If you do not want such dispatch>
18271 tables you can specify the -fno-jump-tables command-line
18272 option.
18273
18274 -<C and C++ constructors/destructors called during
18275 startup/shutdown.>
18276 -<If the tools hit a "gs()" modifier explained above.>
18277 * Jumping to non-symbolic addresses like so is not supported:
18278
18279 int main (void)
18280 {
18281 /* Call function at word address 0x2 */
18282 return ((int(*)(void)) 0x2)();
18283 }
18284
18285 Instead, a stub has to be set up, i.e. the function has to be
18286 called through a symbol ("func_4" in the example):
18287
18288 int main (void)
18289 {
18290 extern int func_4 (void);
18291
18292 /* Call function at byte address 0x4 */
18293 return func_4();
18294 }
18295
18296 and the application be linked with -Wl,--defsym,func_4=0x4.
18297 Alternatively, "func_4" can be defined in the linker script.
18298
18299 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
18300 Registers
18301
18302 Some AVR devices support memories larger than the 64 KiB range that can
18303 be accessed with 16-bit pointers. To access memory locations outside
18304 this 64 KiB range, the content of a "RAMP" register is used as high
18305 part of the address: The "X", "Y", "Z" address register is concatenated
18306 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
18307 respectively, to get a wide address. Similarly, "RAMPD" is used
18308 together with direct addressing.
18309
18310 * The startup code initializes the "RAMP" special function registers
18311 with zero.
18312
18313 * If a AVR Named Address Spaces,named address space other than
18314 generic or "__flash" is used, then "RAMPZ" is set as needed before
18315 the operation.
18316
18317 * If the device supports RAM larger than 64 KiB and the compiler
18318 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
18319 reset to zero after the operation.
18320
18321 * If the device comes with a specific "RAMP" register, the ISR
18322 prologue/epilogue saves/restores that SFR and initializes it with
18323 zero in case the ISR code might (implicitly) use it.
18324
18325 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
18326 you use inline assembler to read from locations outside the 16-bit
18327 address range and change one of the "RAMP" registers, you must
18328 reset it to zero after the access.
18329
18330 AVR Built-in Macros
18331
18332 GCC defines several built-in macros so that the user code can test for
18333 the presence or absence of features. Almost any of the following
18334 built-in macros are deduced from device capabilities and thus triggered
18335 by the -mmcu= command-line option.
18336
18337 For even more AVR-specific built-in macros see AVR Named Address Spaces
18338 and AVR Built-in Functions.
18339
18340 "__AVR_ARCH__"
18341 Build-in macro that resolves to a decimal number that identifies
18342 the architecture and depends on the -mmcu=mcu option. Possible
18343 values are:
18344
18345 2, 25, 3, 31, 35, 4, 5, 51, 6
18346
18347 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
18348 "avr51", "avr6",
18349
18350 respectively and
18351
18352 100, 102, 103, 104, 105, 106, 107
18353
18354 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
18355 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
18356 specifies a device, this built-in macro is set accordingly. For
18357 example, with -mmcu=atmega8 the macro is defined to 4.
18358
18359 "__AVR_Device__"
18360 Setting -mmcu=device defines this built-in macro which reflects the
18361 device's name. For example, -mmcu=atmega8 defines the built-in
18362 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
18363 "__AVR_ATtiny261A__", etc.
18364
18365 The built-in macros' names follow the scheme "__AVR_Device__" where
18366 Device is the device name as from the AVR user manual. The
18367 difference between Device in the built-in macro and device in
18368 -mmcu=device is that the latter is always lowercase.
18369
18370 If device is not a device but only a core architecture like avr51,
18371 this macro is not defined.
18372
18373 "__AVR_DEVICE_NAME__"
18374 Setting -mmcu=device defines this built-in macro to the device's
18375 name. For example, with -mmcu=atmega8 the macro is defined to
18376 "atmega8".
18377
18378 If device is not a device but only a core architecture like avr51,
18379 this macro is not defined.
18380
18381 "__AVR_XMEGA__"
18382 The device / architecture belongs to the XMEGA family of devices.
18383
18384 "__AVR_HAVE_ELPM__"
18385 The device has the "ELPM" instruction.
18386
18387 "__AVR_HAVE_ELPMX__"
18388 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
18389
18390 "__AVR_HAVE_MOVW__"
18391 The device has the "MOVW" instruction to perform 16-bit register-
18392 register moves.
18393
18394 "__AVR_HAVE_LPMX__"
18395 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
18396
18397 "__AVR_HAVE_MUL__"
18398 The device has a hardware multiplier.
18399
18400 "__AVR_HAVE_JMP_CALL__"
18401 The device has the "JMP" and "CALL" instructions. This is the case
18402 for devices with more than 8 KiB of program memory.
18403
18404 "__AVR_HAVE_EIJMP_EICALL__"
18405 "__AVR_3_BYTE_PC__"
18406 The device has the "EIJMP" and "EICALL" instructions. This is the
18407 case for devices with more than 128 KiB of program memory. This
18408 also means that the program counter (PC) is 3 bytes wide.
18409
18410 "__AVR_2_BYTE_PC__"
18411 The program counter (PC) is 2 bytes wide. This is the case for
18412 devices with up to 128 KiB of program memory.
18413
18414 "__AVR_HAVE_8BIT_SP__"
18415 "__AVR_HAVE_16BIT_SP__"
18416 The stack pointer (SP) register is treated as 8-bit respectively
18417 16-bit register by the compiler. The definition of these macros is
18418 affected by -mtiny-stack.
18419
18420 "__AVR_HAVE_SPH__"
18421 "__AVR_SP8__"
18422 The device has the SPH (high part of stack pointer) special
18423 function register or has an 8-bit stack pointer, respectively. The
18424 definition of these macros is affected by -mmcu= and in the cases
18425 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
18426
18427 "__AVR_HAVE_RAMPD__"
18428 "__AVR_HAVE_RAMPX__"
18429 "__AVR_HAVE_RAMPY__"
18430 "__AVR_HAVE_RAMPZ__"
18431 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
18432 function register, respectively.
18433
18434 "__NO_INTERRUPTS__"
18435 This macro reflects the -mno-interrupts command-line option.
18436
18437 "__AVR_ERRATA_SKIP__"
18438 "__AVR_ERRATA_SKIP_JMP_CALL__"
18439 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18440 instructions because of a hardware erratum. Skip instructions are
18441 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
18442 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
18443
18444 "__AVR_ISA_RMW__"
18445 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
18446 LAT).
18447
18448 "__AVR_SFR_OFFSET__=offset"
18449 Instructions that can address I/O special function registers
18450 directly like "IN", "OUT", "SBI", etc. may use a different address
18451 as if addressed by an instruction to access RAM like "LD" or "STS".
18452 This offset depends on the device architecture and has to be
18453 subtracted from the RAM address in order to get the respective I/O
18454 address.
18455
18456 "__AVR_SHORT_CALLS__"
18457 The -mshort-calls command line option is set.
18458
18459 "__AVR_PM_BASE_ADDRESS__=addr"
18460 Some devices support reading from flash memory by means of "LD*"
18461 instructions. The flash memory is seen in the data address space
18462 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
18463 defined, this feature is not available. If defined, the address
18464 space is linear and there is no need to put ".rodata" into RAM.
18465 This is handled by the default linker description file, and is
18466 currently available for "avrtiny" and "avrxmega3". Even more
18467 convenient, there is no need to use address spaces like "__flash"
18468 or features like attribute "progmem" and "pgm_read_*".
18469
18470 "__WITH_AVRLIBC__"
18471 The compiler is configured to be used together with AVR-Libc. See
18472 the --with-avrlibc configure option.
18473
18474 "__HAVE_DOUBLE_MULTILIB__"
18475 Defined if -mdouble= acts as a multilib option.
18476
18477 "__HAVE_DOUBLE32__"
18478 "__HAVE_DOUBLE64__"
18479 Defined if the compiler supports 32-bit double resp. 64-bit double.
18480 The actual layout is specified by option -mdouble=.
18481
18482 "__DEFAULT_DOUBLE__"
18483 The size in bits of "double" if -mdouble= is not set. To test the
18484 layout of "double" in a program, use the built-in macro
18485 "__SIZEOF_DOUBLE__".
18486
18487 "__HAVE_LONG_DOUBLE32__"
18488 "__HAVE_LONG_DOUBLE64__"
18489 "__HAVE_LONG_DOUBLE_MULTILIB__"
18490 "__DEFAULT_LONG_DOUBLE__"
18491 Same as above, but for "long double" instead of "double".
18492
18493 "__WITH_DOUBLE_COMPARISON__"
18494 Reflects the "--with-double-comparison={tristate|bool|libf7}"
18495 configure option ("https://gcc.gnu.org/install/configure.html#avr")
18496 and is defined to 2 or 3.
18497
18498 "__WITH_LIBF7_LIBGCC__"
18499 "__WITH_LIBF7_MATH__"
18500 "__WITH_LIBF7_MATH_SYMBOLS__"
18501 Reflects the "--with-libf7={libgcc|math|math-symbols}"
18502 configure option
18503 ("https://gcc.gnu.org/install/configure.html#avr").
18504
18505 Blackfin Options
18506
18507 -mcpu=cpu[-sirevision]
18508 Specifies the name of the target Blackfin processor. Currently,
18509 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
18510 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
18511 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
18512 bf547m, bf548m, bf549m, bf561, bf592.
18513
18514 The optional sirevision specifies the silicon revision of the
18515 target Blackfin processor. Any workarounds available for the
18516 targeted silicon revision are enabled. If sirevision is none, no
18517 workarounds are enabled. If sirevision is any, all workarounds for
18518 the targeted processor are enabled. The "__SILICON_REVISION__"
18519 macro is defined to two hexadecimal digits representing the major
18520 and minor numbers in the silicon revision. If sirevision is none,
18521 the "__SILICON_REVISION__" is not defined. If sirevision is any,
18522 the "__SILICON_REVISION__" is defined to be 0xffff. If this
18523 optional sirevision is not used, GCC assumes the latest known
18524 silicon revision of the targeted Blackfin processor.
18525
18526 GCC defines a preprocessor macro for the specified cpu. For the
18527 bfin-elf toolchain, this option causes the hardware BSP provided by
18528 libgloss to be linked in if -msim is not given.
18529
18530 Without this option, bf532 is used as the processor by default.
18531
18532 Note that support for bf561 is incomplete. For bf561, only the
18533 preprocessor macro is defined.
18534
18535 -msim
18536 Specifies that the program will be run on the simulator. This
18537 causes the simulator BSP provided by libgloss to be linked in.
18538 This option has effect only for bfin-elf toolchain. Certain other
18539 options, such as -mid-shared-library and -mfdpic, imply -msim.
18540
18541 -momit-leaf-frame-pointer
18542 Don't keep the frame pointer in a register for leaf functions.
18543 This avoids the instructions to save, set up and restore frame
18544 pointers and makes an extra register available in leaf functions.
18545
18546 -mspecld-anomaly
18547 When enabled, the compiler ensures that the generated code does not
18548 contain speculative loads after jump instructions. If this option
18549 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
18550
18551 -mno-specld-anomaly
18552 Don't generate extra code to prevent speculative loads from
18553 occurring.
18554
18555 -mcsync-anomaly
18556 When enabled, the compiler ensures that the generated code does not
18557 contain CSYNC or SSYNC instructions too soon after conditional
18558 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
18559 is defined.
18560
18561 -mno-csync-anomaly
18562 Don't generate extra code to prevent CSYNC or SSYNC instructions
18563 from occurring too soon after a conditional branch.
18564
18565 -mlow64k
18566 When enabled, the compiler is free to take advantage of the
18567 knowledge that the entire program fits into the low 64k of memory.
18568
18569 -mno-low64k
18570 Assume that the program is arbitrarily large. This is the default.
18571
18572 -mstack-check-l1
18573 Do stack checking using information placed into L1 scratchpad
18574 memory by the uClinux kernel.
18575
18576 -mid-shared-library
18577 Generate code that supports shared libraries via the library ID
18578 method. This allows for execute in place and shared libraries in
18579 an environment without virtual memory management. This option
18580 implies -fPIC. With a bfin-elf target, this option implies -msim.
18581
18582 -mno-id-shared-library
18583 Generate code that doesn't assume ID-based shared libraries are
18584 being used. This is the default.
18585
18586 -mleaf-id-shared-library
18587 Generate code that supports shared libraries via the library ID
18588 method, but assumes that this library or executable won't link
18589 against any other ID shared libraries. That allows the compiler to
18590 use faster code for jumps and calls.
18591
18592 -mno-leaf-id-shared-library
18593 Do not assume that the code being compiled won't link against any
18594 ID shared libraries. Slower code is generated for jump and call
18595 insns.
18596
18597 -mshared-library-id=n
18598 Specifies the identification number of the ID-based shared library
18599 being compiled. Specifying a value of 0 generates more compact
18600 code; specifying other values forces the allocation of that number
18601 to the current library but is no more space- or time-efficient than
18602 omitting this option.
18603
18604 -msep-data
18605 Generate code that allows the data segment to be located in a
18606 different area of memory from the text segment. This allows for
18607 execute in place in an environment without virtual memory
18608 management by eliminating relocations against the text section.
18609
18610 -mno-sep-data
18611 Generate code that assumes that the data segment follows the text
18612 segment. This is the default.
18613
18614 -mlong-calls
18615 -mno-long-calls
18616 Tells the compiler to perform function calls by first loading the
18617 address of the function into a register and then performing a
18618 subroutine call on this register. This switch is needed if the
18619 target function lies outside of the 24-bit addressing range of the
18620 offset-based version of subroutine call instruction.
18621
18622 This feature is not enabled by default. Specifying -mno-long-calls
18623 restores the default behavior. Note these switches have no effect
18624 on how the compiler generates code to handle function calls via
18625 function pointers.
18626
18627 -mfast-fp
18628 Link with the fast floating-point library. This library relaxes
18629 some of the IEEE floating-point standard's rules for checking
18630 inputs against Not-a-Number (NAN), in the interest of performance.
18631
18632 -minline-plt
18633 Enable inlining of PLT entries in function calls to functions that
18634 are not known to bind locally. It has no effect without -mfdpic.
18635
18636 -mmulticore
18637 Build a standalone application for multicore Blackfin processors.
18638 This option causes proper start files and link scripts supporting
18639 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
18640 can only be used with -mcpu=bf561[-sirevision].
18641
18642 This option can be used with -mcorea or -mcoreb, which selects the
18643 one-application-per-core programming model. Without -mcorea or
18644 -mcoreb, the single-application/dual-core programming model is
18645 used. In this model, the main function of Core B should be named as
18646 "coreb_main".
18647
18648 If this option is not used, the single-core application programming
18649 model is used.
18650
18651 -mcorea
18652 Build a standalone application for Core A of BF561 when using the
18653 one-application-per-core programming model. Proper start files and
18654 link scripts are used to support Core A, and the macro
18655 "__BFIN_COREA" is defined. This option can only be used in
18656 conjunction with -mmulticore.
18657
18658 -mcoreb
18659 Build a standalone application for Core B of BF561 when using the
18660 one-application-per-core programming model. Proper start files and
18661 link scripts are used to support Core B, and the macro
18662 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
18663 should be used instead of "main". This option can only be used in
18664 conjunction with -mmulticore.
18665
18666 -msdram
18667 Build a standalone application for SDRAM. Proper start files and
18668 link scripts are used to put the application into SDRAM, and the
18669 macro "__BFIN_SDRAM" is defined. The loader should initialize
18670 SDRAM before loading the application.
18671
18672 -micplb
18673 Assume that ICPLBs are enabled at run time. This has an effect on
18674 certain anomaly workarounds. For Linux targets, the default is to
18675 assume ICPLBs are enabled; for standalone applications the default
18676 is off.
18677
18678 C6X Options
18679
18680 -march=name
18681 This specifies the name of the target architecture. GCC uses this
18682 name to determine what kind of instructions it can emit when
18683 generating assembly code. Permissible names are: c62x, c64x,
18684 c64x+, c67x, c67x+, c674x.
18685
18686 -mbig-endian
18687 Generate code for a big-endian target.
18688
18689 -mlittle-endian
18690 Generate code for a little-endian target. This is the default.
18691
18692 -msim
18693 Choose startup files and linker script suitable for the simulator.
18694
18695 -msdata=default
18696 Put small global and static data in the ".neardata" section, which
18697 is pointed to by register "B14". Put small uninitialized global
18698 and static data in the ".bss" section, which is adjacent to the
18699 ".neardata" section. Put small read-only data into the ".rodata"
18700 section. The corresponding sections used for large pieces of data
18701 are ".fardata", ".far" and ".const".
18702
18703 -msdata=all
18704 Put all data, not just small objects, into the sections reserved
18705 for small data, and use addressing relative to the "B14" register
18706 to access them.
18707
18708 -msdata=none
18709 Make no use of the sections reserved for small data, and use
18710 absolute addresses to access all data. Put all initialized global
18711 and static data in the ".fardata" section, and all uninitialized
18712 data in the ".far" section. Put all constant data into the
18713 ".const" section.
18714
18715 CRIS Options
18716
18717 These options are defined specifically for the CRIS ports.
18718
18719 -march=architecture-type
18720 -mcpu=architecture-type
18721 Generate code for the specified architecture. The choices for
18722 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
18723 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
18724 linux-gnu, where the default is v10.
18725
18726 -mtune=architecture-type
18727 Tune to architecture-type everything applicable about the generated
18728 code, except for the ABI and the set of available instructions.
18729 The choices for architecture-type are the same as for
18730 -march=architecture-type.
18731
18732 -mmax-stack-frame=n
18733 Warn when the stack frame of a function exceeds n bytes.
18734
18735 -metrax4
18736 -metrax100
18737 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
18738 -march=v8 respectively.
18739
18740 -mmul-bug-workaround
18741 -mno-mul-bug-workaround
18742 Work around a bug in the "muls" and "mulu" instructions for CPU
18743 models where it applies. This option is active by default.
18744
18745 -mpdebug
18746 Enable CRIS-specific verbose debug-related information in the
18747 assembly code. This option also has the effect of turning off the
18748 #NO_APP formatted-code indicator to the assembler at the beginning
18749 of the assembly file.
18750
18751 -mcc-init
18752 Do not use condition-code results from previous instruction; always
18753 emit compare and test instructions before use of condition codes.
18754
18755 -mno-side-effects
18756 Do not emit instructions with side effects in addressing modes
18757 other than post-increment.
18758
18759 -mstack-align
18760 -mno-stack-align
18761 -mdata-align
18762 -mno-data-align
18763 -mconst-align
18764 -mno-const-align
18765 These options (no- options) arrange (eliminate arrangements) for
18766 the stack frame, individual data and constants to be aligned for
18767 the maximum single data access size for the chosen CPU model. The
18768 default is to arrange for 32-bit alignment. ABI details such as
18769 structure layout are not affected by these options.
18770
18771 -m32-bit
18772 -m16-bit
18773 -m8-bit
18774 Similar to the stack- data- and const-align options above, these
18775 options arrange for stack frame, writable data and constants to all
18776 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
18777 alignment.
18778
18779 -mno-prologue-epilogue
18780 -mprologue-epilogue
18781 With -mno-prologue-epilogue, the normal function prologue and
18782 epilogue which set up the stack frame are omitted and no return
18783 instructions or return sequences are generated in the code. Use
18784 this option only together with visual inspection of the compiled
18785 code: no warnings or errors are generated when call-saved registers
18786 must be saved, or storage for local variables needs to be
18787 allocated.
18788
18789 -mno-gotplt
18790 -mgotplt
18791 With -fpic and -fPIC, don't generate (do generate) instruction
18792 sequences that load addresses for functions from the PLT part of
18793 the GOT rather than (traditional on other architectures) calls to
18794 the PLT. The default is -mgotplt.
18795
18796 -melf
18797 Legacy no-op option only recognized with the cris-axis-elf and
18798 cris-axis-linux-gnu targets.
18799
18800 -mlinux
18801 Legacy no-op option only recognized with the cris-axis-linux-gnu
18802 target.
18803
18804 -sim
18805 This option, recognized for the cris-axis-elf, arranges to link
18806 with input-output functions from a simulator library. Code,
18807 initialized data and zero-initialized data are allocated
18808 consecutively.
18809
18810 -sim2
18811 Like -sim, but pass linker options to locate initialized data at
18812 0x40000000 and zero-initialized data at 0x80000000.
18813
18814 CR16 Options
18815
18816 These options are defined specifically for the CR16 ports.
18817
18818 -mmac
18819 Enable the use of multiply-accumulate instructions. Disabled by
18820 default.
18821
18822 -mcr16cplus
18823 -mcr16c
18824 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18825 is default.
18826
18827 -msim
18828 Links the library libsim.a which is in compatible with simulator.
18829 Applicable to ELF compiler only.
18830
18831 -mint32
18832 Choose integer type as 32-bit wide.
18833
18834 -mbit-ops
18835 Generates "sbit"/"cbit" instructions for bit manipulations.
18836
18837 -mdata-model=model
18838 Choose a data model. The choices for model are near, far or medium.
18839 medium is default. However, far is not valid with -mcr16c, as the
18840 CR16C architecture does not support the far data model.
18841
18842 C-SKY Options
18843
18844 GCC supports these options when compiling for C-SKY V2 processors.
18845
18846 -march=arch
18847 Specify the C-SKY target architecture. Valid values for arch are:
18848 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
18849
18850 -mcpu=cpu
18851 Specify the C-SKY target processor. Valid values for cpu are:
18852 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
18853 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
18854 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
18855 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
18856 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
18857 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
18858 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
18859 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
18860 ck810tv, ck810ft, and ck810ftv.
18861
18862 -mbig-endian
18863 -EB
18864 -mlittle-endian
18865 -EL Select big- or little-endian code. The default is little-endian.
18866
18867 -mfloat-abi=name
18868 Specifies which floating-point ABI to use. Permissible values are:
18869 soft, softfp and hard.
18870
18871 Specifying soft causes GCC to generate output containing library
18872 calls for floating-point operations. softfp allows the generation
18873 of code using hardware floating-point instructions, but still uses
18874 the soft-float calling conventions. hard allows generation of
18875 floating-point instructions and uses FPU-specific calling
18876 conventions.
18877
18878 The default depends on the specific target configuration. Note
18879 that the hard-float and soft-float ABIs are not link-compatible;
18880 you must compile your entire program with the same ABI, and link
18881 with a compatible set of libraries.
18882
18883 -mhard-float
18884 -msoft-float
18885 Select hardware or software floating-point implementations. The
18886 default is soft float.
18887
18888 -mdouble-float
18889 -mno-double-float
18890 When -mhard-float is in effect, enable generation of double-
18891 precision float instructions. This is the default except when
18892 compiling for CK803.
18893
18894 -mfdivdu
18895 -mno-fdivdu
18896 When -mhard-float is in effect, enable generation of "frecipd",
18897 "fsqrtd", and "fdivd" instructions. This is the default except
18898 when compiling for CK803.
18899
18900 -mfpu=fpu
18901 Select the floating-point processor. This option can only be used
18902 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
18903 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
18904 and fpv2_divd (-mdouble-float -mdivdu).
18905
18906 -melrw
18907 -mno-elrw
18908 Enable the extended "lrw" instruction. This option defaults to on
18909 for CK801 and off otherwise.
18910
18911 -mistack
18912 -mno-istack
18913 Enable interrupt stack instructions; the default is off.
18914
18915 The -mistack option is required to handle the "interrupt" and "isr"
18916 function attributes.
18917
18918 -mmp
18919 Enable multiprocessor instructions; the default is off.
18920
18921 -mcp
18922 Enable coprocessor instructions; the default is off.
18923
18924 -mcache
18925 Enable coprocessor instructions; the default is off.
18926
18927 -msecurity
18928 Enable C-SKY security instructions; the default is off.
18929
18930 -mtrust
18931 Enable C-SKY trust instructions; the default is off.
18932
18933 -mdsp
18934 -medsp
18935 -mvdsp
18936 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
18937 respectively. All of these options default to off.
18938
18939 -mdiv
18940 -mno-div
18941 Generate divide instructions. Default is off.
18942
18943 -msmart
18944 -mno-smart
18945 Generate code for Smart Mode, using only registers numbered 0-7 to
18946 allow use of 16-bit instructions. This option is ignored for CK801
18947 where this is the required behavior, and it defaults to on for
18948 CK802. For other targets, the default is off.
18949
18950 -mhigh-registers
18951 -mno-high-registers
18952 Generate code using the high registers numbered 16-31. This option
18953 is not supported on CK801, CK802, or CK803, and is enabled by
18954 default for other processors.
18955
18956 -manchor
18957 -mno-anchor
18958 Generate code using global anchor symbol addresses.
18959
18960 -mpushpop
18961 -mno-pushpop
18962 Generate code using "push" and "pop" instructions. This option
18963 defaults to on.
18964
18965 -mmultiple-stld
18966 -mstm
18967 -mno-multiple-stld
18968 -mno-stm
18969 Generate code using "stm" and "ldm" instructions. This option
18970 isn't supported on CK801 but is enabled by default on other
18971 processors.
18972
18973 -mconstpool
18974 -mno-constpool
18975 Create constant pools in the compiler instead of deferring it to
18976 the assembler. This option is the default and required for correct
18977 code generation on CK801 and CK802, and is optional on other
18978 processors.
18979
18980 -mstack-size
18981 -mno-stack-size
18982 Emit ".stack_size" directives for each function in the assembly
18983 output. This option defaults to off.
18984
18985 -mccrt
18986 -mno-ccrt
18987 Generate code for the C-SKY compiler runtime instead of libgcc.
18988 This option defaults to off.
18989
18990 -mbranch-cost=n
18991 Set the branch costs to roughly "n" instructions. The default is
18992 1.
18993
18994 -msched-prolog
18995 -mno-sched-prolog
18996 Permit scheduling of function prologue and epilogue sequences.
18997 Using this option can result in code that is not compliant with the
18998 C-SKY V2 ABI prologue requirements and that cannot be debugged or
18999 backtraced. It is disabled by default.
19000
19001 -msim
19002 Links the library libsemi.a which is in compatible with simulator.
19003 Applicable to ELF compiler only.
19004
19005 Darwin Options
19006
19007 These options are defined for all architectures running the Darwin
19008 operating system.
19009
19010 FSF GCC on Darwin does not create "fat" object files; it creates an
19011 object file for the single architecture that GCC was built to target.
19012 Apple's GCC on Darwin does create "fat" files if multiple -arch options
19013 are used; it does so by running the compiler or linker multiple times
19014 and joining the results together with lipo.
19015
19016 The subtype of the file created (like ppc7400 or ppc970 or i686) is
19017 determined by the flags that specify the ISA that GCC is targeting,
19018 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
19019 override this.
19020
19021 The Darwin tools vary in their behavior when presented with an ISA
19022 mismatch. The assembler, as, only permits instructions to be used that
19023 are valid for the subtype of the file it is generating, so you cannot
19024 put 64-bit instructions in a ppc750 object file. The linker for shared
19025 libraries, /usr/bin/libtool, fails and prints an error if asked to
19026 create a shared library with a less restrictive subtype than its input
19027 files (for instance, trying to put a ppc970 object file in a ppc7400
19028 library). The linker for executables, ld, quietly gives the executable
19029 the most restrictive subtype of any of its input files.
19030
19031 -Fdir
19032 Add the framework directory dir to the head of the list of
19033 directories to be searched for header files. These directories are
19034 interleaved with those specified by -I options and are scanned in a
19035 left-to-right order.
19036
19037 A framework directory is a directory with frameworks in it. A
19038 framework is a directory with a Headers and/or PrivateHeaders
19039 directory contained directly in it that ends in .framework. The
19040 name of a framework is the name of this directory excluding the
19041 .framework. Headers associated with the framework are found in one
19042 of those two directories, with Headers being searched first. A
19043 subframework is a framework directory that is in a framework's
19044 Frameworks directory. Includes of subframework headers can only
19045 appear in a header of a framework that contains the subframework,
19046 or in a sibling subframework header. Two subframeworks are
19047 siblings if they occur in the same framework. A subframework
19048 should not have the same name as a framework; a warning is issued
19049 if this is violated. Currently a subframework cannot have
19050 subframeworks; in the future, the mechanism may be extended to
19051 support this. The standard frameworks can be found in
19052 /System/Library/Frameworks and /Library/Frameworks. An example
19053 include looks like "#include <Framework/header.h>", where Framework
19054 denotes the name of the framework and header.h is found in the
19055 PrivateHeaders or Headers directory.
19056
19057 -iframeworkdir
19058 Like -F except the directory is a treated as a system directory.
19059 The main difference between this -iframework and -F is that with
19060 -iframework the compiler does not warn about constructs contained
19061 within header files found via dir. This option is valid only for
19062 the C family of languages.
19063
19064 -gused
19065 Emit debugging information for symbols that are used. For stabs
19066 debugging format, this enables -feliminate-unused-debug-symbols.
19067 This is by default ON.
19068
19069 -gfull
19070 Emit debugging information for all symbols and types.
19071
19072 -mmacosx-version-min=version
19073 The earliest version of MacOS X that this executable will run on is
19074 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19075
19076 If the compiler was built to use the system's headers by default,
19077 then the default for this option is the system version on which the
19078 compiler is running, otherwise the default is to make choices that
19079 are compatible with as many systems and code bases as possible.
19080
19081 -mkernel
19082 Enable kernel development mode. The -mkernel option sets -static,
19083 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19084 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19085 where applicable. This mode also sets -mno-altivec, -msoft-float,
19086 -fno-builtin and -mlong-branch for PowerPC targets.
19087
19088 -mone-byte-bool
19089 Override the defaults for "bool" so that "sizeof(bool)==1". By
19090 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19091 when compiling for Darwin/x86, so this option has no effect on x86.
19092
19093 Warning: The -mone-byte-bool switch causes GCC to generate code
19094 that is not binary compatible with code generated without that
19095 switch. Using this switch may require recompiling all other
19096 modules in a program, including system libraries. Use this switch
19097 to conform to a non-default data model.
19098
19099 -mfix-and-continue
19100 -ffix-and-continue
19101 -findirect-data
19102 Generate code suitable for fast turnaround development, such as to
19103 allow GDB to dynamically load .o files into already-running
19104 programs. -findirect-data and -ffix-and-continue are provided for
19105 backwards compatibility.
19106
19107 -all_load
19108 Loads all members of static archive libraries. See man ld(1) for
19109 more information.
19110
19111 -arch_errors_fatal
19112 Cause the errors having to do with files that have the wrong
19113 architecture to be fatal.
19114
19115 -bind_at_load
19116 Causes the output file to be marked such that the dynamic linker
19117 will bind all undefined references when the file is loaded or
19118 launched.
19119
19120 -bundle
19121 Produce a Mach-o bundle format file. See man ld(1) for more
19122 information.
19123
19124 -bundle_loader executable
19125 This option specifies the executable that will load the build
19126 output file being linked. See man ld(1) for more information.
19127
19128 -dynamiclib
19129 When passed this option, GCC produces a dynamic library instead of
19130 an executable when linking, using the Darwin libtool command.
19131
19132 -force_cpusubtype_ALL
19133 This causes GCC's output file to have the ALL subtype, instead of
19134 one controlled by the -mcpu or -march option.
19135
19136 -allowable_client client_name
19137 -client_name
19138 -compatibility_version
19139 -current_version
19140 -dead_strip
19141 -dependency-file
19142 -dylib_file
19143 -dylinker_install_name
19144 -dynamic
19145 -exported_symbols_list
19146 -filelist
19147 -flat_namespace
19148 -force_flat_namespace
19149 -headerpad_max_install_names
19150 -image_base
19151 -init
19152 -install_name
19153 -keep_private_externs
19154 -multi_module
19155 -multiply_defined
19156 -multiply_defined_unused
19157 -noall_load
19158 -no_dead_strip_inits_and_terms
19159 -nofixprebinding
19160 -nomultidefs
19161 -noprebind
19162 -noseglinkedit
19163 -pagezero_size
19164 -prebind
19165 -prebind_all_twolevel_modules
19166 -private_bundle
19167 -read_only_relocs
19168 -sectalign
19169 -sectobjectsymbols
19170 -whyload
19171 -seg1addr
19172 -sectcreate
19173 -sectobjectsymbols
19174 -sectorder
19175 -segaddr
19176 -segs_read_only_addr
19177 -segs_read_write_addr
19178 -seg_addr_table
19179 -seg_addr_table_filename
19180 -seglinkedit
19181 -segprot
19182 -segs_read_only_addr
19183 -segs_read_write_addr
19184 -single_module
19185 -static
19186 -sub_library
19187 -sub_umbrella
19188 -twolevel_namespace
19189 -umbrella
19190 -undefined
19191 -unexported_symbols_list
19192 -weak_reference_mismatches
19193 -whatsloaded
19194 These options are passed to the Darwin linker. The Darwin linker
19195 man page describes them in detail.
19196
19197 DEC Alpha Options
19198
19199 These -m options are defined for the DEC Alpha implementations:
19200
19201 -mno-soft-float
19202 -msoft-float
19203 Use (do not use) the hardware floating-point instructions for
19204 floating-point operations. When -msoft-float is specified,
19205 functions in libgcc.a are used to perform floating-point
19206 operations. Unless they are replaced by routines that emulate the
19207 floating-point operations, or compiled in such a way as to call
19208 such emulations routines, these routines issue floating-point
19209 operations. If you are compiling for an Alpha without floating-
19210 point operations, you must ensure that the library is built so as
19211 not to call them.
19212
19213 Note that Alpha implementations without floating-point operations
19214 are required to have floating-point registers.
19215
19216 -mfp-reg
19217 -mno-fp-regs
19218 Generate code that uses (does not use) the floating-point register
19219 set. -mno-fp-regs implies -msoft-float. If the floating-point
19220 register set is not used, floating-point operands are passed in
19221 integer registers as if they were integers and floating-point
19222 results are passed in $0 instead of $f0. This is a non-standard
19223 calling sequence, so any function with a floating-point argument or
19224 return value called by code compiled with -mno-fp-regs must also be
19225 compiled with that option.
19226
19227 A typical use of this option is building a kernel that does not
19228 use, and hence need not save and restore, any floating-point
19229 registers.
19230
19231 -mieee
19232 The Alpha architecture implements floating-point hardware optimized
19233 for maximum performance. It is mostly compliant with the IEEE
19234 floating-point standard. However, for full compliance, software
19235 assistance is required. This option generates code fully IEEE-
19236 compliant code except that the inexact-flag is not maintained (see
19237 below). If this option is turned on, the preprocessor macro
19238 "_IEEE_FP" is defined during compilation. The resulting code is
19239 less efficient but is able to correctly support denormalized
19240 numbers and exceptional IEEE values such as not-a-number and
19241 plus/minus infinity. Other Alpha compilers call this option
19242 -ieee_with_no_inexact.
19243
19244 -mieee-with-inexact
19245 This is like -mieee except the generated code also maintains the
19246 IEEE inexact-flag. Turning on this option causes the generated
19247 code to implement fully-compliant IEEE math. In addition to
19248 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
19249 On some Alpha implementations the resulting code may execute
19250 significantly slower than the code generated by default. Since
19251 there is very little code that depends on the inexact-flag, you
19252 should normally not specify this option. Other Alpha compilers
19253 call this option -ieee_with_inexact.
19254
19255 -mfp-trap-mode=trap-mode
19256 This option controls what floating-point related traps are enabled.
19257 Other Alpha compilers call this option -fptm trap-mode. The trap
19258 mode can be set to one of four values:
19259
19260 n This is the default (normal) setting. The only traps that are
19261 enabled are the ones that cannot be disabled in software (e.g.,
19262 division by zero trap).
19263
19264 u In addition to the traps enabled by n, underflow traps are
19265 enabled as well.
19266
19267 su Like u, but the instructions are marked to be safe for software
19268 completion (see Alpha architecture manual for details).
19269
19270 sui Like su, but inexact traps are enabled as well.
19271
19272 -mfp-rounding-mode=rounding-mode
19273 Selects the IEEE rounding mode. Other Alpha compilers call this
19274 option -fprm rounding-mode. The rounding-mode can be one of:
19275
19276 n Normal IEEE rounding mode. Floating-point numbers are rounded
19277 towards the nearest machine number or towards the even machine
19278 number in case of a tie.
19279
19280 m Round towards minus infinity.
19281
19282 c Chopped rounding mode. Floating-point numbers are rounded
19283 towards zero.
19284
19285 d Dynamic rounding mode. A field in the floating-point control
19286 register (fpcr, see Alpha architecture reference manual)
19287 controls the rounding mode in effect. The C library
19288 initializes this register for rounding towards plus infinity.
19289 Thus, unless your program modifies the fpcr, d corresponds to
19290 round towards plus infinity.
19291
19292 -mtrap-precision=trap-precision
19293 In the Alpha architecture, floating-point traps are imprecise.
19294 This means without software assistance it is impossible to recover
19295 from a floating trap and program execution normally needs to be
19296 terminated. GCC can generate code that can assist operating system
19297 trap handlers in determining the exact location that caused a
19298 floating-point trap. Depending on the requirements of an
19299 application, different levels of precisions can be selected:
19300
19301 p Program precision. This option is the default and means a trap
19302 handler can only identify which program caused a floating-point
19303 exception.
19304
19305 f Function precision. The trap handler can determine the
19306 function that caused a floating-point exception.
19307
19308 i Instruction precision. The trap handler can determine the
19309 exact instruction that caused a floating-point exception.
19310
19311 Other Alpha compilers provide the equivalent options called
19312 -scope_safe and -resumption_safe.
19313
19314 -mieee-conformant
19315 This option marks the generated code as IEEE conformant. You must
19316 not use this option unless you also specify -mtrap-precision=i and
19317 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
19318 to emit the line .eflag 48 in the function prologue of the
19319 generated assembly file.
19320
19321 -mbuild-constants
19322 Normally GCC examines a 32- or 64-bit integer constant to see if it
19323 can construct it from smaller constants in two or three
19324 instructions. If it cannot, it outputs the constant as a literal
19325 and generates code to load it from the data segment at run time.
19326
19327 Use this option to require GCC to construct all integer constants
19328 using code, even if it takes more instructions (the maximum is
19329 six).
19330
19331 You typically use this option to build a shared library dynamic
19332 loader. Itself a shared library, it must relocate itself in memory
19333 before it can find the variables and constants in its own data
19334 segment.
19335
19336 -mbwx
19337 -mno-bwx
19338 -mcix
19339 -mno-cix
19340 -mfix
19341 -mno-fix
19342 -mmax
19343 -mno-max
19344 Indicate whether GCC should generate code to use the optional BWX,
19345 CIX, FIX and MAX instruction sets. The default is to use the
19346 instruction sets supported by the CPU type specified via -mcpu=
19347 option or that of the CPU on which GCC was built if none is
19348 specified.
19349
19350 -mfloat-vax
19351 -mfloat-ieee
19352 Generate code that uses (does not use) VAX F and G floating-point
19353 arithmetic instead of IEEE single and double precision.
19354
19355 -mexplicit-relocs
19356 -mno-explicit-relocs
19357 Older Alpha assemblers provided no way to generate symbol
19358 relocations except via assembler macros. Use of these macros does
19359 not allow optimal instruction scheduling. GNU binutils as of
19360 version 2.12 supports a new syntax that allows the compiler to
19361 explicitly mark which relocations should apply to which
19362 instructions. This option is mostly useful for debugging, as GCC
19363 detects the capabilities of the assembler when it is built and sets
19364 the default accordingly.
19365
19366 -msmall-data
19367 -mlarge-data
19368 When -mexplicit-relocs is in effect, static data is accessed via
19369 gp-relative relocations. When -msmall-data is used, objects 8
19370 bytes long or smaller are placed in a small data area (the ".sdata"
19371 and ".sbss" sections) and are accessed via 16-bit relocations off
19372 of the $gp register. This limits the size of the small data area
19373 to 64KB, but allows the variables to be directly accessed via a
19374 single instruction.
19375
19376 The default is -mlarge-data. With this option the data area is
19377 limited to just below 2GB. Programs that require more than 2GB of
19378 data must use "malloc" or "mmap" to allocate the data in the heap
19379 instead of in the program's data segment.
19380
19381 When generating code for shared libraries, -fpic implies
19382 -msmall-data and -fPIC implies -mlarge-data.
19383
19384 -msmall-text
19385 -mlarge-text
19386 When -msmall-text is used, the compiler assumes that the code of
19387 the entire program (or shared library) fits in 4MB, and is thus
19388 reachable with a branch instruction. When -msmall-data is used,
19389 the compiler can assume that all local symbols share the same $gp
19390 value, and thus reduce the number of instructions required for a
19391 function call from 4 to 1.
19392
19393 The default is -mlarge-text.
19394
19395 -mcpu=cpu_type
19396 Set the instruction set and instruction scheduling parameters for
19397 machine type cpu_type. You can specify either the EV style name or
19398 the corresponding chip number. GCC supports scheduling parameters
19399 for the EV4, EV5 and EV6 family of processors and chooses the
19400 default values for the instruction set from the processor you
19401 specify. If you do not specify a processor type, GCC defaults to
19402 the processor on which the compiler was built.
19403
19404 Supported values for cpu_type are
19405
19406 ev4
19407 ev45
19408 21064
19409 Schedules as an EV4 and has no instruction set extensions.
19410
19411 ev5
19412 21164
19413 Schedules as an EV5 and has no instruction set extensions.
19414
19415 ev56
19416 21164a
19417 Schedules as an EV5 and supports the BWX extension.
19418
19419 pca56
19420 21164pc
19421 21164PC
19422 Schedules as an EV5 and supports the BWX and MAX extensions.
19423
19424 ev6
19425 21264
19426 Schedules as an EV6 and supports the BWX, FIX, and MAX
19427 extensions.
19428
19429 ev67
19430 21264a
19431 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
19432 extensions.
19433
19434 Native toolchains also support the value native, which selects the
19435 best architecture option for the host processor. -mcpu=native has
19436 no effect if GCC does not recognize the processor.
19437
19438 -mtune=cpu_type
19439 Set only the instruction scheduling parameters for machine type
19440 cpu_type. The instruction set is not changed.
19441
19442 Native toolchains also support the value native, which selects the
19443 best architecture option for the host processor. -mtune=native has
19444 no effect if GCC does not recognize the processor.
19445
19446 -mmemory-latency=time
19447 Sets the latency the scheduler should assume for typical memory
19448 references as seen by the application. This number is highly
19449 dependent on the memory access patterns used by the application and
19450 the size of the external cache on the machine.
19451
19452 Valid options for time are
19453
19454 number
19455 A decimal number representing clock cycles.
19456
19457 L1
19458 L2
19459 L3
19460 main
19461 The compiler contains estimates of the number of clock cycles
19462 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19463 (also called Dcache, Scache, and Bcache), as well as to main
19464 memory. Note that L3 is only valid for EV5.
19465
19466 eBPF Options
19467
19468 -mframe-limit=bytes
19469 This specifies the hard limit for frame sizes, in bytes.
19470 Currently, the value that can be specified should be less than or
19471 equal to 32767. Defaults to whatever limit is imposed by the
19472 version of the Linux kernel targeted.
19473
19474 -mkernel=version
19475 This specifies the minimum version of the kernel that will run the
19476 compiled program. GCC uses this version to determine which
19477 instructions to use, what kernel helpers to allow, etc. Currently,
19478 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
19479 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
19480 4.20, 5.0, 5.1, 5.2, latest and native.
19481
19482 -mbig-endian
19483 Generate code for a big-endian target.
19484
19485 -mlittle-endian
19486 Generate code for a little-endian target. This is the default.
19487
19488 -mxbpf
19489 Generate code for an expanded version of BPF, which relaxes some of
19490 the restrictions imposed by the BPF architecture:
19491
19492 -<Save and restore callee-saved registers at function entry and>
19493 exit, respectively.
19494
19495 FR30 Options
19496
19497 These options are defined specifically for the FR30 port.
19498
19499 -msmall-model
19500 Use the small address space model. This can produce smaller code,
19501 but it does assume that all symbolic values and addresses fit into
19502 a 20-bit range.
19503
19504 -mno-lsim
19505 Assume that runtime support has been provided and so there is no
19506 need to include the simulator library (libsim.a) on the linker
19507 command line.
19508
19509 FT32 Options
19510
19511 These options are defined specifically for the FT32 port.
19512
19513 -msim
19514 Specifies that the program will be run on the simulator. This
19515 causes an alternate runtime startup and library to be linked. You
19516 must not use this option when generating programs that will run on
19517 real hardware; you must provide your own runtime library for
19518 whatever I/O functions are needed.
19519
19520 -mlra
19521 Enable Local Register Allocation. This is still experimental for
19522 FT32, so by default the compiler uses standard reload.
19523
19524 -mnodiv
19525 Do not use div and mod instructions.
19526
19527 -mft32b
19528 Enable use of the extended instructions of the FT32B processor.
19529
19530 -mcompress
19531 Compress all code using the Ft32B code compression scheme.
19532
19533 -mnopm
19534 Do not generate code that reads program memory.
19535
19536 FRV Options
19537
19538 -mgpr-32
19539 Only use the first 32 general-purpose registers.
19540
19541 -mgpr-64
19542 Use all 64 general-purpose registers.
19543
19544 -mfpr-32
19545 Use only the first 32 floating-point registers.
19546
19547 -mfpr-64
19548 Use all 64 floating-point registers.
19549
19550 -mhard-float
19551 Use hardware instructions for floating-point operations.
19552
19553 -msoft-float
19554 Use library routines for floating-point operations.
19555
19556 -malloc-cc
19557 Dynamically allocate condition code registers.
19558
19559 -mfixed-cc
19560 Do not try to dynamically allocate condition code registers, only
19561 use "icc0" and "fcc0".
19562
19563 -mdword
19564 Change ABI to use double word insns.
19565
19566 -mno-dword
19567 Do not use double word instructions.
19568
19569 -mdouble
19570 Use floating-point double instructions.
19571
19572 -mno-double
19573 Do not use floating-point double instructions.
19574
19575 -mmedia
19576 Use media instructions.
19577
19578 -mno-media
19579 Do not use media instructions.
19580
19581 -mmuladd
19582 Use multiply and add/subtract instructions.
19583
19584 -mno-muladd
19585 Do not use multiply and add/subtract instructions.
19586
19587 -mfdpic
19588 Select the FDPIC ABI, which uses function descriptors to represent
19589 pointers to functions. Without any PIC/PIE-related options, it
19590 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
19591 small data are within a 12-bit range from the GOT base address;
19592 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
19593 bfin-elf target, this option implies -msim.
19594
19595 -minline-plt
19596 Enable inlining of PLT entries in function calls to functions that
19597 are not known to bind locally. It has no effect without -mfdpic.
19598 It's enabled by default if optimizing for speed and compiling for
19599 shared libraries (i.e., -fPIC or -fpic), or when an optimization
19600 option such as -O3 or above is present in the command line.
19601
19602 -mTLS
19603 Assume a large TLS segment when generating thread-local code.
19604
19605 -mtls
19606 Do not assume a large TLS segment when generating thread-local
19607 code.
19608
19609 -mgprel-ro
19610 Enable the use of "GPREL" relocations in the FDPIC ABI for data
19611 that is known to be in read-only sections. It's enabled by
19612 default, except for -fpic or -fpie: even though it may help make
19613 the global offset table smaller, it trades 1 instruction for 4.
19614 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
19615 may be shared by multiple symbols, and it avoids the need for a GOT
19616 entry for the referenced symbol, so it's more likely to be a win.
19617 If it is not, -mno-gprel-ro can be used to disable it.
19618
19619 -multilib-library-pic
19620 Link with the (library, not FD) pic libraries. It's implied by
19621 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
19622 should never have to use it explicitly.
19623
19624 -mlinked-fp
19625 Follow the EABI requirement of always creating a frame pointer
19626 whenever a stack frame is allocated. This option is enabled by
19627 default and can be disabled with -mno-linked-fp.
19628
19629 -mlong-calls
19630 Use indirect addressing to call functions outside the current
19631 compilation unit. This allows the functions to be placed anywhere
19632 within the 32-bit address space.
19633
19634 -malign-labels
19635 Try to align labels to an 8-byte boundary by inserting NOPs into
19636 the previous packet. This option only has an effect when VLIW
19637 packing is enabled. It doesn't create new packets; it merely adds
19638 NOPs to existing ones.
19639
19640 -mlibrary-pic
19641 Generate position-independent EABI code.
19642
19643 -macc-4
19644 Use only the first four media accumulator registers.
19645
19646 -macc-8
19647 Use all eight media accumulator registers.
19648
19649 -mpack
19650 Pack VLIW instructions.
19651
19652 -mno-pack
19653 Do not pack VLIW instructions.
19654
19655 -mno-eflags
19656 Do not mark ABI switches in e_flags.
19657
19658 -mcond-move
19659 Enable the use of conditional-move instructions (default).
19660
19661 This switch is mainly for debugging the compiler and will likely be
19662 removed in a future version.
19663
19664 -mno-cond-move
19665 Disable the use of conditional-move instructions.
19666
19667 This switch is mainly for debugging the compiler and will likely be
19668 removed in a future version.
19669
19670 -mscc
19671 Enable the use of conditional set instructions (default).
19672
19673 This switch is mainly for debugging the compiler and will likely be
19674 removed in a future version.
19675
19676 -mno-scc
19677 Disable the use of conditional set instructions.
19678
19679 This switch is mainly for debugging the compiler and will likely be
19680 removed in a future version.
19681
19682 -mcond-exec
19683 Enable the use of conditional execution (default).
19684
19685 This switch is mainly for debugging the compiler and will likely be
19686 removed in a future version.
19687
19688 -mno-cond-exec
19689 Disable the use of conditional execution.
19690
19691 This switch is mainly for debugging the compiler and will likely be
19692 removed in a future version.
19693
19694 -mvliw-branch
19695 Run a pass to pack branches into VLIW instructions (default).
19696
19697 This switch is mainly for debugging the compiler and will likely be
19698 removed in a future version.
19699
19700 -mno-vliw-branch
19701 Do not run a pass to pack branches into VLIW instructions.
19702
19703 This switch is mainly for debugging the compiler and will likely be
19704 removed in a future version.
19705
19706 -mmulti-cond-exec
19707 Enable optimization of "&&" and "||" in conditional execution
19708 (default).
19709
19710 This switch is mainly for debugging the compiler and will likely be
19711 removed in a future version.
19712
19713 -mno-multi-cond-exec
19714 Disable optimization of "&&" and "||" in conditional execution.
19715
19716 This switch is mainly for debugging the compiler and will likely be
19717 removed in a future version.
19718
19719 -mnested-cond-exec
19720 Enable nested conditional execution optimizations (default).
19721
19722 This switch is mainly for debugging the compiler and will likely be
19723 removed in a future version.
19724
19725 -mno-nested-cond-exec
19726 Disable nested conditional execution optimizations.
19727
19728 This switch is mainly for debugging the compiler and will likely be
19729 removed in a future version.
19730
19731 -moptimize-membar
19732 This switch removes redundant "membar" instructions from the
19733 compiler-generated code. It is enabled by default.
19734
19735 -mno-optimize-membar
19736 This switch disables the automatic removal of redundant "membar"
19737 instructions from the generated code.
19738
19739 -mtomcat-stats
19740 Cause gas to print out tomcat statistics.
19741
19742 -mcpu=cpu
19743 Select the processor type for which to generate code. Possible
19744 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
19745 and simple.
19746
19747 GNU/Linux Options
19748
19749 These -m options are defined for GNU/Linux targets:
19750
19751 -mglibc
19752 Use the GNU C library. This is the default except on
19753 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
19754 targets.
19755
19756 -muclibc
19757 Use uClibc C library. This is the default on *-*-linux-*uclibc*
19758 targets.
19759
19760 -mmusl
19761 Use the musl C library. This is the default on *-*-linux-*musl*
19762 targets.
19763
19764 -mbionic
19765 Use Bionic C library. This is the default on *-*-linux-*android*
19766 targets.
19767
19768 -mandroid
19769 Compile code compatible with Android platform. This is the default
19770 on *-*-linux-*android* targets.
19771
19772 When compiling, this option enables -mbionic, -fPIC,
19773 -fno-exceptions and -fno-rtti by default. When linking, this
19774 option makes the GCC driver pass Android-specific options to the
19775 linker. Finally, this option causes the preprocessor macro
19776 "__ANDROID__" to be defined.
19777
19778 -tno-android-cc
19779 Disable compilation effects of -mandroid, i.e., do not enable
19780 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
19781
19782 -tno-android-ld
19783 Disable linking effects of -mandroid, i.e., pass standard Linux
19784 linking options to the linker.
19785
19786 H8/300 Options
19787
19788 These -m options are defined for the H8/300 implementations:
19789
19790 -mrelax
19791 Shorten some address references at link time, when possible; uses
19792 the linker option -relax.
19793
19794 -mh Generate code for the H8/300H.
19795
19796 -ms Generate code for the H8S.
19797
19798 -mn Generate code for the H8S and H8/300H in the normal mode. This
19799 switch must be used either with -mh or -ms.
19800
19801 -ms2600
19802 Generate code for the H8S/2600. This switch must be used with -ms.
19803
19804 -mexr
19805 Extended registers are stored on stack before execution of function
19806 with monitor attribute. Default option is -mexr. This option is
19807 valid only for H8S targets.
19808
19809 -mno-exr
19810 Extended registers are not stored on stack before execution of
19811 function with monitor attribute. Default option is -mno-exr. This
19812 option is valid only for H8S targets.
19813
19814 -mint32
19815 Make "int" data 32 bits by default.
19816
19817 -malign-300
19818 On the H8/300H and H8S, use the same alignment rules as for the
19819 H8/300. The default for the H8/300H and H8S is to align longs and
19820 floats on 4-byte boundaries. -malign-300 causes them to be aligned
19821 on 2-byte boundaries. This option has no effect on the H8/300.
19822
19823 HPPA Options
19824
19825 These -m options are defined for the HPPA family of computers:
19826
19827 -march=architecture-type
19828 Generate code for the specified architecture. The choices for
19829 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
19830 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
19831 system to determine the proper architecture option for your
19832 machine. Code compiled for lower numbered architectures runs on
19833 higher numbered architectures, but not the other way around.
19834
19835 -mpa-risc-1-0
19836 -mpa-risc-1-1
19837 -mpa-risc-2-0
19838 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
19839
19840 -mcaller-copies
19841 The caller copies function arguments passed by hidden reference.
19842 This option should be used with care as it is not compatible with
19843 the default 32-bit runtime. However, only aggregates larger than
19844 eight bytes are passed by hidden reference and the option provides
19845 better compatibility with OpenMP.
19846
19847 -mjump-in-delay
19848 This option is ignored and provided for compatibility purposes
19849 only.
19850
19851 -mdisable-fpregs
19852 Prevent floating-point registers from being used in any manner.
19853 This is necessary for compiling kernels that perform lazy context
19854 switching of floating-point registers. If you use this option and
19855 attempt to perform floating-point operations, the compiler aborts.
19856
19857 -mdisable-indexing
19858 Prevent the compiler from using indexing address modes. This
19859 avoids some rather obscure problems when compiling MIG generated
19860 code under MACH.
19861
19862 -mno-space-regs
19863 Generate code that assumes the target has no space registers. This
19864 allows GCC to generate faster indirect calls and use unscaled index
19865 address modes.
19866
19867 Such code is suitable for level 0 PA systems and kernels.
19868
19869 -mfast-indirect-calls
19870 Generate code that assumes calls never cross space boundaries.
19871 This allows GCC to emit code that performs faster indirect calls.
19872
19873 This option does not work in the presence of shared libraries or
19874 nested functions.
19875
19876 -mfixed-range=register-range
19877 Generate code treating the given register range as fixed registers.
19878 A fixed register is one that the register allocator cannot use.
19879 This is useful when compiling kernel code. A register range is
19880 specified as two registers separated by a dash. Multiple register
19881 ranges can be specified separated by a comma.
19882
19883 -mlong-load-store
19884 Generate 3-instruction load and store sequences as sometimes
19885 required by the HP-UX 10 linker. This is equivalent to the +k
19886 option to the HP compilers.
19887
19888 -mportable-runtime
19889 Use the portable calling conventions proposed by HP for ELF
19890 systems.
19891
19892 -mgas
19893 Enable the use of assembler directives only GAS understands.
19894
19895 -mschedule=cpu-type
19896 Schedule code according to the constraints for the machine type
19897 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
19898 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
19899 to determine the proper scheduling option for your machine. The
19900 default scheduling is 8000.
19901
19902 -mlinker-opt
19903 Enable the optimization pass in the HP-UX linker. Note this makes
19904 symbolic debugging impossible. It also triggers a bug in the HP-UX
19905 8 and HP-UX 9 linkers in which they give bogus error messages when
19906 linking some programs.
19907
19908 -msoft-float
19909 Generate output containing library calls for floating point.
19910 Warning: the requisite libraries are not available for all HPPA
19911 targets. Normally the facilities of the machine's usual C compiler
19912 are used, but this cannot be done directly in cross-compilation.
19913 You must make your own arrangements to provide suitable library
19914 functions for cross-compilation.
19915
19916 -msoft-float changes the calling convention in the output file;
19917 therefore, it is only useful if you compile all of a program with
19918 this option. In particular, you need to compile libgcc.a, the
19919 library that comes with GCC, with -msoft-float in order for this to
19920 work.
19921
19922 -msio
19923 Generate the predefine, "_SIO", for server IO. The default is
19924 -mwsio. This generates the predefines, "__hp9000s700",
19925 "__hp9000s700__" and "_WSIO", for workstation IO. These options
19926 are available under HP-UX and HI-UX.
19927
19928 -mgnu-ld
19929 Use options specific to GNU ld. This passes -shared to ld when
19930 building a shared library. It is the default when GCC is
19931 configured, explicitly or implicitly, with the GNU linker. This
19932 option does not affect which ld is called; it only changes what
19933 parameters are passed to that ld. The ld that is called is
19934 determined by the --with-ld configure option, GCC's program search
19935 path, and finally by the user's PATH. The linker used by GCC can
19936 be printed using which `gcc -print-prog-name=ld`. This option is
19937 only available on the 64-bit HP-UX GCC, i.e. configured with
19938 hppa*64*-*-hpux*.
19939
19940 -mhp-ld
19941 Use options specific to HP ld. This passes -b to ld when building
19942 a shared library and passes +Accept TypeMismatch to ld on all
19943 links. It is the default when GCC is configured, explicitly or
19944 implicitly, with the HP linker. This option does not affect which
19945 ld is called; it only changes what parameters are passed to that
19946 ld. The ld that is called is determined by the --with-ld configure
19947 option, GCC's program search path, and finally by the user's PATH.
19948 The linker used by GCC can be printed using which `gcc
19949 -print-prog-name=ld`. This option is only available on the 64-bit
19950 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
19951
19952 -mlong-calls
19953 Generate code that uses long call sequences. This ensures that a
19954 call is always able to reach linker generated stubs. The default
19955 is to generate long calls only when the distance from the call site
19956 to the beginning of the function or translation unit, as the case
19957 may be, exceeds a predefined limit set by the branch type being
19958 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
19959 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
19960 always limited at 240,000 bytes.
19961
19962 Distances are measured from the beginning of functions when using
19963 the -ffunction-sections option, or when using the -mgas and
19964 -mno-portable-runtime options together under HP-UX with the SOM
19965 linker.
19966
19967 It is normally not desirable to use this option as it degrades
19968 performance. However, it may be useful in large applications,
19969 particularly when partial linking is used to build the application.
19970
19971 The types of long calls used depends on the capabilities of the
19972 assembler and linker, and the type of code being generated. The
19973 impact on systems that support long absolute calls, and long pic
19974 symbol-difference or pc-relative calls should be relatively small.
19975 However, an indirect call is used on 32-bit ELF systems in pic code
19976 and it is quite long.
19977
19978 -munix=unix-std
19979 Generate compiler predefines and select a startfile for the
19980 specified UNIX standard. The choices for unix-std are 93, 95 and
19981 98. 93 is supported on all HP-UX versions. 95 is available on HP-
19982 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
19983 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
19984 11.00, and 98 for HP-UX 11.11 and later.
19985
19986 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
19987 -munix=95 provides additional predefines for "XOPEN_UNIX" and
19988 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
19989 provides additional predefines for "_XOPEN_UNIX",
19990 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
19991 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
19992
19993 It is important to note that this option changes the interfaces for
19994 various library routines. It also affects the operational behavior
19995 of the C library. Thus, extreme care is needed in using this
19996 option.
19997
19998 Library code that is intended to operate with more than one UNIX
19999 standard must test, set and restore the variable
20000 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
20001 provide this capability.
20002
20003 -nolibdld
20004 Suppress the generation of link options to search libdld.sl when
20005 the -static option is specified on HP-UX 10 and later.
20006
20007 -static
20008 The HP-UX implementation of setlocale in libc has a dependency on
20009 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20010 when the -static option is specified, special link options are
20011 needed to resolve this dependency.
20012
20013 On HP-UX 10 and later, the GCC driver adds the necessary options to
20014 link with libdld.sl when the -static option is specified. This
20015 causes the resulting binary to be dynamic. On the 64-bit port, the
20016 linkers generate dynamic binaries by default in any case. The
20017 -nolibdld option can be used to prevent the GCC driver from adding
20018 these link options.
20019
20020 -threads
20021 Add support for multithreading with the dce thread library under
20022 HP-UX. This option sets flags for both the preprocessor and
20023 linker.
20024
20025 IA-64 Options
20026
20027 These are the -m options defined for the Intel IA-64 architecture.
20028
20029 -mbig-endian
20030 Generate code for a big-endian target. This is the default for HP-
20031 UX.
20032
20033 -mlittle-endian
20034 Generate code for a little-endian target. This is the default for
20035 AIX5 and GNU/Linux.
20036
20037 -mgnu-as
20038 -mno-gnu-as
20039 Generate (or don't) code for the GNU assembler. This is the
20040 default.
20041
20042 -mgnu-ld
20043 -mno-gnu-ld
20044 Generate (or don't) code for the GNU linker. This is the default.
20045
20046 -mno-pic
20047 Generate code that does not use a global pointer register. The
20048 result is not position independent code, and violates the IA-64
20049 ABI.
20050
20051 -mvolatile-asm-stop
20052 -mno-volatile-asm-stop
20053 Generate (or don't) a stop bit immediately before and after
20054 volatile asm statements.
20055
20056 -mregister-names
20057 -mno-register-names
20058 Generate (or don't) in, loc, and out register names for the stacked
20059 registers. This may make assembler output more readable.
20060
20061 -mno-sdata
20062 -msdata
20063 Disable (or enable) optimizations that use the small data section.
20064 This may be useful for working around optimizer bugs.
20065
20066 -mconstant-gp
20067 Generate code that uses a single constant global pointer value.
20068 This is useful when compiling kernel code.
20069
20070 -mauto-pic
20071 Generate code that is self-relocatable. This implies
20072 -mconstant-gp. This is useful when compiling firmware code.
20073
20074 -minline-float-divide-min-latency
20075 Generate code for inline divides of floating-point values using the
20076 minimum latency algorithm.
20077
20078 -minline-float-divide-max-throughput
20079 Generate code for inline divides of floating-point values using the
20080 maximum throughput algorithm.
20081
20082 -mno-inline-float-divide
20083 Do not generate inline code for divides of floating-point values.
20084
20085 -minline-int-divide-min-latency
20086 Generate code for inline divides of integer values using the
20087 minimum latency algorithm.
20088
20089 -minline-int-divide-max-throughput
20090 Generate code for inline divides of integer values using the
20091 maximum throughput algorithm.
20092
20093 -mno-inline-int-divide
20094 Do not generate inline code for divides of integer values.
20095
20096 -minline-sqrt-min-latency
20097 Generate code for inline square roots using the minimum latency
20098 algorithm.
20099
20100 -minline-sqrt-max-throughput
20101 Generate code for inline square roots using the maximum throughput
20102 algorithm.
20103
20104 -mno-inline-sqrt
20105 Do not generate inline code for "sqrt".
20106
20107 -mfused-madd
20108 -mno-fused-madd
20109 Do (don't) generate code that uses the fused multiply/add or
20110 multiply/subtract instructions. The default is to use these
20111 instructions.
20112
20113 -mno-dwarf2-asm
20114 -mdwarf2-asm
20115 Don't (or do) generate assembler code for the DWARF line number
20116 debugging info. This may be useful when not using the GNU
20117 assembler.
20118
20119 -mearly-stop-bits
20120 -mno-early-stop-bits
20121 Allow stop bits to be placed earlier than immediately preceding the
20122 instruction that triggered the stop bit. This can improve
20123 instruction scheduling, but does not always do so.
20124
20125 -mfixed-range=register-range
20126 Generate code treating the given register range as fixed registers.
20127 A fixed register is one that the register allocator cannot use.
20128 This is useful when compiling kernel code. A register range is
20129 specified as two registers separated by a dash. Multiple register
20130 ranges can be specified separated by a comma.
20131
20132 -mtls-size=tls-size
20133 Specify bit size of immediate TLS offsets. Valid values are 14,
20134 22, and 64.
20135
20136 -mtune=cpu-type
20137 Tune the instruction scheduling for a particular CPU, Valid values
20138 are itanium, itanium1, merced, itanium2, and mckinley.
20139
20140 -milp32
20141 -mlp64
20142 Generate code for a 32-bit or 64-bit environment. The 32-bit
20143 environment sets int, long and pointer to 32 bits. The 64-bit
20144 environment sets int to 32 bits and long and pointer to 64 bits.
20145 These are HP-UX specific flags.
20146
20147 -mno-sched-br-data-spec
20148 -msched-br-data-spec
20149 (Dis/En)able data speculative scheduling before reload. This
20150 results in generation of "ld.a" instructions and the corresponding
20151 check instructions ("ld.c" / "chk.a"). The default setting is
20152 disabled.
20153
20154 -msched-ar-data-spec
20155 -mno-sched-ar-data-spec
20156 (En/Dis)able data speculative scheduling after reload. This
20157 results in generation of "ld.a" instructions and the corresponding
20158 check instructions ("ld.c" / "chk.a"). The default setting is
20159 enabled.
20160
20161 -mno-sched-control-spec
20162 -msched-control-spec
20163 (Dis/En)able control speculative scheduling. This feature is
20164 available only during region scheduling (i.e. before reload). This
20165 results in generation of the "ld.s" instructions and the
20166 corresponding check instructions "chk.s". The default setting is
20167 disabled.
20168
20169 -msched-br-in-data-spec
20170 -mno-sched-br-in-data-spec
20171 (En/Dis)able speculative scheduling of the instructions that are
20172 dependent on the data speculative loads before reload. This is
20173 effective only with -msched-br-data-spec enabled. The default
20174 setting is enabled.
20175
20176 -msched-ar-in-data-spec
20177 -mno-sched-ar-in-data-spec
20178 (En/Dis)able speculative scheduling of the instructions that are
20179 dependent on the data speculative loads after reload. This is
20180 effective only with -msched-ar-data-spec enabled. The default
20181 setting is enabled.
20182
20183 -msched-in-control-spec
20184 -mno-sched-in-control-spec
20185 (En/Dis)able speculative scheduling of the instructions that are
20186 dependent on the control speculative loads. This is effective only
20187 with -msched-control-spec enabled. The default setting is enabled.
20188
20189 -mno-sched-prefer-non-data-spec-insns
20190 -msched-prefer-non-data-spec-insns
20191 If enabled, data-speculative instructions are chosen for schedule
20192 only if there are no other choices at the moment. This makes the
20193 use of the data speculation much more conservative. The default
20194 setting is disabled.
20195
20196 -mno-sched-prefer-non-control-spec-insns
20197 -msched-prefer-non-control-spec-insns
20198 If enabled, control-speculative instructions are chosen for
20199 schedule only if there are no other choices at the moment. This
20200 makes the use of the control speculation much more conservative.
20201 The default setting is disabled.
20202
20203 -mno-sched-count-spec-in-critical-path
20204 -msched-count-spec-in-critical-path
20205 If enabled, speculative dependencies are considered during
20206 computation of the instructions priorities. This makes the use of
20207 the speculation a bit more conservative. The default setting is
20208 disabled.
20209
20210 -msched-spec-ldc
20211 Use a simple data speculation check. This option is on by default.
20212
20213 -msched-control-spec-ldc
20214 Use a simple check for control speculation. This option is on by
20215 default.
20216
20217 -msched-stop-bits-after-every-cycle
20218 Place a stop bit after every cycle when scheduling. This option is
20219 on by default.
20220
20221 -msched-fp-mem-deps-zero-cost
20222 Assume that floating-point stores and loads are not likely to cause
20223 a conflict when placed into the same instruction group. This
20224 option is disabled by default.
20225
20226 -msel-sched-dont-check-control-spec
20227 Generate checks for control speculation in selective scheduling.
20228 This flag is disabled by default.
20229
20230 -msched-max-memory-insns=max-insns
20231 Limit on the number of memory insns per instruction group, giving
20232 lower priority to subsequent memory insns attempting to schedule in
20233 the same instruction group. Frequently useful to prevent cache bank
20234 conflicts. The default value is 1.
20235
20236 -msched-max-memory-insns-hard-limit
20237 Makes the limit specified by msched-max-memory-insns a hard limit,
20238 disallowing more than that number in an instruction group.
20239 Otherwise, the limit is "soft", meaning that non-memory operations
20240 are preferred when the limit is reached, but memory operations may
20241 still be scheduled.
20242
20243 LM32 Options
20244
20245 These -m options are defined for the LatticeMico32 architecture:
20246
20247 -mbarrel-shift-enabled
20248 Enable barrel-shift instructions.
20249
20250 -mdivide-enabled
20251 Enable divide and modulus instructions.
20252
20253 -mmultiply-enabled
20254 Enable multiply instructions.
20255
20256 -msign-extend-enabled
20257 Enable sign extend instructions.
20258
20259 -muser-enabled
20260 Enable user-defined instructions.
20261
20262 M32C Options
20263
20264 -mcpu=name
20265 Select the CPU for which code is generated. name may be one of r8c
20266 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
20267 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
20268
20269 -msim
20270 Specifies that the program will be run on the simulator. This
20271 causes an alternate runtime library to be linked in which supports,
20272 for example, file I/O. You must not use this option when
20273 generating programs that will run on real hardware; you must
20274 provide your own runtime library for whatever I/O functions are
20275 needed.
20276
20277 -memregs=number
20278 Specifies the number of memory-based pseudo-registers GCC uses
20279 during code generation. These pseudo-registers are used like real
20280 registers, so there is a tradeoff between GCC's ability to fit the
20281 code into available registers, and the performance penalty of using
20282 memory instead of registers. Note that all modules in a program
20283 must be compiled with the same value for this option. Because of
20284 that, you must not use this option with GCC's default runtime
20285 libraries.
20286
20287 M32R/D Options
20288
20289 These -m options are defined for Renesas M32R/D architectures:
20290
20291 -m32r2
20292 Generate code for the M32R/2.
20293
20294 -m32rx
20295 Generate code for the M32R/X.
20296
20297 -m32r
20298 Generate code for the M32R. This is the default.
20299
20300 -mmodel=small
20301 Assume all objects live in the lower 16MB of memory (so that their
20302 addresses can be loaded with the "ld24" instruction), and assume
20303 all subroutines are reachable with the "bl" instruction. This is
20304 the default.
20305
20306 The addressability of a particular object can be set with the
20307 "model" attribute.
20308
20309 -mmodel=medium
20310 Assume objects may be anywhere in the 32-bit address space (the
20311 compiler generates "seth/add3" instructions to load their
20312 addresses), and assume all subroutines are reachable with the "bl"
20313 instruction.
20314
20315 -mmodel=large
20316 Assume objects may be anywhere in the 32-bit address space (the
20317 compiler generates "seth/add3" instructions to load their
20318 addresses), and assume subroutines may not be reachable with the
20319 "bl" instruction (the compiler generates the much slower
20320 "seth/add3/jl" instruction sequence).
20321
20322 -msdata=none
20323 Disable use of the small data area. Variables are put into one of
20324 ".data", ".bss", or ".rodata" (unless the "section" attribute has
20325 been specified). This is the default.
20326
20327 The small data area consists of sections ".sdata" and ".sbss".
20328 Objects may be explicitly put in the small data area with the
20329 "section" attribute using one of these sections.
20330
20331 -msdata=sdata
20332 Put small global and static data in the small data area, but do not
20333 generate special code to reference them.
20334
20335 -msdata=use
20336 Put small global and static data in the small data area, and
20337 generate special instructions to reference them.
20338
20339 -G num
20340 Put global and static objects less than or equal to num bytes into
20341 the small data or BSS sections instead of the normal data or BSS
20342 sections. The default value of num is 8. The -msdata option must
20343 be set to one of sdata or use for this option to have any effect.
20344
20345 All modules should be compiled with the same -G num value.
20346 Compiling with different values of num may or may not work; if it
20347 doesn't the linker gives an error message---incorrect code is not
20348 generated.
20349
20350 -mdebug
20351 Makes the M32R-specific code in the compiler display some
20352 statistics that might help in debugging programs.
20353
20354 -malign-loops
20355 Align all loops to a 32-byte boundary.
20356
20357 -mno-align-loops
20358 Do not enforce a 32-byte alignment for loops. This is the default.
20359
20360 -missue-rate=number
20361 Issue number instructions per cycle. number can only be 1 or 2.
20362
20363 -mbranch-cost=number
20364 number can only be 1 or 2. If it is 1 then branches are preferred
20365 over conditional code, if it is 2, then the opposite applies.
20366
20367 -mflush-trap=number
20368 Specifies the trap number to use to flush the cache. The default
20369 is 12. Valid numbers are between 0 and 15 inclusive.
20370
20371 -mno-flush-trap
20372 Specifies that the cache cannot be flushed by using a trap.
20373
20374 -mflush-func=name
20375 Specifies the name of the operating system function to call to
20376 flush the cache. The default is _flush_cache, but a function call
20377 is only used if a trap is not available.
20378
20379 -mno-flush-func
20380 Indicates that there is no OS function for flushing the cache.
20381
20382 M680x0 Options
20383
20384 These are the -m options defined for M680x0 and ColdFire processors.
20385 The default settings depend on which architecture was selected when the
20386 compiler was configured; the defaults for the most common choices are
20387 given below.
20388
20389 -march=arch
20390 Generate code for a specific M680x0 or ColdFire instruction set
20391 architecture. Permissible values of arch for M680x0 architectures
20392 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
20393 architectures are selected according to Freescale's ISA
20394 classification and the permissible values are: isaa, isaaplus, isab
20395 and isac.
20396
20397 GCC defines a macro "__mcfarch__" whenever it is generating code
20398 for a ColdFire target. The arch in this macro is one of the -march
20399 arguments given above.
20400
20401 When used together, -march and -mtune select code that runs on a
20402 family of similar processors but that is optimized for a particular
20403 microarchitecture.
20404
20405 -mcpu=cpu
20406 Generate code for a specific M680x0 or ColdFire processor. The
20407 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
20408 68332 and cpu32. The ColdFire cpus are given by the table below,
20409 which also classifies the CPUs into families:
20410
20411 Family : -mcpu arguments
20412 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
20413 5206 : 5202 5204 5206
20414 5206e : 5206e
20415 5208 : 5207 5208
20416 5211a : 5210a 5211a
20417 5213 : 5211 5212 5213
20418 5216 : 5214 5216
20419 52235 : 52230 52231 52232 52233 52234 52235
20420 5225 : 5224 5225
20421 52259 : 52252 52254 52255 52256 52258 52259
20422 5235 : 5232 5233 5234 5235 523x
20423 5249 : 5249
20424 5250 : 5250
20425 5271 : 5270 5271
20426 5272 : 5272
20427 5275 : 5274 5275
20428 5282 : 5280 5281 5282 528x
20429 53017 : 53011 53012 53013 53014 53015 53016 53017
20430 5307 : 5307
20431 5329 : 5327 5328 5329 532x
20432 5373 : 5372 5373 537x
20433 5407 : 5407
20434 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
20435 5485
20436
20437 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
20438 Other combinations of -mcpu and -march are rejected.
20439
20440 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
20441 selected. It also defines "__mcf_family_family", where the value
20442 of family is given by the table above.
20443
20444 -mtune=tune
20445 Tune the code for a particular microarchitecture within the
20446 constraints set by -march and -mcpu. The M680x0 microarchitectures
20447 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
20448 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
20449
20450 You can also use -mtune=68020-40 for code that needs to run
20451 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
20452 is similar but includes 68060 targets as well. These two options
20453 select the same tuning decisions as -m68020-40 and -m68020-60
20454 respectively.
20455
20456 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
20457 680x0 architecture arch. It also defines "mcarch" unless either
20458 -ansi or a non-GNU -std option is used. If GCC is tuning for a
20459 range of architectures, as selected by -mtune=68020-40 or
20460 -mtune=68020-60, it defines the macros for every architecture in
20461 the range.
20462
20463 GCC also defines the macro "__muarch__" when tuning for ColdFire
20464 microarchitecture uarch, where uarch is one of the arguments given
20465 above.
20466
20467 -m68000
20468 -mc68000
20469 Generate output for a 68000. This is the default when the compiler
20470 is configured for 68000-based systems. It is equivalent to
20471 -march=68000.
20472
20473 Use this option for microcontrollers with a 68000 or EC000 core,
20474 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20475
20476 -m68010
20477 Generate output for a 68010. This is the default when the compiler
20478 is configured for 68010-based systems. It is equivalent to
20479 -march=68010.
20480
20481 -m68020
20482 -mc68020
20483 Generate output for a 68020. This is the default when the compiler
20484 is configured for 68020-based systems. It is equivalent to
20485 -march=68020.
20486
20487 -m68030
20488 Generate output for a 68030. This is the default when the compiler
20489 is configured for 68030-based systems. It is equivalent to
20490 -march=68030.
20491
20492 -m68040
20493 Generate output for a 68040. This is the default when the compiler
20494 is configured for 68040-based systems. It is equivalent to
20495 -march=68040.
20496
20497 This option inhibits the use of 68881/68882 instructions that have
20498 to be emulated by software on the 68040. Use this option if your
20499 68040 does not have code to emulate those instructions.
20500
20501 -m68060
20502 Generate output for a 68060. This is the default when the compiler
20503 is configured for 68060-based systems. It is equivalent to
20504 -march=68060.
20505
20506 This option inhibits the use of 68020 and 68881/68882 instructions
20507 that have to be emulated by software on the 68060. Use this option
20508 if your 68060 does not have code to emulate those instructions.
20509
20510 -mcpu32
20511 Generate output for a CPU32. This is the default when the compiler
20512 is configured for CPU32-based systems. It is equivalent to
20513 -march=cpu32.
20514
20515 Use this option for microcontrollers with a CPU32 or CPU32+ core,
20516 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
20517 68341, 68349 and 68360.
20518
20519 -m5200
20520 Generate output for a 520X ColdFire CPU. This is the default when
20521 the compiler is configured for 520X-based systems. It is
20522 equivalent to -mcpu=5206, and is now deprecated in favor of that
20523 option.
20524
20525 Use this option for microcontroller with a 5200 core, including the
20526 MCF5202, MCF5203, MCF5204 and MCF5206.
20527
20528 -m5206e
20529 Generate output for a 5206e ColdFire CPU. The option is now
20530 deprecated in favor of the equivalent -mcpu=5206e.
20531
20532 -m528x
20533 Generate output for a member of the ColdFire 528X family. The
20534 option is now deprecated in favor of the equivalent -mcpu=528x.
20535
20536 -m5307
20537 Generate output for a ColdFire 5307 CPU. The option is now
20538 deprecated in favor of the equivalent -mcpu=5307.
20539
20540 -m5407
20541 Generate output for a ColdFire 5407 CPU. The option is now
20542 deprecated in favor of the equivalent -mcpu=5407.
20543
20544 -mcfv4e
20545 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
20546 This includes use of hardware floating-point instructions. The
20547 option is equivalent to -mcpu=547x, and is now deprecated in favor
20548 of that option.
20549
20550 -m68020-40
20551 Generate output for a 68040, without using any of the new
20552 instructions. This results in code that can run relatively
20553 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20554 generated code does use the 68881 instructions that are emulated on
20555 the 68040.
20556
20557 The option is equivalent to -march=68020 -mtune=68020-40.
20558
20559 -m68020-60
20560 Generate output for a 68060, without using any of the new
20561 instructions. This results in code that can run relatively
20562 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20563 generated code does use the 68881 instructions that are emulated on
20564 the 68060.
20565
20566 The option is equivalent to -march=68020 -mtune=68020-60.
20567
20568 -mhard-float
20569 -m68881
20570 Generate floating-point instructions. This is the default for
20571 68020 and above, and for ColdFire devices that have an FPU. It
20572 defines the macro "__HAVE_68881__" on M680x0 targets and
20573 "__mcffpu__" on ColdFire targets.
20574
20575 -msoft-float
20576 Do not generate floating-point instructions; use library calls
20577 instead. This is the default for 68000, 68010, and 68832 targets.
20578 It is also the default for ColdFire devices that have no FPU.
20579
20580 -mdiv
20581 -mno-div
20582 Generate (do not generate) ColdFire hardware divide and remainder
20583 instructions. If -march is used without -mcpu, the default is "on"
20584 for ColdFire architectures and "off" for M680x0 architectures.
20585 Otherwise, the default is taken from the target CPU (either the
20586 default CPU, or the one specified by -mcpu). For example, the
20587 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
20588
20589 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
20590
20591 -mshort
20592 Consider type "int" to be 16 bits wide, like "short int".
20593 Additionally, parameters passed on the stack are also aligned to a
20594 16-bit boundary even on targets whose API mandates promotion to
20595 32-bit.
20596
20597 -mno-short
20598 Do not consider type "int" to be 16 bits wide. This is the
20599 default.
20600
20601 -mnobitfield
20602 -mno-bitfield
20603 Do not use the bit-field instructions. The -m68000, -mcpu32 and
20604 -m5200 options imply -mnobitfield.
20605
20606 -mbitfield
20607 Do use the bit-field instructions. The -m68020 option implies
20608 -mbitfield. This is the default if you use a configuration
20609 designed for a 68020.
20610
20611 -mrtd
20612 Use a different function-calling convention, in which functions
20613 that take a fixed number of arguments return with the "rtd"
20614 instruction, which pops their arguments while returning. This
20615 saves one instruction in the caller since there is no need to pop
20616 the arguments there.
20617
20618 This calling convention is incompatible with the one normally used
20619 on Unix, so you cannot use it if you need to call libraries
20620 compiled with the Unix compiler.
20621
20622 Also, you must provide function prototypes for all functions that
20623 take variable numbers of arguments (including "printf"); otherwise
20624 incorrect code is generated for calls to those functions.
20625
20626 In addition, seriously incorrect code results if you call a
20627 function with too many arguments. (Normally, extra arguments are
20628 harmlessly ignored.)
20629
20630 The "rtd" instruction is supported by the 68010, 68020, 68030,
20631 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20632
20633 The default is -mno-rtd.
20634
20635 -malign-int
20636 -mno-align-int
20637 Control whether GCC aligns "int", "long", "long long", "float",
20638 "double", and "long double" variables on a 32-bit boundary
20639 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
20640 variables on 32-bit boundaries produces code that runs somewhat
20641 faster on processors with 32-bit busses at the expense of more
20642 memory.
20643
20644 Warning: if you use the -malign-int switch, GCC aligns structures
20645 containing the above types differently than most published
20646 application binary interface specifications for the m68k.
20647
20648 Use the pc-relative addressing mode of the 68000 directly, instead
20649 of using a global offset table. At present, this option implies
20650 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
20651 -fPIC is not presently supported with -mpcrel, though this could be
20652 supported for 68020 and higher processors.
20653
20654 -mno-strict-align
20655 -mstrict-align
20656 Do not (do) assume that unaligned memory references are handled by
20657 the system.
20658
20659 -msep-data
20660 Generate code that allows the data segment to be located in a
20661 different area of memory from the text segment. This allows for
20662 execute-in-place in an environment without virtual memory
20663 management. This option implies -fPIC.
20664
20665 -mno-sep-data
20666 Generate code that assumes that the data segment follows the text
20667 segment. This is the default.
20668
20669 -mid-shared-library
20670 Generate code that supports shared libraries via the library ID
20671 method. This allows for execute-in-place and shared libraries in
20672 an environment without virtual memory management. This option
20673 implies -fPIC.
20674
20675 -mno-id-shared-library
20676 Generate code that doesn't assume ID-based shared libraries are
20677 being used. This is the default.
20678
20679 -mshared-library-id=n
20680 Specifies the identification number of the ID-based shared library
20681 being compiled. Specifying a value of 0 generates more compact
20682 code; specifying other values forces the allocation of that number
20683 to the current library, but is no more space- or time-efficient
20684 than omitting this option.
20685
20686 -mxgot
20687 -mno-xgot
20688 When generating position-independent code for ColdFire, generate
20689 code that works if the GOT has more than 8192 entries. This code
20690 is larger and slower than code generated without this option. On
20691 M680x0 processors, this option is not needed; -fPIC suffices.
20692
20693 GCC normally uses a single instruction to load values from the GOT.
20694 While this is relatively efficient, it only works if the GOT is
20695 smaller than about 64k. Anything larger causes the linker to
20696 report an error such as:
20697
20698 relocation truncated to fit: R_68K_GOT16O foobar
20699
20700 If this happens, you should recompile your code with -mxgot. It
20701 should then work with very large GOTs. However, code generated
20702 with -mxgot is less efficient, since it takes 4 instructions to
20703 fetch the value of a global symbol.
20704
20705 Note that some linkers, including newer versions of the GNU linker,
20706 can create multiple GOTs and sort GOT entries. If you have such a
20707 linker, you should only need to use -mxgot when compiling a single
20708 object file that accesses more than 8192 GOT entries. Very few do.
20709
20710 These options have no effect unless GCC is generating position-
20711 independent code.
20712
20713 -mlong-jump-table-offsets
20714 Use 32-bit offsets in "switch" tables. The default is to use
20715 16-bit offsets.
20716
20717 MCore Options
20718
20719 These are the -m options defined for the Motorola M*Core processors.
20720
20721 -mhardlit
20722 -mno-hardlit
20723 Inline constants into the code stream if it can be done in two
20724 instructions or less.
20725
20726 -mdiv
20727 -mno-div
20728 Use the divide instruction. (Enabled by default).
20729
20730 -mrelax-immediate
20731 -mno-relax-immediate
20732 Allow arbitrary-sized immediates in bit operations.
20733
20734 -mwide-bitfields
20735 -mno-wide-bitfields
20736 Always treat bit-fields as "int"-sized.
20737
20738 -m4byte-functions
20739 -mno-4byte-functions
20740 Force all functions to be aligned to a 4-byte boundary.
20741
20742 -mcallgraph-data
20743 -mno-callgraph-data
20744 Emit callgraph information.
20745
20746 -mslow-bytes
20747 -mno-slow-bytes
20748 Prefer word access when reading byte quantities.
20749
20750 -mlittle-endian
20751 -mbig-endian
20752 Generate code for a little-endian target.
20753
20754 -m210
20755 -m340
20756 Generate code for the 210 processor.
20757
20758 -mno-lsim
20759 Assume that runtime support has been provided and so omit the
20760 simulator library (libsim.a) from the linker command line.
20761
20762 -mstack-increment=size
20763 Set the maximum amount for a single stack increment operation.
20764 Large values can increase the speed of programs that contain
20765 functions that need a large amount of stack space, but they can
20766 also trigger a segmentation fault if the stack is extended too
20767 much. The default value is 0x1000.
20768
20769 MeP Options
20770
20771 -mabsdiff
20772 Enables the "abs" instruction, which is the absolute difference
20773 between two registers.
20774
20775 -mall-opts
20776 Enables all the optional instructions---average, multiply, divide,
20777 bit operations, leading zero, absolute difference, min/max, clip,
20778 and saturation.
20779
20780 -maverage
20781 Enables the "ave" instruction, which computes the average of two
20782 registers.
20783
20784 -mbased=n
20785 Variables of size n bytes or smaller are placed in the ".based"
20786 section by default. Based variables use the $tp register as a base
20787 register, and there is a 128-byte limit to the ".based" section.
20788
20789 -mbitops
20790 Enables the bit operation instructions---bit test ("btstm"), set
20791 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
20792 ("tas").
20793
20794 -mc=name
20795 Selects which section constant data is placed in. name may be
20796 tiny, near, or far.
20797
20798 -mclip
20799 Enables the "clip" instruction. Note that -mclip is not useful
20800 unless you also provide -mminmax.
20801
20802 -mconfig=name
20803 Selects one of the built-in core configurations. Each MeP chip has
20804 one or more modules in it; each module has a core CPU and a variety
20805 of coprocessors, optional instructions, and peripherals. The
20806 "MeP-Integrator" tool, not part of GCC, provides these
20807 configurations through this option; using this option is the same
20808 as using all the corresponding command-line options. The default
20809 configuration is default.
20810
20811 -mcop
20812 Enables the coprocessor instructions. By default, this is a 32-bit
20813 coprocessor. Note that the coprocessor is normally enabled via the
20814 -mconfig= option.
20815
20816 -mcop32
20817 Enables the 32-bit coprocessor's instructions.
20818
20819 -mcop64
20820 Enables the 64-bit coprocessor's instructions.
20821
20822 -mivc2
20823 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20824
20825 -mdc
20826 Causes constant variables to be placed in the ".near" section.
20827
20828 -mdiv
20829 Enables the "div" and "divu" instructions.
20830
20831 -meb
20832 Generate big-endian code.
20833
20834 -mel
20835 Generate little-endian code.
20836
20837 -mio-volatile
20838 Tells the compiler that any variable marked with the "io" attribute
20839 is to be considered volatile.
20840
20841 -ml Causes variables to be assigned to the ".far" section by default.
20842
20843 -mleadz
20844 Enables the "leadz" (leading zero) instruction.
20845
20846 -mm Causes variables to be assigned to the ".near" section by default.
20847
20848 -mminmax
20849 Enables the "min" and "max" instructions.
20850
20851 -mmult
20852 Enables the multiplication and multiply-accumulate instructions.
20853
20854 -mno-opts
20855 Disables all the optional instructions enabled by -mall-opts.
20856
20857 -mrepeat
20858 Enables the "repeat" and "erepeat" instructions, used for low-
20859 overhead looping.
20860
20861 -ms Causes all variables to default to the ".tiny" section. Note that
20862 there is a 65536-byte limit to this section. Accesses to these
20863 variables use the %gp base register.
20864
20865 -msatur
20866 Enables the saturation instructions. Note that the compiler does
20867 not currently generate these itself, but this option is included
20868 for compatibility with other tools, like "as".
20869
20870 -msdram
20871 Link the SDRAM-based runtime instead of the default ROM-based
20872 runtime.
20873
20874 -msim
20875 Link the simulator run-time libraries.
20876
20877 -msimnovec
20878 Link the simulator runtime libraries, excluding built-in support
20879 for reset and exception vectors and tables.
20880
20881 -mtf
20882 Causes all functions to default to the ".far" section. Without
20883 this option, functions default to the ".near" section.
20884
20885 -mtiny=n
20886 Variables that are n bytes or smaller are allocated to the ".tiny"
20887 section. These variables use the $gp base register. The default
20888 for this option is 4, but note that there's a 65536-byte limit to
20889 the ".tiny" section.
20890
20891 MicroBlaze Options
20892
20893 -msoft-float
20894 Use software emulation for floating point (default).
20895
20896 -mhard-float
20897 Use hardware floating-point instructions.
20898
20899 -mmemcpy
20900 Do not optimize block moves, use "memcpy".
20901
20902 -mno-clearbss
20903 This option is deprecated. Use -fno-zero-initialized-in-bss
20904 instead.
20905
20906 -mcpu=cpu-type
20907 Use features of, and schedule code for, the given CPU. Supported
20908 values are in the format vX.YY.Z, where X is a major version, YY is
20909 the minor version, and Z is compatibility code. Example values are
20910 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
20911
20912 -mxl-soft-mul
20913 Use software multiply emulation (default).
20914
20915 -mxl-soft-div
20916 Use software emulation for divides (default).
20917
20918 -mxl-barrel-shift
20919 Use the hardware barrel shifter.
20920
20921 -mxl-pattern-compare
20922 Use pattern compare instructions.
20923
20924 -msmall-divides
20925 Use table lookup optimization for small signed integer divisions.
20926
20927 -mxl-stack-check
20928 This option is deprecated. Use -fstack-check instead.
20929
20930 -mxl-gp-opt
20931 Use GP-relative ".sdata"/".sbss" sections.
20932
20933 -mxl-multiply-high
20934 Use multiply high instructions for high part of 32x32 multiply.
20935
20936 -mxl-float-convert
20937 Use hardware floating-point conversion instructions.
20938
20939 -mxl-float-sqrt
20940 Use hardware floating-point square root instruction.
20941
20942 -mbig-endian
20943 Generate code for a big-endian target.
20944
20945 -mlittle-endian
20946 Generate code for a little-endian target.
20947
20948 -mxl-reorder
20949 Use reorder instructions (swap and byte reversed load/store).
20950
20951 -mxl-mode-app-model
20952 Select application model app-model. Valid models are
20953
20954 executable
20955 normal executable (default), uses startup code crt0.o.
20956
20957 -mpic-data-is-text-relative
20958 Assume that the displacement between the text and data segments
20959 is fixed at static link time. This allows data to be
20960 referenced by offset from start of text address instead of GOT
20961 since PC-relative addressing is not supported.
20962
20963 xmdstub
20964 for use with Xilinx Microprocessor Debugger (XMD) based
20965 software intrusive debug agent called xmdstub. This uses
20966 startup file crt1.o and sets the start address of the program
20967 to 0x800.
20968
20969 bootstrap
20970 for applications that are loaded using a bootloader. This
20971 model uses startup file crt2.o which does not contain a
20972 processor reset vector handler. This is suitable for
20973 transferring control on a processor reset to the bootloader
20974 rather than the application.
20975
20976 novectors
20977 for applications that do not require any of the MicroBlaze
20978 vectors. This option may be useful for applications running
20979 within a monitoring application. This model uses crt3.o as a
20980 startup file.
20981
20982 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
20983 model.
20984
20985 MIPS Options
20986
20987 -EB Generate big-endian code.
20988
20989 -EL Generate little-endian code. This is the default for mips*el-*-*
20990 configurations.
20991
20992 -march=arch
20993 Generate code that runs on arch, which can be the name of a generic
20994 MIPS ISA, or the name of a particular processor. The ISA names
20995 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
20996 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
20997 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
20998 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
20999 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
21000 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
21001 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
21002 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
21003 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
21004 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
21005 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
21006 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
21007 and xlp. The special value from-abi selects the most compatible
21008 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
21009 and mips3 for 64-bit ABIs).
21010
21011 The native Linux/GNU toolchain also supports the value native,
21012 which selects the best architecture option for the host processor.
21013 -march=native has no effect if GCC does not recognize the
21014 processor.
21015
21016 In processor names, a final 000 can be abbreviated as k (for
21017 example, -march=r2k). Prefixes are optional, and vr may be written
21018 r.
21019
21020 Names of the form nf2_1 refer to processors with FPUs clocked at
21021 half the rate of the core, names of the form nf1_1 refer to
21022 processors with FPUs clocked at the same rate as the core, and
21023 names of the form nf3_2 refer to processors with FPUs clocked a
21024 ratio of 3:2 with respect to the core. For compatibility reasons,
21025 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
21026 as synonyms for nf1_1.
21027
21028 GCC defines two macros based on the value of this option. The
21029 first is "_MIPS_ARCH", which gives the name of target architecture,
21030 as a string. The second has the form "_MIPS_ARCH_foo", where foo
21031 is the capitalized value of "_MIPS_ARCH". For example,
21032 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
21033 "_MIPS_ARCH_R2000".
21034
21035 Note that the "_MIPS_ARCH" macro uses the processor names given
21036 above. In other words, it has the full prefix and does not
21037 abbreviate 000 as k. In the case of from-abi, the macro names the
21038 resolved architecture (either "mips1" or "mips3"). It names the
21039 default architecture when no -march option is given.
21040
21041 -mtune=arch
21042 Optimize for arch. Among other things, this option controls the
21043 way instructions are scheduled, and the perceived cost of
21044 arithmetic operations. The list of arch values is the same as for
21045 -march.
21046
21047 When this option is not used, GCC optimizes for the processor
21048 specified by -march. By using -march and -mtune together, it is
21049 possible to generate code that runs on a family of processors, but
21050 optimize the code for one particular member of that family.
21051
21052 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
21053 work in the same way as the -march ones described above.
21054
21055 -mips1
21056 Equivalent to -march=mips1.
21057
21058 -mips2
21059 Equivalent to -march=mips2.
21060
21061 -mips3
21062 Equivalent to -march=mips3.
21063
21064 -mips4
21065 Equivalent to -march=mips4.
21066
21067 -mips32
21068 Equivalent to -march=mips32.
21069
21070 -mips32r3
21071 Equivalent to -march=mips32r3.
21072
21073 -mips32r5
21074 Equivalent to -march=mips32r5.
21075
21076 -mips32r6
21077 Equivalent to -march=mips32r6.
21078
21079 -mips64
21080 Equivalent to -march=mips64.
21081
21082 -mips64r2
21083 Equivalent to -march=mips64r2.
21084
21085 -mips64r3
21086 Equivalent to -march=mips64r3.
21087
21088 -mips64r5
21089 Equivalent to -march=mips64r5.
21090
21091 -mips64r6
21092 Equivalent to -march=mips64r6.
21093
21094 -mips16
21095 -mno-mips16
21096 Generate (do not generate) MIPS16 code. If GCC is targeting a
21097 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
21098
21099 MIPS16 code generation can also be controlled on a per-function
21100 basis by means of "mips16" and "nomips16" attributes.
21101
21102 -mflip-mips16
21103 Generate MIPS16 code on alternating functions. This option is
21104 provided for regression testing of mixed MIPS16/non-MIPS16 code
21105 generation, and is not intended for ordinary use in compiling user
21106 code.
21107
21108 -minterlink-compressed
21109 -mno-interlink-compressed
21110 Require (do not require) that code using the standard
21111 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
21112 microMIPS code, and vice versa.
21113
21114 For example, code using the standard ISA encoding cannot jump
21115 directly to MIPS16 or microMIPS code; it must either use a call or
21116 an indirect jump. -minterlink-compressed therefore disables direct
21117 jumps unless GCC knows that the target of the jump is not
21118 compressed.
21119
21120 -minterlink-mips16
21121 -mno-interlink-mips16
21122 Aliases of -minterlink-compressed and -mno-interlink-compressed.
21123 These options predate the microMIPS ASE and are retained for
21124 backwards compatibility.
21125
21126 -mabi=32
21127 -mabi=o64
21128 -mabi=n32
21129 -mabi=64
21130 -mabi=eabi
21131 Generate code for the given ABI.
21132
21133 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21134 generates 64-bit code when you select a 64-bit architecture, but
21135 you can use -mgp32 to get 32-bit code instead.
21136
21137 For information about the O64 ABI, see
21138 <http://gcc.gnu.org/projects/mipso64-abi.html>.
21139
21140 GCC supports a variant of the o32 ABI in which floating-point
21141 registers are 64 rather than 32 bits wide. You can select this
21142 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
21143 and "mfhc1" instructions and is therefore only supported for
21144 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21145
21146 The register assignments for arguments and return values remain the
21147 same, but each scalar value is passed in a single 64-bit register
21148 rather than a pair of 32-bit registers. For example, scalar
21149 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
21150 The set of call-saved registers also remains the same in that the
21151 even-numbered double-precision registers are saved.
21152
21153 Two additional variants of the o32 ABI are supported to enable a
21154 transition from 32-bit to 64-bit registers. These are FPXX
21155 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
21156 mandates that all code must execute correctly when run using 32-bit
21157 or 64-bit registers. The code can be interlinked with either FP32
21158 or FP64, but not both. The FP64A extension is similar to the FP64
21159 extension but forbids the use of odd-numbered single-precision
21160 registers. This can be used in conjunction with the "FRE" mode of
21161 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
21162 interlink and run in the same process without changing FPU modes.
21163
21164 -mabicalls
21165 -mno-abicalls
21166 Generate (do not generate) code that is suitable for SVR4-style
21167 dynamic objects. -mabicalls is the default for SVR4-based systems.
21168
21169 -mshared
21170 -mno-shared
21171 Generate (do not generate) code that is fully position-independent,
21172 and that can therefore be linked into shared libraries. This
21173 option only affects -mabicalls.
21174
21175 All -mabicalls code has traditionally been position-independent,
21176 regardless of options like -fPIC and -fpic. However, as an
21177 extension, the GNU toolchain allows executables to use absolute
21178 accesses for locally-binding symbols. It can also use shorter GP
21179 initialization sequences and generate direct calls to locally-
21180 defined functions. This mode is selected by -mno-shared.
21181
21182 -mno-shared depends on binutils 2.16 or higher and generates
21183 objects that can only be linked by the GNU linker. However, the
21184 option does not affect the ABI of the final executable; it only
21185 affects the ABI of relocatable objects. Using -mno-shared
21186 generally makes executables both smaller and quicker.
21187
21188 -mshared is the default.
21189
21190 -mplt
21191 -mno-plt
21192 Assume (do not assume) that the static and dynamic linkers support
21193 PLTs and copy relocations. This option only affects -mno-shared
21194 -mabicalls. For the n64 ABI, this option has no effect without
21195 -msym32.
21196
21197 You can make -mplt the default by configuring GCC with
21198 --with-mips-plt. The default is -mno-plt otherwise.
21199
21200 -mxgot
21201 -mno-xgot
21202 Lift (do not lift) the usual restrictions on the size of the global
21203 offset table.
21204
21205 GCC normally uses a single instruction to load values from the GOT.
21206 While this is relatively efficient, it only works if the GOT is
21207 smaller than about 64k. Anything larger causes the linker to
21208 report an error such as:
21209
21210 relocation truncated to fit: R_MIPS_GOT16 foobar
21211
21212 If this happens, you should recompile your code with -mxgot. This
21213 works with very large GOTs, although the code is also less
21214 efficient, since it takes three instructions to fetch the value of
21215 a global symbol.
21216
21217 Note that some linkers can create multiple GOTs. If you have such
21218 a linker, you should only need to use -mxgot when a single object
21219 file accesses more than 64k's worth of GOT entries. Very few do.
21220
21221 These options have no effect unless GCC is generating position
21222 independent code.
21223
21224 -mgp32
21225 Assume that general-purpose registers are 32 bits wide.
21226
21227 -mgp64
21228 Assume that general-purpose registers are 64 bits wide.
21229
21230 -mfp32
21231 Assume that floating-point registers are 32 bits wide.
21232
21233 -mfp64
21234 Assume that floating-point registers are 64 bits wide.
21235
21236 -mfpxx
21237 Do not assume the width of floating-point registers.
21238
21239 -mhard-float
21240 Use floating-point coprocessor instructions.
21241
21242 -msoft-float
21243 Do not use floating-point coprocessor instructions. Implement
21244 floating-point calculations using library calls instead.
21245
21246 -mno-float
21247 Equivalent to -msoft-float, but additionally asserts that the
21248 program being compiled does not perform any floating-point
21249 operations. This option is presently supported only by some bare-
21250 metal MIPS configurations, where it may select a special set of
21251 libraries that lack all floating-point support (including, for
21252 example, the floating-point "printf" formats). If code compiled
21253 with -mno-float accidentally contains floating-point operations, it
21254 is likely to suffer a link-time or run-time failure.
21255
21256 -msingle-float
21257 Assume that the floating-point coprocessor only supports single-
21258 precision operations.
21259
21260 -mdouble-float
21261 Assume that the floating-point coprocessor supports double-
21262 precision operations. This is the default.
21263
21264 -modd-spreg
21265 -mno-odd-spreg
21266 Enable the use of odd-numbered single-precision floating-point
21267 registers for the o32 ABI. This is the default for processors that
21268 are known to support these registers. When using the o32 FPXX ABI,
21269 -mno-odd-spreg is set by default.
21270
21271 -mabs=2008
21272 -mabs=legacy
21273 These options control the treatment of the special not-a-number
21274 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
21275 machine instructions.
21276
21277 By default or when -mabs=legacy is used the legacy treatment is
21278 selected. In this case these instructions are considered
21279 arithmetic and avoided where correct operation is required and the
21280 input operand might be a NaN. A longer sequence of instructions
21281 that manipulate the sign bit of floating-point datum manually is
21282 used instead unless the -ffinite-math-only option has also been
21283 specified.
21284
21285 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
21286 case these instructions are considered non-arithmetic and therefore
21287 operating correctly in all cases, including in particular where the
21288 input operand is a NaN. These instructions are therefore always
21289 used for the respective operations.
21290
21291 -mnan=2008
21292 -mnan=legacy
21293 These options control the encoding of the special not-a-number
21294 (NaN) IEEE 754 floating-point data.
21295
21296 The -mnan=legacy option selects the legacy encoding. In this case
21297 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21298 significand field being 0, whereas signaling NaNs (sNaNs) are
21299 denoted by the first bit of their trailing significand field being
21300 1.
21301
21302 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
21303 case qNaNs are denoted by the first bit of their trailing
21304 significand field being 1, whereas sNaNs are denoted by the first
21305 bit of their trailing significand field being 0.
21306
21307 The default is -mnan=legacy unless GCC has been configured with
21308 --with-nan=2008.
21309
21310 -mllsc
21311 -mno-llsc
21312 Use (do not use) ll, sc, and sync instructions to implement atomic
21313 memory built-in functions. When neither option is specified, GCC
21314 uses the instructions if the target architecture supports them.
21315
21316 -mllsc is useful if the runtime environment can emulate the
21317 instructions and -mno-llsc can be useful when compiling for
21318 nonstandard ISAs. You can make either option the default by
21319 configuring GCC with --with-llsc and --without-llsc respectively.
21320 --with-llsc is the default for some configurations; see the
21321 installation documentation for details.
21322
21323 -mdsp
21324 -mno-dsp
21325 Use (do not use) revision 1 of the MIPS DSP ASE.
21326 This option defines the preprocessor macro "__mips_dsp". It also
21327 defines "__mips_dsp_rev" to 1.
21328
21329 -mdspr2
21330 -mno-dspr2
21331 Use (do not use) revision 2 of the MIPS DSP ASE.
21332 This option defines the preprocessor macros "__mips_dsp" and
21333 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
21334
21335 -msmartmips
21336 -mno-smartmips
21337 Use (do not use) the MIPS SmartMIPS ASE.
21338
21339 -mpaired-single
21340 -mno-paired-single
21341 Use (do not use) paired-single floating-point instructions.
21342 This option requires hardware floating-point support to be
21343 enabled.
21344
21345 -mdmx
21346 -mno-mdmx
21347 Use (do not use) MIPS Digital Media Extension instructions. This
21348 option can only be used when generating 64-bit code and requires
21349 hardware floating-point support to be enabled.
21350
21351 -mips3d
21352 -mno-mips3d
21353 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
21354 -mpaired-single.
21355
21356 -mmicromips
21357 -mno-micromips
21358 Generate (do not generate) microMIPS code.
21359
21360 MicroMIPS code generation can also be controlled on a per-function
21361 basis by means of "micromips" and "nomicromips" attributes.
21362
21363 -mmt
21364 -mno-mt
21365 Use (do not use) MT Multithreading instructions.
21366
21367 -mmcu
21368 -mno-mcu
21369 Use (do not use) the MIPS MCU ASE instructions.
21370
21371 -meva
21372 -mno-eva
21373 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21374
21375 -mvirt
21376 -mno-virt
21377 Use (do not use) the MIPS Virtualization (VZ) instructions.
21378
21379 -mxpa
21380 -mno-xpa
21381 Use (do not use) the MIPS eXtended Physical Address (XPA)
21382 instructions.
21383
21384 -mcrc
21385 -mno-crc
21386 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
21387 instructions.
21388
21389 -mginv
21390 -mno-ginv
21391 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21392
21393 -mloongson-mmi
21394 -mno-loongson-mmi
21395 Use (do not use) the MIPS Loongson MultiMedia extensions
21396 Instructions (MMI).
21397
21398 -mloongson-ext
21399 -mno-loongson-ext
21400 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21401
21402 -mloongson-ext2
21403 -mno-loongson-ext2
21404 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
21405 instructions.
21406
21407 -mlong64
21408 Force "long" types to be 64 bits wide. See -mlong32 for an
21409 explanation of the default and the way that the pointer size is
21410 determined.
21411
21412 -mlong32
21413 Force "long", "int", and pointer types to be 32 bits wide.
21414
21415 The default size of "int"s, "long"s and pointers depends on the
21416 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
21417 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
21418 "long"s. Pointers are the same size as "long"s, or the same size
21419 as integer registers, whichever is smaller.
21420
21421 -msym32
21422 -mno-sym32
21423 Assume (do not assume) that all symbols have 32-bit values,
21424 regardless of the selected ABI. This option is useful in
21425 combination with -mabi=64 and -mno-abicalls because it allows GCC
21426 to generate shorter and faster references to symbolic addresses.
21427
21428 -G num
21429 Put definitions of externally-visible data in a small data section
21430 if that data is no bigger than num bytes. GCC can then generate
21431 more efficient accesses to the data; see -mgpopt for details.
21432
21433 The default -G option depends on the configuration.
21434
21435 -mlocal-sdata
21436 -mno-local-sdata
21437 Extend (do not extend) the -G behavior to local data too, such as
21438 to static variables in C. -mlocal-sdata is the default for all
21439 configurations.
21440
21441 If the linker complains that an application is using too much small
21442 data, you might want to try rebuilding the less performance-
21443 critical parts with -mno-local-sdata. You might also want to build
21444 large libraries with -mno-local-sdata, so that the libraries leave
21445 more room for the main program.
21446
21447 -mextern-sdata
21448 -mno-extern-sdata
21449 Assume (do not assume) that externally-defined data is in a small
21450 data section if the size of that data is within the -G limit.
21451 -mextern-sdata is the default for all configurations.
21452
21453 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
21454 Mod references a variable Var that is no bigger than num bytes, you
21455 must make sure that Var is placed in a small data section. If Var
21456 is defined by another module, you must either compile that module
21457 with a high-enough -G setting or attach a "section" attribute to
21458 Var's definition. If Var is common, you must link the application
21459 with a high-enough -G setting.
21460
21461 The easiest way of satisfying these restrictions is to compile and
21462 link every module with the same -G option. However, you may wish
21463 to build a library that supports several different small data
21464 limits. You can do this by compiling the library with the highest
21465 supported -G setting and additionally using -mno-extern-sdata to
21466 stop the library from making assumptions about externally-defined
21467 data.
21468
21469 -mgpopt
21470 -mno-gpopt
21471 Use (do not use) GP-relative accesses for symbols that are known to
21472 be in a small data section; see -G, -mlocal-sdata and
21473 -mextern-sdata. -mgpopt is the default for all configurations.
21474
21475 -mno-gpopt is useful for cases where the $gp register might not
21476 hold the value of "_gp". For example, if the code is part of a
21477 library that might be used in a boot monitor, programs that call
21478 boot monitor routines pass an unknown value in $gp. (In such
21479 situations, the boot monitor itself is usually compiled with -G0.)
21480
21481 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
21482
21483 -membedded-data
21484 -mno-embedded-data
21485 Allocate variables to the read-only data section first if possible,
21486 then next in the small data section if possible, otherwise in data.
21487 This gives slightly slower code than the default, but reduces the
21488 amount of RAM required when executing, and thus may be preferred
21489 for some embedded systems.
21490
21491 -muninit-const-in-rodata
21492 -mno-uninit-const-in-rodata
21493 Put uninitialized "const" variables in the read-only data section.
21494 This option is only meaningful in conjunction with -membedded-data.
21495
21496 -mcode-readable=setting
21497 Specify whether GCC may generate code that reads from executable
21498 sections. There are three possible settings:
21499
21500 -mcode-readable=yes
21501 Instructions may freely access executable sections. This is
21502 the default setting.
21503
21504 -mcode-readable=pcrel
21505 MIPS16 PC-relative load instructions can access executable
21506 sections, but other instructions must not do so. This option
21507 is useful on 4KSc and 4KSd processors when the code TLBs have
21508 the Read Inhibit bit set. It is also useful on processors that
21509 can be configured to have a dual instruction/data SRAM
21510 interface and that, like the M4K, automatically redirect PC-
21511 relative loads to the instruction RAM.
21512
21513 -mcode-readable=no
21514 Instructions must not access executable sections. This option
21515 can be useful on targets that are configured to have a dual
21516 instruction/data SRAM interface but that (unlike the M4K) do
21517 not automatically redirect PC-relative loads to the instruction
21518 RAM.
21519
21520 -msplit-addresses
21521 -mno-split-addresses
21522 Enable (disable) use of the "%hi()" and "%lo()" assembler
21523 relocation operators. This option has been superseded by
21524 -mexplicit-relocs but is retained for backwards compatibility.
21525
21526 -mexplicit-relocs
21527 -mno-explicit-relocs
21528 Use (do not use) assembler relocation operators when dealing with
21529 symbolic addresses. The alternative, selected by
21530 -mno-explicit-relocs, is to use assembler macros instead.
21531
21532 -mexplicit-relocs is the default if GCC was configured to use an
21533 assembler that supports relocation operators.
21534
21535 -mcheck-zero-division
21536 -mno-check-zero-division
21537 Trap (do not trap) on integer division by zero.
21538
21539 The default is -mcheck-zero-division.
21540
21541 -mdivide-traps
21542 -mdivide-breaks
21543 MIPS systems check for division by zero by generating either a
21544 conditional trap or a break instruction. Using traps results in
21545 smaller code, but is only supported on MIPS II and later. Also,
21546 some versions of the Linux kernel have a bug that prevents trap
21547 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
21548 to allow conditional traps on architectures that support them and
21549 -mdivide-breaks to force the use of breaks.
21550
21551 The default is usually -mdivide-traps, but this can be overridden
21552 at configure time using --with-divide=breaks. Divide-by-zero
21553 checks can be completely disabled using -mno-check-zero-division.
21554
21555 -mload-store-pairs
21556 -mno-load-store-pairs
21557 Enable (disable) an optimization that pairs consecutive load or
21558 store instructions to enable load/store bonding. This option is
21559 enabled by default but only takes effect when the selected
21560 architecture is known to support bonding.
21561
21562 -mmemcpy
21563 -mno-memcpy
21564 Force (do not force) the use of "memcpy" for non-trivial block
21565 moves. The default is -mno-memcpy, which allows GCC to inline most
21566 constant-sized copies.
21567
21568 -mlong-calls
21569 -mno-long-calls
21570 Disable (do not disable) use of the "jal" instruction. Calling
21571 functions using "jal" is more efficient but requires the caller and
21572 callee to be in the same 256 megabyte segment.
21573
21574 This option has no effect on abicalls code. The default is
21575 -mno-long-calls.
21576
21577 -mmad
21578 -mno-mad
21579 Enable (disable) use of the "mad", "madu" and "mul" instructions,
21580 as provided by the R4650 ISA.
21581
21582 -mimadd
21583 -mno-imadd
21584 Enable (disable) use of the "madd" and "msub" integer instructions.
21585 The default is -mimadd on architectures that support "madd" and
21586 "msub" except for the 74k architecture where it was found to
21587 generate slower code.
21588
21589 -mfused-madd
21590 -mno-fused-madd
21591 Enable (disable) use of the floating-point multiply-accumulate
21592 instructions, when they are available. The default is
21593 -mfused-madd.
21594
21595 On the R8000 CPU when multiply-accumulate instructions are used,
21596 the intermediate product is calculated to infinite precision and is
21597 not subject to the FCSR Flush to Zero bit. This may be undesirable
21598 in some circumstances. On other processors the result is
21599 numerically identical to the equivalent computation using separate
21600 multiply, add, subtract and negate instructions.
21601
21602 -nocpp
21603 Tell the MIPS assembler to not run its preprocessor over user
21604 assembler files (with a .s suffix) when assembling them.
21605
21606 -mfix-24k
21607 -mno-fix-24k
21608 Work around the 24K E48 (lost data on stores during refill) errata.
21609 The workarounds are implemented by the assembler rather than by
21610 GCC.
21611
21612 -mfix-r4000
21613 -mno-fix-r4000
21614 Work around certain R4000 CPU errata:
21615
21616 - A double-word or a variable shift may give an incorrect result
21617 if executed immediately after starting an integer division.
21618
21619 - A double-word or a variable shift may give an incorrect result
21620 if executed while an integer multiplication is in progress.
21621
21622 - An integer division may give an incorrect result if started in
21623 a delay slot of a taken branch or a jump.
21624
21625 -mfix-r4400
21626 -mno-fix-r4400
21627 Work around certain R4400 CPU errata:
21628
21629 - A double-word or a variable shift may give an incorrect result
21630 if executed immediately after starting an integer division.
21631
21632 -mfix-r10000
21633 -mno-fix-r10000
21634 Work around certain R10000 errata:
21635
21636 - "ll"/"sc" sequences may not behave atomically on revisions
21637 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21638
21639 This option can only be used if the target architecture supports
21640 branch-likely instructions. -mfix-r10000 is the default when
21641 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
21642
21643 -mfix-r5900
21644 -mno-fix-r5900
21645 Do not attempt to schedule the preceding instruction into the delay
21646 slot of a branch instruction placed at the end of a short loop of
21647 six instructions or fewer and always schedule a "nop" instruction
21648 there instead. The short loop bug under certain conditions causes
21649 loops to execute only once or twice, due to a hardware bug in the
21650 R5900 chip. The workaround is implemented by the assembler rather
21651 than by GCC.
21652
21653 -mfix-rm7000
21654 -mno-fix-rm7000
21655 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
21656 are implemented by the assembler rather than by GCC.
21657
21658 -mfix-vr4120
21659 -mno-fix-vr4120
21660 Work around certain VR4120 errata:
21661
21662 - "dmultu" does not always produce the correct result.
21663
21664 - "div" and "ddiv" do not always produce the correct result if
21665 one of the operands is negative.
21666
21667 The workarounds for the division errata rely on special functions
21668 in libgcc.a. At present, these functions are only provided by the
21669 "mips64vr*-elf" configurations.
21670
21671 Other VR4120 errata require a NOP to be inserted between certain
21672 pairs of instructions. These errata are handled by the assembler,
21673 not by GCC itself.
21674
21675 -mfix-vr4130
21676 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
21677 implemented by the assembler rather than by GCC, although GCC
21678 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
21679 "dmacc" and "dmacchi" instructions are available instead.
21680
21681 -mfix-sb1
21682 -mno-fix-sb1
21683 Work around certain SB-1 CPU core errata. (This flag currently
21684 works around the SB-1 revision 2 "F1" and "F2" floating-point
21685 errata.)
21686
21687 -mr10k-cache-barrier=setting
21688 Specify whether GCC should insert cache barriers to avoid the side
21689 effects of speculation on R10K processors.
21690
21691 In common with many processors, the R10K tries to predict the
21692 outcome of a conditional branch and speculatively executes
21693 instructions from the "taken" branch. It later aborts these
21694 instructions if the predicted outcome is wrong. However, on the
21695 R10K, even aborted instructions can have side effects.
21696
21697 This problem only affects kernel stores and, depending on the
21698 system, kernel loads. As an example, a speculatively-executed
21699 store may load the target memory into cache and mark the cache line
21700 as dirty, even if the store itself is later aborted. If a DMA
21701 operation writes to the same area of memory before the "dirty" line
21702 is flushed, the cached data overwrites the DMA-ed data. See the
21703 R10K processor manual for a full description, including other
21704 potential problems.
21705
21706 One workaround is to insert cache barrier instructions before every
21707 memory access that might be speculatively executed and that might
21708 have side effects even if aborted. -mr10k-cache-barrier=setting
21709 controls GCC's implementation of this workaround. It assumes that
21710 aborted accesses to any byte in the following regions does not have
21711 side effects:
21712
21713 1. the memory occupied by the current function's stack frame;
21714
21715 2. the memory occupied by an incoming stack argument;
21716
21717 3. the memory occupied by an object with a link-time-constant
21718 address.
21719
21720 It is the kernel's responsibility to ensure that speculative
21721 accesses to these regions are indeed safe.
21722
21723 If the input program contains a function declaration such as:
21724
21725 void foo (void);
21726
21727 then the implementation of "foo" must allow "j foo" and "jal foo"
21728 to be executed speculatively. GCC honors this restriction for
21729 functions it compiles itself. It expects non-GCC functions (such
21730 as hand-written assembly code) to do the same.
21731
21732 The option has three forms:
21733
21734 -mr10k-cache-barrier=load-store
21735 Insert a cache barrier before a load or store that might be
21736 speculatively executed and that might have side effects even if
21737 aborted.
21738
21739 -mr10k-cache-barrier=store
21740 Insert a cache barrier before a store that might be
21741 speculatively executed and that might have side effects even if
21742 aborted.
21743
21744 -mr10k-cache-barrier=none
21745 Disable the insertion of cache barriers. This is the default
21746 setting.
21747
21748 -mflush-func=func
21749 -mno-flush-func
21750 Specifies the function to call to flush the I and D caches, or to
21751 not call any such function. If called, the function must take the
21752 same arguments as the common "_flush_func", that is, the address of
21753 the memory range for which the cache is being flushed, the size of
21754 the memory range, and the number 3 (to flush both caches). The
21755 default depends on the target GCC was configured for, but commonly
21756 is either "_flush_func" or "__cpu_flush".
21757
21758 mbranch-cost=num
21759 Set the cost of branches to roughly num "simple" instructions.
21760 This cost is only a heuristic and is not guaranteed to produce
21761 consistent results across releases. A zero cost redundantly
21762 selects the default, which is based on the -mtune setting.
21763
21764 -mbranch-likely
21765 -mno-branch-likely
21766 Enable or disable use of Branch Likely instructions, regardless of
21767 the default for the selected architecture. By default, Branch
21768 Likely instructions may be generated if they are supported by the
21769 selected architecture. An exception is for the MIPS32 and MIPS64
21770 architectures and processors that implement those architectures;
21771 for those, Branch Likely instructions are not be generated by
21772 default because the MIPS32 and MIPS64 architectures specifically
21773 deprecate their use.
21774
21775 -mcompact-branches=never
21776 -mcompact-branches=optimal
21777 -mcompact-branches=always
21778 These options control which form of branches will be generated.
21779 The default is -mcompact-branches=optimal.
21780
21781 The -mcompact-branches=never option ensures that compact branch
21782 instructions will never be generated.
21783
21784 The -mcompact-branches=always option ensures that a compact branch
21785 instruction will be generated if available. If a compact branch
21786 instruction is not available, a delay slot form of the branch will
21787 be used instead.
21788
21789 This option is supported from MIPS Release 6 onwards.
21790
21791 The -mcompact-branches=optimal option will cause a delay slot
21792 branch to be used if one is available in the current ISA and the
21793 delay slot is successfully filled. If the delay slot is not
21794 filled, a compact branch will be chosen if one is available.
21795
21796 -mfp-exceptions
21797 -mno-fp-exceptions
21798 Specifies whether FP exceptions are enabled. This affects how FP
21799 instructions are scheduled for some processors. The default is
21800 that FP exceptions are enabled.
21801
21802 For instance, on the SB-1, if FP exceptions are disabled, and we
21803 are emitting 64-bit code, then we can use both FP pipes.
21804 Otherwise, we can only use one FP pipe.
21805
21806 -mvr4130-align
21807 -mno-vr4130-align
21808 The VR4130 pipeline is two-way superscalar, but can only issue two
21809 instructions together if the first one is 8-byte aligned. When
21810 this option is enabled, GCC aligns pairs of instructions that it
21811 thinks should execute in parallel.
21812
21813 This option only has an effect when optimizing for the VR4130. It
21814 normally makes code faster, but at the expense of making it bigger.
21815 It is enabled by default at optimization level -O3.
21816
21817 -msynci
21818 -mno-synci
21819 Enable (disable) generation of "synci" instructions on
21820 architectures that support it. The "synci" instructions (if
21821 enabled) are generated when "__builtin___clear_cache" is compiled.
21822
21823 This option defaults to -mno-synci, but the default can be
21824 overridden by configuring GCC with --with-synci.
21825
21826 When compiling code for single processor systems, it is generally
21827 safe to use "synci". However, on many multi-core (SMP) systems, it
21828 does not invalidate the instruction caches on all cores and may
21829 lead to undefined behavior.
21830
21831 -mrelax-pic-calls
21832 -mno-relax-pic-calls
21833 Try to turn PIC calls that are normally dispatched via register $25
21834 into direct calls. This is only possible if the linker can resolve
21835 the destination at link time and if the destination is within range
21836 for a direct call.
21837
21838 -mrelax-pic-calls is the default if GCC was configured to use an
21839 assembler and a linker that support the ".reloc" assembly directive
21840 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
21841 this optimization can be performed by the assembler and the linker
21842 alone without help from the compiler.
21843
21844 -mmcount-ra-address
21845 -mno-mcount-ra-address
21846 Emit (do not emit) code that allows "_mcount" to modify the calling
21847 function's return address. When enabled, this option extends the
21848 usual "_mcount" interface with a new ra-address parameter, which
21849 has type "intptr_t *" and is passed in register $12. "_mcount" can
21850 then modify the return address by doing both of the following:
21851
21852 * Returning the new address in register $31.
21853
21854 * Storing the new address in "*ra-address", if ra-address is
21855 nonnull.
21856
21857 The default is -mno-mcount-ra-address.
21858
21859 -mframe-header-opt
21860 -mno-frame-header-opt
21861 Enable (disable) frame header optimization in the o32 ABI. When
21862 using the o32 ABI, calling functions will allocate 16 bytes on the
21863 stack for the called function to write out register arguments.
21864 When enabled, this optimization will suppress the allocation of the
21865 frame header if it can be determined that it is unused.
21866
21867 This optimization is off by default at all optimization levels.
21868
21869 -mlxc1-sxc1
21870 -mno-lxc1-sxc1
21871 When applicable, enable (disable) the generation of "lwxc1",
21872 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
21873
21874 -mmadd4
21875 -mno-madd4
21876 When applicable, enable (disable) the generation of 4-operand
21877 "madd.s", "madd.d" and related instructions. Enabled by default.
21878
21879 MMIX Options
21880
21881 These options are defined for the MMIX:
21882
21883 -mlibfuncs
21884 -mno-libfuncs
21885 Specify that intrinsic library functions are being compiled,
21886 passing all values in registers, no matter the size.
21887
21888 -mepsilon
21889 -mno-epsilon
21890 Generate floating-point comparison instructions that compare with
21891 respect to the "rE" epsilon register.
21892
21893 -mabi=mmixware
21894 -mabi=gnu
21895 Generate code that passes function parameters and return values
21896 that (in the called function) are seen as registers $0 and up, as
21897 opposed to the GNU ABI which uses global registers $231 and up.
21898
21899 -mzero-extend
21900 -mno-zero-extend
21901 When reading data from memory in sizes shorter than 64 bits, use
21902 (do not use) zero-extending load instructions by default, rather
21903 than sign-extending ones.
21904
21905 -mknuthdiv
21906 -mno-knuthdiv
21907 Make the result of a division yielding a remainder have the same
21908 sign as the divisor. With the default, -mno-knuthdiv, the sign of
21909 the remainder follows the sign of the dividend. Both methods are
21910 arithmetically valid, the latter being almost exclusively used.
21911
21912 -mtoplevel-symbols
21913 -mno-toplevel-symbols
21914 Prepend (do not prepend) a : to all global symbols, so the assembly
21915 code can be used with the "PREFIX" assembly directive.
21916
21917 -melf
21918 Generate an executable in the ELF format, rather than the default
21919 mmo format used by the mmix simulator.
21920
21921 -mbranch-predict
21922 -mno-branch-predict
21923 Use (do not use) the probable-branch instructions, when static
21924 branch prediction indicates a probable branch.
21925
21926 -mbase-addresses
21927 -mno-base-addresses
21928 Generate (do not generate) code that uses base addresses. Using a
21929 base address automatically generates a request (handled by the
21930 assembler and the linker) for a constant to be set up in a global
21931 register. The register is used for one or more base address
21932 requests within the range 0 to 255 from the value held in the
21933 register. The generally leads to short and fast code, but the
21934 number of different data items that can be addressed is limited.
21935 This means that a program that uses lots of static data may require
21936 -mno-base-addresses.
21937
21938 -msingle-exit
21939 -mno-single-exit
21940 Force (do not force) generated code to have a single exit point in
21941 each function.
21942
21943 MN10300 Options
21944
21945 These -m options are defined for Matsushita MN10300 architectures:
21946
21947 -mmult-bug
21948 Generate code to avoid bugs in the multiply instructions for the
21949 MN10300 processors. This is the default.
21950
21951 -mno-mult-bug
21952 Do not generate code to avoid bugs in the multiply instructions for
21953 the MN10300 processors.
21954
21955 -mam33
21956 Generate code using features specific to the AM33 processor.
21957
21958 -mno-am33
21959 Do not generate code using features specific to the AM33 processor.
21960 This is the default.
21961
21962 -mam33-2
21963 Generate code using features specific to the AM33/2.0 processor.
21964
21965 -mam34
21966 Generate code using features specific to the AM34 processor.
21967
21968 -mtune=cpu-type
21969 Use the timing characteristics of the indicated CPU type when
21970 scheduling instructions. This does not change the targeted
21971 processor type. The CPU type must be one of mn10300, am33, am33-2
21972 or am34.
21973
21974 -mreturn-pointer-on-d0
21975 When generating a function that returns a pointer, return the
21976 pointer in both "a0" and "d0". Otherwise, the pointer is returned
21977 only in "a0", and attempts to call such functions without a
21978 prototype result in errors. Note that this option is on by
21979 default; use -mno-return-pointer-on-d0 to disable it.
21980
21981 -mno-crt0
21982 Do not link in the C run-time initialization object file.
21983
21984 -mrelax
21985 Indicate to the linker that it should perform a relaxation
21986 optimization pass to shorten branches, calls and absolute memory
21987 addresses. This option only has an effect when used on the command
21988 line for the final link step.
21989
21990 This option makes symbolic debugging impossible.
21991
21992 -mliw
21993 Allow the compiler to generate Long Instruction Word instructions
21994 if the target is the AM33 or later. This is the default. This
21995 option defines the preprocessor macro "__LIW__".
21996
21997 -mno-liw
21998 Do not allow the compiler to generate Long Instruction Word
21999 instructions. This option defines the preprocessor macro
22000 "__NO_LIW__".
22001
22002 -msetlb
22003 Allow the compiler to generate the SETLB and Lcc instructions if
22004 the target is the AM33 or later. This is the default. This option
22005 defines the preprocessor macro "__SETLB__".
22006
22007 -mno-setlb
22008 Do not allow the compiler to generate SETLB or Lcc instructions.
22009 This option defines the preprocessor macro "__NO_SETLB__".
22010
22011 Moxie Options
22012
22013 -meb
22014 Generate big-endian code. This is the default for moxie-*-*
22015 configurations.
22016
22017 -mel
22018 Generate little-endian code.
22019
22020 -mmul.x
22021 Generate mul.x and umul.x instructions. This is the default for
22022 moxiebox-*-* configurations.
22023
22024 -mno-crt0
22025 Do not link in the C run-time initialization object file.
22026
22027 MSP430 Options
22028
22029 These options are defined for the MSP430:
22030
22031 -masm-hex
22032 Force assembly output to always use hex constants. Normally such
22033 constants are signed decimals, but this option is available for
22034 testsuite and/or aesthetic purposes.
22035
22036 -mmcu=
22037 Select the MCU to target. This is used to create a C preprocessor
22038 symbol based upon the MCU name, converted to upper case and pre-
22039 and post-fixed with __. This in turn is used by the msp430.h
22040 header file to select an MCU-specific supplementary header file.
22041
22042 The option also sets the ISA to use. If the MCU name is one that
22043 is known to only support the 430 ISA then that is selected,
22044 otherwise the 430X ISA is selected. A generic MCU name of msp430
22045 can also be used to select the 430 ISA. Similarly the generic
22046 msp430x MCU name selects the 430X ISA.
22047
22048 In addition an MCU-specific linker script is added to the linker
22049 command line. The script's name is the name of the MCU with .ld
22050 appended. Thus specifying -mmcu=xxx on the gcc command line
22051 defines the C preprocessor symbol "__XXX__" and cause the linker to
22052 search for a script called xxx.ld.
22053
22054 The ISA and hardware multiply supported for the different MCUs is
22055 hard-coded into GCC. However, an external devices.csv file can be
22056 used to extend device support beyond those that have been hard-
22057 coded.
22058
22059 GCC searches for the devices.csv file using the following methods
22060 in the given precedence order, where the first method takes
22061 precendence over the second which takes precedence over the third.
22062
22063 Include path specified with "-I" and "-L"
22064 devices.csv will be searched for in each of the directories
22065 specified by include paths and linker library search paths.
22066
22067 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
22068 Define the value of the global environment variable
22069 MSP430_GCC_INCLUDE_DIR to the full path to the directory
22070 containing devices.csv, and GCC will search this directory for
22071 devices.csv. If devices.csv is found, this directory will also
22072 be registered as an include path, and linker library path.
22073 Header files and linker scripts in this directory can therefore
22074 be used without manually specifying "-I" and "-L" on the
22075 command line.
22076
22077 The msp430-elf{,bare}/include/devices directory
22078 Finally, GCC will examine msp430-elf{,bare}/include/devices
22079 from the toolchain root directory. This directory does not
22080 exist in a default installation, but if the user has created it
22081 and copied devices.csv there, then the MCU data will be read.
22082 As above, this directory will also be registered as an include
22083 path, and linker library path.
22084
22085 If none of the above search methods find devices.csv, then the
22086 hard-coded MCU data is used.
22087
22088 -mwarn-mcu
22089 -mno-warn-mcu
22090 This option enables or disables warnings about conflicts between
22091 the MCU name specified by the -mmcu option and the ISA set by the
22092 -mcpu option and/or the hardware multiply support set by the
22093 -mhwmult option. It also toggles warnings about unrecognized MCU
22094 names. This option is on by default.
22095
22096 -mcpu=
22097 Specifies the ISA to use. Accepted values are msp430, msp430x and
22098 msp430xv2. This option is deprecated. The -mmcu= option should be
22099 used to select the ISA.
22100
22101 -msim
22102 Link to the simulator runtime libraries and linker script.
22103 Overrides any scripts that would be selected by the -mmcu= option.
22104
22105 -mlarge
22106 Use large-model addressing (20-bit pointers, 20-bit "size_t").
22107
22108 -msmall
22109 Use small-model addressing (16-bit pointers, 16-bit "size_t").
22110
22111 -mrelax
22112 This option is passed to the assembler and linker, and allows the
22113 linker to perform certain optimizations that cannot be done until
22114 the final link.
22115
22116 mhwmult=
22117 Describes the type of hardware multiply supported by the target.
22118 Accepted values are none for no hardware multiply, 16bit for the
22119 original 16-bit-only multiply supported by early MCUs. 32bit for
22120 the 16/32-bit multiply supported by later MCUs and f5series for the
22121 16/32-bit multiply supported by F5-series MCUs. A value of auto
22122 can also be given. This tells GCC to deduce the hardware multiply
22123 support based upon the MCU name provided by the -mmcu option. If
22124 no -mmcu option is specified or if the MCU name is not recognized
22125 then no hardware multiply support is assumed. "auto" is the
22126 default setting.
22127
22128 Hardware multiplies are normally performed by calling a library
22129 routine. This saves space in the generated code. When compiling
22130 at -O3 or higher however the hardware multiplier is invoked inline.
22131 This makes for bigger, but faster code.
22132
22133 The hardware multiply routines disable interrupts whilst running
22134 and restore the previous interrupt state when they finish. This
22135 makes them safe to use inside interrupt handlers as well as in
22136 normal code.
22137
22138 -minrt
22139 Enable the use of a minimum runtime environment - no static
22140 initializers or constructors. This is intended for memory-
22141 constrained devices. The compiler includes special symbols in some
22142 objects that tell the linker and runtime which code fragments are
22143 required.
22144
22145 -mtiny-printf
22146 Enable reduced code size "printf" and "puts" library functions.
22147 The tiny implementations of these functions are not reentrant, so
22148 must be used with caution in multi-threaded applications.
22149
22150 Support for streams has been removed and the string to be printed
22151 will always be sent to stdout via the "write" syscall. The string
22152 is not buffered before it is sent to write.
22153
22154 This option requires Newlib Nano IO, so GCC must be configured with
22155 --enable-newlib-nano-formatted-io.
22156
22157 -mmax-inline-shift=
22158 This option takes an integer between 0 and 64 inclusive, and sets
22159 the maximum number of inline shift instructions which should be
22160 emitted to perform a shift operation by a constant amount. When
22161 this value needs to be exceeded, an mspabi helper function is used
22162 instead. The default value is 4.
22163
22164 This only affects cases where a shift by multiple positions cannot
22165 be completed with a single instruction (e.g. all shifts >1 on the
22166 430 ISA).
22167
22168 Shifts of a 32-bit value are at least twice as costly, so the value
22169 passed for this option is divided by 2 and the resulting value used
22170 instead.
22171
22172 -mcode-region=
22173 -mdata-region=
22174 These options tell the compiler where to place functions and data
22175 that do not have one of the "lower", "upper", "either" or "section"
22176 attributes. Possible values are "lower", "upper", "either" or
22177 "any". The first three behave like the corresponding attribute.
22178 The fourth possible value - "any" - is the default. It leaves
22179 placement entirely up to the linker script and how it assigns the
22180 standard sections (".text", ".data", etc) to the memory regions.
22181
22182 -msilicon-errata=
22183 This option passes on a request to assembler to enable the fixes
22184 for the named silicon errata.
22185
22186 -msilicon-errata-warn=
22187 This option passes on a request to the assembler to enable warning
22188 messages when a silicon errata might need to be applied.
22189
22190 -mwarn-devices-csv
22191 -mno-warn-devices-csv
22192 Warn if devices.csv is not found or there are problem parsing it
22193 (default: on).
22194
22195 NDS32 Options
22196
22197 These options are defined for NDS32 implementations:
22198
22199 -mbig-endian
22200 Generate code in big-endian mode.
22201
22202 -mlittle-endian
22203 Generate code in little-endian mode.
22204
22205 -mreduced-regs
22206 Use reduced-set registers for register allocation.
22207
22208 -mfull-regs
22209 Use full-set registers for register allocation.
22210
22211 -mcmov
22212 Generate conditional move instructions.
22213
22214 -mno-cmov
22215 Do not generate conditional move instructions.
22216
22217 -mext-perf
22218 Generate performance extension instructions.
22219
22220 -mno-ext-perf
22221 Do not generate performance extension instructions.
22222
22223 -mext-perf2
22224 Generate performance extension 2 instructions.
22225
22226 -mno-ext-perf2
22227 Do not generate performance extension 2 instructions.
22228
22229 -mext-string
22230 Generate string extension instructions.
22231
22232 -mno-ext-string
22233 Do not generate string extension instructions.
22234
22235 -mv3push
22236 Generate v3 push25/pop25 instructions.
22237
22238 -mno-v3push
22239 Do not generate v3 push25/pop25 instructions.
22240
22241 -m16-bit
22242 Generate 16-bit instructions.
22243
22244 -mno-16-bit
22245 Do not generate 16-bit instructions.
22246
22247 -misr-vector-size=num
22248 Specify the size of each interrupt vector, which must be 4 or 16.
22249
22250 -mcache-block-size=num
22251 Specify the size of each cache block, which must be a power of 2
22252 between 4 and 512.
22253
22254 -march=arch
22255 Specify the name of the target architecture.
22256
22257 -mcmodel=code-model
22258 Set the code model to one of
22259
22260 small
22261 All the data and read-only data segments must be within 512KB
22262 addressing space. The text segment must be within 16MB
22263 addressing space.
22264
22265 medium
22266 The data segment must be within 512KB while the read-only data
22267 segment can be within 4GB addressing space. The text segment
22268 should be still within 16MB addressing space.
22269
22270 large
22271 All the text and data segments can be within 4GB addressing
22272 space.
22273
22274 -mctor-dtor
22275 Enable constructor/destructor feature.
22276
22277 -mrelax
22278 Guide linker to relax instructions.
22279
22280 Nios II Options
22281
22282 These are the options defined for the Altera Nios II processor.
22283
22284 -G num
22285 Put global and static objects less than or equal to num bytes into
22286 the small data or BSS sections instead of the normal data or BSS
22287 sections. The default value of num is 8.
22288
22289 -mgpopt=option
22290 -mgpopt
22291 -mno-gpopt
22292 Generate (do not generate) GP-relative accesses. The following
22293 option names are recognized:
22294
22295 none
22296 Do not generate GP-relative accesses.
22297
22298 local
22299 Generate GP-relative accesses for small data objects that are
22300 not external, weak, or uninitialized common symbols. Also use
22301 GP-relative addressing for objects that have been explicitly
22302 placed in a small data section via a "section" attribute.
22303
22304 global
22305 As for local, but also generate GP-relative accesses for small
22306 data objects that are external, weak, or common. If you use
22307 this option, you must ensure that all parts of your program
22308 (including libraries) are compiled with the same -G setting.
22309
22310 data
22311 Generate GP-relative accesses for all data objects in the
22312 program. If you use this option, the entire data and BSS
22313 segments of your program must fit in 64K of memory and you must
22314 use an appropriate linker script to allocate them within the
22315 addressable range of the global pointer.
22316
22317 all Generate GP-relative addresses for function pointers as well as
22318 data pointers. If you use this option, the entire text, data,
22319 and BSS segments of your program must fit in 64K of memory and
22320 you must use an appropriate linker script to allocate them
22321 within the addressable range of the global pointer.
22322
22323 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
22324 equivalent to -mgpopt=none.
22325
22326 The default is -mgpopt except when -fpic or -fPIC is specified to
22327 generate position-independent code. Note that the Nios II ABI does
22328 not permit GP-relative accesses from shared libraries.
22329
22330 You may need to specify -mno-gpopt explicitly when building
22331 programs that include large amounts of small data, including large
22332 GOT data sections. In this case, the 16-bit offset for GP-relative
22333 addressing may not be large enough to allow access to the entire
22334 small data section.
22335
22336 -mgprel-sec=regexp
22337 This option specifies additional section names that can be accessed
22338 via GP-relative addressing. It is most useful in conjunction with
22339 "section" attributes on variable declarations and a custom linker
22340 script. The regexp is a POSIX Extended Regular Expression.
22341
22342 This option does not affect the behavior of the -G option, and the
22343 specified sections are in addition to the standard ".sdata" and
22344 ".sbss" small-data sections that are recognized by -mgpopt.
22345
22346 -mr0rel-sec=regexp
22347 This option specifies names of sections that can be accessed via a
22348 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
22349 32-bit address space. It is most useful in conjunction with
22350 "section" attributes on variable declarations and a custom linker
22351 script. The regexp is a POSIX Extended Regular Expression.
22352
22353 In contrast to the use of GP-relative addressing for small data,
22354 zero-based addressing is never generated by default and there are
22355 no conventional section names used in standard linker scripts for
22356 sections in the low or high areas of memory.
22357
22358 -mel
22359 -meb
22360 Generate little-endian (default) or big-endian (experimental) code,
22361 respectively.
22362
22363 -march=arch
22364 This specifies the name of the target Nios II architecture. GCC
22365 uses this name to determine what kind of instructions it can emit
22366 when generating assembly code. Permissible names are: r1, r2.
22367
22368 The preprocessor macro "__nios2_arch__" is available to programs,
22369 with value 1 or 2, indicating the targeted ISA level.
22370
22371 -mbypass-cache
22372 -mno-bypass-cache
22373 Force all load and store instructions to always bypass cache by
22374 using I/O variants of the instructions. The default is not to
22375 bypass the cache.
22376
22377 -mno-cache-volatile
22378 -mcache-volatile
22379 Volatile memory access bypass the cache using the I/O variants of
22380 the load and store instructions. The default is not to bypass the
22381 cache.
22382
22383 -mno-fast-sw-div
22384 -mfast-sw-div
22385 Do not use table-based fast divide for small numbers. The default
22386 is to use the fast divide at -O3 and above.
22387
22388 -mno-hw-mul
22389 -mhw-mul
22390 -mno-hw-mulx
22391 -mhw-mulx
22392 -mno-hw-div
22393 -mhw-div
22394 Enable or disable emitting "mul", "mulx" and "div" family of
22395 instructions by the compiler. The default is to emit "mul" and not
22396 emit "div" and "mulx".
22397
22398 -mbmx
22399 -mno-bmx
22400 -mcdx
22401 -mno-cdx
22402 Enable or disable generation of Nios II R2 BMX (bit manipulation)
22403 and CDX (code density) instructions. Enabling these instructions
22404 also requires -march=r2. Since these instructions are optional
22405 extensions to the R2 architecture, the default is not to emit them.
22406
22407 -mcustom-insn=N
22408 -mno-custom-insn
22409 Each -mcustom-insn=N option enables use of a custom instruction
22410 with encoding N when generating code that uses insn. For example,
22411 -mcustom-fadds=253 generates custom instruction 253 for single-
22412 precision floating-point add operations instead of the default
22413 behavior of using a library call.
22414
22415 The following values of insn are supported. Except as otherwise
22416 noted, floating-point operations are expected to be implemented
22417 with normal IEEE 754 semantics and correspond directly to the C
22418 operators or the equivalent GCC built-in functions.
22419
22420 Single-precision floating point:
22421
22422 fadds, fsubs, fdivs, fmuls
22423 Binary arithmetic operations.
22424
22425 fnegs
22426 Unary negation.
22427
22428 fabss
22429 Unary absolute value.
22430
22431 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
22432 Comparison operations.
22433
22434 fmins, fmaxs
22435 Floating-point minimum and maximum. These instructions are
22436 only generated if -ffinite-math-only is specified.
22437
22438 fsqrts
22439 Unary square root operation.
22440
22441 fcoss, fsins, ftans, fatans, fexps, flogs
22442 Floating-point trigonometric and exponential functions. These
22443 instructions are only generated if -funsafe-math-optimizations
22444 is also specified.
22445
22446 Double-precision floating point:
22447
22448 faddd, fsubd, fdivd, fmuld
22449 Binary arithmetic operations.
22450
22451 fnegd
22452 Unary negation.
22453
22454 fabsd
22455 Unary absolute value.
22456
22457 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
22458 Comparison operations.
22459
22460 fmind, fmaxd
22461 Double-precision minimum and maximum. These instructions are
22462 only generated if -ffinite-math-only is specified.
22463
22464 fsqrtd
22465 Unary square root operation.
22466
22467 fcosd, fsind, ftand, fatand, fexpd, flogd
22468 Double-precision trigonometric and exponential functions.
22469 These instructions are only generated if
22470 -funsafe-math-optimizations is also specified.
22471
22472 Conversions:
22473
22474 fextsd
22475 Conversion from single precision to double precision.
22476
22477 ftruncds
22478 Conversion from double precision to single precision.
22479
22480 fixsi, fixsu, fixdi, fixdu
22481 Conversion from floating point to signed or unsigned integer
22482 types, with truncation towards zero.
22483
22484 round
22485 Conversion from single-precision floating point to signed
22486 integer, rounding to the nearest integer and ties away from
22487 zero. This corresponds to the "__builtin_lroundf" function
22488 when -fno-math-errno is used.
22489
22490 floatis, floatus, floatid, floatud
22491 Conversion from signed or unsigned integer types to floating-
22492 point types.
22493
22494 In addition, all of the following transfer instructions for
22495 internal registers X and Y must be provided to use any of the
22496 double-precision floating-point instructions. Custom instructions
22497 taking two double-precision source operands expect the first
22498 operand in the 64-bit register X. The other operand (or only
22499 operand of a unary operation) is given to the custom arithmetic
22500 instruction with the least significant half in source register src1
22501 and the most significant half in src2. A custom instruction that
22502 returns a double-precision result returns the most significant 32
22503 bits in the destination register and the other half in 32-bit
22504 register Y. GCC automatically generates the necessary code
22505 sequences to write register X and/or read register Y when double-
22506 precision floating-point instructions are used.
22507
22508 fwrx
22509 Write src1 into the least significant half of X and src2 into
22510 the most significant half of X.
22511
22512 fwry
22513 Write src1 into Y.
22514
22515 frdxhi, frdxlo
22516 Read the most or least (respectively) significant half of X and
22517 store it in dest.
22518
22519 frdy
22520 Read the value of Y and store it into dest.
22521
22522 Note that you can gain more local control over generation of Nios
22523 II custom instructions by using the "target("custom-insn=N")" and
22524 "target("no-custom-insn")" function attributes or pragmas.
22525
22526 -mcustom-fpu-cfg=name
22527 This option enables a predefined, named set of custom instruction
22528 encodings (see -mcustom-insn above). Currently, the following sets
22529 are defined:
22530
22531 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
22532 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
22533
22534 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
22535 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
22536 -fsingle-precision-constant
22537
22538 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
22539 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
22540 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
22541 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
22542 -mcustom-fdivs=255 -fsingle-precision-constant
22543
22544 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
22545 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
22546 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
22547 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
22548 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
22549 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
22550 -mcustom-fsubs=254 -mcustom-fdivs=255
22551
22552 Custom instruction assignments given by individual -mcustom-insn=
22553 options override those given by -mcustom-fpu-cfg=, regardless of
22554 the order of the options on the command line.
22555
22556 Note that you can gain more local control over selection of a FPU
22557 configuration by using the "target("custom-fpu-cfg=name")" function
22558 attribute or pragma.
22559
22560 The name fph2 is an abbreviation for Nios II Floating Point
22561 Hardware 2 Component. Please note that the custom instructions
22562 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
22563 generated if -ffinite-math-only is specified. The custom
22564 instruction enabled by -mcustom-round=248 is only generated if
22565 -fno-math-errno is specified. In contrast to the other
22566 configurations, -fsingle-precision-constant is not set.
22567
22568 These additional -m options are available for the Altera Nios II ELF
22569 (bare-metal) target:
22570
22571 -mhal
22572 Link with HAL BSP. This suppresses linking with the GCC-provided C
22573 runtime startup and termination code, and is typically used in
22574 conjunction with -msys-crt0= to specify the location of the
22575 alternate startup code provided by the HAL BSP.
22576
22577 -msmallc
22578 Link with a limited version of the C library, -lsmallc, rather than
22579 Newlib.
22580
22581 -msys-crt0=startfile
22582 startfile is the file name of the startfile (crt0) to use when
22583 linking. This option is only useful in conjunction with -mhal.
22584
22585 -msys-lib=systemlib
22586 systemlib is the library name of the library that provides low-
22587 level system calls required by the C library, e.g. "read" and
22588 "write". This option is typically used to link with a library
22589 provided by a HAL BSP.
22590
22591 Nvidia PTX Options
22592
22593 These options are defined for Nvidia PTX:
22594
22595 -m64
22596 Ignored, but preserved for backward compatibility. Only 64-bit ABI
22597 is supported.
22598
22599 -misa=ISA-string
22600 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
22601 strings must be lower-case. Valid ISA strings include sm_30 and
22602 sm_35. The default ISA is sm_35.
22603
22604 -mmainkernel
22605 Link in code for a __main kernel. This is for stand-alone instead
22606 of offloading execution.
22607
22608 -moptimize
22609 Apply partitioned execution optimizations. This is the default
22610 when any level of optimization is selected.
22611
22612 -msoft-stack
22613 Generate code that does not use ".local" memory directly for stack
22614 storage. Instead, a per-warp stack pointer is maintained
22615 explicitly. This enables variable-length stack allocation (with
22616 variable-length arrays or "alloca"), and when global memory is used
22617 for underlying storage, makes it possible to access automatic
22618 variables from other threads, or with atomic instructions. This
22619 code generation variant is used for OpenMP offloading, but the
22620 option is exposed on its own for the purpose of testing the
22621 compiler; to generate code suitable for linking into programs using
22622 OpenMP offloading, use option -mgomp.
22623
22624 -muniform-simt
22625 Switch to code generation variant that allows to execute all
22626 threads in each warp, while maintaining memory state and side
22627 effects as if only one thread in each warp was active outside of
22628 OpenMP SIMD regions. All atomic operations and calls to runtime
22629 (malloc, free, vprintf) are conditionally executed (iff current
22630 lane index equals the master lane index), and the register being
22631 assigned is copied via a shuffle instruction from the master lane.
22632 Outside of SIMD regions lane 0 is the master; inside, each thread
22633 sees itself as the master. Shared memory array "int __nvptx_uni[]"
22634 stores all-zeros or all-ones bitmasks for each warp, indicating
22635 current mode (0 outside of SIMD regions). Each thread can bitwise-
22636 and the bitmask at position "tid.y" with current lane index to
22637 compute the master lane index.
22638
22639 -mgomp
22640 Generate code for use in OpenMP offloading: enables -msoft-stack
22641 and -muniform-simt options, and selects corresponding multilib
22642 variant.
22643
22644 OpenRISC Options
22645
22646 These options are defined for OpenRISC:
22647
22648 -mboard=name
22649 Configure a board specific runtime. This will be passed to the
22650 linker for newlib board library linking. The default is "or1ksim".
22651
22652 -mnewlib
22653 This option is ignored; it is for compatibility purposes only.
22654 This used to select linker and preprocessor options for use with
22655 newlib.
22656
22657 -msoft-div
22658 -mhard-div
22659 Select software or hardware divide ("l.div", "l.divu")
22660 instructions. This default is hardware divide.
22661
22662 -msoft-mul
22663 -mhard-mul
22664 Select software or hardware multiply ("l.mul", "l.muli")
22665 instructions. This default is hardware multiply.
22666
22667 -msoft-float
22668 -mhard-float
22669 Select software or hardware for floating point operations. The
22670 default is software.
22671
22672 -mdouble-float
22673 When -mhard-float is selected, enables generation of double-
22674 precision floating point instructions. By default functions from
22675 libgcc are used to perform double-precision floating point
22676 operations.
22677
22678 -munordered-float
22679 When -mhard-float is selected, enables generation of unordered
22680 floating point compare and set flag ("lf.sfun*") instructions. By
22681 default functions from libgcc are used to perform unordered
22682 floating point compare and set flag operations.
22683
22684 -mcmov
22685 Enable generation of conditional move ("l.cmov") instructions. By
22686 default the equivalent will be generated using set and branch.
22687
22688 -mror
22689 Enable generation of rotate right ("l.ror") instructions. By
22690 default functions from libgcc are used to perform rotate right
22691 operations.
22692
22693 -mrori
22694 Enable generation of rotate right with immediate ("l.rori")
22695 instructions. By default functions from libgcc are used to perform
22696 rotate right with immediate operations.
22697
22698 -msext
22699 Enable generation of sign extension ("l.ext*") instructions. By
22700 default memory loads are used to perform sign extension.
22701
22702 -msfimm
22703 Enable generation of compare and set flag with immediate ("l.sf*i")
22704 instructions. By default extra instructions will be generated to
22705 store the immediate to a register first.
22706
22707 -mshftimm
22708 Enable generation of shift with immediate ("l.srai", "l.srli",
22709 "l.slli") instructions. By default extra instructions will be
22710 generated to store the immediate to a register first.
22711
22712 PDP-11 Options
22713
22714 These options are defined for the PDP-11:
22715
22716 -mfpu
22717 Use hardware FPP floating point. This is the default. (FIS
22718 floating point on the PDP-11/40 is not supported.) Implies -m45.
22719
22720 -msoft-float
22721 Do not use hardware floating point.
22722
22723 -mac0
22724 Return floating-point results in ac0 (fr0 in Unix assembler
22725 syntax).
22726
22727 -mno-ac0
22728 Return floating-point results in memory. This is the default.
22729
22730 -m40
22731 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22732
22733 -m45
22734 Generate code for a PDP-11/45. This is the default.
22735
22736 -m10
22737 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22738
22739 -mint16
22740 -mno-int32
22741 Use 16-bit "int". This is the default.
22742
22743 -mint32
22744 -mno-int16
22745 Use 32-bit "int".
22746
22747 -msplit
22748 Target has split instruction and data space. Implies -m45.
22749
22750 -munix-asm
22751 Use Unix assembler syntax.
22752
22753 -mdec-asm
22754 Use DEC assembler syntax.
22755
22756 -mgnu-asm
22757 Use GNU assembler syntax. This is the default.
22758
22759 -mlra
22760 Use the new LRA register allocator. By default, the old "reload"
22761 allocator is used.
22762
22763 picoChip Options
22764
22765 These -m options are defined for picoChip implementations:
22766
22767 -mae=ae_type
22768 Set the instruction set, register set, and instruction scheduling
22769 parameters for array element type ae_type. Supported values for
22770 ae_type are ANY, MUL, and MAC.
22771
22772 -mae=ANY selects a completely generic AE type. Code generated with
22773 this option runs on any of the other AE types. The code is not as
22774 efficient as it would be if compiled for a specific AE type, and
22775 some types of operation (e.g., multiplication) do not work properly
22776 on all types of AE.
22777
22778 -mae=MUL selects a MUL AE type. This is the most useful AE type
22779 for compiled code, and is the default.
22780
22781 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
22782 option may suffer from poor performance of byte (char)
22783 manipulation, since the DSP AE does not provide hardware support
22784 for byte load/stores.
22785
22786 -msymbol-as-address
22787 Enable the compiler to directly use a symbol name as an address in
22788 a load/store instruction, without first loading it into a register.
22789 Typically, the use of this option generates larger programs, which
22790 run faster than when the option isn't used. However, the results
22791 vary from program to program, so it is left as a user option,
22792 rather than being permanently enabled.
22793
22794 -mno-inefficient-warnings
22795 Disables warnings about the generation of inefficient code. These
22796 warnings can be generated, for example, when compiling code that
22797 performs byte-level memory operations on the MAC AE type. The MAC
22798 AE has no hardware support for byte-level memory operations, so all
22799 byte load/stores must be synthesized from word load/store
22800 operations. This is inefficient and a warning is generated to
22801 indicate that you should rewrite the code to avoid byte operations,
22802 or to target an AE type that has the necessary hardware support.
22803 This option disables these warnings.
22804
22805 PowerPC Options
22806
22807 These are listed under
22808
22809 PRU Options
22810
22811 These command-line options are defined for PRU target:
22812
22813 -minrt
22814 Link with a minimum runtime environment, with no support for static
22815 initializers and constructors. Using this option can significantly
22816 reduce the size of the final ELF binary. Beware that the compiler
22817 could still generate code with static initializers and
22818 constructors. It is up to the programmer to ensure that the source
22819 program will not use those features.
22820
22821 -mmcu=mcu
22822 Specify the PRU MCU variant to use. Check Newlib for the exact
22823 list of supported MCUs.
22824
22825 -mno-relax
22826 Make GCC pass the --no-relax command-line option to the linker
22827 instead of the --relax option.
22828
22829 -mloop
22830 Allow (or do not allow) GCC to use the LOOP instruction.
22831
22832 -mabi=variant
22833 Specify the ABI variant to output code for. -mabi=ti selects the
22834 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
22835 more naturally with certain GCC assumptions. These are the
22836 differences:
22837
22838 Function Pointer Size
22839 TI ABI specifies that function (code) pointers are 16-bit,
22840 whereas GNU supports only 32-bit data and code pointers.
22841
22842 Optional Return Value Pointer
22843 Function return values larger than 64 bits are passed by using
22844 a hidden pointer as the first argument of the function. TI
22845 ABI, though, mandates that the pointer can be NULL in case the
22846 caller is not using the returned value. GNU always passes and
22847 expects a valid return value pointer.
22848
22849 The current -mabi=ti implementation simply raises a compile error
22850 when any of the above code constructs is detected. As a
22851 consequence the standard C library cannot be built and it is
22852 omitted when linking with -mabi=ti.
22853
22854 Relaxation is a GNU feature and for safety reasons is disabled when
22855 using -mabi=ti. The TI toolchain does not emit relocations for
22856 QBBx instructions, so the GNU linker cannot adjust them when
22857 shortening adjacent LDI32 pseudo instructions.
22858
22859 RISC-V Options
22860
22861 These command-line options are defined for RISC-V targets:
22862
22863 -mbranch-cost=n
22864 Set the cost of branches to roughly n instructions.
22865
22866 -mplt
22867 -mno-plt
22868 When generating PIC code, do or don't allow the use of PLTs.
22869 Ignored for non-PIC. The default is -mplt.
22870
22871 -mabi=ABI-string
22872 Specify integer and floating-point calling convention. ABI-string
22873 contains two parts: the size of integer types and the registers
22874 used for floating-point types. For example -march=rv64ifd
22875 -mabi=lp64d means that long and pointers are 64-bit (implicitly
22876 defining int to be 32-bit), and that floating-point values up to 64
22877 bits wide are passed in F registers. Contrast this with
22878 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
22879 generate code that uses the F and D extensions but only allows
22880 floating-point values up to 32 bits long to be passed in registers;
22881 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
22882 will be passed in registers.
22883
22884 The default for this argument is system dependent, users who want a
22885 specific calling convention should specify one explicitly. The
22886 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
22887 and lp64d. Some calling conventions are impossible to implement on
22888 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
22889 because the ABI requires 64-bit values be passed in F registers,
22890 but F registers are only 32 bits wide. There is also the ilp32e
22891 ABI that can only be used with the rv32e architecture. This ABI is
22892 not well specified at present, and is subject to change.
22893
22894 -mfdiv
22895 -mno-fdiv
22896 Do or don't use hardware floating-point divide and square root
22897 instructions. This requires the F or D extensions for floating-
22898 point registers. The default is to use them if the specified
22899 architecture has these instructions.
22900
22901 -mdiv
22902 -mno-div
22903 Do or don't use hardware instructions for integer division. This
22904 requires the M extension. The default is to use them if the
22905 specified architecture has these instructions.
22906
22907 -march=ISA-string
22908 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
22909 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
22910
22911 When -march= is not specified, use the setting from -mcpu.
22912
22913 If both -march and -mcpu= are not specified, the default for this
22914 argument is system dependent, users who want a specific
22915 architecture extensions should specify one explicitly.
22916
22917 -mcpu=processor-string
22918 Use architecture of and optimize the output for the given
22919 processor, specified by particular CPU name. Permissible values
22920 for this option are: sifive-e20, sifive-e21, sifive-e24,
22921 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
22922 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
22923
22924 -mtune=processor-string
22925 Optimize the output for the given processor, specified by
22926 microarchitecture or particular CPU name. Permissible values for
22927 this option are: rocket, sifive-3-series, sifive-5-series,
22928 sifive-7-series, size, and all valid options for -mcpu=.
22929
22930 When -mtune= is not specified, use the setting from -mcpu, the
22931 default is rocket if both are not specified.
22932
22933 The size choice is not intended for use by end-users. This is used
22934 when -Os is specified. It overrides the instruction cost info
22935 provided by -mtune=, but does not override the pipeline info. This
22936 helps reduce code size while still giving good performance.
22937
22938 -mpreferred-stack-boundary=num
22939 Attempt to keep the stack boundary aligned to a 2 raised to num
22940 byte boundary. If -mpreferred-stack-boundary is not specified, the
22941 default is 4 (16 bytes or 128-bits).
22942
22943 Warning: If you use this switch, then you must build all modules
22944 with the same value, including any libraries. This includes the
22945 system libraries and startup modules.
22946
22947 -msmall-data-limit=n
22948 Put global and static data smaller than n bytes into a special
22949 section (on some targets).
22950
22951 -msave-restore
22952 -mno-save-restore
22953 Do or don't use smaller but slower prologue and epilogue code that
22954 uses library function calls. The default is to use fast inline
22955 prologues and epilogues.
22956
22957 -mshorten-memrefs
22958 -mno-shorten-memrefs
22959 Do or do not attempt to make more use of compressed load/store
22960 instructions by replacing a load/store of 'base register + large
22961 offset' with a new load/store of 'new base + small offset'. If the
22962 new base gets stored in a compressed register, then the new
22963 load/store can be compressed. Currently targets 32-bit integer
22964 load/stores only.
22965
22966 -mstrict-align
22967 -mno-strict-align
22968 Do not or do generate unaligned memory accesses. The default is
22969 set depending on whether the processor we are optimizing for
22970 supports fast unaligned access or not.
22971
22972 -mcmodel=medlow
22973 Generate code for the medium-low code model. The program and its
22974 statically defined symbols must lie within a single 2 GiB address
22975 range and must lie between absolute addresses -2 GiB and +2 GiB.
22976 Programs can be statically or dynamically linked. This is the
22977 default code model.
22978
22979 -mcmodel=medany
22980 Generate code for the medium-any code model. The program and its
22981 statically defined symbols must be within any single 2 GiB address
22982 range. Programs can be statically or dynamically linked.
22983
22984 -mexplicit-relocs
22985 -mno-exlicit-relocs
22986 Use or do not use assembler relocation operators when dealing with
22987 symbolic addresses. The alternative is to use assembler macros
22988 instead, which may limit optimization.
22989
22990 -mrelax
22991 -mno-relax
22992 Take advantage of linker relaxations to reduce the number of
22993 instructions required to materialize symbol addresses. The default
22994 is to take advantage of linker relaxations.
22995
22996 -memit-attribute
22997 -mno-emit-attribute
22998 Emit (do not emit) RISC-V attribute to record extra information
22999 into ELF objects. This feature requires at least binutils 2.32.
23000
23001 -malign-data=type
23002 Control how GCC aligns variables and constants of array, structure,
23003 or union types. Supported values for type are xlen which uses x
23004 register width as the alignment value, and natural which uses
23005 natural alignment. xlen is the default.
23006
23007 -mbig-endian
23008 Generate big-endian code. This is the default when GCC is
23009 configured for a riscv64be-*-* or riscv32be-*-* target.
23010
23011 -mlittle-endian
23012 Generate little-endian code. This is the default when GCC is
23013 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
23014 or riscv32be-*-* target.
23015
23016 -mstack-protector-guard=guard
23017 -mstack-protector-guard-reg=reg
23018 -mstack-protector-guard-offset=offset
23019 Generate stack protection code using canary at guard. Supported
23020 locations are global for a global canary or tls for per-thread
23021 canary in the TLS block.
23022
23023 With the latter choice the options -mstack-protector-guard-reg=reg
23024 and -mstack-protector-guard-offset=offset furthermore specify which
23025 register to use as base register for reading the canary, and from
23026 what offset from that base register. There is no default register
23027 or offset as this is entirely for use within the Linux kernel.
23028
23029 RL78 Options
23030
23031 -msim
23032 Links in additional target libraries to support operation within a
23033 simulator.
23034
23035 -mmul=none
23036 -mmul=g10
23037 -mmul=g13
23038 -mmul=g14
23039 -mmul=rl78
23040 Specifies the type of hardware multiplication and division support
23041 to be used. The simplest is "none", which uses software for both
23042 multiplication and division. This is the default. The "g13" value
23043 is for the hardware multiply/divide peripheral found on the
23044 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
23045 multiplication and division instructions supported by the RL78/G14
23046 (S3 core) parts. The value "rl78" is an alias for "g14" and the
23047 value "mg10" is an alias for "none".
23048
23049 In addition a C preprocessor macro is defined, based upon the
23050 setting of this option. Possible values are: "__RL78_MUL_NONE__",
23051 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
23052
23053 -mcpu=g10
23054 -mcpu=g13
23055 -mcpu=g14
23056 -mcpu=rl78
23057 Specifies the RL78 core to target. The default is the G14 core,
23058 also known as an S3 core or just RL78. The G13 or S2 core does not
23059 have multiply or divide instructions, instead it uses a hardware
23060 peripheral for these operations. The G10 or S1 core does not have
23061 register banks, so it uses a different calling convention.
23062
23063 If this option is set it also selects the type of hardware multiply
23064 support to use, unless this is overridden by an explicit -mmul=none
23065 option on the command line. Thus specifying -mcpu=g13 enables the
23066 use of the G13 hardware multiply peripheral and specifying
23067 -mcpu=g10 disables the use of hardware multiplications altogether.
23068
23069 Note, although the RL78/G14 core is the default target, specifying
23070 -mcpu=g14 or -mcpu=rl78 on the command line does change the
23071 behavior of the toolchain since it also enables G14 hardware
23072 multiply support. If these options are not specified on the
23073 command line then software multiplication routines will be used
23074 even though the code targets the RL78 core. This is for backwards
23075 compatibility with older toolchains which did not have hardware
23076 multiply and divide support.
23077
23078 In addition a C preprocessor macro is defined, based upon the
23079 setting of this option. Possible values are: "__RL78_G10__",
23080 "__RL78_G13__" or "__RL78_G14__".
23081
23082 -mg10
23083 -mg13
23084 -mg14
23085 -mrl78
23086 These are aliases for the corresponding -mcpu= option. They are
23087 provided for backwards compatibility.
23088
23089 -mallregs
23090 Allow the compiler to use all of the available registers. By
23091 default registers "r24..r31" are reserved for use in interrupt
23092 handlers. With this option enabled these registers can be used in
23093 ordinary functions as well.
23094
23095 -m64bit-doubles
23096 -m32bit-doubles
23097 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
23098 (-m32bit-doubles) in size. The default is -m32bit-doubles.
23099
23100 -msave-mduc-in-interrupts
23101 -mno-save-mduc-in-interrupts
23102 Specifies that interrupt handler functions should preserve the MDUC
23103 registers. This is only necessary if normal code might use the
23104 MDUC registers, for example because it performs multiplication and
23105 division operations. The default is to ignore the MDUC registers
23106 as this makes the interrupt handlers faster. The target option
23107 -mg13 needs to be passed for this to work as this feature is only
23108 available on the G13 target (S2 core). The MDUC registers will
23109 only be saved if the interrupt handler performs a multiplication or
23110 division operation or it calls another function.
23111
23112 IBM RS/6000 and PowerPC Options
23113
23114 These -m options are defined for the IBM RS/6000 and PowerPC:
23115
23116 -mpowerpc-gpopt
23117 -mno-powerpc-gpopt
23118 -mpowerpc-gfxopt
23119 -mno-powerpc-gfxopt
23120 -mpowerpc64
23121 -mno-powerpc64
23122 -mmfcrf
23123 -mno-mfcrf
23124 -mpopcntb
23125 -mno-popcntb
23126 -mpopcntd
23127 -mno-popcntd
23128 -mfprnd
23129 -mno-fprnd
23130 -mcmpb
23131 -mno-cmpb
23132 -mhard-dfp
23133 -mno-hard-dfp
23134 You use these options to specify which instructions are available
23135 on the processor you are using. The default value of these options
23136 is determined when configuring GCC. Specifying the -mcpu=cpu_type
23137 overrides the specification of these options. We recommend you use
23138 the -mcpu=cpu_type option rather than the options listed above.
23139
23140 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
23141 architecture instructions in the General Purpose group, including
23142 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
23143 to use the optional PowerPC architecture instructions in the
23144 Graphics group, including floating-point select.
23145
23146 The -mmfcrf option allows GCC to generate the move from condition
23147 register field instruction implemented on the POWER4 processor and
23148 other processors that support the PowerPC V2.01 architecture. The
23149 -mpopcntb option allows GCC to generate the popcount and double-
23150 precision FP reciprocal estimate instruction implemented on the
23151 POWER5 processor and other processors that support the PowerPC
23152 V2.02 architecture. The -mpopcntd option allows GCC to generate
23153 the popcount instruction implemented on the POWER7 processor and
23154 other processors that support the PowerPC V2.06 architecture. The
23155 -mfprnd option allows GCC to generate the FP round to integer
23156 instructions implemented on the POWER5+ processor and other
23157 processors that support the PowerPC V2.03 architecture. The -mcmpb
23158 option allows GCC to generate the compare bytes instruction
23159 implemented on the POWER6 processor and other processors that
23160 support the PowerPC V2.05 architecture. The -mhard-dfp option
23161 allows GCC to generate the decimal floating-point instructions
23162 implemented on some POWER processors.
23163
23164 The -mpowerpc64 option allows GCC to generate the additional 64-bit
23165 instructions that are found in the full PowerPC64 architecture and
23166 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23167 -mno-powerpc64.
23168
23169 -mcpu=cpu_type
23170 Set architecture type, register usage, and instruction scheduling
23171 parameters for machine type cpu_type. Supported values for
23172 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
23173 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
23174 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
23175 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
23176 power4, power5, power5+, power6, power6x, power7, power8, power9,
23177 future, powerpc, powerpc64, powerpc64le, rs64, and native.
23178
23179 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
23180 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
23181 64-bit little endian PowerPC architecture machine types, with an
23182 appropriate, generic processor model assumed for scheduling
23183 purposes.
23184
23185 Specifying native as cpu type detects and selects the architecture
23186 option that corresponds to the host processor of the system
23187 performing the compilation. -mcpu=native has no effect if GCC does
23188 not recognize the processor.
23189
23190 The other options specify a specific processor. Code generated
23191 under those options runs best on that processor, and may not run at
23192 all on others.
23193
23194 The -mcpu options automatically enable or disable the following
23195 options:
23196
23197 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
23198 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
23199 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
23200 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
23201 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
23202
23203 The particular options set for any particular CPU varies between
23204 compiler versions, depending on what setting seems to produce
23205 optimal code for that CPU; it doesn't necessarily reflect the
23206 actual hardware's capabilities. If you wish to set an individual
23207 option to a particular value, you may specify it after the -mcpu
23208 option, like -mcpu=970 -mno-altivec.
23209
23210 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
23211 disabled by the -mcpu option at present because AIX does not have
23212 full support for these options. You may still enable or disable
23213 them individually if you're sure it'll work in your environment.
23214
23215 -mtune=cpu_type
23216 Set the instruction scheduling parameters for machine type
23217 cpu_type, but do not set the architecture type or register usage,
23218 as -mcpu=cpu_type does. The same values for cpu_type are used for
23219 -mtune as for -mcpu. If both are specified, the code generated
23220 uses the architecture and registers set by -mcpu, but the
23221 scheduling parameters set by -mtune.
23222
23223 -mcmodel=small
23224 Generate PowerPC64 code for the small model: The TOC is limited to
23225 64k.
23226
23227 -mcmodel=medium
23228 Generate PowerPC64 code for the medium model: The TOC and other
23229 static data may be up to a total of 4G in size. This is the
23230 default for 64-bit Linux.
23231
23232 -mcmodel=large
23233 Generate PowerPC64 code for the large model: The TOC may be up to
23234 4G in size. Other data and code is only limited by the 64-bit
23235 address space.
23236
23237 -maltivec
23238 -mno-altivec
23239 Generate code that uses (does not use) AltiVec instructions, and
23240 also enable the use of built-in functions that allow more direct
23241 access to the AltiVec instruction set. You may also need to set
23242 -mabi=altivec to adjust the current ABI with AltiVec ABI
23243 enhancements.
23244
23245 When -maltivec is used, the element order for AltiVec intrinsics
23246 such as "vec_splat", "vec_extract", and "vec_insert" match array
23247 element order corresponding to the endianness of the target. That
23248 is, element zero identifies the leftmost element in a vector
23249 register when targeting a big-endian platform, and identifies the
23250 rightmost element in a vector register when targeting a little-
23251 endian platform.
23252
23253 -mvrsave
23254 -mno-vrsave
23255 Generate VRSAVE instructions when generating AltiVec code.
23256
23257 -msecure-plt
23258 Generate code that allows ld and ld.so to build executables and
23259 shared libraries with non-executable ".plt" and ".got" sections.
23260 This is a PowerPC 32-bit SYSV ABI option.
23261
23262 -mbss-plt
23263 Generate code that uses a BSS ".plt" section that ld.so fills in,
23264 and requires ".plt" and ".got" sections that are both writable and
23265 executable. This is a PowerPC 32-bit SYSV ABI option.
23266
23267 -misel
23268 -mno-isel
23269 This switch enables or disables the generation of ISEL
23270 instructions.
23271
23272 -mvsx
23273 -mno-vsx
23274 Generate code that uses (does not use) vector/scalar (VSX)
23275 instructions, and also enable the use of built-in functions that
23276 allow more direct access to the VSX instruction set.
23277
23278 -mcrypto
23279 -mno-crypto
23280 Enable the use (disable) of the built-in functions that allow
23281 direct access to the cryptographic instructions that were added in
23282 version 2.07 of the PowerPC ISA.
23283
23284 -mhtm
23285 -mno-htm
23286 Enable (disable) the use of the built-in functions that allow
23287 direct access to the Hardware Transactional Memory (HTM)
23288 instructions that were added in version 2.07 of the PowerPC ISA.
23289
23290 -mpower8-fusion
23291 -mno-power8-fusion
23292 Generate code that keeps (does not keeps) some integer operations
23293 adjacent so that the instructions can be fused together on power8
23294 and later processors.
23295
23296 -mpower8-vector
23297 -mno-power8-vector
23298 Generate code that uses (does not use) the vector and scalar
23299 instructions that were added in version 2.07 of the PowerPC ISA.
23300 Also enable the use of built-in functions that allow more direct
23301 access to the vector instructions.
23302
23303 -mquad-memory
23304 -mno-quad-memory
23305 Generate code that uses (does not use) the non-atomic quad word
23306 memory instructions. The -mquad-memory option requires use of
23307 64-bit mode.
23308
23309 -mquad-memory-atomic
23310 -mno-quad-memory-atomic
23311 Generate code that uses (does not use) the atomic quad word memory
23312 instructions. The -mquad-memory-atomic option requires use of
23313 64-bit mode.
23314
23315 -mfloat128
23316 -mno-float128
23317 Enable/disable the __float128 keyword for IEEE 128-bit floating
23318 point and use either software emulation for IEEE 128-bit floating
23319 point or hardware instructions.
23320
23321 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
23322 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
23323 support. The IEEE 128-bit floating point support only works on
23324 PowerPC Linux systems.
23325
23326 The default for -mfloat128 is enabled on PowerPC Linux systems
23327 using the VSX instruction set, and disabled on other systems.
23328
23329 If you use the ISA 3.0 instruction set (-mpower9-vector or
23330 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
23331 support will also enable the generation of ISA 3.0 IEEE 128-bit
23332 floating point instructions. Otherwise, if you do not specify to
23333 generate ISA 3.0 instructions or you are targeting a 32-bit big
23334 endian system, IEEE 128-bit floating point will be done with
23335 software emulation.
23336
23337 -mfloat128-hardware
23338 -mno-float128-hardware
23339 Enable/disable using ISA 3.0 hardware instructions to support the
23340 __float128 data type.
23341
23342 The default for -mfloat128-hardware is enabled on PowerPC Linux
23343 systems using the ISA 3.0 instruction set, and disabled on other
23344 systems.
23345
23346 -m32
23347 -m64
23348 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23349 targets (including GNU/Linux). The 32-bit environment sets int,
23350 long and pointer to 32 bits and generates code that runs on any
23351 PowerPC variant. The 64-bit environment sets int to 32 bits and
23352 long and pointer to 64 bits, and generates code for PowerPC64, as
23353 for -mpowerpc64.
23354
23355 -mfull-toc
23356 -mno-fp-in-toc
23357 -mno-sum-in-toc
23358 -mminimal-toc
23359 Modify generation of the TOC (Table Of Contents), which is created
23360 for every executable file. The -mfull-toc option is selected by
23361 default. In that case, GCC allocates at least one TOC entry for
23362 each unique non-automatic variable reference in your program. GCC
23363 also places floating-point constants in the TOC. However, only
23364 16,384 entries are available in the TOC.
23365
23366 If you receive a linker error message that saying you have
23367 overflowed the available TOC space, you can reduce the amount of
23368 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
23369 -mno-fp-in-toc prevents GCC from putting floating-point constants
23370 in the TOC and -mno-sum-in-toc forces GCC to generate code to
23371 calculate the sum of an address and a constant at run time instead
23372 of putting that sum into the TOC. You may specify one or both of
23373 these options. Each causes GCC to produce very slightly slower and
23374 larger code at the expense of conserving TOC space.
23375
23376 If you still run out of space in the TOC even when you specify both
23377 of these options, specify -mminimal-toc instead. This option
23378 causes GCC to make only one TOC entry for every file. When you
23379 specify this option, GCC produces code that is slower and larger
23380 but which uses extremely little TOC space. You may wish to use
23381 this option only on files that contain less frequently-executed
23382 code.
23383
23384 -maix64
23385 -maix32
23386 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
23387 64-bit "long" type, and the infrastructure needed to support them.
23388 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
23389 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
23390
23391 -mxl-compat
23392 -mno-xl-compat
23393 Produce code that conforms more closely to IBM XL compiler
23394 semantics when using AIX-compatible ABI. Pass floating-point
23395 arguments to prototyped functions beyond the register save area
23396 (RSA) on the stack in addition to argument FPRs. Do not assume
23397 that most significant double in 128-bit long double value is
23398 properly rounded when comparing values and converting to double.
23399 Use XL symbol names for long double support routines.
23400
23401 The AIX calling convention was extended but not initially
23402 documented to handle an obscure K&R C case of calling a function
23403 that takes the address of its arguments with fewer arguments than
23404 declared. IBM XL compilers access floating-point arguments that do
23405 not fit in the RSA from the stack when a subroutine is compiled
23406 without optimization. Because always storing floating-point
23407 arguments on the stack is inefficient and rarely needed, this
23408 option is not enabled by default and only is necessary when calling
23409 subroutines compiled by IBM XL compilers without optimization.
23410
23411 -mpe
23412 Support IBM RS/6000 SP Parallel Environment (PE). Link an
23413 application written to use message passing with special startup
23414 code to enable the application to run. The system must have PE
23415 installed in the standard location (/usr/lpp/ppe.poe/), or the
23416 specs file must be overridden with the -specs= option to specify
23417 the appropriate directory location. The Parallel Environment does
23418 not support threads, so the -mpe option and the -pthread option are
23419 incompatible.
23420
23421 -malign-natural
23422 -malign-power
23423 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23424 -malign-natural overrides the ABI-defined alignment of larger
23425 types, such as floating-point doubles, on their natural size-based
23426 boundary. The option -malign-power instructs GCC to follow the
23427 ABI-specified alignment rules. GCC defaults to the standard
23428 alignment defined in the ABI.
23429
23430 On 64-bit Darwin, natural alignment is the default, and
23431 -malign-power is not supported.
23432
23433 -msoft-float
23434 -mhard-float
23435 Generate code that does not use (uses) the floating-point register
23436 set. Software floating-point emulation is provided if you use the
23437 -msoft-float option, and pass the option to GCC when linking.
23438
23439 -mmultiple
23440 -mno-multiple
23441 Generate code that uses (does not use) the load multiple word
23442 instructions and the store multiple word instructions. These
23443 instructions are generated by default on POWER systems, and not
23444 generated on PowerPC systems. Do not use -mmultiple on little-
23445 endian PowerPC systems, since those instructions do not work when
23446 the processor is in little-endian mode. The exceptions are PPC740
23447 and PPC750 which permit these instructions in little-endian mode.
23448
23449 -mupdate
23450 -mno-update
23451 Generate code that uses (does not use) the load or store
23452 instructions that update the base register to the address of the
23453 calculated memory location. These instructions are generated by
23454 default. If you use -mno-update, there is a small window between
23455 the time that the stack pointer is updated and the address of the
23456 previous frame is stored, which means code that walks the stack
23457 frame across interrupts or signals may get corrupted data.
23458
23459 -mavoid-indexed-addresses
23460 -mno-avoid-indexed-addresses
23461 Generate code that tries to avoid (not avoid) the use of indexed
23462 load or store instructions. These instructions can incur a
23463 performance penalty on Power6 processors in certain situations,
23464 such as when stepping through large arrays that cross a 16M
23465 boundary. This option is enabled by default when targeting Power6
23466 and disabled otherwise.
23467
23468 -mfused-madd
23469 -mno-fused-madd
23470 Generate code that uses (does not use) the floating-point multiply
23471 and accumulate instructions. These instructions are generated by
23472 default if hardware floating point is used. The machine-dependent
23473 -mfused-madd option is now mapped to the machine-independent
23474 -ffp-contract=fast option, and -mno-fused-madd is mapped to
23475 -ffp-contract=off.
23476
23477 -mmulhw
23478 -mno-mulhw
23479 Generate code that uses (does not use) the half-word multiply and
23480 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
23481 processors. These instructions are generated by default when
23482 targeting those processors.
23483
23484 -mdlmzb
23485 -mno-dlmzb
23486 Generate code that uses (does not use) the string-search dlmzb
23487 instruction on the IBM 405, 440, 464 and 476 processors. This
23488 instruction is generated by default when targeting those
23489 processors.
23490
23491 -mno-bit-align
23492 -mbit-align
23493 On System V.4 and embedded PowerPC systems do not (do) force
23494 structures and unions that contain bit-fields to be aligned to the
23495 base type of the bit-field.
23496
23497 For example, by default a structure containing nothing but 8
23498 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
23499 and has a size of 4 bytes. By using -mno-bit-align, the structure
23500 is aligned to a 1-byte boundary and is 1 byte in size.
23501
23502 -mno-strict-align
23503 -mstrict-align
23504 On System V.4 and embedded PowerPC systems do not (do) assume that
23505 unaligned memory references are handled by the system.
23506
23507 -mrelocatable
23508 -mno-relocatable
23509 Generate code that allows (does not allow) a static executable to
23510 be relocated to a different address at run time. A simple embedded
23511 PowerPC system loader should relocate the entire contents of
23512 ".got2" and 4-byte locations listed in the ".fixup" section, a
23513 table of 32-bit addresses generated by this option. For this to
23514 work, all objects linked together must be compiled with
23515 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
23516 stack to an 8-byte boundary.
23517
23518 -mrelocatable-lib
23519 -mno-relocatable-lib
23520 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
23521 to allow static executables to be relocated at run time, but
23522 -mrelocatable-lib does not use the smaller stack alignment of
23523 -mrelocatable. Objects compiled with -mrelocatable-lib may be
23524 linked with objects compiled with any combination of the
23525 -mrelocatable options.
23526
23527 -mno-toc
23528 -mtoc
23529 On System V.4 and embedded PowerPC systems do not (do) assume that
23530 register 2 contains a pointer to a global area pointing to the
23531 addresses used in the program.
23532
23533 -mlittle
23534 -mlittle-endian
23535 On System V.4 and embedded PowerPC systems compile code for the
23536 processor in little-endian mode. The -mlittle-endian option is the
23537 same as -mlittle.
23538
23539 -mbig
23540 -mbig-endian
23541 On System V.4 and embedded PowerPC systems compile code for the
23542 processor in big-endian mode. The -mbig-endian option is the same
23543 as -mbig.
23544
23545 -mdynamic-no-pic
23546 On Darwin and Mac OS X systems, compile code so that it is not
23547 relocatable, but that its external references are relocatable. The
23548 resulting code is suitable for applications, but not shared
23549 libraries.
23550
23551 -msingle-pic-base
23552 Treat the register used for PIC addressing as read-only, rather
23553 than loading it in the prologue for each function. The runtime
23554 system is responsible for initializing this register with an
23555 appropriate value before execution begins.
23556
23557 -mprioritize-restricted-insns=priority
23558 This option controls the priority that is assigned to dispatch-slot
23559 restricted instructions during the second scheduling pass. The
23560 argument priority takes the value 0, 1, or 2 to assign no, highest,
23561 or second-highest (respectively) priority to dispatch-slot
23562 restricted instructions.
23563
23564 -msched-costly-dep=dependence_type
23565 This option controls which dependences are considered costly by the
23566 target during instruction scheduling. The argument dependence_type
23567 takes one of the following values:
23568
23569 no No dependence is costly.
23570
23571 all All dependences are costly.
23572
23573 true_store_to_load
23574 A true dependence from store to load is costly.
23575
23576 store_to_load
23577 Any dependence from store to load is costly.
23578
23579 number
23580 Any dependence for which the latency is greater than or equal
23581 to number is costly.
23582
23583 -minsert-sched-nops=scheme
23584 This option controls which NOP insertion scheme is used during the
23585 second scheduling pass. The argument scheme takes one of the
23586 following values:
23587
23588 no Don't insert NOPs.
23589
23590 pad Pad with NOPs any dispatch group that has vacant issue slots,
23591 according to the scheduler's grouping.
23592
23593 regroup_exact
23594 Insert NOPs to force costly dependent insns into separate
23595 groups. Insert exactly as many NOPs as needed to force an insn
23596 to a new group, according to the estimated processor grouping.
23597
23598 number
23599 Insert NOPs to force costly dependent insns into separate
23600 groups. Insert number NOPs to force an insn to a new group.
23601
23602 -mcall-sysv
23603 On System V.4 and embedded PowerPC systems compile code using
23604 calling conventions that adhere to the March 1995 draft of the
23605 System V Application Binary Interface, PowerPC processor
23606 supplement. This is the default unless you configured GCC using
23607 powerpc-*-eabiaix.
23608
23609 -mcall-sysv-eabi
23610 -mcall-eabi
23611 Specify both -mcall-sysv and -meabi options.
23612
23613 -mcall-sysv-noeabi
23614 Specify both -mcall-sysv and -mno-eabi options.
23615
23616 -mcall-aixdesc
23617 On System V.4 and embedded PowerPC systems compile code for the AIX
23618 operating system.
23619
23620 -mcall-linux
23621 On System V.4 and embedded PowerPC systems compile code for the
23622 Linux-based GNU system.
23623
23624 -mcall-freebsd
23625 On System V.4 and embedded PowerPC systems compile code for the
23626 FreeBSD operating system.
23627
23628 -mcall-netbsd
23629 On System V.4 and embedded PowerPC systems compile code for the
23630 NetBSD operating system.
23631
23632 -mcall-openbsd
23633 On System V.4 and embedded PowerPC systems compile code for the
23634 OpenBSD operating system.
23635
23636 -mtraceback=traceback_type
23637 Select the type of traceback table. Valid values for traceback_type
23638 are full, part, and no.
23639
23640 -maix-struct-return
23641 Return all structures in memory (as specified by the AIX ABI).
23642
23643 -msvr4-struct-return
23644 Return structures smaller than 8 bytes in registers (as specified
23645 by the SVR4 ABI).
23646
23647 -mabi=abi-type
23648 Extend the current ABI with a particular extension, or remove such
23649 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
23650 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
23651
23652 -mabi=ibmlongdouble
23653 Change the current ABI to use IBM extended-precision long double.
23654 This is not likely to work if your system defaults to using IEEE
23655 extended-precision long double. If you change the long double type
23656 from IEEE extended-precision, the compiler will issue a warning
23657 unless you use the -Wno-psabi option. Requires -mlong-double-128
23658 to be enabled.
23659
23660 -mabi=ieeelongdouble
23661 Change the current ABI to use IEEE extended-precision long double.
23662 This is not likely to work if your system defaults to using IBM
23663 extended-precision long double. If you change the long double type
23664 from IBM extended-precision, the compiler will issue a warning
23665 unless you use the -Wno-psabi option. Requires -mlong-double-128
23666 to be enabled.
23667
23668 -mabi=elfv1
23669 Change the current ABI to use the ELFv1 ABI. This is the default
23670 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
23671 ABI requires special system support and is likely to fail in
23672 spectacular ways.
23673
23674 -mabi=elfv2
23675 Change the current ABI to use the ELFv2 ABI. This is the default
23676 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
23677 ABI requires special system support and is likely to fail in
23678 spectacular ways.
23679
23680 -mgnu-attribute
23681 -mno-gnu-attribute
23682 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23683 .gnu.attributes section that specify ABI variations in function
23684 parameters or return values.
23685
23686 -mprototype
23687 -mno-prototype
23688 On System V.4 and embedded PowerPC systems assume that all calls to
23689 variable argument functions are properly prototyped. Otherwise,
23690 the compiler must insert an instruction before every non-prototyped
23691 call to set or clear bit 6 of the condition code register ("CR") to
23692 indicate whether floating-point values are passed in the floating-
23693 point registers in case the function takes variable arguments.
23694 With -mprototype, only calls to prototyped variable argument
23695 functions set or clear the bit.
23696
23697 -msim
23698 On embedded PowerPC systems, assume that the startup module is
23699 called sim-crt0.o and that the standard C libraries are libsim.a
23700 and libc.a. This is the default for powerpc-*-eabisim
23701 configurations.
23702
23703 -mmvme
23704 On embedded PowerPC systems, assume that the startup module is
23705 called crt0.o and the standard C libraries are libmvme.a and
23706 libc.a.
23707
23708 -mads
23709 On embedded PowerPC systems, assume that the startup module is
23710 called crt0.o and the standard C libraries are libads.a and libc.a.
23711
23712 -myellowknife
23713 On embedded PowerPC systems, assume that the startup module is
23714 called crt0.o and the standard C libraries are libyk.a and libc.a.
23715
23716 -mvxworks
23717 On System V.4 and embedded PowerPC systems, specify that you are
23718 compiling for a VxWorks system.
23719
23720 -memb
23721 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
23722 header to indicate that eabi extended relocations are used.
23723
23724 -meabi
23725 -mno-eabi
23726 On System V.4 and embedded PowerPC systems do (do not) adhere to
23727 the Embedded Applications Binary Interface (EABI), which is a set
23728 of modifications to the System V.4 specifications. Selecting
23729 -meabi means that the stack is aligned to an 8-byte boundary, a
23730 function "__eabi" is called from "main" to set up the EABI
23731 environment, and the -msdata option can use both "r2" and "r13" to
23732 point to two separate small data areas. Selecting -mno-eabi means
23733 that the stack is aligned to a 16-byte boundary, no EABI
23734 initialization function is called from "main", and the -msdata
23735 option only uses "r13" to point to a single small data area. The
23736 -meabi option is on by default if you configured GCC using one of
23737 the powerpc*-*-eabi* options.
23738
23739 -msdata=eabi
23740 On System V.4 and embedded PowerPC systems, put small initialized
23741 "const" global and static data in the ".sdata2" section, which is
23742 pointed to by register "r2". Put small initialized non-"const"
23743 global and static data in the ".sdata" section, which is pointed to
23744 by register "r13". Put small uninitialized global and static data
23745 in the ".sbss" section, which is adjacent to the ".sdata" section.
23746 The -msdata=eabi option is incompatible with the -mrelocatable
23747 option. The -msdata=eabi option also sets the -memb option.
23748
23749 -msdata=sysv
23750 On System V.4 and embedded PowerPC systems, put small global and
23751 static data in the ".sdata" section, which is pointed to by
23752 register "r13". Put small uninitialized global and static data in
23753 the ".sbss" section, which is adjacent to the ".sdata" section.
23754 The -msdata=sysv option is incompatible with the -mrelocatable
23755 option.
23756
23757 -msdata=default
23758 -msdata
23759 On System V.4 and embedded PowerPC systems, if -meabi is used,
23760 compile code the same as -msdata=eabi, otherwise compile code the
23761 same as -msdata=sysv.
23762
23763 -msdata=data
23764 On System V.4 and embedded PowerPC systems, put small global data
23765 in the ".sdata" section. Put small uninitialized global data in
23766 the ".sbss" section. Do not use register "r13" to address small
23767 data however. This is the default behavior unless other -msdata
23768 options are used.
23769
23770 -msdata=none
23771 -mno-sdata
23772 On embedded PowerPC systems, put all initialized global and static
23773 data in the ".data" section, and all uninitialized data in the
23774 ".bss" section.
23775
23776 -mreadonly-in-sdata
23777 Put read-only objects in the ".sdata" section as well. This is the
23778 default.
23779
23780 -mblock-move-inline-limit=num
23781 Inline all block moves (such as calls to "memcpy" or structure
23782 copies) less than or equal to num bytes. The minimum value for num
23783 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
23784 default value is target-specific.
23785
23786 -mblock-compare-inline-limit=num
23787 Generate non-looping inline code for all block compares (such as
23788 calls to "memcmp" or structure compares) less than or equal to num
23789 bytes. If num is 0, all inline expansion (non-loop and loop) of
23790 block compare is disabled. The default value is target-specific.
23791
23792 -mblock-compare-inline-loop-limit=num
23793 Generate an inline expansion using loop code for all block compares
23794 that are less than or equal to num bytes, but greater than the
23795 limit for non-loop inline block compare expansion. If the block
23796 length is not constant, at most num bytes will be compared before
23797 "memcmp" is called to compare the remainder of the block. The
23798 default value is target-specific.
23799
23800 -mstring-compare-inline-limit=num
23801 Compare at most num string bytes with inline code. If the
23802 difference or end of string is not found at the end of the inline
23803 compare a call to "strcmp" or "strncmp" will take care of the rest
23804 of the comparison. The default is 64 bytes.
23805
23806 -G num
23807 On embedded PowerPC systems, put global and static items less than
23808 or equal to num bytes into the small data or BSS sections instead
23809 of the normal data or BSS section. By default, num is 8. The -G
23810 num switch is also passed to the linker. All modules should be
23811 compiled with the same -G num value.
23812
23813 -mregnames
23814 -mno-regnames
23815 On System V.4 and embedded PowerPC systems do (do not) emit
23816 register names in the assembly language output using symbolic
23817 forms.
23818
23819 -mlongcall
23820 -mno-longcall
23821 By default assume that all calls are far away so that a longer and
23822 more expensive calling sequence is required. This is required for
23823 calls farther than 32 megabytes (33,554,432 bytes) from the current
23824 location. A short call is generated if the compiler knows the call
23825 cannot be that far away. This setting can be overridden by the
23826 "shortcall" function attribute, or by "#pragma longcall(0)".
23827
23828 Some linkers are capable of detecting out-of-range calls and
23829 generating glue code on the fly. On these systems, long calls are
23830 unnecessary and generate slower code. As of this writing, the AIX
23831 linker can do this, as can the GNU linker for PowerPC/64. It is
23832 planned to add this feature to the GNU linker for 32-bit PowerPC
23833 systems as well.
23834
23835 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
23836 linkers, GCC can generate long calls using an inline PLT call
23837 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
23838 ELFv1 (big-endian) do not support inline PLT calls.
23839
23840 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
23841 L42", plus a branch island (glue code). The two target addresses
23842 represent the callee and the branch island. The Darwin/PPC linker
23843 prefers the first address and generates a "bl callee" if the PPC
23844 "bl" instruction reaches the callee directly; otherwise, the linker
23845 generates "bl L42" to call the branch island. The branch island is
23846 appended to the body of the calling function; it computes the full
23847 32-bit address of the callee and jumps to it.
23848
23849 On Mach-O (Darwin) systems, this option directs the compiler emit
23850 to the glue for every direct call, and the Darwin linker decides
23851 whether to use or discard it.
23852
23853 In the future, GCC may ignore all longcall specifications when the
23854 linker is known to generate glue.
23855
23856 -mpltseq
23857 -mno-pltseq
23858 Implement (do not implement) -fno-plt and long calls using an
23859 inline PLT call sequence that supports lazy linking and long calls
23860 to functions in dlopen'd shared libraries. Inline PLT calls are
23861 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
23862 newer GNU linkers, and are enabled by default if the support is
23863 detected when configuring GCC, and, in the case of 32-bit PowerPC,
23864 if GCC is configured with --enable-secureplt. -mpltseq code and
23865 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
23866 together.
23867
23868 -mtls-markers
23869 -mno-tls-markers
23870 Mark (do not mark) calls to "__tls_get_addr" with a relocation
23871 specifying the function argument. The relocation allows the linker
23872 to reliably associate function call with argument setup
23873 instructions for TLS optimization, which in turn allows GCC to
23874 better schedule the sequence.
23875
23876 -mrecip
23877 -mno-recip
23878 This option enables use of the reciprocal estimate and reciprocal
23879 square root estimate instructions with additional Newton-Raphson
23880 steps to increase precision instead of doing a divide or square
23881 root and divide for floating-point arguments. You should use the
23882 -ffast-math option when using -mrecip (or at least
23883 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
23884 and -fno-trapping-math). Note that while the throughput of the
23885 sequence is generally higher than the throughput of the non-
23886 reciprocal instruction, the precision of the sequence can be
23887 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
23888 0.99999994) for reciprocal square roots.
23889
23890 -mrecip=opt
23891 This option controls which reciprocal estimate instructions may be
23892 used. opt is a comma-separated list of options, which may be
23893 preceded by a "!" to invert the option:
23894
23895 all Enable all estimate instructions.
23896
23897 default
23898 Enable the default instructions, equivalent to -mrecip.
23899
23900 none
23901 Disable all estimate instructions, equivalent to -mno-recip.
23902
23903 div Enable the reciprocal approximation instructions for both
23904 single and double precision.
23905
23906 divf
23907 Enable the single-precision reciprocal approximation
23908 instructions.
23909
23910 divd
23911 Enable the double-precision reciprocal approximation
23912 instructions.
23913
23914 rsqrt
23915 Enable the reciprocal square root approximation instructions
23916 for both single and double precision.
23917
23918 rsqrtf
23919 Enable the single-precision reciprocal square root
23920 approximation instructions.
23921
23922 rsqrtd
23923 Enable the double-precision reciprocal square root
23924 approximation instructions.
23925
23926 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
23927 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
23928 "XVRSQRTEDP" instructions which handle the double-precision
23929 reciprocal square root calculations.
23930
23931 -mrecip-precision
23932 -mno-recip-precision
23933 Assume (do not assume) that the reciprocal estimate instructions
23934 provide higher-precision estimates than is mandated by the PowerPC
23935 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
23936 automatically selects -mrecip-precision. The double-precision
23937 square root estimate instructions are not generated by default on
23938 low-precision machines, since they do not provide an estimate that
23939 converges after three steps.
23940
23941 -mveclibabi=type
23942 Specifies the ABI type to use for vectorizing intrinsics using an
23943 external library. The only type supported at present is mass,
23944 which specifies to use IBM's Mathematical Acceleration Subsystem
23945 (MASS) libraries for vectorizing intrinsics using external
23946 libraries. GCC currently emits calls to "acosd2", "acosf4",
23947 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
23948 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
23949 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
23950 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
23951 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
23952 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
23953 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
23954 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
23955 "tanhf4" when generating code for power7. Both -ftree-vectorize
23956 and -funsafe-math-optimizations must also be enabled. The MASS
23957 libraries must be specified at link time.
23958
23959 -mfriz
23960 -mno-friz
23961 Generate (do not generate) the "friz" instruction when the
23962 -funsafe-math-optimizations option is used to optimize rounding of
23963 floating-point values to 64-bit integer and back to floating point.
23964 The "friz" instruction does not return the same value if the
23965 floating-point number is too large to fit in an integer.
23966
23967 -mpointers-to-nested-functions
23968 -mno-pointers-to-nested-functions
23969 Generate (do not generate) code to load up the static chain
23970 register ("r11") when calling through a pointer on AIX and 64-bit
23971 Linux systems where a function pointer points to a 3-word
23972 descriptor giving the function address, TOC value to be loaded in
23973 register "r2", and static chain value to be loaded in register
23974 "r11". The -mpointers-to-nested-functions is on by default. You
23975 cannot call through pointers to nested functions or pointers to
23976 functions compiled in other languages that use the static chain if
23977 you use -mno-pointers-to-nested-functions.
23978
23979 -msave-toc-indirect
23980 -mno-save-toc-indirect
23981 Generate (do not generate) code to save the TOC value in the
23982 reserved stack location in the function prologue if the function
23983 calls through a pointer on AIX and 64-bit Linux systems. If the
23984 TOC value is not saved in the prologue, it is saved just before the
23985 call through the pointer. The -mno-save-toc-indirect option is the
23986 default.
23987
23988 -mcompat-align-parm
23989 -mno-compat-align-parm
23990 Generate (do not generate) code to pass structure parameters with a
23991 maximum alignment of 64 bits, for compatibility with older versions
23992 of GCC.
23993
23994 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23995 structure parameter on a 128-bit boundary when that structure
23996 contained a member requiring 128-bit alignment. This is corrected
23997 in more recent versions of GCC. This option may be used to
23998 generate code that is compatible with functions compiled with older
23999 versions of GCC.
24000
24001 The -mno-compat-align-parm option is the default.
24002
24003 -mstack-protector-guard=guard
24004 -mstack-protector-guard-reg=reg
24005 -mstack-protector-guard-offset=offset
24006 -mstack-protector-guard-symbol=symbol
24007 Generate stack protection code using canary at guard. Supported
24008 locations are global for global canary or tls for per-thread canary
24009 in the TLS block (the default with GNU libc version 2.4 or later).
24010
24011 With the latter choice the options -mstack-protector-guard-reg=reg
24012 and -mstack-protector-guard-offset=offset furthermore specify which
24013 register to use as base register for reading the canary, and from
24014 what offset from that base register. The default for those is as
24015 specified in the relevant ABI.
24016 -mstack-protector-guard-symbol=symbol overrides the offset with a
24017 symbol reference to a canary in the TLS block.
24018
24019 -mpcrel
24020 -mno-pcrel
24021 Generate (do not generate) pc-relative addressing when the option
24022 -mcpu=future is used. The -mpcrel option requires that the medium
24023 code model (-mcmodel=medium) and prefixed addressing (-mprefixed)
24024 options are enabled.
24025
24026 -mprefixed
24027 -mno-prefixed
24028 Generate (do not generate) addressing modes using prefixed load and
24029 store instructions when the option -mcpu=future is used.
24030
24031 -mmma
24032 -mno-mma
24033 Generate (do not generate) the MMA instructions when the option
24034 -mcpu=future is used.
24035
24036 -mrop-protect
24037 -mno-rop-protect
24038 Generate (do not generate) ROP protection instructions when the
24039 target processor supports them. Currently this option disables the
24040 shrink-wrap optimization (-fshrink-wrap).
24041
24042 -mprivileged
24043 -mno-privileged
24044 Generate (do not generate) code that will run in privileged state.
24045
24046 -mblock-ops-unaligned-vsx
24047 -mno-block-ops-unaligned-vsx
24048 Generate (do not generate) unaligned vsx loads and stores for
24049 inline expansion of "memcpy" and "memmove".
24050
24051 RX Options
24052
24053 These command-line options are defined for RX targets:
24054
24055 -m64bit-doubles
24056 -m32bit-doubles
24057 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24058 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
24059 RX floating-point hardware only works on 32-bit values, which is
24060 why the default is -m32bit-doubles.
24061
24062 -fpu
24063 -nofpu
24064 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
24065 hardware. The default is enabled for the RX600 series and disabled
24066 for the RX200 series.
24067
24068 Floating-point instructions are only generated for 32-bit floating-
24069 point values, however, so the FPU hardware is not used for doubles
24070 if the -m64bit-doubles option is used.
24071
24072 Note If the -fpu option is enabled then -funsafe-math-optimizations
24073 is also enabled automatically. This is because the RX FPU
24074 instructions are themselves unsafe.
24075
24076 -mcpu=name
24077 Selects the type of RX CPU to be targeted. Currently three types
24078 are supported, the generic RX600 and RX200 series hardware and the
24079 specific RX610 CPU. The default is RX600.
24080
24081 The only difference between RX600 and RX610 is that the RX610 does
24082 not support the "MVTIPL" instruction.
24083
24084 The RX200 series does not have a hardware floating-point unit and
24085 so -nofpu is enabled by default when this type is selected.
24086
24087 -mbig-endian-data
24088 -mlittle-endian-data
24089 Store data (but not code) in the big-endian format. The default is
24090 -mlittle-endian-data, i.e. to store data in the little-endian
24091 format.
24092
24093 -msmall-data-limit=N
24094 Specifies the maximum size in bytes of global and static variables
24095 which can be placed into the small data area. Using the small data
24096 area can lead to smaller and faster code, but the size of area is
24097 limited and it is up to the programmer to ensure that the area does
24098 not overflow. Also when the small data area is used one of the
24099 RX's registers (usually "r13") is reserved for use pointing to this
24100 area, so it is no longer available for use by the compiler. This
24101 could result in slower and/or larger code if variables are pushed
24102 onto the stack instead of being held in this register.
24103
24104 Note, common variables (variables that have not been initialized)
24105 and constants are not placed into the small data area as they are
24106 assigned to other sections in the output executable.
24107
24108 The default value is zero, which disables this feature. Note, this
24109 feature is not enabled by default with higher optimization levels
24110 (-O2 etc) because of the potentially detrimental effects of
24111 reserving a register. It is up to the programmer to experiment and
24112 discover whether this feature is of benefit to their program. See
24113 the description of the -mpid option for a description of how the
24114 actual register to hold the small data area pointer is chosen.
24115
24116 -msim
24117 -mno-sim
24118 Use the simulator runtime. The default is to use the libgloss
24119 board-specific runtime.
24120
24121 -mas100-syntax
24122 -mno-as100-syntax
24123 When generating assembler output use a syntax that is compatible
24124 with Renesas's AS100 assembler. This syntax can also be handled by
24125 the GAS assembler, but it has some restrictions so it is not
24126 generated by default.
24127
24128 -mmax-constant-size=N
24129 Specifies the maximum size, in bytes, of a constant that can be
24130 used as an operand in a RX instruction. Although the RX
24131 instruction set does allow constants of up to 4 bytes in length to
24132 be used in instructions, a longer value equates to a longer
24133 instruction. Thus in some circumstances it can be beneficial to
24134 restrict the size of constants that are used in instructions.
24135 Constants that are too big are instead placed into a constant pool
24136 and referenced via register indirection.
24137
24138 The value N can be between 0 and 4. A value of 0 (the default) or
24139 4 means that constants of any size are allowed.
24140
24141 -mrelax
24142 Enable linker relaxation. Linker relaxation is a process whereby
24143 the linker attempts to reduce the size of a program by finding
24144 shorter versions of various instructions. Disabled by default.
24145
24146 -mint-register=N
24147 Specify the number of registers to reserve for fast interrupt
24148 handler functions. The value N can be between 0 and 4. A value of
24149 1 means that register "r13" is reserved for the exclusive use of
24150 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
24151 value of 3 reserves "r13", "r12" and "r11", and a value of 4
24152 reserves "r13" through "r10". A value of 0, the default, does not
24153 reserve any registers.
24154
24155 -msave-acc-in-interrupts
24156 Specifies that interrupt handler functions should preserve the
24157 accumulator register. This is only necessary if normal code might
24158 use the accumulator register, for example because it performs
24159 64-bit multiplications. The default is to ignore the accumulator
24160 as this makes the interrupt handlers faster.
24161
24162 -mpid
24163 -mno-pid
24164 Enables the generation of position independent data. When enabled
24165 any access to constant data is done via an offset from a base
24166 address held in a register. This allows the location of constant
24167 data to be determined at run time without requiring the executable
24168 to be relocated, which is a benefit to embedded applications with
24169 tight memory constraints. Data that can be modified is not
24170 affected by this option.
24171
24172 Note, using this feature reserves a register, usually "r13", for
24173 the constant data base address. This can result in slower and/or
24174 larger code, especially in complicated functions.
24175
24176 The actual register chosen to hold the constant data base address
24177 depends upon whether the -msmall-data-limit and/or the
24178 -mint-register command-line options are enabled. Starting with
24179 register "r13" and proceeding downwards, registers are allocated
24180 first to satisfy the requirements of -mint-register, then -mpid and
24181 finally -msmall-data-limit. Thus it is possible for the small data
24182 area register to be "r8" if both -mint-register=4 and -mpid are
24183 specified on the command line.
24184
24185 By default this feature is not enabled. The default can be
24186 restored via the -mno-pid command-line option.
24187
24188 -mno-warn-multiple-fast-interrupts
24189 -mwarn-multiple-fast-interrupts
24190 Prevents GCC from issuing a warning message if it finds more than
24191 one fast interrupt handler when it is compiling a file. The
24192 default is to issue a warning for each extra fast interrupt handler
24193 found, as the RX only supports one such interrupt.
24194
24195 -mallow-string-insns
24196 -mno-allow-string-insns
24197 Enables or disables the use of the string manipulation instructions
24198 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
24199 "RMPA" instruction. These instructions may prefetch data, which is
24200 not safe to do if accessing an I/O register. (See section 12.2.7
24201 of the RX62N Group User's Manual for more information).
24202
24203 The default is to allow these instructions, but it is not possible
24204 for GCC to reliably detect all circumstances where a string
24205 instruction might be used to access an I/O register, so their use
24206 cannot be disabled automatically. Instead it is reliant upon the
24207 programmer to use the -mno-allow-string-insns option if their
24208 program accesses I/O space.
24209
24210 When the instructions are enabled GCC defines the C preprocessor
24211 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
24212 "__RX_DISALLOW_STRING_INSNS__".
24213
24214 -mjsr
24215 -mno-jsr
24216 Use only (or not only) "JSR" instructions to access functions.
24217 This option can be used when code size exceeds the range of "BSR"
24218 instructions. Note that -mno-jsr does not mean to not use "JSR"
24219 but instead means that any type of branch may be used.
24220
24221 Note: The generic GCC command-line option -ffixed-reg has special
24222 significance to the RX port when used with the "interrupt" function
24223 attribute. This attribute indicates a function intended to process
24224 fast interrupts. GCC ensures that it only uses the registers "r10",
24225 "r11", "r12" and/or "r13" and only provided that the normal use of the
24226 corresponding registers have been restricted via the -ffixed-reg or
24227 -mint-register command-line options.
24228
24229 S/390 and zSeries Options
24230
24231 These are the -m options defined for the S/390 and zSeries
24232 architecture.
24233
24234 -mhard-float
24235 -msoft-float
24236 Use (do not use) the hardware floating-point instructions and
24237 registers for floating-point operations. When -msoft-float is
24238 specified, functions in libgcc.a are used to perform floating-point
24239 operations. When -mhard-float is specified, the compiler generates
24240 IEEE floating-point instructions. This is the default.
24241
24242 -mhard-dfp
24243 -mno-hard-dfp
24244 Use (do not use) the hardware decimal-floating-point instructions
24245 for decimal-floating-point operations. When -mno-hard-dfp is
24246 specified, functions in libgcc.a are used to perform decimal-
24247 floating-point operations. When -mhard-dfp is specified, the
24248 compiler generates decimal-floating-point hardware instructions.
24249 This is the default for -march=z9-ec or higher.
24250
24251 -mlong-double-64
24252 -mlong-double-128
24253 These switches control the size of "long double" type. A size of 64
24254 bits makes the "long double" type equivalent to the "double" type.
24255 This is the default.
24256
24257 -mbackchain
24258 -mno-backchain
24259 Store (do not store) the address of the caller's frame as backchain
24260 pointer into the callee's stack frame. A backchain may be needed
24261 to allow debugging using tools that do not understand DWARF call
24262 frame information. When -mno-packed-stack is in effect, the
24263 backchain pointer is stored at the bottom of the stack frame; when
24264 -mpacked-stack is in effect, the backchain is placed into the
24265 topmost word of the 96/160 byte register save area.
24266
24267 In general, code compiled with -mbackchain is call-compatible with
24268 code compiled with -mno-backchain; however, use of the backchain
24269 for debugging purposes usually requires that the whole binary is
24270 built with -mbackchain. Note that the combination of -mbackchain,
24271 -mpacked-stack and -mhard-float is not supported. In order to
24272 build a linux kernel use -msoft-float.
24273
24274 The default is to not maintain the backchain.
24275
24276 -mpacked-stack
24277 -mno-packed-stack
24278 Use (do not use) the packed stack layout. When -mno-packed-stack
24279 is specified, the compiler uses the all fields of the 96/160 byte
24280 register save area only for their default purpose; unused fields
24281 still take up stack space. When -mpacked-stack is specified,
24282 register save slots are densely packed at the top of the register
24283 save area; unused space is reused for other purposes, allowing for
24284 more efficient use of the available stack space. However, when
24285 -mbackchain is also in effect, the topmost word of the save area is
24286 always used to store the backchain, and the return address register
24287 is always saved two words below the backchain.
24288
24289 As long as the stack frame backchain is not used, code generated
24290 with -mpacked-stack is call-compatible with code generated with
24291 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
24292 S/390 or zSeries generated code that uses the stack frame backchain
24293 at run time, not just for debugging purposes. Such code is not
24294 call-compatible with code compiled with -mpacked-stack. Also, note
24295 that the combination of -mbackchain, -mpacked-stack and
24296 -mhard-float is not supported. In order to build a linux kernel
24297 use -msoft-float.
24298
24299 The default is to not use the packed stack layout.
24300
24301 -msmall-exec
24302 -mno-small-exec
24303 Generate (or do not generate) code using the "bras" instruction to
24304 do subroutine calls. This only works reliably if the total
24305 executable size does not exceed 64k. The default is to use the
24306 "basr" instruction instead, which does not have this limitation.
24307
24308 -m64
24309 -m31
24310 When -m31 is specified, generate code compliant to the GNU/Linux
24311 for S/390 ABI. When -m64 is specified, generate code compliant to
24312 the GNU/Linux for zSeries ABI. This allows GCC in particular to
24313 generate 64-bit instructions. For the s390 targets, the default is
24314 -m31, while the s390x targets default to -m64.
24315
24316 -mzarch
24317 -mesa
24318 When -mzarch is specified, generate code using the instructions
24319 available on z/Architecture. When -mesa is specified, generate
24320 code using the instructions available on ESA/390. Note that -mesa
24321 is not possible with -m64. When generating code compliant to the
24322 GNU/Linux for S/390 ABI, the default is -mesa. When generating
24323 code compliant to the GNU/Linux for zSeries ABI, the default is
24324 -mzarch.
24325
24326 -mhtm
24327 -mno-htm
24328 The -mhtm option enables a set of builtins making use of
24329 instructions available with the transactional execution facility
24330 introduced with the IBM zEnterprise EC12 machine generation S/390
24331 System z Built-in Functions. -mhtm is enabled by default when
24332 using -march=zEC12.
24333
24334 -mvx
24335 -mno-vx
24336 When -mvx is specified, generate code using the instructions
24337 available with the vector extension facility introduced with the
24338 IBM z13 machine generation. This option changes the ABI for some
24339 vector type values with regard to alignment and calling
24340 conventions. In case vector type values are being used in an ABI-
24341 relevant context a GAS .gnu_attribute command will be added to mark
24342 the resulting binary with the ABI used. -mvx is enabled by default
24343 when using -march=z13.
24344
24345 -mzvector
24346 -mno-zvector
24347 The -mzvector option enables vector language extensions and
24348 builtins using instructions available with the vector extension
24349 facility introduced with the IBM z13 machine generation. This
24350 option adds support for vector to be used as a keyword to define
24351 vector type variables and arguments. vector is only available when
24352 GNU extensions are enabled. It will not be expanded when
24353 requesting strict standard compliance e.g. with -std=c99. In
24354 addition to the GCC low-level builtins -mzvector enables a set of
24355 builtins added for compatibility with AltiVec-style implementations
24356 like Power and Cell. In order to make use of these builtins the
24357 header file vecintrin.h needs to be included. -mzvector is
24358 disabled by default.
24359
24360 -mmvcle
24361 -mno-mvcle
24362 Generate (or do not generate) code using the "mvcle" instruction to
24363 perform block moves. When -mno-mvcle is specified, use a "mvc"
24364 loop instead. This is the default unless optimizing for size.
24365
24366 -mdebug
24367 -mno-debug
24368 Print (or do not print) additional debug information when
24369 compiling. The default is to not print debug information.
24370
24371 -march=cpu-type
24372 Generate code that runs on cpu-type, which is the name of a system
24373 representing a certain processor type. Possible values for cpu-
24374 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
24375 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, and native.
24376
24377 The default is -march=z900.
24378
24379 Specifying native as cpu type can be used to select the best
24380 architecture option for the host processor. -march=native has no
24381 effect if GCC does not recognize the processor.
24382
24383 -mtune=cpu-type
24384 Tune to cpu-type everything applicable about the generated code,
24385 except for the ABI and the set of available instructions. The list
24386 of cpu-type values is the same as for -march. The default is the
24387 value used for -march.
24388
24389 -mtpf-trace
24390 -mno-tpf-trace
24391 Generate code that adds (does not add) in TPF OS specific branches
24392 to trace routines in the operating system. This option is off by
24393 default, even when compiling for the TPF OS.
24394
24395 -mtpf-trace-skip
24396 -mno-tpf-trace-skip
24397 Generate code that changes (does not change) the default branch
24398 targets enabled by -mtpf-trace to point to specialized trace
24399 routines providing the ability of selectively skipping function
24400 trace entries for the TPF OS. This option is off by default, even
24401 when compiling for the TPF OS and specifying -mtpf-trace.
24402
24403 -mfused-madd
24404 -mno-fused-madd
24405 Generate code that uses (does not use) the floating-point multiply
24406 and accumulate instructions. These instructions are generated by
24407 default if hardware floating point is used.
24408
24409 -mwarn-framesize=framesize
24410 Emit a warning if the current function exceeds the given frame
24411 size. Because this is a compile-time check it doesn't need to be a
24412 real problem when the program runs. It is intended to identify
24413 functions that most probably cause a stack overflow. It is useful
24414 to be used in an environment with limited stack size e.g. the linux
24415 kernel.
24416
24417 -mwarn-dynamicstack
24418 Emit a warning if the function calls "alloca" or uses dynamically-
24419 sized arrays. This is generally a bad idea with a limited stack
24420 size.
24421
24422 -mstack-guard=stack-guard
24423 -mstack-size=stack-size
24424 If these options are provided the S/390 back end emits additional
24425 instructions in the function prologue that trigger a trap if the
24426 stack size is stack-guard bytes above the stack-size (remember that
24427 the stack on S/390 grows downward). If the stack-guard option is
24428 omitted the smallest power of 2 larger than the frame size of the
24429 compiled function is chosen. These options are intended to be used
24430 to help debugging stack overflow problems. The additionally
24431 emitted code causes only little overhead and hence can also be used
24432 in production-like systems without greater performance degradation.
24433 The given values have to be exact powers of 2 and stack-size has to
24434 be greater than stack-guard without exceeding 64k. In order to be
24435 efficient the extra code makes the assumption that the stack starts
24436 at an address aligned to the value given by stack-size. The stack-
24437 guard option can only be used in conjunction with stack-size.
24438
24439 -mhotpatch=pre-halfwords,post-halfwords
24440 If the hotpatch option is enabled, a "hot-patching" function
24441 prologue is generated for all functions in the compilation unit.
24442 The funtion label is prepended with the given number of two-byte
24443 NOP instructions (pre-halfwords, maximum 1000000). After the
24444 label, 2 * post-halfwords bytes are appended, using the largest NOP
24445 like instructions the architecture allows (maximum 1000000).
24446
24447 If both arguments are zero, hotpatching is disabled.
24448
24449 This option can be overridden for individual functions with the
24450 "hotpatch" attribute.
24451
24452 Score Options
24453
24454 These options are defined for Score implementations:
24455
24456 -meb
24457 Compile code for big-endian mode. This is the default.
24458
24459 -mel
24460 Compile code for little-endian mode.
24461
24462 -mnhwloop
24463 Disable generation of "bcnz" instructions.
24464
24465 -muls
24466 Enable generation of unaligned load and store instructions.
24467
24468 -mmac
24469 Enable the use of multiply-accumulate instructions. Disabled by
24470 default.
24471
24472 -mscore5
24473 Specify the SCORE5 as the target architecture.
24474
24475 -mscore5u
24476 Specify the SCORE5U of the target architecture.
24477
24478 -mscore7
24479 Specify the SCORE7 as the target architecture. This is the default.
24480
24481 -mscore7d
24482 Specify the SCORE7D as the target architecture.
24483
24484 SH Options
24485
24486 These -m options are defined for the SH implementations:
24487
24488 -m1 Generate code for the SH1.
24489
24490 -m2 Generate code for the SH2.
24491
24492 -m2e
24493 Generate code for the SH2e.
24494
24495 -m2a-nofpu
24496 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
24497 way that the floating-point unit is not used.
24498
24499 -m2a-single-only
24500 Generate code for the SH2a-FPU, in such a way that no double-
24501 precision floating-point operations are used.
24502
24503 -m2a-single
24504 Generate code for the SH2a-FPU assuming the floating-point unit is
24505 in single-precision mode by default.
24506
24507 -m2a
24508 Generate code for the SH2a-FPU assuming the floating-point unit is
24509 in double-precision mode by default.
24510
24511 -m3 Generate code for the SH3.
24512
24513 -m3e
24514 Generate code for the SH3e.
24515
24516 -m4-nofpu
24517 Generate code for the SH4 without a floating-point unit.
24518
24519 -m4-single-only
24520 Generate code for the SH4 with a floating-point unit that only
24521 supports single-precision arithmetic.
24522
24523 -m4-single
24524 Generate code for the SH4 assuming the floating-point unit is in
24525 single-precision mode by default.
24526
24527 -m4 Generate code for the SH4.
24528
24529 -m4-100
24530 Generate code for SH4-100.
24531
24532 -m4-100-nofpu
24533 Generate code for SH4-100 in such a way that the floating-point
24534 unit is not used.
24535
24536 -m4-100-single
24537 Generate code for SH4-100 assuming the floating-point unit is in
24538 single-precision mode by default.
24539
24540 -m4-100-single-only
24541 Generate code for SH4-100 in such a way that no double-precision
24542 floating-point operations are used.
24543
24544 -m4-200
24545 Generate code for SH4-200.
24546
24547 -m4-200-nofpu
24548 Generate code for SH4-200 without in such a way that the floating-
24549 point unit is not used.
24550
24551 -m4-200-single
24552 Generate code for SH4-200 assuming the floating-point unit is in
24553 single-precision mode by default.
24554
24555 -m4-200-single-only
24556 Generate code for SH4-200 in such a way that no double-precision
24557 floating-point operations are used.
24558
24559 -m4-300
24560 Generate code for SH4-300.
24561
24562 -m4-300-nofpu
24563 Generate code for SH4-300 without in such a way that the floating-
24564 point unit is not used.
24565
24566 -m4-300-single
24567 Generate code for SH4-300 in such a way that no double-precision
24568 floating-point operations are used.
24569
24570 -m4-300-single-only
24571 Generate code for SH4-300 in such a way that no double-precision
24572 floating-point operations are used.
24573
24574 -m4-340
24575 Generate code for SH4-340 (no MMU, no FPU).
24576
24577 -m4-500
24578 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
24579 assembler.
24580
24581 -m4a-nofpu
24582 Generate code for the SH4al-dsp, or for a SH4a in such a way that
24583 the floating-point unit is not used.
24584
24585 -m4a-single-only
24586 Generate code for the SH4a, in such a way that no double-precision
24587 floating-point operations are used.
24588
24589 -m4a-single
24590 Generate code for the SH4a assuming the floating-point unit is in
24591 single-precision mode by default.
24592
24593 -m4a
24594 Generate code for the SH4a.
24595
24596 -m4al
24597 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
24598 assembler. GCC doesn't generate any DSP instructions at the
24599 moment.
24600
24601 -mb Compile code for the processor in big-endian mode.
24602
24603 -ml Compile code for the processor in little-endian mode.
24604
24605 -mdalign
24606 Align doubles at 64-bit boundaries. Note that this changes the
24607 calling conventions, and thus some functions from the standard C
24608 library do not work unless you recompile it first with -mdalign.
24609
24610 -mrelax
24611 Shorten some address references at link time, when possible; uses
24612 the linker option -relax.
24613
24614 -mbigtable
24615 Use 32-bit offsets in "switch" tables. The default is to use
24616 16-bit offsets.
24617
24618 -mbitops
24619 Enable the use of bit manipulation instructions on SH2A.
24620
24621 -mfmovd
24622 Enable the use of the instruction "fmovd". Check -mdalign for
24623 alignment constraints.
24624
24625 -mrenesas
24626 Comply with the calling conventions defined by Renesas.
24627
24628 -mno-renesas
24629 Comply with the calling conventions defined for GCC before the
24630 Renesas conventions were available. This option is the default for
24631 all targets of the SH toolchain.
24632
24633 -mnomacsave
24634 Mark the "MAC" register as call-clobbered, even if -mrenesas is
24635 given.
24636
24637 -mieee
24638 -mno-ieee
24639 Control the IEEE compliance of floating-point comparisons, which
24640 affects the handling of cases where the result of a comparison is
24641 unordered. By default -mieee is implicitly enabled. If
24642 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
24643 results in faster floating-point greater-equal and less-equal
24644 comparisons. The implicit settings can be overridden by specifying
24645 either -mieee or -mno-ieee.
24646
24647 -minline-ic_invalidate
24648 Inline code to invalidate instruction cache entries after setting
24649 up nested function trampolines. This option has no effect if
24650 -musermode is in effect and the selected code generation option
24651 (e.g. -m4) does not allow the use of the "icbi" instruction. If
24652 the selected code generation option does not allow the use of the
24653 "icbi" instruction, and -musermode is not in effect, the inlined
24654 code manipulates the instruction cache address array directly with
24655 an associative write. This not only requires privileged mode at
24656 run time, but it also fails if the cache line had been mapped via
24657 the TLB and has become unmapped.
24658
24659 -misize
24660 Dump instruction size and location in the assembly code.
24661
24662 -mpadstruct
24663 This option is deprecated. It pads structures to multiple of 4
24664 bytes, which is incompatible with the SH ABI.
24665
24666 -matomic-model=model
24667 Sets the model of atomic operations and additional parameters as a
24668 comma separated list. For details on the atomic built-in functions
24669 see __atomic Builtins. The following models and parameters are
24670 supported:
24671
24672 none
24673 Disable compiler generated atomic sequences and emit library
24674 calls for atomic operations. This is the default if the target
24675 is not "sh*-*-linux*".
24676
24677 soft-gusa
24678 Generate GNU/Linux compatible gUSA software atomic sequences
24679 for the atomic built-in functions. The generated atomic
24680 sequences require additional support from the
24681 interrupt/exception handling code of the system and are only
24682 suitable for SH3* and SH4* single-core systems. This option is
24683 enabled by default when the target is "sh*-*-linux*" and SH3*
24684 or SH4*. When the target is SH4A, this option also partially
24685 utilizes the hardware atomic instructions "movli.l" and
24686 "movco.l" to create more efficient code, unless strict is
24687 specified.
24688
24689 soft-tcb
24690 Generate software atomic sequences that use a variable in the
24691 thread control block. This is a variation of the gUSA
24692 sequences which can also be used on SH1* and SH2* targets. The
24693 generated atomic sequences require additional support from the
24694 interrupt/exception handling code of the system and are only
24695 suitable for single-core systems. When using this model, the
24696 gbr-offset= parameter has to be specified as well.
24697
24698 soft-imask
24699 Generate software atomic sequences that temporarily disable
24700 interrupts by setting "SR.IMASK = 1111". This model works only
24701 when the program runs in privileged mode and is only suitable
24702 for single-core systems. Additional support from the
24703 interrupt/exception handling code of the system is not
24704 required. This model is enabled by default when the target is
24705 "sh*-*-linux*" and SH1* or SH2*.
24706
24707 hard-llcs
24708 Generate hardware atomic sequences using the "movli.l" and
24709 "movco.l" instructions only. This is only available on SH4A
24710 and is suitable for multi-core systems. Since the hardware
24711 instructions support only 32 bit atomic variables access to 8
24712 or 16 bit variables is emulated with 32 bit accesses. Code
24713 compiled with this option is also compatible with other
24714 software atomic model interrupt/exception handling systems if
24715 executed on an SH4A system. Additional support from the
24716 interrupt/exception handling code of the system is not required
24717 for this model.
24718
24719 gbr-offset=
24720 This parameter specifies the offset in bytes of the variable in
24721 the thread control block structure that should be used by the
24722 generated atomic sequences when the soft-tcb model has been
24723 selected. For other models this parameter is ignored. The
24724 specified value must be an integer multiple of four and in the
24725 range 0-1020.
24726
24727 strict
24728 This parameter prevents mixed usage of multiple atomic models,
24729 even if they are compatible, and makes the compiler generate
24730 atomic sequences of the specified model only.
24731
24732 -mtas
24733 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
24734 that depending on the particular hardware and software
24735 configuration this can degrade overall performance due to the
24736 operand cache line flushes that are implied by the "tas.b"
24737 instruction. On multi-core SH4A processors the "tas.b" instruction
24738 must be used with caution since it can result in data corruption
24739 for certain cache configurations.
24740
24741 -mprefergot
24742 When generating position-independent code, emit function calls
24743 using the Global Offset Table instead of the Procedure Linkage
24744 Table.
24745
24746 -musermode
24747 -mno-usermode
24748 Don't allow (allow) the compiler generating privileged mode code.
24749 Specifying -musermode also implies -mno-inline-ic_invalidate if the
24750 inlined code would not work in user mode. -musermode is the
24751 default when the target is "sh*-*-linux*". If the target is SH1*
24752 or SH2* -musermode has no effect, since there is no user mode.
24753
24754 -multcost=number
24755 Set the cost to assume for a multiply insn.
24756
24757 -mdiv=strategy
24758 Set the division strategy to be used for integer division
24759 operations. strategy can be one of:
24760
24761 call-div1
24762 Calls a library function that uses the single-step division
24763 instruction "div1" to perform the operation. Division by zero
24764 calculates an unspecified result and does not trap. This is
24765 the default except for SH4, SH2A and SHcompact.
24766
24767 call-fp
24768 Calls a library function that performs the operation in double
24769 precision floating point. Division by zero causes a floating-
24770 point exception. This is the default for SHcompact with FPU.
24771 Specifying this for targets that do not have a double precision
24772 FPU defaults to "call-div1".
24773
24774 call-table
24775 Calls a library function that uses a lookup table for small
24776 divisors and the "div1" instruction with case distinction for
24777 larger divisors. Division by zero calculates an unspecified
24778 result and does not trap. This is the default for SH4.
24779 Specifying this for targets that do not have dynamic shift
24780 instructions defaults to "call-div1".
24781
24782 When a division strategy has not been specified the default
24783 strategy is selected based on the current target. For SH2A the
24784 default strategy is to use the "divs" and "divu" instructions
24785 instead of library function calls.
24786
24787 -maccumulate-outgoing-args
24788 Reserve space once for outgoing arguments in the function prologue
24789 rather than around each call. Generally beneficial for performance
24790 and size. Also needed for unwinding to avoid changing the stack
24791 frame around conditional code.
24792
24793 -mdivsi3_libfunc=name
24794 Set the name of the library function used for 32-bit signed
24795 division to name. This only affects the name used in the call
24796 division strategies, and the compiler still expects the same sets
24797 of input/output/clobbered registers as if this option were not
24798 present.
24799
24800 -mfixed-range=register-range
24801 Generate code treating the given register range as fixed registers.
24802 A fixed register is one that the register allocator cannot use.
24803 This is useful when compiling kernel code. A register range is
24804 specified as two registers separated by a dash. Multiple register
24805 ranges can be specified separated by a comma.
24806
24807 -mbranch-cost=num
24808 Assume num to be the cost for a branch instruction. Higher numbers
24809 make the compiler try to generate more branch-free code if
24810 possible. If not specified the value is selected depending on the
24811 processor type that is being compiled for.
24812
24813 -mzdcbranch
24814 -mno-zdcbranch
24815 Assume (do not assume) that zero displacement conditional branch
24816 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
24817 the compiler prefers zero displacement branch code sequences. This
24818 is enabled by default when generating code for SH4 and SH4A. It
24819 can be explicitly disabled by specifying -mno-zdcbranch.
24820
24821 -mcbranch-force-delay-slot
24822 Force the usage of delay slots for conditional branches, which
24823 stuffs the delay slot with a "nop" if a suitable instruction cannot
24824 be found. By default this option is disabled. It can be enabled
24825 to work around hardware bugs as found in the original SH7055.
24826
24827 -mfused-madd
24828 -mno-fused-madd
24829 Generate code that uses (does not use) the floating-point multiply
24830 and accumulate instructions. These instructions are generated by
24831 default if hardware floating point is used. The machine-dependent
24832 -mfused-madd option is now mapped to the machine-independent
24833 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24834 -ffp-contract=off.
24835
24836 -mfsca
24837 -mno-fsca
24838 Allow or disallow the compiler to emit the "fsca" instruction for
24839 sine and cosine approximations. The option -mfsca must be used in
24840 combination with -funsafe-math-optimizations. It is enabled by
24841 default when generating code for SH4A. Using -mno-fsca disables
24842 sine and cosine approximations even if -funsafe-math-optimizations
24843 is in effect.
24844
24845 -mfsrra
24846 -mno-fsrra
24847 Allow or disallow the compiler to emit the "fsrra" instruction for
24848 reciprocal square root approximations. The option -mfsrra must be
24849 used in combination with -funsafe-math-optimizations and
24850 -ffinite-math-only. It is enabled by default when generating code
24851 for SH4A. Using -mno-fsrra disables reciprocal square root
24852 approximations even if -funsafe-math-optimizations and
24853 -ffinite-math-only are in effect.
24854
24855 -mpretend-cmove
24856 Prefer zero-displacement conditional branches for conditional move
24857 instruction patterns. This can result in faster code on the SH4
24858 processor.
24859
24860 -mfdpic
24861 Generate code using the FDPIC ABI.
24862
24863 Solaris 2 Options
24864
24865 These -m options are supported on Solaris 2:
24866
24867 -mclear-hwcap
24868 -mclear-hwcap tells the compiler to remove the hardware
24869 capabilities generated by the Solaris assembler. This is only
24870 necessary when object files use ISA extensions not supported by the
24871 current machine, but check at runtime whether or not to use them.
24872
24873 -mimpure-text
24874 -mimpure-text, used in addition to -shared, tells the compiler to
24875 not pass -z text to the linker when linking a shared object. Using
24876 this option, you can link position-dependent code into a shared
24877 object.
24878
24879 -mimpure-text suppresses the "relocations remain against
24880 allocatable but non-writable sections" linker error message.
24881 However, the necessary relocations trigger copy-on-write, and the
24882 shared object is not actually shared across processes. Instead of
24883 using -mimpure-text, you should compile all source code with -fpic
24884 or -fPIC.
24885
24886 These switches are supported in addition to the above on Solaris 2:
24887
24888 -pthreads
24889 This is a synonym for -pthread.
24890
24891 SPARC Options
24892
24893 These -m options are supported on the SPARC:
24894
24895 -mno-app-regs
24896 -mapp-regs
24897 Specify -mapp-regs to generate output using the global registers 2
24898 through 4, which the SPARC SVR4 ABI reserves for applications.
24899 Like the global register 1, each global register 2 through 4 is
24900 then treated as an allocable register that is clobbered by function
24901 calls. This is the default.
24902
24903 To be fully SVR4 ABI-compliant at the cost of some performance
24904 loss, specify -mno-app-regs. You should compile libraries and
24905 system software with this option.
24906
24907 -mflat
24908 -mno-flat
24909 With -mflat, the compiler does not generate save/restore
24910 instructions and uses a "flat" or single register window model.
24911 This model is compatible with the regular register window model.
24912 The local registers and the input registers (0--5) are still
24913 treated as "call-saved" registers and are saved on the stack as
24914 needed.
24915
24916 With -mno-flat (the default), the compiler generates save/restore
24917 instructions (except for leaf functions). This is the normal
24918 operating mode.
24919
24920 -mfpu
24921 -mhard-float
24922 Generate output containing floating-point instructions. This is
24923 the default.
24924
24925 -mno-fpu
24926 -msoft-float
24927 Generate output containing library calls for floating point.
24928 Warning: the requisite libraries are not available for all SPARC
24929 targets. Normally the facilities of the machine's usual C compiler
24930 are used, but this cannot be done directly in cross-compilation.
24931 You must make your own arrangements to provide suitable library
24932 functions for cross-compilation. The embedded targets sparc-*-aout
24933 and sparclite-*-* do provide software floating-point support.
24934
24935 -msoft-float changes the calling convention in the output file;
24936 therefore, it is only useful if you compile all of a program with
24937 this option. In particular, you need to compile libgcc.a, the
24938 library that comes with GCC, with -msoft-float in order for this to
24939 work.
24940
24941 -mhard-quad-float
24942 Generate output containing quad-word (long double) floating-point
24943 instructions.
24944
24945 -msoft-quad-float
24946 Generate output containing library calls for quad-word (long
24947 double) floating-point instructions. The functions called are
24948 those specified in the SPARC ABI. This is the default.
24949
24950 As of this writing, there are no SPARC implementations that have
24951 hardware support for the quad-word floating-point instructions.
24952 They all invoke a trap handler for one of these instructions, and
24953 then the trap handler emulates the effect of the instruction.
24954 Because of the trap handler overhead, this is much slower than
24955 calling the ABI library routines. Thus the -msoft-quad-float
24956 option is the default.
24957
24958 -mno-unaligned-doubles
24959 -munaligned-doubles
24960 Assume that doubles have 8-byte alignment. This is the default.
24961
24962 With -munaligned-doubles, GCC assumes that doubles have 8-byte
24963 alignment only if they are contained in another type, or if they
24964 have an absolute address. Otherwise, it assumes they have 4-byte
24965 alignment. Specifying this option avoids some rare compatibility
24966 problems with code generated by other compilers. It is not the
24967 default because it results in a performance loss, especially for
24968 floating-point code.
24969
24970 -muser-mode
24971 -mno-user-mode
24972 Do not generate code that can only run in supervisor mode. This is
24973 relevant only for the "casa" instruction emitted for the LEON3
24974 processor. This is the default.
24975
24976 -mfaster-structs
24977 -mno-faster-structs
24978 With -mfaster-structs, the compiler assumes that structures should
24979 have 8-byte alignment. This enables the use of pairs of "ldd" and
24980 "std" instructions for copies in structure assignment, in place of
24981 twice as many "ld" and "st" pairs. However, the use of this
24982 changed alignment directly violates the SPARC ABI. Thus, it's
24983 intended only for use on targets where the developer acknowledges
24984 that their resulting code is not directly in line with the rules of
24985 the ABI.
24986
24987 -mstd-struct-return
24988 -mno-std-struct-return
24989 With -mstd-struct-return, the compiler generates checking code in
24990 functions returning structures or unions to detect size mismatches
24991 between the two sides of function calls, as per the 32-bit ABI.
24992
24993 The default is -mno-std-struct-return. This option has no effect
24994 in 64-bit mode.
24995
24996 -mlra
24997 -mno-lra
24998 Enable Local Register Allocation. This is the default for SPARC
24999 since GCC 7 so -mno-lra needs to be passed to get old Reload.
25000
25001 -mcpu=cpu_type
25002 Set the instruction set, register set, and instruction scheduling
25003 parameters for machine type cpu_type. Supported values for
25004 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
25005 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
25006 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
25007 niagara4, niagara7 and m8.
25008
25009 Native Solaris and GNU/Linux toolchains also support the value
25010 native, which selects the best architecture option for the host
25011 processor. -mcpu=native has no effect if GCC does not recognize
25012 the processor.
25013
25014 Default instruction scheduling parameters are used for values that
25015 select an architecture and not an implementation. These are v7,
25016 v8, sparclite, sparclet, v9.
25017
25018 Here is a list of each supported architecture and their supported
25019 implementations.
25020
25021 v7 cypress, leon3v7
25022
25023 v8 supersparc, hypersparc, leon, leon3, leon5
25024
25025 sparclite
25026 f930, f934, sparclite86x
25027
25028 sparclet
25029 tsc701
25030
25031 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25032 niagara7, m8
25033
25034 By default (unless configured otherwise), GCC generates code for
25035 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
25036 compiler additionally optimizes it for the Cypress CY7C602 chip, as
25037 used in the SPARCStation/SPARCServer 3xx series. This is also
25038 appropriate for the older SPARCStation 1, 2, IPX etc.
25039
25040 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
25041 architecture. The only difference from V7 code is that the
25042 compiler emits the integer multiply and integer divide instructions
25043 which exist in SPARC-V8 but not in SPARC-V7. With
25044 -mcpu=supersparc, the compiler additionally optimizes it for the
25045 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
25046 series.
25047
25048 With -mcpu=sparclite, GCC generates code for the SPARClite variant
25049 of the SPARC architecture. This adds the integer multiply, integer
25050 divide step and scan ("ffs") instructions which exist in SPARClite
25051 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
25052 optimizes it for the Fujitsu MB86930 chip, which is the original
25053 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
25054 optimizes it for the Fujitsu MB86934 chip, which is the more recent
25055 SPARClite with FPU.
25056
25057 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
25058 the SPARC architecture. This adds the integer multiply,
25059 multiply/accumulate, integer divide step and scan ("ffs")
25060 instructions which exist in SPARClet but not in SPARC-V7. With
25061 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
25062 SPARClet chip.
25063
25064 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
25065 architecture. This adds 64-bit integer and floating-point move
25066 instructions, 3 additional floating-point condition code registers
25067 and conditional move instructions. With -mcpu=ultrasparc, the
25068 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
25069 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
25070 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25071 -mcpu=niagara, the compiler additionally optimizes it for Sun
25072 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
25073 additionally optimizes it for Sun UltraSPARC T2 chips. With
25074 -mcpu=niagara3, the compiler additionally optimizes it for Sun
25075 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
25076 additionally optimizes it for Sun UltraSPARC T4 chips. With
25077 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
25078 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
25079 it for Oracle M8 chips.
25080
25081 -mtune=cpu_type
25082 Set the instruction scheduling parameters for machine type
25083 cpu_type, but do not set the instruction set or register set that
25084 the option -mcpu=cpu_type does.
25085
25086 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
25087 but the only useful values are those that select a particular CPU
25088 implementation. Those are cypress, supersparc, hypersparc, leon,
25089 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
25090 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25091 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
25092 native can also be used.
25093
25094 -mv8plus
25095 -mno-v8plus
25096 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
25097 difference from the V8 ABI is that the global and out registers are
25098 considered 64 bits wide. This is enabled by default on Solaris in
25099 32-bit mode for all SPARC-V9 processors.
25100
25101 -mvis
25102 -mno-vis
25103 With -mvis, GCC generates code that takes advantage of the
25104 UltraSPARC Visual Instruction Set extensions. The default is
25105 -mno-vis.
25106
25107 -mvis2
25108 -mno-vis2
25109 With -mvis2, GCC generates code that takes advantage of version 2.0
25110 of the UltraSPARC Visual Instruction Set extensions. The default
25111 is -mvis2 when targeting a cpu that supports such instructions,
25112 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
25113
25114 -mvis3
25115 -mno-vis3
25116 With -mvis3, GCC generates code that takes advantage of version 3.0
25117 of the UltraSPARC Visual Instruction Set extensions. The default
25118 is -mvis3 when targeting a cpu that supports such instructions,
25119 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
25120 -mvis.
25121
25122 -mvis4
25123 -mno-vis4
25124 With -mvis4, GCC generates code that takes advantage of version 4.0
25125 of the UltraSPARC Visual Instruction Set extensions. The default
25126 is -mvis4 when targeting a cpu that supports such instructions,
25127 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
25128 -mvis2 and -mvis.
25129
25130 -mvis4b
25131 -mno-vis4b
25132 With -mvis4b, GCC generates code that takes advantage of version
25133 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
25134 additional VIS instructions introduced in the Oracle SPARC
25135 Architecture 2017. The default is -mvis4b when targeting a cpu
25136 that supports such instructions, such as m8 and later. Setting
25137 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
25138
25139 -mcbcond
25140 -mno-cbcond
25141 With -mcbcond, GCC generates code that takes advantage of the
25142 UltraSPARC Compare-and-Branch-on-Condition instructions. The
25143 default is -mcbcond when targeting a CPU that supports such
25144 instructions, such as Niagara-4 and later.
25145
25146 -mfmaf
25147 -mno-fmaf
25148 With -mfmaf, GCC generates code that takes advantage of the
25149 UltraSPARC Fused Multiply-Add Floating-point instructions. The
25150 default is -mfmaf when targeting a CPU that supports such
25151 instructions, such as Niagara-3 and later.
25152
25153 -mfsmuld
25154 -mno-fsmuld
25155 With -mfsmuld, GCC generates code that takes advantage of the
25156 Floating-point Multiply Single to Double (FsMULd) instruction. The
25157 default is -mfsmuld when targeting a CPU supporting the
25158 architecture versions V8 or V9 with FPU except -mcpu=leon.
25159
25160 -mpopc
25161 -mno-popc
25162 With -mpopc, GCC generates code that takes advantage of the
25163 UltraSPARC Population Count instruction. The default is -mpopc
25164 when targeting a CPU that supports such an instruction, such as
25165 Niagara-2 and later.
25166
25167 -msubxc
25168 -mno-subxc
25169 With -msubxc, GCC generates code that takes advantage of the
25170 UltraSPARC Subtract-Extended-with-Carry instruction. The default
25171 is -msubxc when targeting a CPU that supports such an instruction,
25172 such as Niagara-7 and later.
25173
25174 -mfix-at697f
25175 Enable the documented workaround for the single erratum of the
25176 Atmel AT697F processor (which corresponds to erratum #13 of the
25177 AT697E processor).
25178
25179 -mfix-ut699
25180 Enable the documented workarounds for the floating-point errata and
25181 the data cache nullify errata of the UT699 processor.
25182
25183 -mfix-ut700
25184 Enable the documented workaround for the back-to-back store errata
25185 of the UT699E/UT700 processor.
25186
25187 -mfix-gr712rc
25188 Enable the documented workaround for the back-to-back store errata
25189 of the GR712RC processor.
25190
25191 These -m options are supported in addition to the above on SPARC-V9
25192 processors in 64-bit environments:
25193
25194 -m32
25195 -m64
25196 Generate code for a 32-bit or 64-bit environment. The 32-bit
25197 environment sets int, long and pointer to 32 bits. The 64-bit
25198 environment sets int to 32 bits and long and pointer to 64 bits.
25199
25200 -mcmodel=which
25201 Set the code model to one of
25202
25203 medlow
25204 The Medium/Low code model: 64-bit addresses, programs must be
25205 linked in the low 32 bits of memory. Programs can be
25206 statically or dynamically linked.
25207
25208 medmid
25209 The Medium/Middle code model: 64-bit addresses, programs must
25210 be linked in the low 44 bits of memory, the text and data
25211 segments must be less than 2GB in size and the data segment
25212 must be located within 2GB of the text segment.
25213
25214 medany
25215 The Medium/Anywhere code model: 64-bit addresses, programs may
25216 be linked anywhere in memory, the text and data segments must
25217 be less than 2GB in size and the data segment must be located
25218 within 2GB of the text segment.
25219
25220 embmedany
25221 The Medium/Anywhere code model for embedded systems: 64-bit
25222 addresses, the text and data segments must be less than 2GB in
25223 size, both starting anywhere in memory (determined at link
25224 time). The global register %g4 points to the base of the data
25225 segment. Programs are statically linked and PIC is not
25226 supported.
25227
25228 -mmemory-model=mem-model
25229 Set the memory model in force on the processor to one of
25230
25231 default
25232 The default memory model for the processor and operating
25233 system.
25234
25235 rmo Relaxed Memory Order
25236
25237 pso Partial Store Order
25238
25239 tso Total Store Order
25240
25241 sc Sequential Consistency
25242
25243 These memory models are formally defined in Appendix D of the
25244 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
25245 field.
25246
25247 -mstack-bias
25248 -mno-stack-bias
25249 With -mstack-bias, GCC assumes that the stack pointer, and frame
25250 pointer if present, are offset by -2047 which must be added back
25251 when making stack frame references. This is the default in 64-bit
25252 mode. Otherwise, assume no such offset is present.
25253
25254 Options for System V
25255
25256 These additional options are available on System V Release 4 for
25257 compatibility with other compilers on those systems:
25258
25259 -G Create a shared object. It is recommended that -symbolic or
25260 -shared be used instead.
25261
25262 -Qy Identify the versions of each tool used by the compiler, in a
25263 ".ident" assembler directive in the output.
25264
25265 -Qn Refrain from adding ".ident" directives to the output file (this is
25266 the default).
25267
25268 -YP,dirs
25269 Search the directories dirs, and no others, for libraries specified
25270 with -l.
25271
25272 -Ym,dir
25273 Look in the directory dir to find the M4 preprocessor. The
25274 assembler uses this option.
25275
25276 TILE-Gx Options
25277
25278 These -m options are supported on the TILE-Gx:
25279
25280 -mcmodel=small
25281 Generate code for the small model. The distance for direct calls
25282 is limited to 500M in either direction. PC-relative addresses are
25283 32 bits. Absolute addresses support the full address range.
25284
25285 -mcmodel=large
25286 Generate code for the large model. There is no limitation on call
25287 distance, pc-relative addresses, or absolute addresses.
25288
25289 -mcpu=name
25290 Selects the type of CPU to be targeted. Currently the only
25291 supported type is tilegx.
25292
25293 -m32
25294 -m64
25295 Generate code for a 32-bit or 64-bit environment. The 32-bit
25296 environment sets int, long, and pointer to 32 bits. The 64-bit
25297 environment sets int to 32 bits and long and pointer to 64 bits.
25298
25299 -mbig-endian
25300 -mlittle-endian
25301 Generate code in big/little endian mode, respectively.
25302
25303 TILEPro Options
25304
25305 These -m options are supported on the TILEPro:
25306
25307 -mcpu=name
25308 Selects the type of CPU to be targeted. Currently the only
25309 supported type is tilepro.
25310
25311 -m32
25312 Generate code for a 32-bit environment, which sets int, long, and
25313 pointer to 32 bits. This is the only supported behavior so the
25314 flag is essentially ignored.
25315
25316 V850 Options
25317
25318 These -m options are defined for V850 implementations:
25319
25320 -mlong-calls
25321 -mno-long-calls
25322 Treat all calls as being far away (near). If calls are assumed to
25323 be far away, the compiler always loads the function's address into
25324 a register, and calls indirect through the pointer.
25325
25326 -mno-ep
25327 -mep
25328 Do not optimize (do optimize) basic blocks that use the same index
25329 pointer 4 or more times to copy pointer into the "ep" register, and
25330 use the shorter "sld" and "sst" instructions. The -mep option is
25331 on by default if you optimize.
25332
25333 -mno-prolog-function
25334 -mprolog-function
25335 Do not use (do use) external functions to save and restore
25336 registers at the prologue and epilogue of a function. The external
25337 functions are slower, but use less code space if more than one
25338 function saves the same number of registers. The -mprolog-function
25339 option is on by default if you optimize.
25340
25341 -mspace
25342 Try to make the code as small as possible. At present, this just
25343 turns on the -mep and -mprolog-function options.
25344
25345 -mtda=n
25346 Put static or global variables whose size is n bytes or less into
25347 the tiny data area that register "ep" points to. The tiny data
25348 area can hold up to 256 bytes in total (128 bytes for byte
25349 references).
25350
25351 -msda=n
25352 Put static or global variables whose size is n bytes or less into
25353 the small data area that register "gp" points to. The small data
25354 area can hold up to 64 kilobytes.
25355
25356 -mzda=n
25357 Put static or global variables whose size is n bytes or less into
25358 the first 32 kilobytes of memory.
25359
25360 -mv850
25361 Specify that the target processor is the V850.
25362
25363 -mv850e3v5
25364 Specify that the target processor is the V850E3V5. The
25365 preprocessor constant "__v850e3v5__" is defined if this option is
25366 used.
25367
25368 -mv850e2v4
25369 Specify that the target processor is the V850E3V5. This is an
25370 alias for the -mv850e3v5 option.
25371
25372 -mv850e2v3
25373 Specify that the target processor is the V850E2V3. The
25374 preprocessor constant "__v850e2v3__" is defined if this option is
25375 used.
25376
25377 -mv850e2
25378 Specify that the target processor is the V850E2. The preprocessor
25379 constant "__v850e2__" is defined if this option is used.
25380
25381 -mv850e1
25382 Specify that the target processor is the V850E1. The preprocessor
25383 constants "__v850e1__" and "__v850e__" are defined if this option
25384 is used.
25385
25386 -mv850es
25387 Specify that the target processor is the V850ES. This is an alias
25388 for the -mv850e1 option.
25389
25390 -mv850e
25391 Specify that the target processor is the V850E. The preprocessor
25392 constant "__v850e__" is defined if this option is used.
25393
25394 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
25395 -mv850e2v3 nor -mv850e3v5 are defined then a default target
25396 processor is chosen and the relevant __v850*__ preprocessor
25397 constant is defined.
25398
25399 The preprocessor constants "__v850" and "__v851__" are always
25400 defined, regardless of which processor variant is the target.
25401
25402 -mdisable-callt
25403 -mno-disable-callt
25404 This option suppresses generation of the "CALLT" instruction for
25405 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
25406 v850 architecture.
25407
25408 This option is enabled by default when the RH850 ABI is in use (see
25409 -mrh850-abi), and disabled by default when the GCC ABI is in use.
25410 If "CALLT" instructions are being generated then the C preprocessor
25411 symbol "__V850_CALLT__" is defined.
25412
25413 -mrelax
25414 -mno-relax
25415 Pass on (or do not pass on) the -mrelax command-line option to the
25416 assembler.
25417
25418 -mlong-jumps
25419 -mno-long-jumps
25420 Disable (or re-enable) the generation of PC-relative jump
25421 instructions.
25422
25423 -msoft-float
25424 -mhard-float
25425 Disable (or re-enable) the generation of hardware floating point
25426 instructions. This option is only significant when the target
25427 architecture is V850E2V3 or higher. If hardware floating point
25428 instructions are being generated then the C preprocessor symbol
25429 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
25430 defined.
25431
25432 -mloop
25433 Enables the use of the e3v5 LOOP instruction. The use of this
25434 instruction is not enabled by default when the e3v5 architecture is
25435 selected because its use is still experimental.
25436
25437 -mrh850-abi
25438 -mghs
25439 Enables support for the RH850 version of the V850 ABI. This is the
25440 default. With this version of the ABI the following rules apply:
25441
25442 * Integer sized structures and unions are returned via a memory
25443 pointer rather than a register.
25444
25445 * Large structures and unions (more than 8 bytes in size) are
25446 passed by value.
25447
25448 * Functions are aligned to 16-bit boundaries.
25449
25450 * The -m8byte-align command-line option is supported.
25451
25452 * The -mdisable-callt command-line option is enabled by default.
25453 The -mno-disable-callt command-line option is not supported.
25454
25455 When this version of the ABI is enabled the C preprocessor symbol
25456 "__V850_RH850_ABI__" is defined.
25457
25458 -mgcc-abi
25459 Enables support for the old GCC version of the V850 ABI. With this
25460 version of the ABI the following rules apply:
25461
25462 * Integer sized structures and unions are returned in register
25463 "r10".
25464
25465 * Large structures and unions (more than 8 bytes in size) are
25466 passed by reference.
25467
25468 * Functions are aligned to 32-bit boundaries, unless optimizing
25469 for size.
25470
25471 * The -m8byte-align command-line option is not supported.
25472
25473 * The -mdisable-callt command-line option is supported but not
25474 enabled by default.
25475
25476 When this version of the ABI is enabled the C preprocessor symbol
25477 "__V850_GCC_ABI__" is defined.
25478
25479 -m8byte-align
25480 -mno-8byte-align
25481 Enables support for "double" and "long long" types to be aligned on
25482 8-byte boundaries. The default is to restrict the alignment of all
25483 objects to at most 4-bytes. When -m8byte-align is in effect the C
25484 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
25485
25486 -mbig-switch
25487 Generate code suitable for big switch tables. Use this option only
25488 if the assembler/linker complain about out of range branches within
25489 a switch table.
25490
25491 -mapp-regs
25492 This option causes r2 and r5 to be used in the code generated by
25493 the compiler. This setting is the default.
25494
25495 -mno-app-regs
25496 This option causes r2 and r5 to be treated as fixed registers.
25497
25498 VAX Options
25499
25500 These -m options are defined for the VAX:
25501
25502 -munix
25503 Do not output certain jump instructions ("aobleq" and so on) that
25504 the Unix assembler for the VAX cannot handle across long ranges.
25505
25506 -mgnu
25507 Do output those jump instructions, on the assumption that the GNU
25508 assembler is being used.
25509
25510 -mg Output code for G-format floating-point numbers instead of
25511 D-format.
25512
25513 Visium Options
25514
25515 -mdebug
25516 A program which performs file I/O and is destined to run on an MCM
25517 target should be linked with this option. It causes the libraries
25518 libc.a and libdebug.a to be linked. The program should be run on
25519 the target under the control of the GDB remote debugging stub.
25520
25521 -msim
25522 A program which performs file I/O and is destined to run on the
25523 simulator should be linked with option. This causes libraries
25524 libc.a and libsim.a to be linked.
25525
25526 -mfpu
25527 -mhard-float
25528 Generate code containing floating-point instructions. This is the
25529 default.
25530
25531 -mno-fpu
25532 -msoft-float
25533 Generate code containing library calls for floating-point.
25534
25535 -msoft-float changes the calling convention in the output file;
25536 therefore, it is only useful if you compile all of a program with
25537 this option. In particular, you need to compile libgcc.a, the
25538 library that comes with GCC, with -msoft-float in order for this to
25539 work.
25540
25541 -mcpu=cpu_type
25542 Set the instruction set, register set, and instruction scheduling
25543 parameters for machine type cpu_type. Supported values for
25544 cpu_type are mcm, gr5 and gr6.
25545
25546 mcm is a synonym of gr5 present for backward compatibility.
25547
25548 By default (unless configured otherwise), GCC generates code for
25549 the GR5 variant of the Visium architecture.
25550
25551 With -mcpu=gr6, GCC generates code for the GR6 variant of the
25552 Visium architecture. The only difference from GR5 code is that the
25553 compiler will generate block move instructions.
25554
25555 -mtune=cpu_type
25556 Set the instruction scheduling parameters for machine type
25557 cpu_type, but do not set the instruction set or register set that
25558 the option -mcpu=cpu_type would.
25559
25560 -msv-mode
25561 Generate code for the supervisor mode, where there are no
25562 restrictions on the access to general registers. This is the
25563 default.
25564
25565 -muser-mode
25566 Generate code for the user mode, where the access to some general
25567 registers is forbidden: on the GR5, registers r24 to r31 cannot be
25568 accessed in this mode; on the GR6, only registers r29 to r31 are
25569 affected.
25570
25571 VMS Options
25572
25573 These -m options are defined for the VMS implementations:
25574
25575 -mvms-return-codes
25576 Return VMS condition codes from "main". The default is to return
25577 POSIX-style condition (e.g. error) codes.
25578
25579 -mdebug-main=prefix
25580 Flag the first routine whose name starts with prefix as the main
25581 routine for the debugger.
25582
25583 -mmalloc64
25584 Default to 64-bit memory allocation routines.
25585
25586 -mpointer-size=size
25587 Set the default size of pointers. Possible options for size are 32
25588 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
25589 no for supporting only 32 bit pointers. The later option disables
25590 "pragma pointer_size".
25591
25592 VxWorks Options
25593
25594 The options in this section are defined for all VxWorks targets.
25595 Options specific to the target hardware are listed with the other
25596 options for that target.
25597
25598 -mrtp
25599 GCC can generate code for both VxWorks kernels and real time
25600 processes (RTPs). This option switches from the former to the
25601 latter. It also defines the preprocessor macro "__RTP__".
25602
25603 -non-static
25604 Link an RTP executable against shared libraries rather than static
25605 libraries. The options -static and -shared can also be used for
25606 RTPs; -static is the default.
25607
25608 -Bstatic
25609 -Bdynamic
25610 These options are passed down to the linker. They are defined for
25611 compatibility with Diab.
25612
25613 -Xbind-lazy
25614 Enable lazy binding of function calls. This option is equivalent
25615 to -Wl,-z,now and is defined for compatibility with Diab.
25616
25617 -Xbind-now
25618 Disable lazy binding of function calls. This option is the default
25619 and is defined for compatibility with Diab.
25620
25621 x86 Options
25622
25623 These -m options are defined for the x86 family of computers.
25624
25625 -march=cpu-type
25626 Generate instructions for the machine type cpu-type. In contrast
25627 to -mtune=cpu-type, which merely tunes the generated code for the
25628 specified cpu-type, -march=cpu-type allows GCC to generate code
25629 that may not run at all on processors other than the one indicated.
25630 Specifying -march=cpu-type implies -mtune=cpu-type, except where
25631 noted otherwise.
25632
25633 The choices for cpu-type are:
25634
25635 native
25636 This selects the CPU to generate code for at compilation time
25637 by determining the processor type of the compiling machine.
25638 Using -march=native enables all instruction subsets supported
25639 by the local machine (hence the result might not run on
25640 different machines). Using -mtune=native produces code
25641 optimized for the local machine under the constraints of the
25642 selected instruction set.
25643
25644 x86-64
25645 A generic CPU with 64-bit extensions.
25646
25647 x86-64-v2
25648 x86-64-v3
25649 x86-64-v4
25650 These choices for cpu-type select the corresponding micro-
25651 architecture level from the x86-64 psABI. On ABIs other than
25652 the x86-64 psABI they select the same CPU features as the
25653 x86-64 psABI documents for the particular micro-architecture
25654 level.
25655
25656 Since these cpu-type values do not have a corresponding -mtune
25657 setting, using -march with these values enables generic tuning.
25658 Specific tuning can be enabled using the -mtune=other-cpu-type
25659 option with an appropriate other-cpu-type value.
25660
25661 i386
25662 Original Intel i386 CPU.
25663
25664 i486
25665 Intel i486 CPU. (No scheduling is implemented for this chip.)
25666
25667 i586
25668 pentium
25669 Intel Pentium CPU with no MMX support.
25670
25671 lakemont
25672 Intel Lakemont MCU, based on Intel Pentium CPU.
25673
25674 pentium-mmx
25675 Intel Pentium MMX CPU, based on Pentium core with MMX
25676 instruction set support.
25677
25678 pentiumpro
25679 Intel Pentium Pro CPU.
25680
25681 i686
25682 When used with -march, the Pentium Pro instruction set is used,
25683 so the code runs on all i686 family chips. When used with
25684 -mtune, it has the same meaning as generic.
25685
25686 pentium2
25687 Intel Pentium II CPU, based on Pentium Pro core with MMX
25688 instruction set support.
25689
25690 pentium3
25691 pentium3m
25692 Intel Pentium III CPU, based on Pentium Pro core with MMX and
25693 SSE instruction set support.
25694
25695 pentium-m
25696 Intel Pentium M; low-power version of Intel Pentium III CPU
25697 with MMX, SSE and SSE2 instruction set support. Used by
25698 Centrino notebooks.
25699
25700 pentium4
25701 pentium4m
25702 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
25703 support.
25704
25705 prescott
25706 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
25707 SSE3 instruction set support.
25708
25709 nocona
25710 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
25711 MMX, SSE, SSE2 and SSE3 instruction set support.
25712
25713 core2
25714 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
25715 and SSSE3 instruction set support.
25716
25717 nehalem
25718 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
25719 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
25720
25721 westmere
25722 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
25723 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
25724 set support.
25725
25726 sandybridge
25727 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25728 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
25729 instruction set support.
25730
25731 ivybridge
25732 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25733 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
25734 FSGSBASE, RDRND and F16C instruction set support.
25735
25736 haswell
25737 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25738 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25739 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
25740 set support.
25741
25742 broadwell
25743 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25744 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25745 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED ADCX and
25746 PREFETCHW instruction set support.
25747
25748 skylake
25749 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25750 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25751 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25752 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
25753 support.
25754
25755 bonnell
25756 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25757 SSE2, SSE3 and SSSE3 instruction set support.
25758
25759 silvermont
25760 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25761 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25762 PCLMUL and RDRND instruction set support.
25763
25764 goldmont
25765 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25766 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25767 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT and FSGSBASE
25768 instruction set support.
25769
25770 goldmont-plus
25771 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
25772 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25773 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25774 PTWRITE, RDPID, SGX and UMIP instruction set support.
25775
25776 tremont
25777 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25778 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25779 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25780 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25781 CLDEMOTE and WAITPKG instruction set support.
25782
25783 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
25784 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25785 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25786 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER and
25787 AVX512CD instruction set support.
25788
25789 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
25790 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25791 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25792 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25793 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set
25794 support.
25795
25796 skylake-avx512
25797 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
25798 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25799 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25800 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25801 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
25802 support.
25803
25804 cannonlake
25805 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
25806 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25807 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25808 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25809 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
25810 UMIP instruction set support.
25811
25812 icelake-client
25813 Intel Icelake Client 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, AVX512VL,
25817 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25818 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25819 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25820 support.
25821
25822 icelake-server
25823 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
25824 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25825 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25826 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25827 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25828 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25829 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
25830 WBNOINVD instruction set support.
25831
25832 cascadelake
25833 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25834 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25835 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25836 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25837 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
25838 support.
25839
25840 cooperlake
25841 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25842 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25843 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25844 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25845 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
25846 instruction set support.
25847
25848 tigerlake
25849 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25850 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25851 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25852 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25853 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25854 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25855 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG, WBNOINVD,
25856 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
25857 instruction set support.
25858
25859 sapphirerapids
25860 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
25861 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25862 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25863 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25864 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
25865 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE,
25866 PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-
25867 TILE, AMX-INT8 and AVX-VNNI instruction set support.
25868
25869 alderlake
25870 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25871 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25872 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25873 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25874 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
25875 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
25876 WIDEKL and AVX-VNNI instruction set support.
25877
25878 rocketlake
25879 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25880 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25881 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25882 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25883 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25884 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25885 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25886 support.
25887
25888 k6 AMD K6 CPU with MMX instruction set support.
25889
25890 k6-2
25891 k6-3
25892 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
25893 set support.
25894
25895 athlon
25896 athlon-tbird
25897 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
25898 prefetch instructions support.
25899
25900 athlon-4
25901 athlon-xp
25902 athlon-mp
25903 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
25904 full SSE instruction set support.
25905
25906 k8
25907 opteron
25908 athlon64
25909 athlon-fx
25910 Processors based on the AMD K8 core with x86-64 instruction set
25911 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
25912 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
25913 3DNow! and 64-bit instruction set extensions.)
25914
25915 k8-sse3
25916 opteron-sse3
25917 athlon64-sse3
25918 Improved versions of AMD K8 cores with SSE3 instruction set
25919 support.
25920
25921 amdfam10
25922 barcelona
25923 CPUs based on AMD Family 10h cores with x86-64 instruction set
25924 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
25925 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
25926
25927 bdver1
25928 CPUs based on AMD Family 15h cores with x86-64 instruction set
25929 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
25930 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
25931 and 64-bit instruction set extensions.)
25932
25933 bdver2
25934 AMD Family 15h core based CPUs with x86-64 instruction set
25935 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
25936 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
25937 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
25938
25939 bdver3
25940 AMD Family 15h core based CPUs with x86-64 instruction set
25941 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
25942 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
25943 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
25944 extensions.)
25945
25946 bdver4
25947 AMD Family 15h core based CPUs with x86-64 instruction set
25948 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
25949 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
25950 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
25951 instruction set extensions.)
25952
25953 znver1
25954 AMD Family 17h core based CPUs with x86-64 instruction set
25955 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
25956 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
25957 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
25958 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
25959 extensions.)
25960
25961 znver2
25962 AMD Family 17h core based CPUs with x86-64 instruction set
25963 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25964 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25965 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25966 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25967 WBNOINVD, and 64-bit instruction set extensions.)
25968
25969 znver3
25970 AMD Family 19h core based CPUs with x86-64 instruction set
25971 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25972 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25973 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25974 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25975 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
25976 extensions.)
25977
25978 btver1
25979 CPUs based on AMD Family 14h cores with x86-64 instruction set
25980 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
25981 CX16, ABM and 64-bit instruction set extensions.)
25982
25983 btver2
25984 CPUs based on AMD Family 16h cores with x86-64 instruction set
25985 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
25986 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
25987 and 64-bit instruction set extensions.
25988
25989 winchip-c6
25990 IDT WinChip C6 CPU, dealt in same way as i486 with additional
25991 MMX instruction set support.
25992
25993 winchip2
25994 IDT WinChip 2 CPU, dealt in same way as i486 with additional
25995 MMX and 3DNow! instruction set support.
25996
25997 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
25998 scheduling is implemented for this chip.)
25999
26000 c3-2
26001 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
26002 support. (No scheduling is implemented for this chip.)
26003
26004 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
26005 set support. (No scheduling is implemented for this chip.)
26006
26007 samuel-2
26008 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
26009 support. (No scheduling is implemented for this chip.)
26010
26011 nehemiah
26012 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
26013 (No scheduling is implemented for this chip.)
26014
26015 esther
26016 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
26017 set support. (No scheduling is implemented for this chip.)
26018
26019 eden-x2
26020 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
26021 instruction set support. (No scheduling is implemented for
26022 this chip.)
26023
26024 eden-x4
26025 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
26026 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
26027 scheduling is implemented for this chip.)
26028
26029 nano
26030 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
26031 SSSE3 instruction set support. (No scheduling is implemented
26032 for this chip.)
26033
26034 nano-1000
26035 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26036 instruction set support. (No scheduling is implemented for
26037 this chip.)
26038
26039 nano-2000
26040 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26041 instruction set support. (No scheduling is implemented for
26042 this chip.)
26043
26044 nano-3000
26045 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
26046 SSE4.1 instruction set support. (No scheduling is implemented
26047 for this chip.)
26048
26049 nano-x2
26050 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
26051 and SSE4.1 instruction set support. (No scheduling is
26052 implemented for this chip.)
26053
26054 nano-x4
26055 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
26056 and SSE4.1 instruction set support. (No scheduling is
26057 implemented for this chip.)
26058
26059 geode
26060 AMD Geode embedded processor with MMX and 3DNow! instruction
26061 set support.
26062
26063 -mtune=cpu-type
26064 Tune to cpu-type everything applicable about the generated code,
26065 except for the ABI and the set of available instructions. While
26066 picking a specific cpu-type schedules things appropriately for that
26067 particular chip, the compiler does not generate any code that
26068 cannot run on the default machine type unless you use a -march=cpu-
26069 type option. For example, if GCC is configured for
26070 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
26071 for Pentium 4 but still runs on i686 machines.
26072
26073 The choices for cpu-type are the same as for -march. In addition,
26074 -mtune supports 2 extra choices for cpu-type:
26075
26076 generic
26077 Produce code optimized for the most common IA32/AMD64/EM64T
26078 processors. If you know the CPU on which your code will run,
26079 then you should use the corresponding -mtune or -march option
26080 instead of -mtune=generic. But, if you do not know exactly
26081 what CPU users of your application will have, then you should
26082 use this option.
26083
26084 As new processors are deployed in the marketplace, the behavior
26085 of this option will change. Therefore, if you upgrade to a
26086 newer version of GCC, code generation controlled by this option
26087 will change to reflect the processors that are most common at
26088 the time that version of GCC is released.
26089
26090 There is no -march=generic option because -march indicates the
26091 instruction set the compiler can use, and there is no generic
26092 instruction set applicable to all processors. In contrast,
26093 -mtune indicates the processor (or, in this case, collection of
26094 processors) for which the code is optimized.
26095
26096 intel
26097 Produce code optimized for the most current Intel processors,
26098 which are Haswell and Silvermont for this version of GCC. If
26099 you know the CPU on which your code will run, then you should
26100 use the corresponding -mtune or -march option instead of
26101 -mtune=intel. But, if you want your application performs
26102 better on both Haswell and Silvermont, then you should use this
26103 option.
26104
26105 As new Intel processors are deployed in the marketplace, the
26106 behavior of this option will change. Therefore, if you upgrade
26107 to a newer version of GCC, code generation controlled by this
26108 option will change to reflect the most current Intel processors
26109 at the time that version of GCC is released.
26110
26111 There is no -march=intel option because -march indicates the
26112 instruction set the compiler can use, and there is no common
26113 instruction set applicable to all processors. In contrast,
26114 -mtune indicates the processor (or, in this case, collection of
26115 processors) for which the code is optimized.
26116
26117 -mcpu=cpu-type
26118 A deprecated synonym for -mtune.
26119
26120 -mfpmath=unit
26121 Generate floating-point arithmetic for selected unit unit. The
26122 choices for unit are:
26123
26124 387 Use the standard 387 floating-point coprocessor present on the
26125 majority of chips and emulated otherwise. Code compiled with
26126 this option runs almost everywhere. The temporary results are
26127 computed in 80-bit precision instead of the precision specified
26128 by the type, resulting in slightly different results compared
26129 to most of other chips. See -ffloat-store for more detailed
26130 description.
26131
26132 This is the default choice for non-Darwin x86-32 targets.
26133
26134 sse Use scalar floating-point instructions present in the SSE
26135 instruction set. This instruction set is supported by Pentium
26136 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
26137 and Athlon MP chips. The earlier version of the SSE
26138 instruction set supports only single-precision arithmetic, thus
26139 the double and extended-precision arithmetic are still done
26140 using 387. A later version, present only in Pentium 4 and AMD
26141 x86-64 chips, supports double-precision arithmetic too.
26142
26143 For the x86-32 compiler, you must use -march=cpu-type, -msse or
26144 -msse2 switches to enable SSE extensions and make this option
26145 effective. For the x86-64 compiler, these extensions are
26146 enabled by default.
26147
26148 The resulting code should be considerably faster in the
26149 majority of cases and avoid the numerical instability problems
26150 of 387 code, but may break some existing code that expects
26151 temporaries to be 80 bits.
26152
26153 This is the default choice for the x86-64 compiler, Darwin
26154 x86-32 targets, and the default choice for x86-32 targets with
26155 the SSE2 instruction set when -ffast-math is enabled.
26156
26157 sse,387
26158 sse+387
26159 both
26160 Attempt to utilize both instruction sets at once. This
26161 effectively doubles the amount of available registers, and on
26162 chips with separate execution units for 387 and SSE the
26163 execution resources too. Use this option with care, as it is
26164 still experimental, because the GCC register allocator does not
26165 model separate functional units well, resulting in unstable
26166 performance.
26167
26168 -masm=dialect
26169 Output assembly instructions using selected dialect. Also affects
26170 which dialect is used for basic "asm" and extended "asm". Supported
26171 choices (in dialect order) are att or intel. The default is att.
26172 Darwin does not support intel.
26173
26174 -mieee-fp
26175 -mno-ieee-fp
26176 Control whether or not the compiler uses IEEE floating-point
26177 comparisons. These correctly handle the case where the result of a
26178 comparison is unordered.
26179
26180 -m80387
26181 -mhard-float
26182 Generate output containing 80387 instructions for floating point.
26183
26184 -mno-80387
26185 -msoft-float
26186 Generate output containing library calls for floating point.
26187
26188 Warning: the requisite libraries are not part of GCC. Normally the
26189 facilities of the machine's usual C compiler are used, but this
26190 cannot be done directly in cross-compilation. You must make your
26191 own arrangements to provide suitable library functions for cross-
26192 compilation.
26193
26194 On machines where a function returns floating-point results in the
26195 80387 register stack, some floating-point opcodes may be emitted
26196 even if -msoft-float is used.
26197
26198 -mno-fp-ret-in-387
26199 Do not use the FPU registers for return values of functions.
26200
26201 The usual calling convention has functions return values of types
26202 "float" and "double" in an FPU register, even if there is no FPU.
26203 The idea is that the operating system should emulate an FPU.
26204
26205 The option -mno-fp-ret-in-387 causes such values to be returned in
26206 ordinary CPU registers instead.
26207
26208 -mno-fancy-math-387
26209 Some 387 emulators do not support the "sin", "cos" and "sqrt"
26210 instructions for the 387. Specify this option to avoid generating
26211 those instructions. This option is overridden when -march
26212 indicates that the target CPU always has an FPU and so the
26213 instruction does not need emulation. These instructions are not
26214 generated unless you also use the -funsafe-math-optimizations
26215 switch.
26216
26217 -malign-double
26218 -mno-align-double
26219 Control whether GCC aligns "double", "long double", and "long long"
26220 variables on a two-word boundary or a one-word boundary. Aligning
26221 "double" variables on a two-word boundary produces code that runs
26222 somewhat faster on a Pentium at the expense of more memory.
26223
26224 On x86-64, -malign-double is enabled by default.
26225
26226 Warning: if you use the -malign-double switch, structures
26227 containing the above types are aligned differently than the
26228 published application binary interface specifications for the
26229 x86-32 and are not binary compatible with structures in code
26230 compiled without that switch.
26231
26232 -m96bit-long-double
26233 -m128bit-long-double
26234 These switches control the size of "long double" type. The x86-32
26235 application binary interface specifies the size to be 96 bits, so
26236 -m96bit-long-double is the default in 32-bit mode.
26237
26238 Modern architectures (Pentium and newer) prefer "long double" to be
26239 aligned to an 8- or 16-byte boundary. In arrays or structures
26240 conforming to the ABI, this is not possible. So specifying
26241 -m128bit-long-double aligns "long double" to a 16-byte boundary by
26242 padding the "long double" with an additional 32-bit zero.
26243
26244 In the x86-64 compiler, -m128bit-long-double is the default choice
26245 as its ABI specifies that "long double" is aligned on 16-byte
26246 boundary.
26247
26248 Notice that neither of these options enable any extra precision
26249 over the x87 standard of 80 bits for a "long double".
26250
26251 Warning: if you override the default value for your target ABI,
26252 this changes the size of structures and arrays containing "long
26253 double" variables, as well as modifying the function calling
26254 convention for functions taking "long double". Hence they are not
26255 binary-compatible with code compiled without that switch.
26256
26257 -mlong-double-64
26258 -mlong-double-80
26259 -mlong-double-128
26260 These switches control the size of "long double" type. A size of 64
26261 bits makes the "long double" type equivalent to the "double" type.
26262 This is the default for 32-bit Bionic C library. A size of 128
26263 bits makes the "long double" type equivalent to the "__float128"
26264 type. This is the default for 64-bit Bionic C library.
26265
26266 Warning: if you override the default value for your target ABI,
26267 this changes the size of structures and arrays containing "long
26268 double" variables, as well as modifying the function calling
26269 convention for functions taking "long double". Hence they are not
26270 binary-compatible with code compiled without that switch.
26271
26272 -malign-data=type
26273 Control how GCC aligns variables. Supported values for type are
26274 compat uses increased alignment value compatible uses GCC 4.8 and
26275 earlier, abi uses alignment value as specified by the psABI, and
26276 cacheline uses increased alignment value to match the cache line
26277 size. compat is the default.
26278
26279 -mlarge-data-threshold=threshold
26280 When -mcmodel=medium is specified, data objects larger than
26281 threshold are placed in the large data section. This value must be
26282 the same across all objects linked into the binary, and defaults to
26283 65535.
26284
26285 -mrtd
26286 Use a different function-calling convention, in which functions
26287 that take a fixed number of arguments return with the "ret num"
26288 instruction, which pops their arguments while returning. This
26289 saves one instruction in the caller since there is no need to pop
26290 the arguments there.
26291
26292 You can specify that an individual function is called with this
26293 calling sequence with the function attribute "stdcall". You can
26294 also override the -mrtd option by using the function attribute
26295 "cdecl".
26296
26297 Warning: this calling convention is incompatible with the one
26298 normally used on Unix, so you cannot use it if you need to call
26299 libraries compiled with the Unix compiler.
26300
26301 Also, you must provide function prototypes for all functions that
26302 take variable numbers of arguments (including "printf"); otherwise
26303 incorrect code is generated for calls to those functions.
26304
26305 In addition, seriously incorrect code results if you call a
26306 function with too many arguments. (Normally, extra arguments are
26307 harmlessly ignored.)
26308
26309 -mregparm=num
26310 Control how many registers are used to pass integer arguments. By
26311 default, no registers are used to pass arguments, and at most 3
26312 registers can be used. You can control this behavior for a
26313 specific function by using the function attribute "regparm".
26314
26315 Warning: if you use this switch, and num is nonzero, then you must
26316 build all modules with the same value, including any libraries.
26317 This includes the system libraries and startup modules.
26318
26319 -msseregparm
26320 Use SSE register passing conventions for float and double arguments
26321 and return values. You can control this behavior for a specific
26322 function by using the function attribute "sseregparm".
26323
26324 Warning: if you use this switch then you must build all modules
26325 with the same value, including any libraries. This includes the
26326 system libraries and startup modules.
26327
26328 -mvect8-ret-in-mem
26329 Return 8-byte vectors in memory instead of MMX registers. This is
26330 the default on VxWorks to match the ABI of the Sun Studio compilers
26331 until version 12. Only use this option if you need to remain
26332 compatible with existing code produced by those previous compiler
26333 versions or older versions of GCC.
26334
26335 -mpc32
26336 -mpc64
26337 -mpc80
26338 Set 80387 floating-point precision to 32, 64 or 80 bits. When
26339 -mpc32 is specified, the significands of results of floating-point
26340 operations are rounded to 24 bits (single precision); -mpc64 rounds
26341 the significands of results of floating-point operations to 53 bits
26342 (double precision) and -mpc80 rounds the significands of results of
26343 floating-point operations to 64 bits (extended double precision),
26344 which is the default. When this option is used, floating-point
26345 operations in higher precisions are not available to the programmer
26346 without setting the FPU control word explicitly.
26347
26348 Setting the rounding of floating-point operations to less than the
26349 default 80 bits can speed some programs by 2% or more. Note that
26350 some mathematical libraries assume that extended-precision (80-bit)
26351 floating-point operations are enabled by default; routines in such
26352 libraries could suffer significant loss of accuracy, typically
26353 through so-called "catastrophic cancellation", when this option is
26354 used to set the precision to less than extended precision.
26355
26356 -mstackrealign
26357 Realign the stack at entry. On the x86, the -mstackrealign option
26358 generates an alternate prologue and epilogue that realigns the run-
26359 time stack if necessary. This supports mixing legacy codes that
26360 keep 4-byte stack alignment with modern codes that keep 16-byte
26361 stack alignment for SSE compatibility. See also the attribute
26362 "force_align_arg_pointer", applicable to individual functions.
26363
26364 -mpreferred-stack-boundary=num
26365 Attempt to keep the stack boundary aligned to a 2 raised to num
26366 byte boundary. If -mpreferred-stack-boundary is not specified, the
26367 default is 4 (16 bytes or 128 bits).
26368
26369 Warning: When generating code for the x86-64 architecture with SSE
26370 extensions disabled, -mpreferred-stack-boundary=3 can be used to
26371 keep the stack boundary aligned to 8 byte boundary. Since x86-64
26372 ABI require 16 byte stack alignment, this is ABI incompatible and
26373 intended to be used in controlled environment where stack space is
26374 important limitation. This option leads to wrong code when
26375 functions compiled with 16 byte stack alignment (such as functions
26376 from a standard library) are called with misaligned stack. In this
26377 case, SSE instructions may lead to misaligned memory access traps.
26378 In addition, variable arguments are handled incorrectly for 16 byte
26379 aligned objects (including x87 long double and __int128), leading
26380 to wrong results. You must build all modules with
26381 -mpreferred-stack-boundary=3, including any libraries. This
26382 includes the system libraries and startup modules.
26383
26384 -mincoming-stack-boundary=num
26385 Assume the incoming stack is aligned to a 2 raised to num byte
26386 boundary. If -mincoming-stack-boundary is not specified, the one
26387 specified by -mpreferred-stack-boundary is used.
26388
26389 On Pentium and Pentium Pro, "double" and "long double" values
26390 should be aligned to an 8-byte boundary (see -malign-double) or
26391 suffer significant run time performance penalties. On Pentium III,
26392 the Streaming SIMD Extension (SSE) data type "__m128" may not work
26393 properly if it is not 16-byte aligned.
26394
26395 To ensure proper alignment of this values on the stack, the stack
26396 boundary must be as aligned as that required by any value stored on
26397 the stack. Further, every function must be generated such that it
26398 keeps the stack aligned. Thus calling a function compiled with a
26399 higher preferred stack boundary from a function compiled with a
26400 lower preferred stack boundary most likely misaligns the stack. It
26401 is recommended that libraries that use callbacks always use the
26402 default setting.
26403
26404 This extra alignment does consume extra stack space, and generally
26405 increases code size. Code that is sensitive to stack space usage,
26406 such as embedded systems and operating system kernels, may want to
26407 reduce the preferred alignment to -mpreferred-stack-boundary=2.
26408
26409 -mmmx
26410 -msse
26411 -msse2
26412 -msse3
26413 -mssse3
26414 -msse4
26415 -msse4a
26416 -msse4.1
26417 -msse4.2
26418 -mavx
26419 -mavx2
26420 -mavx512f
26421 -mavx512pf
26422 -mavx512er
26423 -mavx512cd
26424 -mavx512vl
26425 -mavx512bw
26426 -mavx512dq
26427 -mavx512ifma
26428 -mavx512vbmi
26429 -msha
26430 -maes
26431 -mpclmul
26432 -mclflushopt
26433 -mclwb
26434 -mfsgsbase
26435 -mptwrite
26436 -mrdrnd
26437 -mf16c
26438 -mfma
26439 -mpconfig
26440 -mwbnoinvd
26441 -mfma4
26442 -mprfchw
26443 -mrdpid
26444 -mprefetchwt1
26445 -mrdseed
26446 -msgx
26447 -mxop
26448 -mlwp
26449 -m3dnow
26450 -m3dnowa
26451 -mpopcnt
26452 -mabm
26453 -madx
26454 -mbmi
26455 -mbmi2
26456 -mlzcnt
26457 -mfxsr
26458 -mxsave
26459 -mxsaveopt
26460 -mxsavec
26461 -mxsaves
26462 -mrtm
26463 -mhle
26464 -mtbm
26465 -mmwaitx
26466 -mclzero
26467 -mpku
26468 -mavx512vbmi2
26469 -mavx512bf16
26470 -mgfni
26471 -mvaes
26472 -mwaitpkg
26473 -mvpclmulqdq
26474 -mavx512bitalg
26475 -mmovdiri
26476 -mmovdir64b
26477 -menqcmd
26478 -muintr
26479 -mtsxldtrk
26480 -mavx512vpopcntdq
26481 -mavx512vp2intersect
26482 -mavx5124fmaps
26483 -mavx512vnni
26484 -mavxvnni
26485 -mavx5124vnniw
26486 -mcldemote
26487 -mserialize
26488 -mamx-tile
26489 -mamx-int8
26490 -mamx-bf16
26491 -mhreset
26492 -mkl
26493 -mwidekl
26494 These switches enable the use of instructions in the MMX, SSE,
26495 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
26496 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
26497 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
26498 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
26499 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
26500 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
26501 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
26502 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
26503 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
26504 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
26505 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI or CLDEMOTE extended
26506 instruction sets. Each has a corresponding -mno- option to disable
26507 use of these instructions.
26508
26509 These extensions are also available as built-in functions: see x86
26510 Built-in Functions, for details of the functions enabled and
26511 disabled by these switches.
26512
26513 To generate SSE/SSE2 instructions automatically from floating-point
26514 code (as opposed to 387 instructions), see -mfpmath=sse.
26515
26516 GCC depresses SSEx instructions when -mavx is used. Instead, it
26517 generates new AVX instructions or AVX equivalence for all SSEx
26518 instructions when needed.
26519
26520 These options enable GCC to use these extended instructions in
26521 generated code, even without -mfpmath=sse. Applications that
26522 perform run-time CPU detection must compile separate files for each
26523 supported architecture, using the appropriate flags. In
26524 particular, the file containing the CPU detection code should be
26525 compiled without these options.
26526
26527 -mdump-tune-features
26528 This option instructs GCC to dump the names of the x86 performance
26529 tuning features and default settings. The names can be used in
26530 -mtune-ctrl=feature-list.
26531
26532 -mtune-ctrl=feature-list
26533 This option is used to do fine grain control of x86 code generation
26534 features. feature-list is a comma separated list of feature names.
26535 See also -mdump-tune-features. When specified, the feature is
26536 turned on if it is not preceded with ^, otherwise, it is turned
26537 off. -mtune-ctrl=feature-list is intended to be used by GCC
26538 developers. Using it may lead to code paths not covered by testing
26539 and can potentially result in compiler ICEs or runtime errors.
26540
26541 -mno-default
26542 This option instructs GCC to turn off all tunable features. See
26543 also -mtune-ctrl=feature-list and -mdump-tune-features.
26544
26545 -mcld
26546 This option instructs GCC to emit a "cld" instruction in the
26547 prologue of functions that use string instructions. String
26548 instructions depend on the DF flag to select between autoincrement
26549 or autodecrement mode. While the ABI specifies the DF flag to be
26550 cleared on function entry, some operating systems violate this
26551 specification by not clearing the DF flag in their exception
26552 dispatchers. The exception handler can be invoked with the DF flag
26553 set, which leads to wrong direction mode when string instructions
26554 are used. This option can be enabled by default on 32-bit x86
26555 targets by configuring GCC with the --enable-cld configure option.
26556 Generation of "cld" instructions can be suppressed with the
26557 -mno-cld compiler option in this case.
26558
26559 -mvzeroupper
26560 This option instructs GCC to emit a "vzeroupper" instruction before
26561 a transfer of control flow out of the function to minimize the AVX
26562 to SSE transition penalty as well as remove unnecessary "zeroupper"
26563 intrinsics.
26564
26565 -mprefer-avx128
26566 This option instructs GCC to use 128-bit AVX instructions instead
26567 of 256-bit AVX instructions in the auto-vectorizer.
26568
26569 -mprefer-vector-width=opt
26570 This option instructs GCC to use opt-bit vector width in
26571 instructions instead of default on the selected platform.
26572
26573 none
26574 No extra limitations applied to GCC other than defined by the
26575 selected platform.
26576
26577 128 Prefer 128-bit vector width for instructions.
26578
26579 256 Prefer 256-bit vector width for instructions.
26580
26581 512 Prefer 512-bit vector width for instructions.
26582
26583 -mcx16
26584 This option enables GCC to generate "CMPXCHG16B" instructions in
26585 64-bit code to implement compare-and-exchange operations on 16-byte
26586 aligned 128-bit objects. This is useful for atomic updates of data
26587 structures exceeding one machine word in size. The compiler uses
26588 this instruction to implement __sync Builtins. However, for
26589 __atomic Builtins operating on 128-bit integers, a library call is
26590 always used.
26591
26592 -msahf
26593 This option enables generation of "SAHF" instructions in 64-bit
26594 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
26595 the introduction of Pentium 4 G1 step in December 2005, lacked the
26596 "LAHF" and "SAHF" instructions which are supported by AMD64. These
26597 are load and store instructions, respectively, for certain status
26598 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
26599 "fmod", "drem", and "remainder" built-in functions; see Other
26600 Builtins for details.
26601
26602 -mmovbe
26603 This option enables use of the "movbe" instruction to implement
26604 "__builtin_bswap32" and "__builtin_bswap64".
26605
26606 -mshstk
26607 The -mshstk option enables shadow stack built-in functions from x86
26608 Control-flow Enforcement Technology (CET).
26609
26610 -mcrc32
26611 This option enables built-in functions "__builtin_ia32_crc32qi",
26612 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
26613 "__builtin_ia32_crc32di" to generate the "crc32" machine
26614 instruction.
26615
26616 -mmwait
26617 This option enables built-in functions "__builtin_ia32_monitor",
26618 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
26619 machine instructions.
26620
26621 -mrecip
26622 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
26623 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
26624 Newton-Raphson step to increase precision instead of "DIVSS" and
26625 "SQRTSS" (and their vectorized variants) for single-precision
26626 floating-point arguments. These instructions are generated only
26627 when -funsafe-math-optimizations is enabled together with
26628 -ffinite-math-only and -fno-trapping-math. Note that while the
26629 throughput of the sequence is higher than the throughput of the
26630 non-reciprocal instruction, the precision of the sequence can be
26631 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
26632 0.99999994).
26633
26634 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
26635 "RSQRTPS") already with -ffast-math (or the above option
26636 combination), and doesn't need -mrecip.
26637
26638 Also note that GCC emits the above sequence with additional Newton-
26639 Raphson step for vectorized single-float division and vectorized
26640 "sqrtf(x)" already with -ffast-math (or the above option
26641 combination), and doesn't need -mrecip.
26642
26643 -mrecip=opt
26644 This option controls which reciprocal estimate instructions may be
26645 used. opt is a comma-separated list of options, which may be
26646 preceded by a ! to invert the option:
26647
26648 all Enable all estimate instructions.
26649
26650 default
26651 Enable the default instructions, equivalent to -mrecip.
26652
26653 none
26654 Disable all estimate instructions, equivalent to -mno-recip.
26655
26656 div Enable the approximation for scalar division.
26657
26658 vec-div
26659 Enable the approximation for vectorized division.
26660
26661 sqrt
26662 Enable the approximation for scalar square root.
26663
26664 vec-sqrt
26665 Enable the approximation for vectorized square root.
26666
26667 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
26668 approximations, except for square root.
26669
26670 -mveclibabi=type
26671 Specifies the ABI type to use for vectorizing intrinsics using an
26672 external library. Supported values for type are svml for the Intel
26673 short vector math library and acml for the AMD math core library.
26674 To use this option, both -ftree-vectorize and
26675 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
26676 ABI-compatible library must be specified at link time.
26677
26678 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
26679 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
26680 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
26681 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
26682 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
26683 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
26684 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
26685 and "vmlsAcos4" for corresponding function type when
26686 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
26687 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
26688 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
26689 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
26690 corresponding function type when -mveclibabi=acml is used.
26691
26692 -mabi=name
26693 Generate code for the specified calling convention. Permissible
26694 values are sysv for the ABI used on GNU/Linux and other systems,
26695 and ms for the Microsoft ABI. The default is to use the Microsoft
26696 ABI when targeting Microsoft Windows and the SysV ABI on all other
26697 systems. You can control this behavior for specific functions by
26698 using the function attributes "ms_abi" and "sysv_abi".
26699
26700 -mforce-indirect-call
26701 Force all calls to functions to be indirect. This is useful when
26702 using Intel Processor Trace where it generates more precise timing
26703 information for function calls.
26704
26705 -mmanual-endbr
26706 Insert ENDBR instruction at function entry only via the "cf_check"
26707 function attribute. This is useful when used with the option
26708 -fcf-protection=branch to control ENDBR insertion at the function
26709 entry.
26710
26711 -mcall-ms2sysv-xlogues
26712 Due to differences in 64-bit ABIs, any Microsoft ABI function that
26713 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
26714 clobbered. By default, the code for saving and restoring these
26715 registers is emitted inline, resulting in fairly lengthy prologues
26716 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
26717 epilogues that use stubs in the static portion of libgcc to perform
26718 these saves and restores, thus reducing function size at the cost
26719 of a few extra instructions.
26720
26721 -mtls-dialect=type
26722 Generate code to access thread-local storage using the gnu or gnu2
26723 conventions. gnu is the conservative default; gnu2 is more
26724 efficient, but it may add compile- and run-time requirements that
26725 cannot be satisfied on all systems.
26726
26727 -mpush-args
26728 -mno-push-args
26729 Use PUSH operations to store outgoing parameters. This method is
26730 shorter and usually equally fast as method using SUB/MOV operations
26731 and is enabled by default. In some cases disabling it may improve
26732 performance because of improved scheduling and reduced
26733 dependencies.
26734
26735 -maccumulate-outgoing-args
26736 If enabled, the maximum amount of space required for outgoing
26737 arguments is computed in the function prologue. This is faster on
26738 most modern CPUs because of reduced dependencies, improved
26739 scheduling and reduced stack usage when the preferred stack
26740 boundary is not equal to 2. The drawback is a notable increase in
26741 code size. This switch implies -mno-push-args.
26742
26743 -mthreads
26744 Support thread-safe exception handling on MinGW. Programs that
26745 rely on thread-safe exception handling must compile and link all
26746 code with the -mthreads option. When compiling, -mthreads defines
26747 -D_MT; when linking, it links in a special thread helper library
26748 -lmingwthrd which cleans up per-thread exception-handling data.
26749
26750 -mms-bitfields
26751 -mno-ms-bitfields
26752 Enable/disable bit-field layout compatible with the native
26753 Microsoft Windows compiler.
26754
26755 If "packed" is used on a structure, or if bit-fields are used, it
26756 may be that the Microsoft ABI lays out the structure differently
26757 than the way GCC normally does. Particularly when moving packed
26758 data between functions compiled with GCC and the native Microsoft
26759 compiler (either via function call or as data in a file), it may be
26760 necessary to access either format.
26761
26762 This option is enabled by default for Microsoft Windows targets.
26763 This behavior can also be controlled locally by use of variable or
26764 type attributes. For more information, see x86 Variable Attributes
26765 and x86 Type Attributes.
26766
26767 The Microsoft structure layout algorithm is fairly simple with the
26768 exception of the bit-field packing. The padding and alignment of
26769 members of structures and whether a bit-field can straddle a
26770 storage-unit boundary are determine by these rules:
26771
26772 1. Structure members are stored sequentially in the order in which
26773 they are
26774 declared: the first member has the lowest memory address and
26775 the last member the highest.
26776
26777 2. Every data object has an alignment requirement. The alignment
26778 requirement
26779 for all data except structures, unions, and arrays is either
26780 the size of the object or the current packing size (specified
26781 with either the "aligned" attribute or the "pack" pragma),
26782 whichever is less. For structures, unions, and arrays, the
26783 alignment requirement is the largest alignment requirement of
26784 its members. Every object is allocated an offset so that:
26785
26786 offset % alignment_requirement == 0
26787
26788 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
26789 allocation
26790 unit if the integral types are the same size and if the next
26791 bit-field fits into the current allocation unit without
26792 crossing the boundary imposed by the common alignment
26793 requirements of the bit-fields.
26794
26795 MSVC interprets zero-length bit-fields in the following ways:
26796
26797 1. If a zero-length bit-field is inserted between two bit-fields
26798 that
26799 are normally coalesced, the bit-fields are not coalesced.
26800
26801 For example:
26802
26803 struct
26804 {
26805 unsigned long bf_1 : 12;
26806 unsigned long : 0;
26807 unsigned long bf_2 : 12;
26808 } t1;
26809
26810 The size of "t1" is 8 bytes with the zero-length bit-field. If
26811 the zero-length bit-field were removed, "t1"'s size would be 4
26812 bytes.
26813
26814 2. If a zero-length bit-field is inserted after a bit-field, "foo",
26815 and the
26816 alignment of the zero-length bit-field is greater than the
26817 member that follows it, "bar", "bar" is aligned as the type of
26818 the zero-length bit-field.
26819
26820 For example:
26821
26822 struct
26823 {
26824 char foo : 4;
26825 short : 0;
26826 char bar;
26827 } t2;
26828
26829 struct
26830 {
26831 char foo : 4;
26832 short : 0;
26833 double bar;
26834 } t3;
26835
26836 For "t2", "bar" is placed at offset 2, rather than offset 1.
26837 Accordingly, the size of "t2" is 4. For "t3", the zero-length
26838 bit-field does not affect the alignment of "bar" or, as a
26839 result, the size of the structure.
26840
26841 Taking this into account, it is important to note the
26842 following:
26843
26844 1. If a zero-length bit-field follows a normal bit-field, the
26845 type of the
26846 zero-length bit-field may affect the alignment of the
26847 structure as whole. For example, "t2" has a size of 4
26848 bytes, since the zero-length bit-field follows a normal
26849 bit-field, and is of type short.
26850
26851 2. Even if a zero-length bit-field is not followed by a normal
26852 bit-field, it may
26853 still affect the alignment of the structure:
26854
26855 struct
26856 {
26857 char foo : 6;
26858 long : 0;
26859 } t4;
26860
26861 Here, "t4" takes up 4 bytes.
26862
26863 3. Zero-length bit-fields following non-bit-field members are
26864 ignored:
26865 struct
26866 {
26867 char foo;
26868 long : 0;
26869 char bar;
26870 } t5;
26871
26872 Here, "t5" takes up 2 bytes.
26873
26874 -mno-align-stringops
26875 Do not align the destination of inlined string operations. This
26876 switch reduces code size and improves performance in case the
26877 destination is already aligned, but GCC doesn't know about it.
26878
26879 -minline-all-stringops
26880 By default GCC inlines string operations only when the destination
26881 is known to be aligned to least a 4-byte boundary. This enables
26882 more inlining and increases code size, but may improve performance
26883 of code that depends on fast "memcpy" and "memset" for short
26884 lengths. The option enables inline expansion of "strlen" for all
26885 pointer alignments.
26886
26887 -minline-stringops-dynamically
26888 For string operations of unknown size, use run-time checks with
26889 inline code for small blocks and a library call for large blocks.
26890
26891 -mstringop-strategy=alg
26892 Override the internal decision heuristic for the particular
26893 algorithm to use for inlining string operations. The allowed
26894 values for alg are:
26895
26896 rep_byte
26897 rep_4byte
26898 rep_8byte
26899 Expand using i386 "rep" prefix of the specified size.
26900
26901 byte_loop
26902 loop
26903 unrolled_loop
26904 Expand into an inline loop.
26905
26906 libcall
26907 Always use a library call.
26908
26909 -mmemcpy-strategy=strategy
26910 Override the internal decision heuristic to decide if
26911 "__builtin_memcpy" should be inlined and what inline algorithm to
26912 use when the expected size of the copy operation is known. strategy
26913 is a comma-separated list of alg:max_size:dest_align triplets. alg
26914 is specified in -mstringop-strategy, max_size specifies the max
26915 byte size with which inline algorithm alg is allowed. For the last
26916 triplet, the max_size must be "-1". The max_size of the triplets in
26917 the list must be specified in increasing order. The minimal byte
26918 size for alg is 0 for the first triplet and "max_size + 1" of the
26919 preceding range.
26920
26921 -mmemset-strategy=strategy
26922 The option is similar to -mmemcpy-strategy= except that it is to
26923 control "__builtin_memset" expansion.
26924
26925 -momit-leaf-frame-pointer
26926 Don't keep the frame pointer in a register for leaf functions.
26927 This avoids the instructions to save, set up, and restore frame
26928 pointers and makes an extra register available in leaf functions.
26929 The option -fomit-leaf-frame-pointer removes the frame pointer for
26930 leaf functions, which might make debugging harder.
26931
26932 -mtls-direct-seg-refs
26933 -mno-tls-direct-seg-refs
26934 Controls whether TLS variables may be accessed with offsets from
26935 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
26936 whether the thread base pointer must be added. Whether or not this
26937 is valid depends on the operating system, and whether it maps the
26938 segment to cover the entire TLS area.
26939
26940 For systems that use the GNU C Library, the default is on.
26941
26942 -msse2avx
26943 -mno-sse2avx
26944 Specify that the assembler should encode SSE instructions with VEX
26945 prefix. The option -mavx turns this on by default.
26946
26947 -mfentry
26948 -mno-fentry
26949 If profiling is active (-pg), put the profiling counter call before
26950 the prologue. Note: On x86 architectures the attribute
26951 "ms_hook_prologue" isn't possible at the moment for -mfentry and
26952 -pg.
26953
26954 -mrecord-mcount
26955 -mno-record-mcount
26956 If profiling is active (-pg), generate a __mcount_loc section that
26957 contains pointers to each profiling call. This is useful for
26958 automatically patching and out calls.
26959
26960 -mnop-mcount
26961 -mno-nop-mcount
26962 If profiling is active (-pg), generate the calls to the profiling
26963 functions as NOPs. This is useful when they should be patched in
26964 later dynamically. This is likely only useful together with
26965 -mrecord-mcount.
26966
26967 -minstrument-return=type
26968 Instrument function exit in -pg -mfentry instrumented functions
26969 with call to specified function. This only instruments true returns
26970 ending with ret, but not sibling calls ending with jump. Valid
26971 types are none to not instrument, call to generate a call to
26972 __return__, or nop5 to generate a 5 byte nop.
26973
26974 -mrecord-return
26975 -mno-record-return
26976 Generate a __return_loc section pointing to all return
26977 instrumentation code.
26978
26979 -mfentry-name=name
26980 Set name of __fentry__ symbol called at function entry for -pg
26981 -mfentry functions.
26982
26983 -mfentry-section=name
26984 Set name of section to record -mrecord-mcount calls (default
26985 __mcount_loc).
26986
26987 -mskip-rax-setup
26988 -mno-skip-rax-setup
26989 When generating code for the x86-64 architecture with SSE
26990 extensions disabled, -mskip-rax-setup can be used to skip setting
26991 up RAX register when there are no variable arguments passed in
26992 vector registers.
26993
26994 Warning: Since RAX register is used to avoid unnecessarily saving
26995 vector registers on stack when passing variable arguments, the
26996 impacts of this option are callees may waste some stack space,
26997 misbehave or jump to a random location. GCC 4.4 or newer don't
26998 have those issues, regardless the RAX register value.
26999
27000 -m8bit-idiv
27001 -mno-8bit-idiv
27002 On some processors, like Intel Atom, 8-bit unsigned integer divide
27003 is much faster than 32-bit/64-bit integer divide. This option
27004 generates a run-time check. If both dividend and divisor are
27005 within range of 0 to 255, 8-bit unsigned integer divide is used
27006 instead of 32-bit/64-bit integer divide.
27007
27008 -mavx256-split-unaligned-load
27009 -mavx256-split-unaligned-store
27010 Split 32-byte AVX unaligned load and store.
27011
27012 -mstack-protector-guard=guard
27013 -mstack-protector-guard-reg=reg
27014 -mstack-protector-guard-offset=offset
27015 Generate stack protection code using canary at guard. Supported
27016 locations are global for global canary or tls for per-thread canary
27017 in the TLS block (the default). This option has effect only when
27018 -fstack-protector or -fstack-protector-all is specified.
27019
27020 With the latter choice the options -mstack-protector-guard-reg=reg
27021 and -mstack-protector-guard-offset=offset furthermore specify which
27022 segment register (%fs or %gs) to use as base register for reading
27023 the canary, and from what offset from that base register. The
27024 default for those is as specified in the relevant ABI.
27025
27026 -mgeneral-regs-only
27027 Generate code that uses only the general-purpose registers. This
27028 prevents the compiler from using floating-point, vector, mask and
27029 bound registers.
27030
27031 -mindirect-branch=choice
27032 Convert indirect call and jump with choice. The default is keep,
27033 which keeps indirect call and jump unmodified. thunk converts
27034 indirect call and jump to call and return thunk. thunk-inline
27035 converts indirect call and jump to inlined call and return thunk.
27036 thunk-extern converts indirect call and jump to external call and
27037 return thunk provided in a separate object file. You can control
27038 this behavior for a specific function by using the function
27039 attribute "indirect_branch".
27040
27041 Note that -mcmodel=large is incompatible with
27042 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
27043 the thunk function may not be reachable in the large code model.
27044
27045 Note that -mindirect-branch=thunk-extern is compatible with
27046 -fcf-protection=branch since the external thunk can be made to
27047 enable control-flow check.
27048
27049 -mfunction-return=choice
27050 Convert function return with choice. The default is keep, which
27051 keeps function return unmodified. thunk converts function return
27052 to call and return thunk. thunk-inline converts function return to
27053 inlined call and return thunk. thunk-extern converts function
27054 return to external call and return thunk provided in a separate
27055 object file. You can control this behavior for a specific function
27056 by using the function attribute "function_return".
27057
27058 Note that -mindirect-return=thunk-extern is compatible with
27059 -fcf-protection=branch since the external thunk can be made to
27060 enable control-flow check.
27061
27062 Note that -mcmodel=large is incompatible with
27063 -mfunction-return=thunk and -mfunction-return=thunk-extern since
27064 the thunk function may not be reachable in the large code model.
27065
27066 -mindirect-branch-register
27067 Force indirect call and jump via register.
27068
27069 These -m switches are supported in addition to the above on x86-64
27070 processors in 64-bit environments.
27071
27072 -m32
27073 -m64
27074 -mx32
27075 -m16
27076 -miamcu
27077 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
27078 option sets "int", "long", and pointer types to 32 bits, and
27079 generates code that runs on any i386 system.
27080
27081 The -m64 option sets "int" to 32 bits and "long" and pointer types
27082 to 64 bits, and generates code for the x86-64 architecture. For
27083 Darwin only the -m64 option also turns off the -fno-pic and
27084 -mdynamic-no-pic options.
27085
27086 The -mx32 option sets "int", "long", and pointer types to 32 bits,
27087 and generates code for the x86-64 architecture.
27088
27089 The -m16 option is the same as -m32, except for that it outputs the
27090 ".code16gcc" assembly directive at the beginning of the assembly
27091 output so that the binary can run in 16-bit mode.
27092
27093 The -miamcu option generates code which conforms to Intel MCU
27094 psABI. It requires the -m32 option to be turned on.
27095
27096 -mno-red-zone
27097 Do not use a so-called "red zone" for x86-64 code. The red zone is
27098 mandated by the x86-64 ABI; it is a 128-byte area beyond the
27099 location of the stack pointer that is not modified by signal or
27100 interrupt handlers and therefore can be used for temporary data
27101 without adjusting the stack pointer. The flag -mno-red-zone
27102 disables this red zone.
27103
27104 -mcmodel=small
27105 Generate code for the small code model: the program and its symbols
27106 must be linked in the lower 2 GB of the address space. Pointers
27107 are 64 bits. Programs can be statically or dynamically linked.
27108 This is the default code model.
27109
27110 -mcmodel=kernel
27111 Generate code for the kernel code model. The kernel runs in the
27112 negative 2 GB of the address space. This model has to be used for
27113 Linux kernel code.
27114
27115 -mcmodel=medium
27116 Generate code for the medium model: the program is linked in the
27117 lower 2 GB of the address space. Small symbols are also placed
27118 there. Symbols with sizes larger than -mlarge-data-threshold are
27119 put into large data or BSS sections and can be located above 2GB.
27120 Programs can be statically or dynamically linked.
27121
27122 -mcmodel=large
27123 Generate code for the large model. This model makes no assumptions
27124 about addresses and sizes of sections.
27125
27126 -maddress-mode=long
27127 Generate code for long address mode. This is only supported for
27128 64-bit and x32 environments. It is the default address mode for
27129 64-bit environments.
27130
27131 -maddress-mode=short
27132 Generate code for short address mode. This is only supported for
27133 32-bit and x32 environments. It is the default address mode for
27134 32-bit and x32 environments.
27135
27136 -mneeded
27137 -mno-needed
27138 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
27139 indicate the micro-architecture ISA level required to execute the
27140 binary.
27141
27142 x86 Windows Options
27143
27144 These additional options are available for Microsoft Windows targets:
27145
27146 -mconsole
27147 This option specifies that a console application is to be
27148 generated, by instructing the linker to set the PE header subsystem
27149 type required for console applications. This option is available
27150 for Cygwin and MinGW targets and is enabled by default on those
27151 targets.
27152
27153 -mdll
27154 This option is available for Cygwin and MinGW targets. It
27155 specifies that a DLL---a dynamic link library---is to be generated,
27156 enabling the selection of the required runtime startup object and
27157 entry point.
27158
27159 -mnop-fun-dllimport
27160 This option is available for Cygwin and MinGW targets. It
27161 specifies that the "dllimport" attribute should be ignored.
27162
27163 -mthread
27164 This option is available for MinGW targets. It specifies that
27165 MinGW-specific thread support is to be used.
27166
27167 -municode
27168 This option is available for MinGW-w64 targets. It causes the
27169 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
27170 capable runtime startup code.
27171
27172 -mwin32
27173 This option is available for Cygwin and MinGW targets. It
27174 specifies that the typical Microsoft Windows predefined macros are
27175 to be set in the pre-processor, but does not influence the choice
27176 of runtime library/startup code.
27177
27178 -mwindows
27179 This option is available for Cygwin and MinGW targets. It
27180 specifies that a GUI application is to be generated by instructing
27181 the linker to set the PE header subsystem type appropriately.
27182
27183 -fno-set-stack-executable
27184 This option is available for MinGW targets. It specifies that the
27185 executable flag for the stack used by nested functions isn't set.
27186 This is necessary for binaries running in kernel mode of Microsoft
27187 Windows, as there the User32 API, which is used to set executable
27188 privileges, isn't available.
27189
27190 -fwritable-relocated-rdata
27191 This option is available for MinGW and Cygwin targets. It
27192 specifies that relocated-data in read-only section is put into the
27193 ".data" section. This is a necessary for older runtimes not
27194 supporting modification of ".rdata" sections for pseudo-relocation.
27195
27196 -mpe-aligned-commons
27197 This option is available for Cygwin and MinGW targets. It
27198 specifies that the GNU extension to the PE file format that permits
27199 the correct alignment of COMMON variables should be used when
27200 generating code. It is enabled by default if GCC detects that the
27201 target assembler found during configuration supports the feature.
27202
27203 See also under x86 Options for standard options.
27204
27205 Xstormy16 Options
27206
27207 These options are defined for Xstormy16:
27208
27209 -msim
27210 Choose startup files and linker script suitable for the simulator.
27211
27212 Xtensa Options
27213
27214 These options are supported for Xtensa targets:
27215
27216 -mconst16
27217 -mno-const16
27218 Enable or disable use of "CONST16" instructions for loading
27219 constant values. The "CONST16" instruction is currently not a
27220 standard option from Tensilica. When enabled, "CONST16"
27221 instructions are always used in place of the standard "L32R"
27222 instructions. The use of "CONST16" is enabled by default only if
27223 the "L32R" instruction is not available.
27224
27225 -mfused-madd
27226 -mno-fused-madd
27227 Enable or disable use of fused multiply/add and multiply/subtract
27228 instructions in the floating-point option. This has no effect if
27229 the floating-point option is not also enabled. Disabling fused
27230 multiply/add and multiply/subtract instructions forces the compiler
27231 to use separate instructions for the multiply and add/subtract
27232 operations. This may be desirable in some cases where strict IEEE
27233 754-compliant results are required: the fused multiply add/subtract
27234 instructions do not round the intermediate result, thereby
27235 producing results with more bits of precision than specified by the
27236 IEEE standard. Disabling fused multiply add/subtract instructions
27237 also ensures that the program output is not sensitive to the
27238 compiler's ability to combine multiply and add/subtract operations.
27239
27240 -mserialize-volatile
27241 -mno-serialize-volatile
27242 When this option is enabled, GCC inserts "MEMW" instructions before
27243 "volatile" memory references to guarantee sequential consistency.
27244 The default is -mserialize-volatile. Use -mno-serialize-volatile
27245 to omit the "MEMW" instructions.
27246
27247 -mforce-no-pic
27248 For targets, like GNU/Linux, where all user-mode Xtensa code must
27249 be position-independent code (PIC), this option disables PIC for
27250 compiling kernel code.
27251
27252 -mtext-section-literals
27253 -mno-text-section-literals
27254 These options control the treatment of literal pools. The default
27255 is -mno-text-section-literals, which places literals in a separate
27256 section in the output file. This allows the literal pool to be
27257 placed in a data RAM/ROM, and it also allows the linker to combine
27258 literal pools from separate object files to remove redundant
27259 literals and improve code size. With -mtext-section-literals, the
27260 literals are interspersed in the text section in order to keep them
27261 as close as possible to their references. This may be necessary
27262 for large assembly files. Literals for each function are placed
27263 right before that function.
27264
27265 -mauto-litpools
27266 -mno-auto-litpools
27267 These options control the treatment of literal pools. The default
27268 is -mno-auto-litpools, which places literals in a separate section
27269 in the output file unless -mtext-section-literals is used. With
27270 -mauto-litpools the literals are interspersed in the text section
27271 by the assembler. Compiler does not produce explicit ".literal"
27272 directives and loads literals into registers with "MOVI"
27273 instructions instead of "L32R" to let the assembler do relaxation
27274 and place literals as necessary. This option allows assembler to
27275 create several literal pools per function and assemble very big
27276 functions, which may not be possible with -mtext-section-literals.
27277
27278 -mtarget-align
27279 -mno-target-align
27280 When this option is enabled, GCC instructs the assembler to
27281 automatically align instructions to reduce branch penalties at the
27282 expense of some code density. The assembler attempts to widen
27283 density instructions to align branch targets and the instructions
27284 following call instructions. If there are not enough preceding
27285 safe density instructions to align a target, no widening is
27286 performed. The default is -mtarget-align. These options do not
27287 affect the treatment of auto-aligned instructions like "LOOP",
27288 which the assembler always aligns, either by widening density
27289 instructions or by inserting NOP instructions.
27290
27291 -mlongcalls
27292 -mno-longcalls
27293 When this option is enabled, GCC instructs the assembler to
27294 translate direct calls to indirect calls unless it can determine
27295 that the target of a direct call is in the range allowed by the
27296 call instruction. This translation typically occurs for calls to
27297 functions in other source files. Specifically, the assembler
27298 translates a direct "CALL" instruction into an "L32R" followed by a
27299 "CALLX" instruction. The default is -mno-longcalls. This option
27300 should be used in programs where the call target can potentially be
27301 out of range. This option is implemented in the assembler, not the
27302 compiler, so the assembly code generated by GCC still shows direct
27303 call instructions---look at the disassembled object code to see the
27304 actual instructions. Note that the assembler uses an indirect call
27305 for every cross-file call, not just those that really are out of
27306 range.
27307
27308 -mabi=name
27309 Generate code for the specified ABI. Permissible values are:
27310 call0, windowed. Default ABI is chosen by the Xtensa core
27311 configuration.
27312
27313 -mabi=call0
27314 When this option is enabled function parameters are passed in
27315 registers "a2" through "a7", registers "a12" through "a15" are
27316 caller-saved, and register "a15" may be used as a frame pointer.
27317 When this version of the ABI is enabled the C preprocessor symbol
27318 "__XTENSA_CALL0_ABI__" is defined.
27319
27320 -mabi=windowed
27321 When this option is enabled function parameters are passed in
27322 registers "a10" through "a15", and called function rotates register
27323 window by 8 registers on entry so that its arguments are found in
27324 registers "a2" through "a7". Register "a7" may be used as a frame
27325 pointer. Register window is rotated 8 registers back upon return.
27326 When this version of the ABI is enabled the C preprocessor symbol
27327 "__XTENSA_WINDOWED_ABI__" is defined.
27328
27329 zSeries Options
27330
27331 These are listed under
27332
27334 This section describes several environment variables that affect how
27335 GCC operates. Some of them work by specifying directories or prefixes
27336 to use when searching for various kinds of files. Some are used to
27337 specify other aspects of the compilation environment.
27338
27339 Note that you can also specify places to search using options such as
27340 -B, -I and -L. These take precedence over places specified using
27341 environment variables, which in turn take precedence over those
27342 specified by the configuration of GCC.
27343
27344 LANG
27345 LC_CTYPE
27346 LC_MESSAGES
27347 LC_ALL
27348 These environment variables control the way that GCC uses
27349 localization information which allows GCC to work with different
27350 national conventions. GCC inspects the locale categories LC_CTYPE
27351 and LC_MESSAGES if it has been configured to do so. These locale
27352 categories can be set to any value supported by your installation.
27353 A typical value is en_GB.UTF-8 for English in the United Kingdom
27354 encoded in UTF-8.
27355
27356 The LC_CTYPE environment variable specifies character
27357 classification. GCC uses it to determine the character boundaries
27358 in a string; this is needed for some multibyte encodings that
27359 contain quote and escape characters that are otherwise interpreted
27360 as a string end or escape.
27361
27362 The LC_MESSAGES environment variable specifies the language to use
27363 in diagnostic messages.
27364
27365 If the LC_ALL environment variable is set, it overrides the value
27366 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
27367 default to the value of the LANG environment variable. If none of
27368 these variables are set, GCC defaults to traditional C English
27369 behavior.
27370
27371 TMPDIR
27372 If TMPDIR is set, it specifies the directory to use for temporary
27373 files. GCC uses temporary files to hold the output of one stage of
27374 compilation which is to be used as input to the next stage: for
27375 example, the output of the preprocessor, which is the input to the
27376 compiler proper.
27377
27378 GCC_COMPARE_DEBUG
27379 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
27380 -fcompare-debug to the compiler driver. See the documentation of
27381 this option for more details.
27382
27383 GCC_EXEC_PREFIX
27384 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
27385 names of the subprograms executed by the compiler. No slash is
27386 added when this prefix is combined with the name of a subprogram,
27387 but you can specify a prefix that ends with a slash if you wish.
27388
27389 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
27390 appropriate prefix to use based on the pathname it is invoked with.
27391
27392 If GCC cannot find the subprogram using the specified prefix, it
27393 tries looking in the usual places for the subprogram.
27394
27395 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
27396 prefix is the prefix to the installed compiler. In many cases
27397 prefix is the value of "prefix" when you ran the configure script.
27398
27399 Other prefixes specified with -B take precedence over this prefix.
27400
27401 This prefix is also used for finding files such as crt0.o that are
27402 used for linking.
27403
27404 In addition, the prefix is used in an unusual way in finding the
27405 directories to search for header files. For each of the standard
27406 directories whose name normally begins with /usr/local/lib/gcc
27407 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
27408 replacing that beginning with the specified prefix to produce an
27409 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
27410 just before it searches the standard directory /usr/local/lib/bar.
27411 If a standard directory begins with the configured prefix then the
27412 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
27413 header files.
27414
27415 COMPILER_PATH
27416 The value of COMPILER_PATH is a colon-separated list of
27417 directories, much like PATH. GCC tries the directories thus
27418 specified when searching for subprograms, if it cannot find the
27419 subprograms using GCC_EXEC_PREFIX.
27420
27421 LIBRARY_PATH
27422 The value of LIBRARY_PATH is a colon-separated list of directories,
27423 much like PATH. When configured as a native compiler, GCC tries
27424 the directories thus specified when searching for special linker
27425 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
27426 GCC also uses these directories when searching for ordinary
27427 libraries for the -l option (but directories specified with -L come
27428 first).
27429
27430 LANG
27431 This variable is used to pass locale information to the compiler.
27432 One way in which this information is used is to determine the
27433 character set to be used when character literals, string literals
27434 and comments are parsed in C and C++. When the compiler is
27435 configured to allow multibyte characters, the following values for
27436 LANG are recognized:
27437
27438 C-JIS
27439 Recognize JIS characters.
27440
27441 C-SJIS
27442 Recognize SJIS characters.
27443
27444 C-EUCJP
27445 Recognize EUCJP characters.
27446
27447 If LANG is not defined, or if it has some other value, then the
27448 compiler uses "mblen" and "mbtowc" as defined by the default locale
27449 to recognize and translate multibyte characters.
27450
27451 GCC_EXTRA_DIAGNOSTIC_OUTPUT
27452 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
27453 values, then additional text will be emitted to stderr when fix-it
27454 hints are emitted. -fdiagnostics-parseable-fixits and
27455 -fno-diagnostics-parseable-fixits take precedence over this
27456 environment variable.
27457
27458 fixits-v1
27459 Emit parseable fix-it hints, equivalent to
27460 -fdiagnostics-parseable-fixits. In particular, columns are
27461 expressed as a count of bytes, starting at byte 1 for the
27462 initial column.
27463
27464 fixits-v2
27465 As "fixits-v1", but columns are expressed as display columns,
27466 as per -fdiagnostics-column-unit=display.
27467
27468 Some additional environment variables affect the behavior of the
27469 preprocessor.
27470
27471 CPATH
27472 C_INCLUDE_PATH
27473 CPLUS_INCLUDE_PATH
27474 OBJC_INCLUDE_PATH
27475 Each variable's value is a list of directories separated by a
27476 special character, much like PATH, in which to look for header
27477 files. The special character, "PATH_SEPARATOR", is target-
27478 dependent and determined at GCC build time. For Microsoft Windows-
27479 based targets it is a semicolon, and for almost all other targets
27480 it is a colon.
27481
27482 CPATH specifies a list of directories to be searched as if
27483 specified with -I, but after any paths given with -I options on the
27484 command line. This environment variable is used regardless of
27485 which language is being preprocessed.
27486
27487 The remaining environment variables apply only when preprocessing
27488 the particular language indicated. Each specifies a list of
27489 directories to be searched as if specified with -isystem, but after
27490 any paths given with -isystem options on the command line.
27491
27492 In all these variables, an empty element instructs the compiler to
27493 search its current working directory. Empty elements can appear at
27494 the beginning or end of a path. For instance, if the value of
27495 CPATH is ":/special/include", that has the same effect as
27496 -I. -I/special/include.
27497
27498 DEPENDENCIES_OUTPUT
27499 If this variable is set, its value specifies how to output
27500 dependencies for Make based on the non-system header files
27501 processed by the compiler. System header files are ignored in the
27502 dependency output.
27503
27504 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
27505 case the Make rules are written to that file, guessing the target
27506 name from the source file name. Or the value can have the form
27507 file target, in which case the rules are written to file file using
27508 target as the target name.
27509
27510 In other words, this environment variable is equivalent to
27511 combining the options -MM and -MF, with an optional -MT switch too.
27512
27513 SUNPRO_DEPENDENCIES
27514 This variable is the same as DEPENDENCIES_OUTPUT (see above),
27515 except that system header files are not ignored, so it implies -M
27516 rather than -MM. However, the dependence on the main input file is
27517 omitted.
27518
27519 SOURCE_DATE_EPOCH
27520 If this variable is set, its value specifies a UNIX timestamp to be
27521 used in replacement of the current date and time in the "__DATE__"
27522 and "__TIME__" macros, so that the embedded timestamps become
27523 reproducible.
27524
27525 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
27526 the number of seconds (excluding leap seconds) since 01 Jan 1970
27527 00:00:00 represented in ASCII; identical to the output of "date
27528 +%s" on GNU/Linux and other systems that support the %s extension
27529 in the "date" command.
27530
27531 The value should be a known timestamp such as the last modification
27532 time of the source or package and it should be set by the build
27533 process.
27534
27536 For instructions on reporting bugs, see
27537 <http://bugzilla.redhat.com/bugzilla>.
27538
27540 1. On some systems, gcc -shared needs to build supplementary stub code
27541 for constructors to work. On multi-libbed systems, gcc -shared
27542 must select the correct support libraries to link against. Failing
27543 to supply the correct flags may lead to subtle defects. Supplying
27544 them in cases where they are not necessary is innocuous.
27545
27547 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
27548 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
27549
27551 See the Info entry for gcc, or
27552 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
27553 to GCC.
27554
27556 Copyright (c) 1988-2021 Free Software Foundation, Inc.
27557
27558 Permission is granted to copy, distribute and/or modify this document
27559 under the terms of the GNU Free Documentation License, Version 1.3 or
27560 any later version published by the Free Software Foundation; with the
27561 Invariant Sections being "GNU General Public License" and "Funding Free
27562 Software", the Front-Cover texts being (a) (see below), and with the
27563 Back-Cover Texts being (b) (see below). A copy of the license is
27564 included in the gfdl(7) man page.
27565
27566 (a) The FSF's Front-Cover Text is:
27567
27568 A GNU Manual
27569
27570 (b) The FSF's Back-Cover Text is:
27571
27572 You have freedom to copy and modify this GNU Manual, like GNU
27573 software. Copies published by the Free Software Foundation raise
27574 funds for GNU development.
27575
27576
27577
27578gcc-11.2.1 2021-10-19 GCC(1)