1GCC(1) GNU GCC(1)
2
3
4
6 gcc - GNU project C and C++ compiler
7
9 gcc [-c|-S|-E] [-std=standard]
10 [-g] [-pg] [-Olevel]
11 [-Wwarn...] [-Wpedantic]
12 [-Idir...] [-Ldir...]
13 [-Dmacro[=defn]...] [-Umacro]
14 [-foption...] [-mmachine-option...]
15 [-o outfile] [@file] infile...
16
17 Only the most useful options are listed here; see below for the
18 remainder. g++ accepts mostly the same options as gcc.
19
21 When you invoke GCC, it normally does preprocessing, compilation,
22 assembly and linking. The "overall options" allow you to stop this
23 process at an intermediate stage. For example, the -c option says not
24 to run the linker. Then the output consists of object files output by
25 the assembler.
26
27 Other options are passed on to one or more stages of processing. Some
28 options control the preprocessor and others the compiler itself. Yet
29 other options control the assembler and linker; most of these are not
30 documented here, since you rarely need to use any of them.
31
32 Most of the command-line options that you can use with GCC are useful
33 for C programs; when an option is only useful with another language
34 (usually C++), the explanation says so explicitly. If the description
35 for a particular option does not mention a source language, you can use
36 that option with all supported languages.
37
38 The usual way to run GCC is to run the executable called gcc, or
39 machine-gcc when cross-compiling, or machine-gcc-version to run a
40 specific version of GCC. When you compile C++ programs, you should
41 invoke GCC as g++ instead.
42
43 The gcc program accepts options and file names as operands. Many
44 options have multi-letter names; therefore multiple single-letter
45 options may not be grouped: -dv is very different from -d -v.
46
47 You can mix options and other arguments. For the most part, the order
48 you use doesn't matter. Order does matter when you use several options
49 of the same kind; for example, if you specify -L more than once, the
50 directories are searched in the order specified. Also, the placement
51 of the -l option is significant.
52
53 Many options have long names starting with -f or with -W---for example,
54 -fmove-loop-invariants, -Wformat and so on. Most of these have both
55 positive and negative forms; the negative form of -ffoo is -fno-foo.
56 This manual documents only one of these two forms, whichever one is not
57 the default.
58
59 Some options take one or more arguments typically separated either by a
60 space or by the equals sign (=) from the option name. Unless
61 documented otherwise, an argument can be either numeric or a string.
62 Numeric arguments must typically be small unsigned decimal or
63 hexadecimal integers. Hexadecimal arguments must begin with the 0x
64 prefix. Arguments to options that specify a size threshold of some
65 sort may be arbitrarily large decimal or hexadecimal integers followed
66 by a byte size suffix designating a multiple of bytes such as "kB" and
67 "KiB" for kilobyte and kibibyte, respectively, "MB" and "MiB" for
68 megabyte and mebibyte, "GB" and "GiB" for gigabyte and gigibyte, and so
69 on. Such arguments are designated by byte-size in the following text.
70 Refer to the NIST, IEC, and other relevant national and international
71 standards for the full listing and explanation of the binary and
72 decimal byte size prefixes.
73
75 Option Summary
76 Here is a summary of all the options, grouped by type. Explanations
77 are in the following sections.
78
79 Overall Options
80 -c -S -E -o file -dumpbase dumpbase -dumpbase-ext auxdropsuf
81 -dumpdir dumppfx -x language -v -### --help[=class[,...]]
82 --target-help --version -pass-exit-codes -pipe -specs=file
83 -wrapper @file -ffile-prefix-map=old=new -fplugin=file
84 -fplugin-arg-name=arg -fdump-ada-spec[-slim]
85 -fada-spec-parent=unit -fdump-go-spec=file
86
87 C Language Options
88 -ansi -std=standard -fgnu89-inline
89 -fpermitted-flt-eval-methods=standard -aux-info filename
90 -fallow-parameterless-variadic-functions -fno-asm -fno-builtin
91 -fno-builtin-function -fgimple -fhosted -ffreestanding -fopenacc
92 -fopenacc-dim=geom -fopenmp -fopenmp-simd -fms-extensions
93 -fplan9-extensions -fsso-struct=endianness
94 -fallow-single-precision -fcond-mismatch -flax-vector-conversions
95 -fsigned-bitfields -fsigned-char -funsigned-bitfields
96 -funsigned-char
97
98 C++ Language Options
99 -fabi-version=n -fno-access-control -faligned-new=n
100 -fargs-in-order=n -fchar8_t -fcheck-new -fconstexpr-depth=n
101 -fconstexpr-cache-depth=n -fconstexpr-loop-limit=n
102 -fconstexpr-ops-limit=n -fno-elide-constructors
103 -fno-enforce-eh-specs -fno-gnu-keywords -fno-implicit-templates
104 -fno-implicit-inline-templates -fno-implement-inlines
105 -fmodule-header[=kind] -fmodule-only -fmodules-ts
106 -fmodule-implicit-inline -fno-module-lazy
107 -fmodule-mapper=specification -fmodule-version-ignore
108 -fms-extensions -fnew-inheriting-ctors -fnew-ttp-matching
109 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names
110 -fno-optional-diags -fpermissive -fno-pretty-templates -fno-rtti
111 -fsized-deallocation -ftemplate-backtrace-limit=n
112 -ftemplate-depth=n -fno-threadsafe-statics -fuse-cxa-atexit
113 -fno-weak -nostdinc++ -fvisibility-inlines-hidden
114 -fvisibility-ms-compat -fext-numeric-literals
115 -flang-info-include-translate[=header]
116 -flang-info-include-translate-not -flang-info-module-cmi[=module]
117 -stdlib=libstdc++,libc++ -Wabi-tag -Wcatch-value -Wcatch-value=n
118 -Wno-class-conversion -Wclass-memaccess -Wcomma-subscript
119 -Wconditionally-supported -Wno-conversion-null
120 -Wctad-maybe-unsupported -Wctor-dtor-privacy
121 -Wno-delete-incomplete -Wdelete-non-virtual-dtor -Wdeprecated-copy
122 -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion
123 -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-exceptions
124 -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor
125 -Wno-init-list-lifetime -Winvalid-imported-macros
126 -Wno-invalid-offsetof -Wno-literal-suffix
127 -Wno-mismatched-new-delete -Wmismatched-tags -Wmultiple-inheritance
128 -Wnamespaces -Wnarrowing -Wnoexcept -Wnoexcept-type
129 -Wnon-virtual-dtor -Wpessimizing-move -Wno-placement-new
130 -Wplacement-new=n -Wrange-loop-construct -Wredundant-move
131 -Wredundant-tags -Wreorder -Wregister -Wstrict-null-sentinel
132 -Wno-subobject-linkage -Wtemplates -Wno-non-template-friend
133 -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions
134 -Wsign-promo -Wsized-deallocation -Wsuggest-final-methods
135 -Wsuggest-final-types -Wsuggest-override -Wno-terminate
136 -Wuseless-cast -Wno-vexing-parse -Wvirtual-inheritance
137 -Wno-virtual-move-assign -Wvolatile
138 -Wzero-as-null-pointer-constant
139
140 Objective-C and Objective-C++ Language Options
141 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
142 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
143 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
144 -fobjc-std=objc1 -fno-local-ivars
145 -fivar-visibility=[public|protected|private|package]
146 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
147 -Wno-property-assign-default -Wno-protocol -Wobjc-root-class
148 -Wselector -Wstrict-selector-match -Wundeclared-selector
149
150 Diagnostic Message Formatting Options
151 -fmessage-length=n -fdiagnostics-plain-output
152 -fdiagnostics-show-location=[once|every-line]
153 -fdiagnostics-color=[auto|never|always]
154 -fdiagnostics-urls=[auto|never|always]
155 -fdiagnostics-format=[text|json] -fno-diagnostics-show-option
156 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
157 -fno-diagnostics-show-line-numbers -fno-diagnostics-show-cwe
158 -fdiagnostics-minimum-margin-width=width
159 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
160 -fdiagnostics-show-template-tree -fno-elide-type
161 -fdiagnostics-path-format=[none|separate-events|inline-events]
162 -fdiagnostics-show-path-depths -fno-show-column
163 -fdiagnostics-column-unit=[display|byte]
164 -fdiagnostics-column-origin=origin
165
166 Warning Options
167 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
168 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
169 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
170 -Walloca -Walloca-larger-than=byte-size
171 -Wno-aggressive-loop-optimizations -Warith-conversion
172 -Warray-bounds -Warray-bounds=n -Wno-attributes
173 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
174 -Wbool-compare -Wbool-operation -Wno-builtin-declaration-mismatch
175 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
176 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
177 -Wc++17-compat -Wc++20-compat -Wcast-align -Wcast-align=strict
178 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
179 -Wcomment -Wconversion -Wno-coverage-mismatch -Wno-cpp
180 -Wdangling-else -Wdate-time -Wno-deprecated
181 -Wno-deprecated-declarations -Wno-designated-init
182 -Wdisabled-optimization -Wno-discarded-array-qualifiers
183 -Wno-discarded-qualifiers -Wno-div-by-zero -Wdouble-promotion
184 -Wduplicated-branches -Wduplicated-cond -Wempty-body
185 -Wno-endif-labels -Wenum-compare -Wenum-conversion -Werror
186 -Werror=* -Wexpansion-to-defined -Wfatal-errors
187 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2
188 -Wno-format-contains-nul -Wno-format-extra-args
189 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
190 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
191 -Wframe-address -Wframe-larger-than=byte-size
192 -Wno-free-nonheap-object -Wno-if-not-aligned
193 -Wno-ignored-attributes -Wignored-qualifiers
194 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
195 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
196 -Wno-implicit-int -Winit-self -Winline -Wno-int-conversion
197 -Wint-in-bool-context -Wno-int-to-pointer-cast
198 -Wno-invalid-memory-model -Winvalid-pch -Wjump-misses-init
199 -Wlarger-than=byte-size -Wlogical-not-parentheses -Wlogical-op
200 -Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
201 -Wmemset-elt-size -Wmemset-transposed-args
202 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
203 -Wmissing-field-initializers -Wmissing-format-attribute
204 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
205 -Wno-multichar -Wmultistatement-macros -Wnonnull
206 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
207 -Wnull-dereference -Wno-odr -Wopenmp-simd -Wno-overflow
208 -Woverlength-strings -Wno-override-init-side-effects -Wpacked
209 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
210 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
211 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
212 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
213 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
214 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
215 -Wshadow=compatible-local -Wno-shadow-ivar
216 -Wno-shift-count-negative -Wno-shift-count-overflow
217 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
218 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
219 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
220 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
221 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
222 -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread
223 -Wno-stringop-truncation
224 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
225 -Wno-switch-bool -Wswitch-default -Wswitch-enum
226 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
227 -Wsystem-headers -Wtautological-compare -Wtrampolines
228 -Wtrigraphs -Wtsan -Wtype-limits -Wundef -Wuninitialized
229 -Wunknown-pragmas -Wunsuffixed-float-constants -Wunused
230 -Wunused-but-set-parameter -Wunused-but-set-variable
231 -Wunused-const-variable -Wunused-const-variable=n
232 -Wunused-function -Wunused-label -Wunused-local-typedefs
233 -Wunused-macros -Wunused-parameter -Wno-unused-result
234 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
235 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
236 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
237 -Wzero-length-bounds
238
239 Static Analyzer Options
240 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
241 -fno-analyzer-feasibility -fanalyzer-fine-grained
242 -fanalyzer-state-merge -fanalyzer-state-purge
243 -fanalyzer-transitivity -fanalyzer-verbose-edges
244 -fanalyzer-verbose-state-changes -fanalyzer-verbosity=level
245 -fdump-analyzer -fdump-analyzer-stderr -fdump-analyzer-callgraph
246 -fdump-analyzer-exploded-graph -fdump-analyzer-exploded-nodes
247 -fdump-analyzer-exploded-nodes-2 -fdump-analyzer-exploded-nodes-3
248 -fdump-analyzer-feasibility -fdump-analyzer-json
249 -fdump-analyzer-state-purge -fdump-analyzer-supergraph
250 -Wno-analyzer-double-fclose -Wno-analyzer-double-free
251 -Wno-analyzer-exposure-through-output-file -Wno-analyzer-file-leak
252 -Wno-analyzer-free-of-non-heap -Wno-analyzer-malloc-leak
253 -Wno-analyzer-mismatching-deallocation -Wno-analyzer-null-argument
254 -Wno-analyzer-null-dereference -Wno-analyzer-possible-null-argument
255 -Wno-analyzer-possible-null-dereference
256 -Wno-analyzer-shift-count-negative
257 -Wno-analyzer-shift-count-overflow
258 -Wno-analyzer-stale-setjmp-buffer -Wno-analyzer-tainted-array-index
259 -Wanalyzer-too-complex
260 -Wno-analyzer-unsafe-call-within-signal-handler
261 -Wno-analyzer-use-after-free
262 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
263 -Wno-analyzer-use-of-uninitialized-value
264 -Wno-analyzer-write-to-const -Wno-analyzer-write-to-string-literal
265
266 C and Objective-C-only Warning Options
267 -Wbad-function-cast -Wmissing-declarations
268 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
269 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
270 -Wtraditional -Wtraditional-conversion
271 -Wdeclaration-after-statement -Wpointer-sign
272
273 Debugging Options
274 -g -glevel -gdwarf -gdwarf-version -ggdb -grecord-gcc-switches
275 -gno-record-gcc-switches -gstabs -gstabs+ -gstrict-dwarf
276 -gno-strict-dwarf -gas-loc-support -gno-as-loc-support
277 -gas-locview-support -gno-as-locview-support -gcolumn-info
278 -gno-column-info -gdwarf32 -gdwarf64 -gstatement-frontiers
279 -gno-statement-frontiers -gvariable-location-views
280 -gno-variable-location-views -ginternal-reset-location-views
281 -gno-internal-reset-location-views -ginline-points
282 -gno-inline-points -gvms -gxcoff -gxcoff+ -gz[=type]
283 -gsplit-dwarf -gdescribe-dies -gno-describe-dies
284 -fdebug-prefix-map=old=new -fdebug-types-section
285 -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
286 -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-
287 list] -fno-eliminate-unused-debug-symbols
288 -femit-class-debug-always -fno-merge-debug-strings
289 -fno-dwarf2-cfi-asm -fvar-tracking -fvar-tracking-assignments
290
291 Optimization Options
292 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
293 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
294 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
295 -fallow-store-data-races -fassociative-math -fauto-profile
296 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
297 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
298 -fcompare-elim -fcprop-registers -fcrossjumping
299 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
300 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
301 -fdelete-null-pointer-checks -fdevirtualize
302 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
303 -fearly-inlining -fipa-sra -fexpensive-optimizations
304 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
305 -fexcess-precision=style -ffinite-loops -fforward-propagate
306 -ffp-contract=style -ffunction-sections -fgcse
307 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
308 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
309 -findirect-inlining -finline-functions
310 -finline-functions-called-once -finline-limit=n
311 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
312 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
313 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
314 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
315 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
316 -fno-ira-share-save-slots -fno-ira-share-spill-slots
317 -fisolate-erroneous-paths-dereference
318 -fisolate-erroneous-paths-attribute -fivopts
319 -fkeep-inline-functions -fkeep-static-functions
320 -fkeep-static-consts -flimit-function-alignment
321 -flive-range-shrinkage -floop-block -floop-interchange
322 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
323 -floop-parallelize-all -flra-remat -flto -flto-compression-level
324 -flto-partition=alg -fmerge-all-constants -fmerge-constants
325 -fmodulo-sched -fmodulo-sched-allow-regmoves
326 -fmove-loop-invariants -fno-branch-count-reg -fno-defer-pop
327 -fno-fp-int-builtin-inexact -fno-function-cse
328 -fno-guess-branch-probability -fno-inline -fno-math-errno
329 -fno-peephole -fno-peephole2 -fno-printf-return-value
330 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
331 -fno-toplevel-reorder -fno-trapping-math
332 -fno-zero-initialized-in-bss -fomit-frame-pointer
333 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
334 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
335 -fprofile-use -fprofile-use=path -fprofile-partial-training
336 -fprofile-values -fprofile-reorder-functions -freciprocal-math
337 -free -frename-registers -freorder-blocks
338 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
339 -freorder-functions -frerun-cse-after-loop
340 -freschedule-modulo-scheduled-loops -frounding-math
341 -fsave-optimization-record -fsched2-use-superblocks
342 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
343 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
344 -fsched-group-heuristic -fsched-critical-path-heuristic
345 -fsched-spec-insn-heuristic -fsched-rank-heuristic
346 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
347 -fschedule-fusion -fschedule-insns -fschedule-insns2
348 -fsection-anchors -fselective-scheduling -fselective-scheduling2
349 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
350 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
351 -fsignaling-nans -fsingle-precision-constant
352 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
353 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
354 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
355 -fthread-jumps -ftracer -ftree-bit-ccp -ftree-builtin-call-dce
356 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
357 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
358 -ftree-fre -fcode-hoisting -ftree-loop-if-convert -ftree-loop-im
359 -ftree-phiprop -ftree-loop-distribution
360 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
361 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
362 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
363 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
364 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
365 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons
366 -funit-at-a-time -funroll-all-loops -funroll-loops
367 -funsafe-math-optimizations -funswitch-loops -fipa-ra
368 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb
369 -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs
370 --param name=value -O -O0 -O1 -O2 -O3 -Os -Ofast -Og
371
372 Program Instrumentation Options
373 -p -pg -fprofile-arcs --coverage -ftest-coverage
374 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
375 -fprofile-generate=path -fprofile-info-section
376 -fprofile-info-section=name -fprofile-note=path
377 -fprofile-prefix-path=path -fprofile-update=method
378 -fprofile-filter-files=regex -fprofile-exclude-files=regex
379 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
380 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
381 -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
382 -fsanitize-undefined-trap-on-error -fbounds-check
383 -fcf-protection=[full|branch|return|none|check] -fstack-protector
384 -fstack-protector-all -fstack-protector-strong
385 -fstack-protector-explicit -fstack-check
386 -fstack-limit-register=reg -fstack-limit-symbol=sym
387 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
388 -fvtv-counts -fvtv-debug -finstrument-functions
389 -finstrument-functions-exclude-function-list=sym,sym,...
390 -finstrument-functions-exclude-file-list=file,file,...
391
392 Preprocessor Options
393 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
394 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
395 -fdollars-in-identifiers -fexec-charset=charset
396 -fextended-identifiers -finput-charset=charset
397 -flarge-source-files -fmacro-prefix-map=old=new
398 -fmax-include-depth=depth -fno-canonical-system-headers -fpch-deps
399 -fpch-preprocess -fpreprocessed -ftabstop=width
400 -ftrack-macro-expansion -fwide-exec-charset=charset
401 -fworking-directory -H -imacros file -include file -M -MD -MF
402 -MG -MM -MMD -MP -MQ -MT -Mno-modules -no-integrated-cpp -P
403 -pthread -remap -traditional -traditional-cpp -trigraphs -Umacro
404 -undef -Wp,option -Xpreprocessor option
405
406 Assembler Options
407 -Wa,option -Xassembler option
408
409 Linker Options
410 object-file-name -fuse-ld=linker -llibrary -nostartfiles
411 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
412 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
413 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
414 -static-libubsan -shared -shared-libgcc -symbolic -T script
415 -Wl,option -Xlinker option -u symbol -z keyword
416
417 Directory Options
418 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
419 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
420 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
421 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
422 --sysroot=dir
423
424 Code Generation Options
425 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
426 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
427 -fasynchronous-unwind-tables -fno-gnu-unique
428 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
429 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
430 -fno-bit-tests -frecord-gcc-switches -freg-struct-return
431 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
432 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
433 -ftrampolines -ftrapv -fwrapv
434 -fvisibility=[default|internal|hidden|protected]
435 -fstrict-volatile-bitfields -fsync-libcalls
436
437 Developer Options
438 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
439 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
440 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
441 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
442 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
443 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
444 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
445 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
446 -fdump-lang-switch -fdump-lang-switch-options
447 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
448 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
449 -fdump-tree-switch -fdump-tree-switch-options
450 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
451 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
452 list -fira-verbose=n -flto-report -flto-report-wpa
453 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
454 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
455 -fprofile-report -frandom-seed=string -fsched-verbose=n
456 -fsel-sched-verbose -fsel-sched-dump-cfg
457 -fsel-sched-pipelining-verbose -fstats -fstack-usage
458 -ftime-report -ftime-report-details
459 -fvar-tracking-assignments-toggle -gtoggle
460 -print-file-name=library -print-libgcc-file-name
461 -print-multi-directory -print-multi-lib -print-multi-os-directory
462 -print-prog-name=program -print-search-dirs -Q -print-sysroot
463 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
464 -save-temps=obj -time[=file]
465
466 Machine-Dependent Options
467 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
468 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
469 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
470 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
471 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
472 -mlow-precision-recip-sqrt -mlow-precision-sqrt
473 -mlow-precision-div -mpc-relative-literal-loads
474 -msign-return-address=scope -mbranch-protection=none|standard|pac-
475 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
476 -mtune=name -moverride=string -mverbose-cost-dump
477 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
478 -mstack-protector-guard-offset=offset -mtrack-speculation
479 -moutline-atomics
480
481 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
482 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
483 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
484 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
485 -mvect-double -max-vect-align=num -msplit-vecmove-early
486 -m1reg-reg
487
488 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
489
490 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
491 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
492 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
493 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
494 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
495 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
496 -marclinux_prof -mlong-calls -mmedium-calls -msdata
497 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
498 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
499 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
500 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
501 -mlra -mlra-priority-none -mlra-priority-compact mlra-priority-
502 noncompact -mmillicode -mmixed-code -mq-class -mRcq -mRcw
503 -msize-level=level -mtune=cpu -mmultcost=num -mcode-density-frame
504 -munalign-prob-threshold=probability -mmpy-option=multo -mdiv-rem
505 -mcode-density -mll64 -mfpu=fpu -mrf16 -mbranch-index
506
507 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
508 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
509 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
510 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
511 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
512 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
513 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
514 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
515 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
516 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
517 -mtpcs-leaf-frame -mcaller-super-interworking
518 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
519 -mword-relocations -mfix-cortex-m3-ldrd -munaligned-access
520 -mneon-for-64bits -mslow-flash-data -masm-syntax-unified
521 -mrestrict-it -mverbose-cost-dump -mpure-code -mcmse -mfdpic
522
523 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
524 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
525 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
526 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
527 -mfract-convert-truncate -mshort-calls -nodevicelib
528 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
529
530 Blackfin Options -mcpu=cpu[-sirevision] -msim
531 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
532 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
533 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
534 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
535 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
536 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
537 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
538
539 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
540 -msdata=sdata-type
541
542 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
543 -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init
544 -mno-side-effects -mstack-align -mdata-align -mconst-align
545 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt
546 -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround
547 -mno-mul-bug-workaround
548
549 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
550 -mdata-model=model
551
552 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
553 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
554 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
555 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
556 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
557 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
558 -msched-prolog -msim
559
560 Darwin Options -all_load -allowable_client -arch
561 -arch_errors_fatal -arch_only -bind_at_load -bundle
562 -bundle_loader -client_name -compatibility_version
563 -current_version -dead_strip -dependency-file -dylib_file
564 -dylinker_install_name -dynamic -dynamiclib
565 -exported_symbols_list -filelist -flat_namespace
566 -force_cpusubtype_ALL -force_flat_namespace
567 -headerpad_max_install_names -iframework -image_base -init
568 -install_name -keep_private_externs -multi_module
569 -multiply_defined -multiply_defined_unused -noall_load
570 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
571 -noprebind -noseglinkedit -pagezero_size -prebind
572 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
573 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
574 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
575 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
576 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
577 -single_module -static -sub_library -sub_umbrella
578 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
579 -weak_reference_mismatches -whatsloaded -F -gused -gfull
580 -mmacosx-version-min=version -mkernel -mone-byte-bool
581
582 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
583 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
584 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
585 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
586 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
587 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
588
589 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
590 -mframe-limit=bytes -mxbpf
591
592 FR30 Options -msmall-model -mno-lsim
593
594 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
595
596 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
597 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
598 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
599 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
600 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
601 -mno-pack -mno-eflags -mcond-move -mno-cond-move
602 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
603 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
604 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
605 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
606
607 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
608 -tno-android-cc -tno-android-ld
609
610 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
611 -malign-300
612
613 HPPA Options -march=architecture-type -mcaller-copies
614 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
615 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
616 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
617 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
618 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
619 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
620 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
621 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
622 -static -threads
623
624 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
625 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
626 -mconstant-gp -mauto-pic -mfused-madd
627 -minline-float-divide-min-latency
628 -minline-float-divide-max-throughput -mno-inline-float-divide
629 -minline-int-divide-min-latency -minline-int-divide-max-throughput
630 -mno-inline-int-divide -minline-sqrt-min-latency
631 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
632 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
633 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
634 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
635 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
636 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
637 -msched-prefer-non-control-spec-insns
638 -msched-stop-bits-after-every-cycle
639 -msched-count-spec-in-critical-path
640 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
641 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
642 insns
643
644 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
645 -mmultiply-enabled -msign-extend-enabled -muser-enabled
646
647 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
648 -mno-align-loops -missue-rate=number -mbranch-cost=number
649 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
650 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
651
652 M32C Options -mcpu=cpu -msim -memregs=number
653
654 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
655 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
656 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
657 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
658 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
659 -malign-int -mstrict-align -msep-data -mno-sep-data
660 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
661 -mxgot -mno-xgot -mlong-jump-table-offsets
662
663 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
664 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
665 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
666 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
667 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
668 -mstack-increment
669
670 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
671 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
672 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
673 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
674 -msimnovec -mtf -mtiny=n
675
676 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
677 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
678 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
679 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
680 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
681 -mpic-data-is-text-relative
682
683 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
684 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
685 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
686 -mno-mips16 -mflip-mips16 -minterlink-compressed
687 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
688 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
689 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
690 -mhard-float -msoft-float -mno-float -msingle-float
691 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
692 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
693 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
694 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
695 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
696 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
697 type -msmartmips -mno-smartmips -mpaired-single
698 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
699 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
700 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
701 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
702 -mno-embedded-data -muninit-const-in-rodata
703 -mno-uninit-const-in-rodata -mcode-readable=setting
704 -msplit-addresses -mno-split-addresses -mexplicit-relocs
705 -mno-explicit-relocs -mcheck-zero-division
706 -mno-check-zero-division -mdivide-traps -mdivide-breaks
707 -mload-store-pairs -mno-load-store-pairs -mmemcpy -mno-memcpy
708 -mlong-calls -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd
709 -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k
710 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
711 -mfix-r5900 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000
712 -mfix-rm7000 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120
713 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1
714 -mflush-func=func -mno-flush-func -mbranch-cost=num
715 -mbranch-likely -mno-branch-likely -mcompact-branches=policy
716 -mfp-exceptions -mno-fp-exceptions -mvr4130-align
717 -mno-vr4130-align -msynci -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1
718 -mmadd4 -mno-madd4 -mrelax-pic-calls -mno-relax-pic-calls
719 -mmcount-ra-address -mframe-header-opt -mno-frame-header-opt
720
721 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
722 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
723 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
724 -mbase-addresses -mno-base-addresses -msingle-exit
725 -mno-single-exit
726
727 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
728 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
729 -mrelax -mliw -msetlb
730
731 Moxie Options -meb -mel -mmul.x -mno-crt0
732
733 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
734 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
735 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
736 -mmax-inline-shift=
737
738 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
739 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
740 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
741 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
742 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
743
744 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
745 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
746 -mbypass-cache -mno-cache-volatile -mcache-volatile
747 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
748 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
749 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
750 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
751 -mno-cdx
752
753 Nvidia PTX Options -m64 -mmainkernel -moptimize
754
755 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
756 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
757 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
758
759 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
760 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
761 -mdec-asm -mgnu-asm -mlra
762
763 picoChip Options -mae=ae_type -mvliw-lookahead=N
764 -msymbol-as-address -mno-inefficient-warnings
765
766 PowerPC Options See RS/6000 and PowerPC Options.
767
768 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
769
770 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
771 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -march=ISA-
772 string -mtune=processor-string -mpreferred-stack-boundary=num
773 -msmall-data-limit=N-bytes -msave-restore -mno-save-restore
774 -mshorten-memrefs -mno-shorten-memrefs -mstrict-align
775 -mno-strict-align -mcmodel=medlow -mcmodel=medany
776 -mexplicit-relocs -mno-explicit-relocs -mrelax -mno-relax
777 -mriscv-attribute -mmo-riscv-attribute -malign-data=type
778 -mbig-endian -mlittle-endian +-mstack-protector-guard=guard
779 -mstack-protector-guard-reg=reg
780 +-mstack-protector-guard-offset=offset
781
782 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
783 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
784 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
785
786 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
787 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
788 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
789 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
790 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
791 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
792 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
793 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
794 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
795 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
796 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
797 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
798 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
799 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
800 -msingle-pic-base -mprioritize-restricted-insns=priority
801 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
802 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
803 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
804 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
805 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
806 -mlongcall -mno-longcall -mpltseq -mno-pltseq
807 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
808 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
809 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
810 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
811 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
812 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
813 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
814 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
815 -mno-pointers-to-nested-functions -msave-toc-indirect
816 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
817 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
818 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
819 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
820 -mfloat128 -mno-float128 -mfloat128-hardware
821 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
822 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
823 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
824 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
825 -mprivileged -mno-privileged
826
827 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
828 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
829 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
830 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
831 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
832 -msave-acc-in-interrupts
833
834 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
835 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
836 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
837 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
838 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
839 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
840 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
841 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
842 -mhotpatch=halfwords,halfwords
843
844 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
845 -mscore7 -mscore7d
846
847 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
848 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
849 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
850 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
851 -mnomacsave -mieee -mno-ieee -mbitops -misize
852 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
853 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
854 -mfixed-range=register-range -maccumulate-outgoing-args
855 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
856 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
857 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
858 -mpretend-cmove -mtas
859
860 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
861 -mno-impure-text -pthreads
862
863 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
864 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
865 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
866 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
867 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
868 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
869 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
870 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
871 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
872 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
873 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
874
875 System V Options -Qy -Qn -YP,paths -Ym,dir
876
877 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
878 -mlittle-endian -mcmodel=code-model
879
880 TILEPro Options -mcpu=cpu -m32
881
882 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
883 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
884 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
885 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
886 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
887 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
888
889 VAX Options -mg -mgnu -munix
890
891 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
892 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
893 -muser-mode
894
895 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
896 -mpointer-size=size
897
898 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
899 -Xbind-now
900
901 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
902 list -mdump-tune-features -mno-default -mfpmath=unit
903 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
904 -mhard-float -msoft-float -mno-wide-multiply -mrtd
905 -malign-double -mpreferred-stack-boundary=num
906 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
907 -mcrc32 -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
908 -mprefer-vector-width=opt -mmmx -msse -msse2 -msse3 -mssse3
909 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf
910 -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq
911 -mavx512ifma -mavx512vbmi -msha -maes -mpclmul -mfsgsbase
912 -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite
913 -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves -msse4a
914 -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
915 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle
916 -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
917 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
918 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
919 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
920 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
921 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
922 -mamx-bf16 -muintr -mhreset -mavxvnni -mcldemote -mms-bitfields
923 -mno-align-stringops -minline-all-stringops
924 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
925 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
926 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
927 -m96bit-long-double -mlong-double-64 -mlong-double-80
928 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
929 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
930 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
931 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
932 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
933 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
934 -minstrument-return=type -mfentry-name=name -mfentry-section=name
935 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
936 -malign-data=type -mstack-protector-guard=guard
937 -mstack-protector-guard-reg=reg
938 -mstack-protector-guard-offset=offset
939 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
940 -mcall-ms2sysv-xlogues -mindirect-branch=choice
941 -mfunction-return=choice -mindirect-branch-register -mneeded
942
943 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
944 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
945 -fno-set-stack-executable
946
947 Xstormy16 Options -msim
948
949 Xtensa Options -mconst16 -mno-const16 -mfused-madd
950 -mno-fused-madd -mforce-no-pic -mserialize-volatile
951 -mno-serialize-volatile -mtext-section-literals
952 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
953 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
954 -mabi=abi-type
955
956 zSeries Options See S/390 and zSeries Options.
957
958 Options Controlling the Kind of Output
959 Compilation can involve up to four stages: preprocessing, compilation
960 proper, assembly and linking, always in that order. GCC is capable of
961 preprocessing and compiling several files either into several assembler
962 input files, or into one assembler input file; then each assembler
963 input file produces an object file, and linking combines all the object
964 files (those newly compiled, and those specified as input) into an
965 executable file.
966
967 For any given input file, the file name suffix determines what kind of
968 compilation is done:
969
970 file.c
971 C source code that must be preprocessed.
972
973 file.i
974 C source code that should not be preprocessed.
975
976 file.ii
977 C++ source code that should not be preprocessed.
978
979 file.m
980 Objective-C source code. Note that you must link with the libobjc
981 library to make an Objective-C program work.
982
983 file.mi
984 Objective-C source code that should not be preprocessed.
985
986 file.mm
987 file.M
988 Objective-C++ source code. Note that you must link with the
989 libobjc library to make an Objective-C++ program work. Note that
990 .M refers to a literal capital M.
991
992 file.mii
993 Objective-C++ source code that should not be preprocessed.
994
995 file.h
996 C, C++, Objective-C or Objective-C++ header file to be turned into
997 a precompiled header (default), or C, C++ header file to be turned
998 into an Ada spec (via the -fdump-ada-spec switch).
999
1000 file.cc
1001 file.cp
1002 file.cxx
1003 file.cpp
1004 file.CPP
1005 file.c++
1006 file.C
1007 C++ source code that must be preprocessed. Note that in .cxx, the
1008 last two letters must both be literally x. Likewise, .C refers to
1009 a literal capital C.
1010
1011 file.mm
1012 file.M
1013 Objective-C++ source code that must be preprocessed.
1014
1015 file.mii
1016 Objective-C++ source code that should not be preprocessed.
1017
1018 file.hh
1019 file.H
1020 file.hp
1021 file.hxx
1022 file.hpp
1023 file.HPP
1024 file.h++
1025 file.tcc
1026 C++ header file to be turned into a precompiled header or Ada spec.
1027
1028 file.f
1029 file.for
1030 file.ftn
1031 Fixed form Fortran source code that should not be preprocessed.
1032
1033 file.F
1034 file.FOR
1035 file.fpp
1036 file.FPP
1037 file.FTN
1038 Fixed form Fortran source code that must be preprocessed (with the
1039 traditional preprocessor).
1040
1041 file.f90
1042 file.f95
1043 file.f03
1044 file.f08
1045 Free form Fortran source code that should not be preprocessed.
1046
1047 file.F90
1048 file.F95
1049 file.F03
1050 file.F08
1051 Free form Fortran source code that must be preprocessed (with the
1052 traditional preprocessor).
1053
1054 file.go
1055 Go source code.
1056
1057 file.brig
1058 BRIG files (binary representation of HSAIL).
1059
1060 file.d
1061 D source code.
1062
1063 file.di
1064 D interface file.
1065
1066 file.dd
1067 D documentation code (Ddoc).
1068
1069 file.ads
1070 Ada source code file that contains a library unit declaration (a
1071 declaration of a package, subprogram, or generic, or a generic
1072 instantiation), or a library unit renaming declaration (a package,
1073 generic, or subprogram renaming declaration). Such files are also
1074 called specs.
1075
1076 file.adb
1077 Ada source code file containing a library unit body (a subprogram
1078 or package body). Such files are also called bodies.
1079
1080 file.s
1081 Assembler code.
1082
1083 file.S
1084 file.sx
1085 Assembler code that must be preprocessed.
1086
1087 other
1088 An object file to be fed straight into linking. Any file name with
1089 no recognized suffix is treated this way.
1090
1091 You can specify the input language explicitly with the -x option:
1092
1093 -x language
1094 Specify explicitly the language for the following input files
1095 (rather than letting the compiler choose a default based on the
1096 file name suffix). This option applies to all following input
1097 files until the next -x option. Possible values for language are:
1098
1099 c c-header cpp-output
1100 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1101 objective-c objective-c-header objective-c-cpp-output
1102 objective-c++ objective-c++-header objective-c++-cpp-output
1103 assembler assembler-with-cpp
1104 ada
1105 d
1106 f77 f77-cpp-input f95 f95-cpp-input
1107 go
1108 brig
1109
1110 -x none
1111 Turn off any specification of a language, so that subsequent files
1112 are handled according to their file name suffixes (as they are if
1113 -x has not been used at all).
1114
1115 If you only want some of the stages of compilation, you can use -x (or
1116 filename suffixes) to tell gcc where to start, and one of the options
1117 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1118 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1119
1120 -c Compile or assemble the source files, but do not link. The linking
1121 stage simply is not done. The ultimate output is in the form of an
1122 object file for each source file.
1123
1124 By default, the object file name for a source file is made by
1125 replacing the suffix .c, .i, .s, etc., with .o.
1126
1127 Unrecognized input files, not requiring compilation or assembly,
1128 are ignored.
1129
1130 -S Stop after the stage of compilation proper; do not assemble. The
1131 output is in the form of an assembler code file for each non-
1132 assembler input file specified.
1133
1134 By default, the assembler file name for a source file is made by
1135 replacing the suffix .c, .i, etc., with .s.
1136
1137 Input files that don't require compilation are ignored.
1138
1139 -E Stop after the preprocessing stage; do not run the compiler proper.
1140 The output is in the form of preprocessed source code, which is
1141 sent to the standard output.
1142
1143 Input files that don't require preprocessing are ignored.
1144
1145 -o file
1146 Place the primary output in file file. This applies to whatever
1147 sort of output is being produced, whether it be an executable file,
1148 an object file, an assembler file or preprocessed C code.
1149
1150 If -o is not specified, the default is to put an executable file in
1151 a.out, the object file for source.suffix in source.o, its assembler
1152 file in source.s, a precompiled header file in source.suffix.gch,
1153 and all preprocessed C source on standard output.
1154
1155 Though -o names only the primary output, it also affects the naming
1156 of auxiliary and dump outputs. See the examples below. Unless
1157 overridden, both auxiliary outputs and dump outputs are placed in
1158 the same directory as the primary output. In auxiliary outputs,
1159 the suffix of the input file is replaced with that of the auxiliary
1160 output file type; in dump outputs, the suffix of the dump file is
1161 appended to the input file suffix. In compilation commands, the
1162 base name of both auxiliary and dump outputs is that of the primary
1163 output; in compile and link commands, the primary output name,
1164 minus the executable suffix, is combined with the input file name.
1165 If both share the same base name, disregarding the suffix, the
1166 result of the combination is that base name, otherwise, they are
1167 concatenated, separated by a dash.
1168
1169 gcc -c foo.c ...
1170
1171 will use foo.o as the primary output, and place aux outputs and
1172 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1173 dump file foo.c.???r.final for -fdump-rtl-final.
1174
1175 If a non-linker output file is explicitly specified, aux and dump
1176 files by default take the same base name:
1177
1178 gcc -c foo.c -o dir/foobar.o ...
1179
1180 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1181
1182 A linker output will instead prefix aux and dump outputs:
1183
1184 gcc foo.c bar.c -o dir/foobar ...
1185
1186 will generally name aux outputs dir/foobar-foo.* and
1187 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1188 dir/foobar-bar.c.*.
1189
1190 The one exception to the above is when the executable shares the
1191 base name with the single input:
1192
1193 gcc foo.c -o dir/foo ...
1194
1195 in which case aux outputs are named dir/foo.* and dump outputs
1196 named dir/foo.c.*.
1197
1198 The location and the names of auxiliary and dump outputs can be
1199 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1200 -save-temps=cwd, and -save-temps=obj.
1201
1202 -dumpbase dumpbase
1203 This option sets the base name for auxiliary and dump output files.
1204 It does not affect the name of the primary output file.
1205 Intermediate outputs, when preserved, are not regarded as primary
1206 outputs, but as auxiliary outputs:
1207
1208 gcc -save-temps -S foo.c
1209
1210 saves the (no longer) temporary preprocessed file in foo.i, and
1211 then compiles to the (implied) output file foo.s, whereas:
1212
1213 gcc -save-temps -dumpbase save-foo -c foo.c
1214
1215 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1216 intermediate, thus auxiliary output), and then assembles to the
1217 (implied) output file foo.o.
1218
1219 Absent this option, dump and aux files take their names from the
1220 input file, or from the (non-linker) output file, if one is
1221 explicitly specified: dump output files (e.g. those requested by
1222 -fdump-* options) with the input name suffix, and aux output files
1223 (those requested by other non-dump options, e.g. "-save-temps",
1224 "-gsplit-dwarf", "-fcallgraph-info") without it.
1225
1226 Similar suffix differentiation of dump and aux outputs can be
1227 attained for explicitly-given -dumpbase basename.suf by also
1228 specifying -dumpbase-ext .suf.
1229
1230 If dumpbase is explicitly specified with any directory component,
1231 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1232 ignored, and instead of appending to it, dumpbase fully overrides
1233 it:
1234
1235 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1236 -dumpdir pfx- -save-temps=cwd ...
1237
1238 creates auxiliary and dump outputs named alt/foo.*, disregarding
1239 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1240 -dumpdir.
1241
1242 When -dumpbase is specified in a command that compiles multiple
1243 inputs, or that compiles and then links, it may be combined with
1244 dumppfx, as specified under -dumpdir. Then, each input file is
1245 compiled using the combined dumppfx, and default values for
1246 dumpbase and auxdropsuf are computed for each input file:
1247
1248 gcc foo.c bar.c -c -dumpbase main ...
1249
1250 creates foo.o and bar.o as primary outputs, and avoids overwriting
1251 the auxiliary and dump outputs by using the dumpbase as a prefix,
1252 creating auxiliary and dump outputs named main-foo.* and
1253 main-bar.*.
1254
1255 An empty string specified as dumpbase avoids the influence of the
1256 output basename in the naming of auxiliary and dump outputs during
1257 compilation, computing default values :
1258
1259 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1260
1261 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1262 how their basenames are taken from the input name, but the
1263 directory still defaults to that of the output.
1264
1265 The empty-string dumpbase does not prevent the use of the output
1266 basename for outputs during linking:
1267
1268 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1269
1270 The compilation of the source files will name auxiliary outputs
1271 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1272 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1273 as the prefix for dumps and auxiliary files.
1274
1275 -dumpbase-ext auxdropsuf
1276 When forming the name of an auxiliary (but not a dump) output file,
1277 drop trailing auxdropsuf from dumpbase before appending any
1278 suffixes. If not specified, this option defaults to the suffix of
1279 a default dumpbase, i.e., the suffix of the input file when
1280 -dumpbase is not present in the command line, or dumpbase is
1281 combined with dumppfx.
1282
1283 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1284
1285 creates dir/foo.o as the main output, and generates auxiliary
1286 outputs in dir/x-foo.*, taking the location of the primary output,
1287 and dropping the .c suffix from the dumpbase. Dump outputs retain
1288 the suffix: dir/x-foo.c.*.
1289
1290 This option is disregarded if it does not match the suffix of a
1291 specified dumpbase, except as an alternative to the executable
1292 suffix when appending the linker output base name to dumppfx, as
1293 specified below:
1294
1295 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1296
1297 creates main.out as the primary output, and avoids overwriting the
1298 auxiliary and dump outputs by using the executable name minus
1299 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1300 and main-bar.* and dump outputs named main-foo.c.* and
1301 main-bar.c.*.
1302
1303 -dumpdir dumppfx
1304 When forming the name of an auxiliary or dump output file, use
1305 dumppfx as a prefix:
1306
1307 gcc -dumpdir pfx- -c foo.c ...
1308
1309 creates foo.o as the primary output, and auxiliary outputs named
1310 pfx-foo.*, combining the given dumppfx with the default dumpbase
1311 derived from the default primary output, derived in turn from the
1312 input name. Dump outputs also take the input name suffix:
1313 pfx-foo.c.*.
1314
1315 If dumppfx is to be used as a directory name, it must end with a
1316 directory separator:
1317
1318 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1319
1320 creates obj/bar.o as the primary output, and auxiliary outputs
1321 named dir/bar.*, combining the given dumppfx with the default
1322 dumpbase derived from the primary output name. Dump outputs also
1323 take the input name suffix: dir/bar.c.*.
1324
1325 It defaults to the location of the output file; options
1326 -save-temps=cwd and -save-temps=obj override this default, just
1327 like an explicit -dumpdir option. In case multiple such options
1328 are given, the last one prevails:
1329
1330 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1331
1332 outputs foo.o, with auxiliary outputs named foo.* because
1333 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1334 option. It does not matter that =obj is the default for
1335 -save-temps, nor that the output directory is implicitly the
1336 current directory. Dump outputs are named foo.c.*.
1337
1338 When compiling from multiple input files, if -dumpbase is
1339 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1340 appended to (or override, if containing any directory components)
1341 an explicit or defaulted dumppfx, so that each of the multiple
1342 compilations gets differently-named aux and dump outputs.
1343
1344 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1345
1346 outputs auxiliary dumps to dir/pfx-main-foo.* and
1347 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1348 retain the input file suffix: dir/pfx-main-foo.c.* and
1349 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1350 compilation:
1351
1352 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1353
1354 that, applying -dumpbase to a single source, does not compute and
1355 append a separate dumpbase per input file. Its auxiliary and dump
1356 outputs go in dir/pfx-main.*.
1357
1358 When compiling and then linking from multiple input files, a
1359 defaulted or explicitly specified dumppfx also undergoes the
1360 dumpbase- transformation above (e.g. the compilation of foo.c and
1361 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1362 are given, the linker output base name, minus auxdropsuf, if
1363 specified, or the executable suffix otherwise, plus a dash is
1364 appended to the default dumppfx instead. Note, however, that
1365 unlike earlier cases of linking:
1366
1367 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1368
1369 does not append the output name main to dumppfx, because -dumpdir
1370 is explicitly specified. The goal is that the explicitly-specified
1371 dumppfx may contain the specified output name as part of the
1372 prefix, if desired; only an explicitly-specified -dumpbase would be
1373 combined with it, in order to avoid simply discarding a meaningful
1374 option.
1375
1376 When compiling and then linking from a single input file, the
1377 linker output base name will only be appended to the default
1378 dumppfx as above if it does not share the base name with the single
1379 input file name. This has been covered in single-input linking
1380 cases above, but not with an explicit -dumpdir that inhibits the
1381 combination, even if overridden by -save-temps=*:
1382
1383 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1384
1385 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1386 current working directory as ultimately requested by
1387 -save-temps=cwd.
1388
1389 Summing it all up for an intuitive though slightly imprecise data
1390 flow: the primary output name is broken into a directory part and a
1391 basename part; dumppfx is set to the former, unless overridden by
1392 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1393 unless overriden by -dumpbase. If there are multiple inputs or
1394 linking, this dumpbase may be combined with dumppfx and taken from
1395 each input file. Auxiliary output names for each input are formed
1396 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1397 output suffix; dump output names are only different in that the
1398 suffix from dumpbase is retained.
1399
1400 When it comes to auxiliary and dump outputs created during LTO
1401 recompilation, a combination of dumppfx and dumpbase, as given or
1402 as derived from the linker output name but not from inputs, even in
1403 cases in which this combination would not otherwise be used as
1404 such, is passed down with a trailing period replacing the compiler-
1405 added dash, if any, as a -dumpdir option to lto-wrapper; being
1406 involved in linking, this program does not normally get any
1407 -dumpbase and -dumpbase-ext, and it ignores them.
1408
1409 When running sub-compilers, lto-wrapper appends LTO stage names to
1410 the received dumppfx, ensures it contains a directory component so
1411 that it overrides any -dumpdir, and passes that as -dumpbase to
1412 sub-compilers.
1413
1414 -v Print (on standard error output) the commands executed to run the
1415 stages of compilation. Also print the version number of the
1416 compiler driver program and of the preprocessor and the compiler
1417 proper.
1418
1419 -###
1420 Like -v except the commands are not executed and arguments are
1421 quoted unless they contain only alphanumeric characters or "./-_".
1422 This is useful for shell scripts to capture the driver-generated
1423 command lines.
1424
1425 --help
1426 Print (on the standard output) a description of the command-line
1427 options understood by gcc. If the -v option is also specified then
1428 --help is also passed on to the various processes invoked by gcc,
1429 so that they can display the command-line options they accept. If
1430 the -Wextra option has also been specified (prior to the --help
1431 option), then command-line options that have no documentation
1432 associated with them are also displayed.
1433
1434 --target-help
1435 Print (on the standard output) a description of target-specific
1436 command-line options for each tool. For some targets extra target-
1437 specific information may also be printed.
1438
1439 --help={class|[^]qualifier}[,...]
1440 Print (on the standard output) a description of the command-line
1441 options understood by the compiler that fit into all specified
1442 classes and qualifiers. These are the supported classes:
1443
1444 optimizers
1445 Display all of the optimization options supported by the
1446 compiler.
1447
1448 warnings
1449 Display all of the options controlling warning messages
1450 produced by the compiler.
1451
1452 target
1453 Display target-specific options. Unlike the --target-help
1454 option however, target-specific options of the linker and
1455 assembler are not displayed. This is because those tools do
1456 not currently support the extended --help= syntax.
1457
1458 params
1459 Display the values recognized by the --param option.
1460
1461 language
1462 Display the options supported for language, where language is
1463 the name of one of the languages supported in this version of
1464 GCC. If an option is supported by all languages, one needs to
1465 select common class.
1466
1467 common
1468 Display the options that are common to all languages.
1469
1470 These are the supported qualifiers:
1471
1472 undocumented
1473 Display only those options that are undocumented.
1474
1475 joined
1476 Display options taking an argument that appears after an equal
1477 sign in the same continuous piece of text, such as:
1478 --help=target.
1479
1480 separate
1481 Display options taking an argument that appears as a separate
1482 word following the original option, such as: -o output-file.
1483
1484 Thus for example to display all the undocumented target-specific
1485 switches supported by the compiler, use:
1486
1487 --help=target,undocumented
1488
1489 The sense of a qualifier can be inverted by prefixing it with the ^
1490 character, so for example to display all binary warning options
1491 (i.e., ones that are either on or off and that do not take an
1492 argument) that have a description, use:
1493
1494 --help=warnings,^joined,^undocumented
1495
1496 The argument to --help= should not consist solely of inverted
1497 qualifiers.
1498
1499 Combining several classes is possible, although this usually
1500 restricts the output so much that there is nothing to display. One
1501 case where it does work, however, is when one of the classes is
1502 target. For example, to display all the target-specific
1503 optimization options, use:
1504
1505 --help=target,optimizers
1506
1507 The --help= option can be repeated on the command line. Each
1508 successive use displays its requested class of options, skipping
1509 those that have already been displayed. If --help is also
1510 specified anywhere on the command line then this takes precedence
1511 over any --help= option.
1512
1513 If the -Q option appears on the command line before the --help=
1514 option, then the descriptive text displayed by --help= is changed.
1515 Instead of describing the displayed options, an indication is given
1516 as to whether the option is enabled, disabled or set to a specific
1517 value (assuming that the compiler knows this at the point where the
1518 --help= option is used).
1519
1520 Here is a truncated example from the ARM port of gcc:
1521
1522 % gcc -Q -mabi=2 --help=target -c
1523 The following options are target specific:
1524 -mabi= 2
1525 -mabort-on-noreturn [disabled]
1526 -mapcs [disabled]
1527
1528 The output is sensitive to the effects of previous command-line
1529 options, so for example it is possible to find out which
1530 optimizations are enabled at -O2 by using:
1531
1532 -Q -O2 --help=optimizers
1533
1534 Alternatively you can discover which binary optimizations are
1535 enabled by -O3 by using:
1536
1537 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1538 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1539 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1540
1541 --version
1542 Display the version number and copyrights of the invoked GCC.
1543
1544 -pass-exit-codes
1545 Normally the gcc program exits with the code of 1 if any phase of
1546 the compiler returns a non-success return code. If you specify
1547 -pass-exit-codes, the gcc program instead returns with the
1548 numerically highest error produced by any phase returning an error
1549 indication. The C, C++, and Fortran front ends return 4 if an
1550 internal compiler error is encountered.
1551
1552 -pipe
1553 Use pipes rather than temporary files for communication between the
1554 various stages of compilation. This fails to work on some systems
1555 where the assembler is unable to read from a pipe; but the GNU
1556 assembler has no trouble.
1557
1558 -specs=file
1559 Process file after the compiler reads in the standard specs file,
1560 in order to override the defaults which the gcc driver program uses
1561 when determining what switches to pass to cc1, cc1plus, as, ld,
1562 etc. More than one -specs=file can be specified on the command
1563 line, and they are processed in order, from left to right.
1564
1565 -wrapper
1566 Invoke all subcommands under a wrapper program. The name of the
1567 wrapper program and its parameters are passed as a comma separated
1568 list.
1569
1570 gcc -c t.c -wrapper gdb,--args
1571
1572 This invokes all subprograms of gcc under gdb --args, thus the
1573 invocation of cc1 is gdb --args cc1 ....
1574
1575 -ffile-prefix-map=old=new
1576 When compiling files residing in directory old, record any
1577 references to them in the result of the compilation as if the files
1578 resided in directory new instead. Specifying this option is
1579 equivalent to specifying all the individual -f*-prefix-map options.
1580 This can be used to make reproducible builds that are location
1581 independent. See also -fmacro-prefix-map and -fdebug-prefix-map.
1582
1583 -fplugin=name.so
1584 Load the plugin code in file name.so, assumed to be a shared object
1585 to be dlopen'd by the compiler. The base name of the shared object
1586 file is used to identify the plugin for the purposes of argument
1587 parsing (See -fplugin-arg-name-key=value below). Each plugin
1588 should define the callback functions specified in the Plugins API.
1589
1590 -fplugin-arg-name-key=value
1591 Define an argument called key with a value of value for the plugin
1592 called name.
1593
1594 -fdump-ada-spec[-slim]
1595 For C and C++ source and include files, generate corresponding Ada
1596 specs.
1597
1598 -fada-spec-parent=unit
1599 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1600 specs as child units of parent unit.
1601
1602 -fdump-go-spec=file
1603 For input files in any language, generate corresponding Go
1604 declarations in file. This generates Go "const", "type", "var",
1605 and "func" declarations which may be a useful way to start writing
1606 a Go interface to code written in some other language.
1607
1608 @file
1609 Read command-line options from file. The options read are inserted
1610 in place of the original @file option. If file does not exist, or
1611 cannot be read, then the option will be treated literally, and not
1612 removed.
1613
1614 Options in file are separated by whitespace. A whitespace
1615 character may be included in an option by surrounding the entire
1616 option in either single or double quotes. Any character (including
1617 a backslash) may be included by prefixing the character to be
1618 included with a backslash. The file may itself contain additional
1619 @file options; any such options will be processed recursively.
1620
1621 Compiling C++ Programs
1622 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1623 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1624 (for shared template code) .tcc; and preprocessed C++ files use the
1625 suffix .ii. GCC recognizes files with these names and compiles them as
1626 C++ programs even if you call the compiler the same way as for
1627 compiling C programs (usually with the name gcc).
1628
1629 However, the use of gcc does not add the C++ library. g++ is a program
1630 that calls GCC and automatically specifies linking against the C++
1631 library. It treats .c, .h and .i files as C++ source files instead of
1632 C source files unless -x is used. This program is also useful when
1633 precompiling a C header file with a .h extension for use in C++
1634 compilations. On many systems, g++ is also installed with the name
1635 c++.
1636
1637 When you compile C++ programs, you may specify many of the same
1638 command-line options that you use for compiling programs in any
1639 language; or command-line options meaningful for C and related
1640 languages; or options that are meaningful only for C++ programs.
1641
1642 Options Controlling C Dialect
1643 The following options control the dialect of C (or languages derived
1644 from C, such as C++, Objective-C and Objective-C++) that the compiler
1645 accepts:
1646
1647 -ansi
1648 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1649 equivalent to -std=c++98.
1650
1651 This turns off certain features of GCC that are incompatible with
1652 ISO C90 (when compiling C code), or of standard C++ (when compiling
1653 C++ code), such as the "asm" and "typeof" keywords, and predefined
1654 macros such as "unix" and "vax" that identify the type of system
1655 you are using. It also enables the undesirable and rarely used ISO
1656 trigraph feature. For the C compiler, it disables recognition of
1657 C++ style // comments as well as the "inline" keyword.
1658
1659 The alternate keywords "__asm__", "__extension__", "__inline__" and
1660 "__typeof__" continue to work despite -ansi. You would not want to
1661 use them in an ISO C program, of course, but it is useful to put
1662 them in header files that might be included in compilations done
1663 with -ansi. Alternate predefined macros such as "__unix__" and
1664 "__vax__" are also available, with or without -ansi.
1665
1666 The -ansi option does not cause non-ISO programs to be rejected
1667 gratuitously. For that, -Wpedantic is required in addition to
1668 -ansi.
1669
1670 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1671 used. Some header files may notice this macro and refrain from
1672 declaring certain functions or defining certain macros that the ISO
1673 standard doesn't call for; this is to avoid interfering with any
1674 programs that might use these names for other things.
1675
1676 Functions that are normally built in but do not have semantics
1677 defined by ISO C (such as "alloca" and "ffs") are not built-in
1678 functions when -ansi is used.
1679
1680 -std=
1681 Determine the language standard. This option is currently only
1682 supported when compiling C or C++.
1683
1684 The compiler can accept several base standards, such as c90 or
1685 c++98, and GNU dialects of those standards, such as gnu90 or
1686 gnu++98. When a base standard is specified, the compiler accepts
1687 all programs following that standard plus those using GNU
1688 extensions that do not contradict it. For example, -std=c90 turns
1689 off certain features of GCC that are incompatible with ISO C90,
1690 such as the "asm" and "typeof" keywords, but not other GNU
1691 extensions that do not have a meaning in ISO C90, such as omitting
1692 the middle term of a "?:" expression. On the other hand, when a GNU
1693 dialect of a standard is specified, all features supported by the
1694 compiler are enabled, even when those features change the meaning
1695 of the base standard. As a result, some strict-conforming programs
1696 may be rejected. The particular standard is used by -Wpedantic to
1697 identify which features are GNU extensions given that version of
1698 the standard. For example -std=gnu90 -Wpedantic warns about C++
1699 style // comments, while -std=gnu99 -Wpedantic does not.
1700
1701 A value for this option must be provided; possible values are
1702
1703 c90
1704 c89
1705 iso9899:1990
1706 Support all ISO C90 programs (certain GNU extensions that
1707 conflict with ISO C90 are disabled). Same as -ansi for C code.
1708
1709 iso9899:199409
1710 ISO C90 as modified in amendment 1.
1711
1712 c99
1713 c9x
1714 iso9899:1999
1715 iso9899:199x
1716 ISO C99. This standard is substantially completely supported,
1717 modulo bugs and floating-point issues (mainly but not entirely
1718 relating to optional C99 features from Annexes F and G). See
1719 <http://gcc.gnu.org/c99status.html> for more information. The
1720 names c9x and iso9899:199x are deprecated.
1721
1722 c11
1723 c1x
1724 iso9899:2011
1725 ISO C11, the 2011 revision of the ISO C standard. This
1726 standard is substantially completely supported, modulo bugs,
1727 floating-point issues (mainly but not entirely relating to
1728 optional C11 features from Annexes F and G) and the optional
1729 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1730 The name c1x is deprecated.
1731
1732 c17
1733 c18
1734 iso9899:2017
1735 iso9899:2018
1736 ISO C17, the 2017 revision of the ISO C standard (published in
1737 2018). This standard is same as C11 except for corrections of
1738 defects (all of which are also applied with -std=c11) and a new
1739 value of "__STDC_VERSION__", and so is supported to the same
1740 extent as C11.
1741
1742 c2x The next version of the ISO C standard, still under
1743 development. The support for this version is experimental and
1744 incomplete.
1745
1746 gnu90
1747 gnu89
1748 GNU dialect of ISO C90 (including some C99 features).
1749
1750 gnu99
1751 gnu9x
1752 GNU dialect of ISO C99. The name gnu9x is deprecated.
1753
1754 gnu11
1755 gnu1x
1756 GNU dialect of ISO C11. The name gnu1x is deprecated.
1757
1758 gnu17
1759 gnu18
1760 GNU dialect of ISO C17. This is the default for C code.
1761
1762 gnu2x
1763 The next version of the ISO C standard, still under
1764 development, plus GNU extensions. The support for this version
1765 is experimental and incomplete.
1766
1767 c++98
1768 c++03
1769 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1770 and some additional defect reports. Same as -ansi for C++ code.
1771
1772 gnu++98
1773 gnu++03
1774 GNU dialect of -std=c++98.
1775
1776 c++11
1777 c++0x
1778 The 2011 ISO C++ standard plus amendments. The name c++0x is
1779 deprecated.
1780
1781 gnu++11
1782 gnu++0x
1783 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1784
1785 c++14
1786 c++1y
1787 The 2014 ISO C++ standard plus amendments. The name c++1y is
1788 deprecated.
1789
1790 gnu++14
1791 gnu++1y
1792 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1793
1794 c++17
1795 c++1z
1796 The 2017 ISO C++ standard plus amendments. The name c++1z is
1797 deprecated.
1798
1799 gnu++17
1800 gnu++1z
1801 GNU dialect of -std=c++17. This is the default for C++ code.
1802 The name gnu++1z is deprecated.
1803
1804 c++20
1805 c++2a
1806 The 2020 ISO C++ standard plus amendments. Support is
1807 experimental, and could change in incompatible ways in future
1808 releases. The name c++2a is deprecated.
1809
1810 gnu++20
1811 gnu++2a
1812 GNU dialect of -std=c++20. Support is experimental, and could
1813 change in incompatible ways in future releases. The name
1814 gnu++2a is deprecated.
1815
1816 c++2b
1817 c++23
1818 The next revision of the ISO C++ standard, planned for 2023.
1819 Support is highly experimental, and will almost certainly
1820 change in incompatible ways in future releases.
1821
1822 gnu++2b
1823 gnu++23
1824 GNU dialect of -std=c++2b. Support is highly experimental, and
1825 will almost certainly change in incompatible ways in future
1826 releases.
1827
1828 -fgnu89-inline
1829 The option -fgnu89-inline tells GCC to use the traditional GNU
1830 semantics for "inline" functions when in C99 mode.
1831
1832 Using this option is roughly equivalent to adding the "gnu_inline"
1833 function attribute to all inline functions.
1834
1835 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1836 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1837 specifies the default behavior). This option is not supported in
1838 -std=c90 or -std=gnu90 mode.
1839
1840 The preprocessor macros "__GNUC_GNU_INLINE__" and
1841 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1842 effect for "inline" functions.
1843
1844 -fpermitted-flt-eval-methods=style
1845 ISO/IEC TS 18661-3 defines new permissible values for
1846 "FLT_EVAL_METHOD" that indicate that operations and constants with
1847 a semantic type that is an interchange or extended format should be
1848 evaluated to the precision and range of that type. These new
1849 values are a superset of those permitted under C99/C11, which does
1850 not specify the meaning of other positive values of
1851 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
1852 been written expecting the possibility of the new values.
1853
1854 -fpermitted-flt-eval-methods specifies whether the compiler should
1855 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
1856 the extended set of values specified in ISO/IEC TS 18661-3.
1857
1858 style is either "c11" or "ts-18661-3" as appropriate.
1859
1860 The default when in a standards compliant mode (-std=c11 or
1861 similar) is -fpermitted-flt-eval-methods=c11. The default when in
1862 a GNU dialect (-std=gnu11 or similar) is
1863 -fpermitted-flt-eval-methods=ts-18661-3.
1864
1865 -aux-info filename
1866 Output to the given filename prototyped declarations for all
1867 functions declared and/or defined in a translation unit, including
1868 those in header files. This option is silently ignored in any
1869 language other than C.
1870
1871 Besides declarations, the file indicates, in comments, the origin
1872 of each declaration (source file and line), whether the declaration
1873 was implicit, prototyped or unprototyped (I, N for new or O for
1874 old, respectively, in the first character after the line number and
1875 the colon), and whether it came from a declaration or a definition
1876 (C or F, respectively, in the following character). In the case of
1877 function definitions, a K&R-style list of arguments followed by
1878 their declarations is also provided, inside comments, after the
1879 declaration.
1880
1881 -fallow-parameterless-variadic-functions
1882 Accept variadic functions without named parameters.
1883
1884 Although it is possible to define such a function, this is not very
1885 useful as it is not possible to read the arguments. This is only
1886 supported for C as this construct is allowed by C++.
1887
1888 -fno-asm
1889 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1890 code can use these words as identifiers. You can use the keywords
1891 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
1892 -fno-asm.
1893
1894 In C++, this switch only affects the "typeof" keyword, since "asm"
1895 and "inline" are standard keywords. You may want to use the
1896 -fno-gnu-keywords flag instead, which has the same effect. In C99
1897 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
1898 and "typeof" keywords, since "inline" is a standard keyword in ISO
1899 C99.
1900
1901 -fno-builtin
1902 -fno-builtin-function
1903 Don't recognize built-in functions that do not begin with
1904 __builtin_ as prefix.
1905
1906 GCC normally generates special code to handle certain built-in
1907 functions more efficiently; for instance, calls to "alloca" may
1908 become single instructions which adjust the stack directly, and
1909 calls to "memcpy" may become inline copy loops. The resulting code
1910 is often both smaller and faster, but since the function calls no
1911 longer appear as such, you cannot set a breakpoint on those calls,
1912 nor can you change the behavior of the functions by linking with a
1913 different library. In addition, when a function is recognized as a
1914 built-in function, GCC may use information about that function to
1915 warn about problems with calls to that function, or to generate
1916 more efficient code, even if the resulting code still contains
1917 calls to that function. For example, warnings are given with
1918 -Wformat for bad calls to "printf" when "printf" is built in and
1919 "strlen" is known not to modify global memory.
1920
1921 With the -fno-builtin-function option only the built-in function
1922 function is disabled. function must not begin with __builtin_. If
1923 a function is named that is not built-in in this version of GCC,
1924 this option is ignored. There is no corresponding
1925 -fbuiltin-function option; if you wish to enable built-in functions
1926 selectively when using -fno-builtin or -ffreestanding, you may
1927 define macros such as:
1928
1929 #define abs(n) __builtin_abs ((n))
1930 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1931
1932 -fgimple
1933 Enable parsing of function definitions marked with "__GIMPLE".
1934 This is an experimental feature that allows unit testing of GIMPLE
1935 passes.
1936
1937 -fhosted
1938 Assert that compilation targets a hosted environment. This implies
1939 -fbuiltin. A hosted environment is one in which the entire
1940 standard library is available, and in which "main" has a return
1941 type of "int". Examples are nearly everything except a kernel.
1942 This is equivalent to -fno-freestanding.
1943
1944 -ffreestanding
1945 Assert that compilation targets a freestanding environment. This
1946 implies -fno-builtin. A freestanding environment is one in which
1947 the standard library may not exist, and program startup may not
1948 necessarily be at "main". The most obvious example is an OS
1949 kernel. This is equivalent to -fno-hosted.
1950
1951 -fopenacc
1952 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
1953 "!$acc" in Fortran. When -fopenacc is specified, the compiler
1954 generates accelerated code according to the OpenACC Application
1955 Programming Interface v2.6 <https://www.openacc.org>. This option
1956 implies -pthread, and thus is only supported on targets that have
1957 support for -pthread.
1958
1959 -fopenacc-dim=geom
1960 Specify default compute dimensions for parallel offload regions
1961 that do not explicitly specify. The geom value is a triple of
1962 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
1963 size can be omitted, to use a target-specific default value.
1964
1965 -fopenmp
1966 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
1967 "!$omp" in Fortran. When -fopenmp is specified, the compiler
1968 generates parallel code according to the OpenMP Application Program
1969 Interface v4.5 <https://www.openmp.org>. This option implies
1970 -pthread, and thus is only supported on targets that have support
1971 for -pthread. -fopenmp implies -fopenmp-simd.
1972
1973 -fopenmp-simd
1974 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
1975 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
1976
1977 -fgnu-tm
1978 When the option -fgnu-tm is specified, the compiler generates code
1979 for the Linux variant of Intel's current Transactional Memory ABI
1980 specification document (Revision 1.1, May 6 2009). This is an
1981 experimental feature whose interface may change in future versions
1982 of GCC, as the official specification changes. Please note that
1983 not all architectures are supported for this feature.
1984
1985 For more information on GCC's support for transactional memory,
1986
1987 Note that the transactional memory feature is not supported with
1988 non-call exceptions (-fnon-call-exceptions).
1989
1990 -fms-extensions
1991 Accept some non-standard constructs used in Microsoft header files.
1992
1993 In C++ code, this allows member names in structures to be similar
1994 to previous types declarations.
1995
1996 typedef int UOW;
1997 struct ABC {
1998 UOW UOW;
1999 };
2000
2001 Some cases of unnamed fields in structures and unions are only
2002 accepted with this option.
2003
2004 Note that this option is off for all targets except for x86 targets
2005 using ms-abi.
2006
2007 -fplan9-extensions
2008 Accept some non-standard constructs used in Plan 9 code.
2009
2010 This enables -fms-extensions, permits passing pointers to
2011 structures with anonymous fields to functions that expect pointers
2012 to elements of the type of the field, and permits referring to
2013 anonymous fields declared using a typedef. This is only
2014 supported for C, not C++.
2015
2016 -fcond-mismatch
2017 Allow conditional expressions with mismatched types in the second
2018 and third arguments. The value of such an expression is void.
2019 This option is not supported for C++.
2020
2021 -flax-vector-conversions
2022 Allow implicit conversions between vectors with differing numbers
2023 of elements and/or incompatible element types. This option should
2024 not be used for new code.
2025
2026 -funsigned-char
2027 Let the type "char" be unsigned, like "unsigned char".
2028
2029 Each kind of machine has a default for what "char" should be. It
2030 is either like "unsigned char" by default or like "signed char" by
2031 default.
2032
2033 Ideally, a portable program should always use "signed char" or
2034 "unsigned char" when it depends on the signedness of an object.
2035 But many programs have been written to use plain "char" and expect
2036 it to be signed, or expect it to be unsigned, depending on the
2037 machines they were written for. This option, and its inverse, let
2038 you make such a program work with the opposite default.
2039
2040 The type "char" is always a distinct type from each of "signed
2041 char" or "unsigned char", even though its behavior is always just
2042 like one of those two.
2043
2044 -fsigned-char
2045 Let the type "char" be signed, like "signed char".
2046
2047 Note that this is equivalent to -fno-unsigned-char, which is the
2048 negative form of -funsigned-char. Likewise, the option
2049 -fno-signed-char is equivalent to -funsigned-char.
2050
2051 -fsigned-bitfields
2052 -funsigned-bitfields
2053 -fno-signed-bitfields
2054 -fno-unsigned-bitfields
2055 These options control whether a bit-field is signed or unsigned,
2056 when the declaration does not use either "signed" or "unsigned".
2057 By default, such a bit-field is signed, because this is consistent:
2058 the basic integer types such as "int" are signed types.
2059
2060 -fsso-struct=endianness
2061 Set the default scalar storage order of structures and unions to
2062 the specified endianness. The accepted values are big-endian,
2063 little-endian and native for the native endianness of the target
2064 (the default). This option is not supported for C++.
2065
2066 Warning: the -fsso-struct switch causes GCC to generate code that
2067 is not binary compatible with code generated without it if the
2068 specified endianness is not the native endianness of the target.
2069
2070 Options Controlling C++ Dialect
2071 This section describes the command-line options that are only
2072 meaningful for C++ programs. You can also use most of the GNU compiler
2073 options regardless of what language your program is in. For example,
2074 you might compile a file firstClass.C like this:
2075
2076 g++ -g -fstrict-enums -O -c firstClass.C
2077
2078 In this example, only -fstrict-enums is an option meant only for C++
2079 programs; you can use the other options with any language supported by
2080 GCC.
2081
2082 Some options for compiling C programs, such as -std, are also relevant
2083 for C++ programs.
2084
2085 Here is a list of options that are only for compiling C++ programs:
2086
2087 -fabi-version=n
2088 Use version n of the C++ ABI. The default is version 0.
2089
2090 Version 0 refers to the version conforming most closely to the C++
2091 ABI specification. Therefore, the ABI obtained using version 0
2092 will change in different versions of G++ as ABI bugs are fixed.
2093
2094 Version 1 is the version of the C++ ABI that first appeared in G++
2095 3.2.
2096
2097 Version 2 is the version of the C++ ABI that first appeared in G++
2098 3.4, and was the default through G++ 4.9.
2099
2100 Version 3 corrects an error in mangling a constant address as a
2101 template argument.
2102
2103 Version 4, which first appeared in G++ 4.5, implements a standard
2104 mangling for vector types.
2105
2106 Version 5, which first appeared in G++ 4.6, corrects the mangling
2107 of attribute const/volatile on function pointer types, decltype of
2108 a plain decl, and use of a function parameter in the declaration of
2109 another parameter.
2110
2111 Version 6, which first appeared in G++ 4.7, corrects the promotion
2112 behavior of C++11 scoped enums and the mangling of template
2113 argument packs, const/static_cast, prefix ++ and --, and a class
2114 scope function used as a template argument.
2115
2116 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2117 as a builtin type and corrects the mangling of lambdas in default
2118 argument scope.
2119
2120 Version 8, which first appeared in G++ 4.9, corrects the
2121 substitution behavior of function types with function-cv-
2122 qualifiers.
2123
2124 Version 9, which first appeared in G++ 5.2, corrects the alignment
2125 of "nullptr_t".
2126
2127 Version 10, which first appeared in G++ 6.1, adds mangling of
2128 attributes that affect type identity, such as ia32 calling
2129 convention attributes (e.g. stdcall).
2130
2131 Version 11, which first appeared in G++ 7, corrects the mangling of
2132 sizeof... expressions and operator names. For multiple entities
2133 with the same name within a function, that are declared in
2134 different scopes, the mangling now changes starting with the
2135 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2136
2137 Version 12, which first appeared in G++ 8, corrects the calling
2138 conventions for empty classes on the x86_64 target and for classes
2139 with only deleted copy/move constructors. It accidentally changes
2140 the calling convention for classes with a deleted copy constructor
2141 and a trivial move constructor.
2142
2143 Version 13, which first appeared in G++ 8.2, fixes the accidental
2144 change in version 12.
2145
2146 Version 14, which first appeared in G++ 10, corrects the mangling
2147 of the nullptr expression.
2148
2149 Version 15, which first appeared in G++ 11, changes the mangling of
2150 "__alignof__" to be distinct from that of "alignof", and dependent
2151 operator names.
2152
2153 See also -Wabi.
2154
2155 -fabi-compat-version=n
2156 On targets that support strong aliases, G++ works around mangling
2157 changes by creating an alias with the correct mangled name when
2158 defining a symbol with an incorrect mangled name. This switch
2159 specifies which ABI version to use for the alias.
2160
2161 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
2162 compatibility). If another ABI version is explicitly selected,
2163 this defaults to 0. For compatibility with GCC versions 3.2
2164 through 4.9, use -fabi-compat-version=2.
2165
2166 If this option is not provided but -Wabi=n is, that version is used
2167 for compatibility aliases. If this option is provided along with
2168 -Wabi (without the version), the version from this option is used
2169 for the warning.
2170
2171 -fno-access-control
2172 Turn off all access checking. This switch is mainly useful for
2173 working around bugs in the access control code.
2174
2175 -faligned-new
2176 Enable support for C++17 "new" of types that require more alignment
2177 than "void* ::operator new(std::size_t)" provides. A numeric
2178 argument such as "-faligned-new=32" can be used to specify how much
2179 alignment (in bytes) is provided by that function, but few users
2180 will need to override the default of "alignof(std::max_align_t)".
2181
2182 This flag is enabled by default for -std=c++17.
2183
2184 -fchar8_t
2185 -fno-char8_t
2186 Enable support for "char8_t" as adopted for C++20. This includes
2187 the addition of a new "char8_t" fundamental type, changes to the
2188 types of UTF-8 string and character literals, new signatures for
2189 user-defined literals, associated standard library updates, and new
2190 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2191
2192 This option enables functions to be overloaded for ordinary and
2193 UTF-8 strings:
2194
2195 int f(const char *); // #1
2196 int f(const char8_t *); // #2
2197 int v1 = f("text"); // Calls #1
2198 int v2 = f(u8"text"); // Calls #2
2199
2200 and introduces new signatures for user-defined literals:
2201
2202 int operator""_udl1(char8_t);
2203 int v3 = u8'x'_udl1;
2204 int operator""_udl2(const char8_t*, std::size_t);
2205 int v4 = u8"text"_udl2;
2206 template<typename T, T...> int operator""_udl3();
2207 int v5 = u8"text"_udl3;
2208
2209 The change to the types of UTF-8 string and character literals
2210 introduces incompatibilities with ISO C++11 and later standards.
2211 For example, the following code is well-formed under ISO C++11, but
2212 is ill-formed when -fchar8_t is specified.
2213
2214 char ca[] = u8"xx"; // error: char-array initialized from wide
2215 // string
2216 const char *cp = u8"xx";// error: invalid conversion from
2217 // `const char8_t*' to `const char*'
2218 int f(const char*);
2219 auto v = f(u8"xx"); // error: invalid conversion from
2220 // `const char8_t*' to `const char*'
2221 std::string s{u8"xx"}; // error: no matching function for call to
2222 // `std::basic_string<char>::basic_string()'
2223 using namespace std::literals;
2224 s = u8"xx"s; // error: conversion from
2225 // `basic_string<char8_t>' to non-scalar
2226 // type `basic_string<char>' requested
2227
2228 -fcheck-new
2229 Check that the pointer returned by "operator new" is non-null
2230 before attempting to modify the storage allocated. This check is
2231 normally unnecessary because the C++ standard specifies that
2232 "operator new" only returns 0 if it is declared "throw()", in which
2233 case the compiler always checks the return value even without this
2234 option. In all other cases, when "operator new" has a non-empty
2235 exception specification, memory exhaustion is signalled by throwing
2236 "std::bad_alloc". See also new (nothrow).
2237
2238 -fconcepts
2239 -fconcepts-ts
2240 Below -std=c++20, -fconcepts enables support for the C++ Extensions
2241 for Concepts Technical Specification, ISO 19217 (2015).
2242
2243 With -std=c++20 and above, Concepts are part of the language
2244 standard, so -fconcepts defaults to on. But the standard
2245 specification of Concepts differs significantly from the TS, so
2246 some constructs that were allowed in the TS but didn't make it into
2247 the standard can still be enabled by -fconcepts-ts.
2248
2249 -fconstexpr-depth=n
2250 Set the maximum nested evaluation depth for C++11 constexpr
2251 functions to n. A limit is needed to detect endless recursion
2252 during constant expression evaluation. The minimum specified by
2253 the standard is 512.
2254
2255 -fconstexpr-cache-depth=n
2256 Set the maximum level of nested evaluation depth for C++11
2257 constexpr functions that will be cached to n. This is a heuristic
2258 that trades off compilation speed (when the cache avoids repeated
2259 calculations) against memory consumption (when the cache grows very
2260 large from highly recursive evaluations). The default is 8. Very
2261 few users are likely to want to adjust it, but if your code does
2262 heavy constexpr calculations you might want to experiment to find
2263 which value works best for you.
2264
2265 -fconstexpr-loop-limit=n
2266 Set the maximum number of iterations for a loop in C++14 constexpr
2267 functions to n. A limit is needed to detect infinite loops during
2268 constant expression evaluation. The default is 262144 (1<<18).
2269
2270 -fconstexpr-ops-limit=n
2271 Set the maximum number of operations during a single constexpr
2272 evaluation. Even when number of iterations of a single loop is
2273 limited with the above limit, if there are several nested loops and
2274 each of them has many iterations but still smaller than the above
2275 limit, or if in a body of some loop or even outside of a loop too
2276 many expressions need to be evaluated, the resulting constexpr
2277 evaluation might take too long. The default is 33554432 (1<<25).
2278
2279 -fcoroutines
2280 Enable support for the C++ coroutines extension (experimental).
2281
2282 -fno-elide-constructors
2283 The C++ standard allows an implementation to omit creating a
2284 temporary that is only used to initialize another object of the
2285 same type. Specifying this option disables that optimization, and
2286 forces G++ to call the copy constructor in all cases. This option
2287 also causes G++ to call trivial member functions which otherwise
2288 would be expanded inline.
2289
2290 In C++17, the compiler is required to omit these temporaries, but
2291 this option still affects trivial member functions.
2292
2293 -fno-enforce-eh-specs
2294 Don't generate code to check for violation of exception
2295 specifications at run time. This option violates the C++ standard,
2296 but may be useful for reducing code size in production builds, much
2297 like defining "NDEBUG". This does not give user code permission to
2298 throw exceptions in violation of the exception specifications; the
2299 compiler still optimizes based on the specifications, so throwing
2300 an unexpected exception results in undefined behavior at run time.
2301
2302 -fextern-tls-init
2303 -fno-extern-tls-init
2304 The C++11 and OpenMP standards allow "thread_local" and
2305 "threadprivate" variables to have dynamic (runtime) initialization.
2306 To support this, any use of such a variable goes through a wrapper
2307 function that performs any necessary initialization. When the use
2308 and definition of the variable are in the same translation unit,
2309 this overhead can be optimized away, but when the use is in a
2310 different translation unit there is significant overhead even if
2311 the variable doesn't actually need dynamic initialization. If the
2312 programmer can be sure that no use of the variable in a non-
2313 defining TU needs to trigger dynamic initialization (either because
2314 the variable is statically initialized, or a use of the variable in
2315 the defining TU will be executed before any uses in another TU),
2316 they can avoid this overhead with the -fno-extern-tls-init option.
2317
2318 On targets that support symbol aliases, the default is
2319 -fextern-tls-init. On targets that do not support symbol aliases,
2320 the default is -fno-extern-tls-init.
2321
2322 -fno-gnu-keywords
2323 Do not recognize "typeof" as a keyword, so that code can use this
2324 word as an identifier. You can use the keyword "__typeof__"
2325 instead. This option is implied by the strict ISO C++ dialects:
2326 -ansi, -std=c++98, -std=c++11, etc.
2327
2328 -fno-implicit-templates
2329 Never emit code for non-inline templates that are instantiated
2330 implicitly (i.e. by use); only emit code for explicit
2331 instantiations. If you use this option, you must take care to
2332 structure your code to include all the necessary explicit
2333 instantiations to avoid getting undefined symbols at link time.
2334
2335 -fno-implicit-inline-templates
2336 Don't emit code for implicit instantiations of inline templates,
2337 either. The default is to handle inlines differently so that
2338 compiles with and without optimization need the same set of
2339 explicit instantiations.
2340
2341 -fno-implement-inlines
2342 To save space, do not emit out-of-line copies of inline functions
2343 controlled by "#pragma implementation". This causes linker errors
2344 if these functions are not inlined everywhere they are called.
2345
2346 -fmodules-ts
2347 -fno-modules-ts
2348 Enable support for C++20 modules The -fno-modules-ts is usually
2349 not needed, as that is the default. Even though this is a C++20
2350 feature, it is not currently implicitly enabled by selecting that
2351 standard version.
2352
2353 -fmodule-header
2354 -fmodule-header=user
2355 -fmodule-header=system
2356 Compile a header file to create an importable header unit.
2357
2358 -fmodule-implicit-inline
2359 Member functions defined in their class definitions are not
2360 implicitly inline for modular code. This is different to
2361 traditional C++ behavior, for good reasons. However, it may result
2362 in a difficulty during code porting. This option makes such
2363 function definitions implicitly inline. It does however generate
2364 an ABI incompatibility, so you must use it everywhere or nowhere.
2365 (Such definitions outside of a named module remain implicitly
2366 inline, regardless.)
2367
2368 -fno-module-lazy
2369 Disable lazy module importing and module mapper creation.
2370
2371 -fmodule-mapper=[hostname]:port[?ident]
2372 -fmodule-mapper=|program[?ident] args...
2373 -fmodule-mapper==socket[?ident]
2374 -fmodule-mapper=<>[inout][?ident]
2375 -fmodule-mapper=<in>out[?ident]
2376 -fmodule-mapper=file[?ident]
2377 An oracle to query for module name to filename mappings. If
2378 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2379 if that is unset, an in-process default is provided.
2380
2381 -fmodule-only
2382 Only emit the Compiled Module Interface, inhibiting any object
2383 file.
2384
2385 -fms-extensions
2386 Disable Wpedantic warnings about constructs used in MFC, such as
2387 implicit int and getting a pointer to member function via non-
2388 standard syntax.
2389
2390 -fnew-inheriting-ctors
2391 Enable the P0136 adjustment to the semantics of C++11 constructor
2392 inheritance. This is part of C++17 but also considered to be a
2393 Defect Report against C++11 and C++14. This flag is enabled by
2394 default unless -fabi-version=10 or lower is specified.
2395
2396 -fnew-ttp-matching
2397 Enable the P0522 resolution to Core issue 150, template template
2398 parameters and default arguments: this allows a template with
2399 default template arguments as an argument for a template template
2400 parameter with fewer template parameters. This flag is enabled by
2401 default for -std=c++17.
2402
2403 -fno-nonansi-builtins
2404 Disable built-in declarations of functions that are not mandated by
2405 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2406 "bzero", "conjf", and other related functions.
2407
2408 -fnothrow-opt
2409 Treat a "throw()" exception specification as if it were a
2410 "noexcept" specification to reduce or eliminate the text size
2411 overhead relative to a function with no exception specification.
2412 If the function has local variables of types with non-trivial
2413 destructors, the exception specification actually makes the
2414 function smaller because the EH cleanups for those variables can be
2415 optimized away. The semantic effect is that an exception thrown
2416 out of a function with such an exception specification results in a
2417 call to "terminate" rather than "unexpected".
2418
2419 -fno-operator-names
2420 Do not treat the operator name keywords "and", "bitand", "bitor",
2421 "compl", "not", "or" and "xor" as synonyms as keywords.
2422
2423 -fno-optional-diags
2424 Disable diagnostics that the standard says a compiler does not need
2425 to issue. Currently, the only such diagnostic issued by G++ is the
2426 one for a name having multiple meanings within a class.
2427
2428 -fpermissive
2429 Downgrade some diagnostics about nonconformant code from errors to
2430 warnings. Thus, using -fpermissive allows some nonconforming code
2431 to compile.
2432
2433 -fno-pretty-templates
2434 When an error message refers to a specialization of a function
2435 template, the compiler normally prints the signature of the
2436 template followed by the template arguments and any typedefs or
2437 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2438 than "void f(int)") so that it's clear which template is involved.
2439 When an error message refers to a specialization of a class
2440 template, the compiler omits any template arguments that match the
2441 default template arguments for that template. If either of these
2442 behaviors make it harder to understand the error message rather
2443 than easier, you can use -fno-pretty-templates to disable them.
2444
2445 -fno-rtti
2446 Disable generation of information about every class with virtual
2447 functions for use by the C++ run-time type identification features
2448 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2449 language, you can save some space by using this flag. Note that
2450 exception handling uses the same information, but G++ generates it
2451 as needed. The "dynamic_cast" operator can still be used for casts
2452 that do not require run-time type information, i.e. casts to "void
2453 *" or to unambiguous base classes.
2454
2455 Mixing code compiled with -frtti with that compiled with -fno-rtti
2456 may not work. For example, programs may fail to link if a class
2457 compiled with -fno-rtti is used as a base for a class compiled with
2458 -frtti.
2459
2460 -fsized-deallocation
2461 Enable the built-in global declarations
2462
2463 void operator delete (void *, std::size_t) noexcept;
2464 void operator delete[] (void *, std::size_t) noexcept;
2465
2466 as introduced in C++14. This is useful for user-defined
2467 replacement deallocation functions that, for example, use the size
2468 of the object to make deallocation faster. Enabled by default
2469 under -std=c++14 and above. The flag -Wsized-deallocation warns
2470 about places that might want to add a definition.
2471
2472 -fstrict-enums
2473 Allow the compiler to optimize using the assumption that a value of
2474 enumerated type can only be one of the values of the enumeration
2475 (as defined in the C++ standard; basically, a value that can be
2476 represented in the minimum number of bits needed to represent all
2477 the enumerators). This assumption may not be valid if the program
2478 uses a cast to convert an arbitrary integer value to the enumerated
2479 type.
2480
2481 -fstrong-eval-order
2482 Evaluate member access, array subscripting, and shift expressions
2483 in left-to-right order, and evaluate assignment in right-to-left
2484 order, as adopted for C++17. Enabled by default with -std=c++17.
2485 -fstrong-eval-order=some enables just the ordering of member access
2486 and shift expressions, and is the default without -std=c++17.
2487
2488 -ftemplate-backtrace-limit=n
2489 Set the maximum number of template instantiation notes for a single
2490 warning or error to n. The default value is 10.
2491
2492 -ftemplate-depth=n
2493 Set the maximum instantiation depth for template classes to n. A
2494 limit on the template instantiation depth is needed to detect
2495 endless recursions during template class instantiation. ANSI/ISO
2496 C++ conforming programs must not rely on a maximum depth greater
2497 than 17 (changed to 1024 in C++11). The default value is 900, as
2498 the compiler can run out of stack space before hitting 1024 in some
2499 situations.
2500
2501 -fno-threadsafe-statics
2502 Do not emit the extra code to use the routines specified in the C++
2503 ABI for thread-safe initialization of local statics. You can use
2504 this option to reduce code size slightly in code that doesn't need
2505 to be thread-safe.
2506
2507 -fuse-cxa-atexit
2508 Register destructors for objects with static storage duration with
2509 the "__cxa_atexit" function rather than the "atexit" function.
2510 This option is required for fully standards-compliant handling of
2511 static destructors, but only works if your C library supports
2512 "__cxa_atexit".
2513
2514 -fno-use-cxa-get-exception-ptr
2515 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2516 causes "std::uncaught_exception" to be incorrect, but is necessary
2517 if the runtime routine is not available.
2518
2519 -fvisibility-inlines-hidden
2520 This switch declares that the user does not attempt to compare
2521 pointers to inline functions or methods where the addresses of the
2522 two functions are taken in different shared objects.
2523
2524 The effect of this is that GCC may, effectively, mark inline
2525 methods with "__attribute__ ((visibility ("hidden")))" so that they
2526 do not appear in the export table of a DSO and do not require a PLT
2527 indirection when used within the DSO. Enabling this option can
2528 have a dramatic effect on load and link times of a DSO as it
2529 massively reduces the size of the dynamic export table when the
2530 library makes heavy use of templates.
2531
2532 The behavior of this switch is not quite the same as marking the
2533 methods as hidden directly, because it does not affect static
2534 variables local to the function or cause the compiler to deduce
2535 that the function is defined in only one shared object.
2536
2537 You may mark a method as having a visibility explicitly to negate
2538 the effect of the switch for that method. For example, if you do
2539 want to compare pointers to a particular inline method, you might
2540 mark it as having default visibility. Marking the enclosing class
2541 with explicit visibility has no effect.
2542
2543 Explicitly instantiated inline methods are unaffected by this
2544 option as their linkage might otherwise cross a shared library
2545 boundary.
2546
2547 -fvisibility-ms-compat
2548 This flag attempts to use visibility settings to make GCC's C++
2549 linkage model compatible with that of Microsoft Visual Studio.
2550
2551 The flag makes these changes to GCC's linkage model:
2552
2553 1. It sets the default visibility to "hidden", like
2554 -fvisibility=hidden.
2555
2556 2. Types, but not their members, are not hidden by default.
2557
2558 3. The One Definition Rule is relaxed for types without explicit
2559 visibility specifications that are defined in more than one
2560 shared object: those declarations are permitted if they are
2561 permitted when this option is not used.
2562
2563 In new code it is better to use -fvisibility=hidden and export
2564 those classes that are intended to be externally visible.
2565 Unfortunately it is possible for code to rely, perhaps
2566 accidentally, on the Visual Studio behavior.
2567
2568 Among the consequences of these changes are that static data
2569 members of the same type with the same name but defined in
2570 different shared objects are different, so changing one does not
2571 change the other; and that pointers to function members defined in
2572 different shared objects may not compare equal. When this flag is
2573 given, it is a violation of the ODR to define types with the same
2574 name differently.
2575
2576 -fno-weak
2577 Do not use weak symbol support, even if it is provided by the
2578 linker. By default, G++ uses weak symbols if they are available.
2579 This option exists only for testing, and should not be used by end-
2580 users; it results in inferior code and has no benefits. This
2581 option may be removed in a future release of G++.
2582
2583 -fext-numeric-literals (C++ and Objective-C++ only)
2584 Accept imaginary, fixed-point, or machine-defined literal number
2585 suffixes as GNU extensions. When this option is turned off these
2586 suffixes are treated as C++11 user-defined literal numeric
2587 suffixes. This is on by default for all pre-C++11 dialects and all
2588 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2589 This option is off by default for ISO C++11 onwards (-std=c++11,
2590 ...).
2591
2592 -nostdinc++
2593 Do not search for header files in the standard directories specific
2594 to C++, but do still search the other standard directories. (This
2595 option is used when building the C++ library.)
2596
2597 -flang-info-include-translate
2598 -flang-info-include-translate-not
2599 -flang-info-include-translate=header
2600 Inform of include translation events. The first will note accepted
2601 include translations, the second will note declined include
2602 translations. The header form will inform of include translations
2603 relating to that specific header. If header is of the form "user"
2604 or "<system>" it will be resolved to a specific user or system
2605 header using the include path.
2606
2607 -flang-info-module-cmi
2608 -flang-info-module-cmi=module
2609 Inform of Compiled Module Interface pathnames. The first will note
2610 all read CMI pathnames. The module form will not reading a
2611 specific module's CMI. module may be a named module or a header-
2612 unit (the latter indicated by either being a pathname containing
2613 directory separators or enclosed in "<>" or "").
2614
2615 -stdlib=libstdc++,libc++
2616 When G++ is configured to support this option, it allows
2617 specification of alternate C++ runtime libraries. Two options are
2618 available: libstdc++ (the default, native C++ runtime for G++) and
2619 libc++ which is the C++ runtime installed on some operating systems
2620 (e.g. Darwin versions from Darwin11 onwards). The option switches
2621 G++ to use the headers from the specified library and to emit
2622 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2623 for linking.
2624
2625 In addition, these warning options have meanings only for C++ programs:
2626
2627 -Wabi-tag (C++ and Objective-C++ only)
2628 Warn when a type with an ABI tag is used in a context that does not
2629 have that ABI tag. See C++ Attributes for more information about
2630 ABI tags.
2631
2632 -Wcomma-subscript (C++ and Objective-C++ only)
2633 Warn about uses of a comma expression within a subscripting
2634 expression. This usage was deprecated in C++20. However, a comma
2635 expression wrapped in "( )" is not deprecated. Example:
2636
2637 void f(int *a, int b, int c) {
2638 a[b,c]; // deprecated
2639 a[(b,c)]; // OK
2640 }
2641
2642 Enabled by default with -std=c++20.
2643
2644 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2645 Warn when performing class template argument deduction (CTAD) on a
2646 type with no explicitly written deduction guides. This warning
2647 will point out cases where CTAD succeeded only because the compiler
2648 synthesized the implicit deduction guides, which might not be what
2649 the programmer intended. Certain style guides allow CTAD only on
2650 types that specifically "opt-in"; i.e., on types that are designed
2651 to support CTAD. This warning can be suppressed with the following
2652 pattern:
2653
2654 struct allow_ctad_t; // any name works
2655 template <typename T> struct S {
2656 S(T) { }
2657 };
2658 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
2659
2660 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2661 Warn when a class seems unusable because all the constructors or
2662 destructors in that class are private, and it has neither friends
2663 nor public static member functions. Also warn if there are no non-
2664 private methods, and there's at least one private member function
2665 that isn't a constructor or destructor.
2666
2667 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2668 Warn when "delete" is used to destroy an instance of a class that
2669 has virtual functions and non-virtual destructor. It is unsafe to
2670 delete an instance of a derived class through a pointer to a base
2671 class if the base class does not have a virtual destructor. This
2672 warning is enabled by -Wall.
2673
2674 -Wdeprecated-copy (C++ and Objective-C++ only)
2675 Warn that the implicit declaration of a copy constructor or copy
2676 assignment operator is deprecated if the class has a user-provided
2677 copy constructor or copy assignment operator, in C++11 and up.
2678 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2679 also deprecate if the class has a user-provided destructor.
2680
2681 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2682 Disable the warning about the case when the usual arithmetic
2683 conversions are applied on operands where one is of enumeration
2684 type and the other is of a different enumeration type. This
2685 conversion was deprecated in C++20. For example:
2686
2687 enum E1 { e };
2688 enum E2 { f };
2689 int k = f - e;
2690
2691 -Wdeprecated-enum-enum-conversion is enabled by default with
2692 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2693 -Wenum-conversion.
2694
2695 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2696 Disable the warning about the case when the usual arithmetic
2697 conversions are applied on operands where one is of enumeration
2698 type and the other is of a floating-point type. This conversion
2699 was deprecated in C++20. For example:
2700
2701 enum E1 { e };
2702 enum E2 { f };
2703 bool b = e <= 3.7;
2704
2705 -Wdeprecated-enum-float-conversion is enabled by default with
2706 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2707 -Wenum-conversion.
2708
2709 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2710 Do not warn about uses of "std::initializer_list" that are likely
2711 to result in dangling pointers. Since the underlying array for an
2712 "initializer_list" is handled like a normal C++ temporary object,
2713 it is easy to inadvertently keep a pointer to the array past the
2714 end of the array's lifetime. For example:
2715
2716 * If a function returns a temporary "initializer_list", or a
2717 local "initializer_list" variable, the array's lifetime ends at
2718 the end of the return statement, so the value returned has a
2719 dangling pointer.
2720
2721 * If a new-expression creates an "initializer_list", the array
2722 only lives until the end of the enclosing full-expression, so
2723 the "initializer_list" in the heap has a dangling pointer.
2724
2725 * When an "initializer_list" variable is assigned from a brace-
2726 enclosed initializer list, the temporary array created for the
2727 right side of the assignment only lives until the end of the
2728 full-expression, so at the next statement the
2729 "initializer_list" variable has a dangling pointer.
2730
2731 // li's initial underlying array lives as long as li
2732 std::initializer_list<int> li = { 1,2,3 };
2733 // assignment changes li to point to a temporary array
2734 li = { 4, 5 };
2735 // now the temporary is gone and li has a dangling pointer
2736 int i = li.begin()[0] // undefined behavior
2737
2738 * When a list constructor stores the "begin" pointer from the
2739 "initializer_list" argument, this doesn't extend the lifetime
2740 of the array, so if a class variable is constructed from a
2741 temporary "initializer_list", the pointer is left dangling by
2742 the end of the variable declaration statement.
2743
2744 -Winvalid-imported-macros
2745 Verify all imported macro definitions are valid at the end of
2746 compilation. This is not enabled by default, as it requires
2747 additional processing to determine. It may be useful when
2748 preparing sets of header-units to ensure consistent macros.
2749
2750 -Wno-literal-suffix (C++ and Objective-C++ only)
2751 Do not warn when a string or character literal is followed by a ud-
2752 suffix which does not begin with an underscore. As a conforming
2753 extension, GCC treats such suffixes as separate preprocessing
2754 tokens in order to maintain backwards compatibility with code that
2755 uses formatting macros from "<inttypes.h>". For example:
2756
2757 #define __STDC_FORMAT_MACROS
2758 #include <inttypes.h>
2759 #include <stdio.h>
2760
2761 int main() {
2762 int64_t i64 = 123;
2763 printf("My int64: %" PRId64"\n", i64);
2764 }
2765
2766 In this case, "PRId64" is treated as a separate preprocessing
2767 token.
2768
2769 This option also controls warnings when a user-defined literal
2770 operator is declared with a literal suffix identifier that doesn't
2771 begin with an underscore. Literal suffix identifiers that don't
2772 begin with an underscore are reserved for future standardization.
2773
2774 These warnings are enabled by default.
2775
2776 -Wno-narrowing (C++ and Objective-C++ only)
2777 For C++11 and later standards, narrowing conversions are diagnosed
2778 by default, as required by the standard. A narrowing conversion
2779 from a constant produces an error, and a narrowing conversion from
2780 a non-constant produces a warning, but -Wno-narrowing suppresses
2781 the diagnostic. Note that this does not affect the meaning of
2782 well-formed code; narrowing conversions are still considered ill-
2783 formed in SFINAE contexts.
2784
2785 With -Wnarrowing in C++98, warn when a narrowing conversion
2786 prohibited by C++11 occurs within { }, e.g.
2787
2788 int i = { 2.2 }; // error: narrowing from double to int
2789
2790 This flag is included in -Wall and -Wc++11-compat.
2791
2792 -Wnoexcept (C++ and Objective-C++ only)
2793 Warn when a noexcept-expression evaluates to false because of a
2794 call to a function that does not have a non-throwing exception
2795 specification (i.e. "throw()" or "noexcept") but is known by the
2796 compiler to never throw an exception.
2797
2798 -Wnoexcept-type (C++ and Objective-C++ only)
2799 Warn if the C++17 feature making "noexcept" part of a function type
2800 changes the mangled name of a symbol relative to C++14. Enabled by
2801 -Wabi and -Wc++17-compat.
2802
2803 As an example:
2804
2805 template <class T> void f(T t) { t(); };
2806 void g() noexcept;
2807 void h() { f(g); }
2808
2809 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2810 "f<void(*)()noexcept>".
2811
2812 -Wclass-memaccess (C++ and Objective-C++ only)
2813 Warn when the destination of a call to a raw memory function such
2814 as "memset" or "memcpy" is an object of class type, and when
2815 writing into such an object might bypass the class non-trivial or
2816 deleted constructor or copy assignment, violate const-correctness
2817 or encapsulation, or corrupt virtual table pointers. Modifying the
2818 representation of such objects may violate invariants maintained by
2819 member functions of the class. For example, the call to "memset"
2820 below is undefined because it modifies a non-trivial class object
2821 and is, therefore, diagnosed. The safe way to either initialize or
2822 clear the storage of objects of such types is by using the
2823 appropriate constructor or assignment operator, if one is
2824 available.
2825
2826 std::string str = "abc";
2827 memset (&str, 0, sizeof str);
2828
2829 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2830 casting the pointer to the class object to "void *" or to a type
2831 that can be safely accessed by the raw memory function suppresses
2832 the warning.
2833
2834 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2835 Warn when a class has virtual functions and an accessible non-
2836 virtual destructor itself or in an accessible polymorphic base
2837 class, in which case it is possible but unsafe to delete an
2838 instance of a derived class through a pointer to the class itself
2839 or base class. This warning is automatically enabled if -Weffc++
2840 is specified.
2841
2842 -Wregister (C++ and Objective-C++ only)
2843 Warn on uses of the "register" storage class specifier, except when
2844 it is part of the GNU Explicit Register Variables extension. The
2845 use of the "register" keyword as storage class specifier has been
2846 deprecated in C++11 and removed in C++17. Enabled by default with
2847 -std=c++17.
2848
2849 -Wreorder (C++ and Objective-C++ only)
2850 Warn when the order of member initializers given in the code does
2851 not match the order in which they must be executed. For instance:
2852
2853 struct A {
2854 int i;
2855 int j;
2856 A(): j (0), i (1) { }
2857 };
2858
2859 The compiler rearranges the member initializers for "i" and "j" to
2860 match the declaration order of the members, emitting a warning to
2861 that effect. This warning is enabled by -Wall.
2862
2863 -Wno-pessimizing-move (C++ and Objective-C++ only)
2864 This warning warns when a call to "std::move" prevents copy
2865 elision. A typical scenario when copy elision can occur is when
2866 returning in a function with a class return type, when the
2867 expression being returned is the name of a non-volatile automatic
2868 object, and is not a function parameter, and has the same type as
2869 the function return type.
2870
2871 struct T {
2872 ...
2873 };
2874 T fn()
2875 {
2876 T t;
2877 ...
2878 return std::move (t);
2879 }
2880
2881 But in this example, the "std::move" call prevents copy elision.
2882
2883 This warning is enabled by -Wall.
2884
2885 -Wno-redundant-move (C++ and Objective-C++ only)
2886 This warning warns about redundant calls to "std::move"; that is,
2887 when a move operation would have been performed even without the
2888 "std::move" call. This happens because the compiler is forced to
2889 treat the object as if it were an rvalue in certain situations such
2890 as returning a local variable, where copy elision isn't applicable.
2891 Consider:
2892
2893 struct T {
2894 ...
2895 };
2896 T fn(T t)
2897 {
2898 ...
2899 return std::move (t);
2900 }
2901
2902 Here, the "std::move" call is redundant. Because G++ implements
2903 Core Issue 1579, another example is:
2904
2905 struct T { // convertible to U
2906 ...
2907 };
2908 struct U {
2909 ...
2910 };
2911 U fn()
2912 {
2913 T t;
2914 ...
2915 return std::move (t);
2916 }
2917
2918 In this example, copy elision isn't applicable because the type of
2919 the expression being returned and the function return type differ,
2920 yet G++ treats the return value as if it were designated by an
2921 rvalue.
2922
2923 This warning is enabled by -Wextra.
2924
2925 -Wrange-loop-construct (C++ and Objective-C++ only)
2926 This warning warns when a C++ range-based for-loop is creating an
2927 unnecessary copy. This can happen when the range declaration is
2928 not a reference, but probably should be. For example:
2929
2930 struct S { char arr[128]; };
2931 void fn () {
2932 S arr[5];
2933 for (const auto x : arr) { ... }
2934 }
2935
2936 It does not warn when the type being copied is a trivially-copyable
2937 type whose size is less than 64 bytes.
2938
2939 This warning also warns when a loop variable in a range-based for-
2940 loop is initialized with a value of a different type resulting in a
2941 copy. For example:
2942
2943 void fn() {
2944 int arr[10];
2945 for (const double &x : arr) { ... }
2946 }
2947
2948 In the example above, in every iteration of the loop a temporary
2949 value of type "double" is created and destroyed, to which the
2950 reference "const double &" is bound.
2951
2952 This warning is enabled by -Wall.
2953
2954 -Wredundant-tags (C++ and Objective-C++ only)
2955 Warn about redundant class-key and enum-key in references to class
2956 types and enumerated types in contexts where the key can be
2957 eliminated without causing an ambiguity. For example:
2958
2959 struct foo;
2960 struct foo *p; // warn that keyword struct can be eliminated
2961
2962 On the other hand, in this example there is no warning:
2963
2964 struct foo;
2965 void foo (); // "hides" struct foo
2966 void bar (struct foo&); // no warning, keyword struct is necessary
2967
2968 -Wno-subobject-linkage (C++ and Objective-C++ only)
2969 Do not warn if a class type has a base or a field whose type uses
2970 the anonymous namespace or depends on a type with no linkage. If a
2971 type A depends on a type B with no or internal linkage, defining it
2972 in multiple translation units would be an ODR violation because the
2973 meaning of B is different in each translation unit. If A only
2974 appears in a single translation unit, the best way to silence the
2975 warning is to give it internal linkage by putting it in an
2976 anonymous namespace as well. The compiler doesn't give this
2977 warning for types defined in the main .C file, as those are
2978 unlikely to have multiple definitions. -Wsubobject-linkage is
2979 enabled by default.
2980
2981 -Weffc++ (C++ and Objective-C++ only)
2982 Warn about violations of the following style guidelines from Scott
2983 Meyers' Effective C++ series of books:
2984
2985 * Define a copy constructor and an assignment operator for
2986 classes with dynamically-allocated memory.
2987
2988 * Prefer initialization to assignment in constructors.
2989
2990 * Have "operator=" return a reference to *this.
2991
2992 * Don't try to return a reference when you must return an object.
2993
2994 * Distinguish between prefix and postfix forms of increment and
2995 decrement operators.
2996
2997 * Never overload "&&", "||", or ",".
2998
2999 This option also enables -Wnon-virtual-dtor, which is also one of
3000 the effective C++ recommendations. However, the check is extended
3001 to warn about the lack of virtual destructor in accessible non-
3002 polymorphic bases classes too.
3003
3004 When selecting this option, be aware that the standard library
3005 headers do not obey all of these guidelines; use grep -v to filter
3006 out those warnings.
3007
3008 -Wno-exceptions (C++ and Objective-C++ only)
3009 Disable the warning about the case when an exception handler is
3010 shadowed by another handler, which can point out a wrong ordering
3011 of exception handlers.
3012
3013 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3014 Warn about the use of an uncasted "NULL" as sentinel. When
3015 compiling only with GCC this is a valid sentinel, as "NULL" is
3016 defined to "__null". Although it is a null pointer constant rather
3017 than a null pointer, it is guaranteed to be of the same size as a
3018 pointer. But this use is not portable across different compilers.
3019
3020 -Wno-non-template-friend (C++ and Objective-C++ only)
3021 Disable warnings when non-template friend functions are declared
3022 within a template. In very old versions of GCC that predate
3023 implementation of the ISO standard, declarations such as friend int
3024 foo(int), where the name of the friend is an unqualified-id, could
3025 be interpreted as a particular specialization of a template
3026 function; the warning exists to diagnose compatibility problems,
3027 and is enabled by default.
3028
3029 -Wold-style-cast (C++ and Objective-C++ only)
3030 Warn if an old-style (C-style) cast to a non-void type is used
3031 within a C++ program. The new-style casts ("dynamic_cast",
3032 "static_cast", "reinterpret_cast", and "const_cast") are less
3033 vulnerable to unintended effects and much easier to search for.
3034
3035 -Woverloaded-virtual (C++ and Objective-C++ only)
3036 Warn when a function declaration hides virtual functions from a
3037 base class. For example, in:
3038
3039 struct A {
3040 virtual void f();
3041 };
3042
3043 struct B: public A {
3044 void f(int);
3045 };
3046
3047 the "A" class version of "f" is hidden in "B", and code like:
3048
3049 B* b;
3050 b->f();
3051
3052 fails to compile.
3053
3054 -Wno-pmf-conversions (C++ and Objective-C++ only)
3055 Disable the diagnostic for converting a bound pointer to member
3056 function to a plain pointer.
3057
3058 -Wsign-promo (C++ and Objective-C++ only)
3059 Warn when overload resolution chooses a promotion from unsigned or
3060 enumerated type to a signed type, over a conversion to an unsigned
3061 type of the same size. Previous versions of G++ tried to preserve
3062 unsignedness, but the standard mandates the current behavior.
3063
3064 -Wtemplates (C++ and Objective-C++ only)
3065 Warn when a primary template declaration is encountered. Some
3066 coding rules disallow templates, and this may be used to enforce
3067 that rule. The warning is inactive inside a system header file,
3068 such as the STL, so one can still use the STL. One may also
3069 instantiate or specialize templates.
3070
3071 -Wno-mismatched-new-delete (C++ and Objective-C++ only)
3072 Warn for mismatches between calls to "operator new" or "operator
3073 delete" and the corresponding call to the allocation or
3074 deallocation function. This includes invocations of C++ "operator
3075 delete" with pointers returned from either mismatched forms of
3076 "operator new", or from other functions that allocate objects for
3077 which the "operator delete" isn't a suitable deallocator, as well
3078 as calls to other deallocation functions with pointers returned
3079 from "operator new" for which the deallocation function isn't
3080 suitable.
3081
3082 For example, the "delete" expression in the function below is
3083 diagnosed because it doesn't match the array form of the "new"
3084 expression the pointer argument was returned from. Similarly, the
3085 call to "free" is also diagnosed.
3086
3087 void f ()
3088 {
3089 int *a = new int[n];
3090 delete a; // warning: mismatch in array forms of expressions
3091
3092 char *p = new char[n];
3093 free (p); // warning: mismatch between new and free
3094 }
3095
3096 The related option -Wmismatched-dealloc diagnoses mismatches
3097 involving allocation and deallocation functions other than
3098 "operator new" and "operator delete".
3099
3100 -Wmismatched-new-delete is enabled by default.
3101
3102 -Wmismatched-tags (C++ and Objective-C++ only)
3103 Warn for declarations of structs, classes, and class templates and
3104 their specializations with a class-key that does not match either
3105 the definition or the first declaration if no definition is
3106 provided.
3107
3108 For example, the declaration of "struct Object" in the argument
3109 list of "draw" triggers the warning. To avoid it, either remove
3110 the redundant class-key "struct" or replace it with "class" to
3111 match its definition.
3112
3113 class Object {
3114 public:
3115 virtual ~Object () = 0;
3116 };
3117 void draw (struct Object*);
3118
3119 It is not wrong to declare a class with the class-key "struct" as
3120 the example above shows. The -Wmismatched-tags option is intended
3121 to help achieve a consistent style of class declarations. In code
3122 that is intended to be portable to Windows-based compilers the
3123 warning helps prevent unresolved references due to the difference
3124 in the mangling of symbols declared with different class-keys. The
3125 option can be used either on its own or in conjunction with
3126 -Wredundant-tags.
3127
3128 -Wmultiple-inheritance (C++ and Objective-C++ only)
3129 Warn when a class is defined with multiple direct base classes.
3130 Some coding rules disallow multiple inheritance, and this may be
3131 used to enforce that rule. The warning is inactive inside a system
3132 header file, such as the STL, so one can still use the STL. One
3133 may also define classes that indirectly use multiple inheritance.
3134
3135 -Wvirtual-inheritance
3136 Warn when a class is defined with a virtual direct base class.
3137 Some coding rules disallow multiple inheritance, and this may be
3138 used to enforce that rule. The warning is inactive inside a system
3139 header file, such as the STL, so one can still use the STL. One
3140 may also define classes that indirectly use virtual inheritance.
3141
3142 -Wno-virtual-move-assign
3143 Suppress warnings about inheriting from a virtual base with a non-
3144 trivial C++11 move assignment operator. This is dangerous because
3145 if the virtual base is reachable along more than one path, it is
3146 moved multiple times, which can mean both objects end up in the
3147 moved-from state. If the move assignment operator is written to
3148 avoid moving from a moved-from object, this warning can be
3149 disabled.
3150
3151 -Wnamespaces
3152 Warn when a namespace definition is opened. Some coding rules
3153 disallow namespaces, and this may be used to enforce that rule.
3154 The warning is inactive inside a system header file, such as the
3155 STL, so one can still use the STL. One may also use using
3156 directives and qualified names.
3157
3158 -Wno-terminate (C++ and Objective-C++ only)
3159 Disable the warning about a throw-expression that will immediately
3160 result in a call to "terminate".
3161
3162 -Wno-vexing-parse (C++ and Objective-C++ only)
3163 Warn about the most vexing parse syntactic ambiguity. This warns
3164 about the cases when a declaration looks like a variable
3165 definition, but the C++ language requires it to be interpreted as a
3166 function declaration. For instance:
3167
3168 void f(double a) {
3169 int i(); // extern int i (void);
3170 int n(int(a)); // extern int n (int);
3171 }
3172
3173 Another example:
3174
3175 struct S { S(int); };
3176 void f(double a) {
3177 S x(int(a)); // extern struct S x (int);
3178 S y(int()); // extern struct S y (int (*) (void));
3179 S z(); // extern struct S z (void);
3180 }
3181
3182 The warning will suggest options how to deal with such an
3183 ambiguity; e.g., it can suggest removing the parentheses or using
3184 braces instead.
3185
3186 This warning is enabled by default.
3187
3188 -Wno-class-conversion (C++ and Objective-C++ only)
3189 Do not warn when a conversion function converts an object to the
3190 same type, to a base class of that type, or to void; such a
3191 conversion function will never be called.
3192
3193 -Wvolatile (C++ and Objective-C++ only)
3194 Warn about deprecated uses of the "volatile" qualifier. This
3195 includes postfix and prefix "++" and "--" expressions of
3196 "volatile"-qualified types, using simple assignments where the left
3197 operand is a "volatile"-qualified non-class type for their value,
3198 compound assignments where the left operand is a
3199 "volatile"-qualified non-class type, "volatile"-qualified function
3200 return type, "volatile"-qualified parameter type, and structured
3201 bindings of a "volatile"-qualified type. This usage was deprecated
3202 in C++20.
3203
3204 Enabled by default with -std=c++20.
3205
3206 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3207 Warn when a literal 0 is used as null pointer constant. This can
3208 be useful to facilitate the conversion to "nullptr" in C++11.
3209
3210 -Waligned-new
3211 Warn about a new-expression of a type that requires greater
3212 alignment than the "alignof(std::max_align_t)" but uses an
3213 allocation function without an explicit alignment parameter. This
3214 option is enabled by -Wall.
3215
3216 Normally this only warns about global allocation functions, but
3217 -Waligned-new=all also warns about class member allocation
3218 functions.
3219
3220 -Wno-placement-new
3221 -Wplacement-new=n
3222 Warn about placement new expressions with undefined behavior, such
3223 as constructing an object in a buffer that is smaller than the type
3224 of the object. For example, the placement new expression below is
3225 diagnosed because it attempts to construct an array of 64 integers
3226 in a buffer only 64 bytes large.
3227
3228 char buf [64];
3229 new (buf) int[64];
3230
3231 This warning is enabled by default.
3232
3233 -Wplacement-new=1
3234 This is the default warning level of -Wplacement-new. At this
3235 level the warning is not issued for some strictly undefined
3236 constructs that GCC allows as extensions for compatibility with
3237 legacy code. For example, the following "new" expression is
3238 not diagnosed at this level even though it has undefined
3239 behavior according to the C++ standard because it writes past
3240 the end of the one-element array.
3241
3242 struct S { int n, a[1]; };
3243 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3244 new (s->a)int [32]();
3245
3246 -Wplacement-new=2
3247 At this level, in addition to diagnosing all the same
3248 constructs as at level 1, a diagnostic is also issued for
3249 placement new expressions that construct an object in the last
3250 member of structure whose type is an array of a single element
3251 and whose size is less than the size of the object being
3252 constructed. While the previous example would be diagnosed,
3253 the following construct makes use of the flexible member array
3254 extension to avoid the warning at level 2.
3255
3256 struct S { int n, a[]; };
3257 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3258 new (s->a)int [32]();
3259
3260 -Wcatch-value
3261 -Wcatch-value=n (C++ and Objective-C++ only)
3262 Warn about catch handlers that do not catch via reference. With
3263 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3264 class types that are caught by value. With -Wcatch-value=2 warn
3265 about all class types that are caught by value. With
3266 -Wcatch-value=3 warn about all types that are not caught by
3267 reference. -Wcatch-value is enabled by -Wall.
3268
3269 -Wconditionally-supported (C++ and Objective-C++ only)
3270 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3271
3272 -Wno-delete-incomplete (C++ and Objective-C++ only)
3273 Do not warn when deleting a pointer to incomplete type, which may
3274 cause undefined behavior at runtime. This warning is enabled by
3275 default.
3276
3277 -Wextra-semi (C++, Objective-C++ only)
3278 Warn about redundant semicolons after in-class function
3279 definitions.
3280
3281 -Wno-inaccessible-base (C++, Objective-C++ only)
3282 This option controls warnings when a base class is inaccessible in
3283 a class derived from it due to ambiguity. The warning is enabled
3284 by default. Note that the warning for ambiguous virtual bases is
3285 enabled by the -Wextra option.
3286
3287 struct A { int a; };
3288
3289 struct B : A { };
3290
3291 struct C : B, A { };
3292
3293 -Wno-inherited-variadic-ctor
3294 Suppress warnings about use of C++11 inheriting constructors when
3295 the base class inherited from has a C variadic constructor; the
3296 warning is on by default because the ellipsis is not inherited.
3297
3298 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3299 Suppress warnings from applying the "offsetof" macro to a non-POD
3300 type. According to the 2014 ISO C++ standard, applying "offsetof"
3301 to a non-standard-layout type is undefined. In existing C++
3302 implementations, however, "offsetof" typically gives meaningful
3303 results. This flag is for users who are aware that they are
3304 writing nonportable code and who have deliberately chosen to ignore
3305 the warning about it.
3306
3307 The restrictions on "offsetof" may be relaxed in a future version
3308 of the C++ standard.
3309
3310 -Wsized-deallocation (C++ and Objective-C++ only)
3311 Warn about a definition of an unsized deallocation function
3312
3313 void operator delete (void *) noexcept;
3314 void operator delete[] (void *) noexcept;
3315
3316 without a definition of the corresponding sized deallocation
3317 function
3318
3319 void operator delete (void *, std::size_t) noexcept;
3320 void operator delete[] (void *, std::size_t) noexcept;
3321
3322 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3323
3324 -Wsuggest-final-types
3325 Warn about types with virtual methods where code quality would be
3326 improved if the type were declared with the C++11 "final"
3327 specifier, or, if possible, declared in an anonymous namespace.
3328 This allows GCC to more aggressively devirtualize the polymorphic
3329 calls. This warning is more effective with link-time optimization,
3330 where the information about the class hierarchy graph is more
3331 complete.
3332
3333 -Wsuggest-final-methods
3334 Warn about virtual methods where code quality would be improved if
3335 the method were declared with the C++11 "final" specifier, or, if
3336 possible, its type were declared in an anonymous namespace or with
3337 the "final" specifier. This warning is more effective with link-
3338 time optimization, where the information about the class hierarchy
3339 graph is more complete. It is recommended to first consider
3340 suggestions of -Wsuggest-final-types and then rebuild with new
3341 annotations.
3342
3343 -Wsuggest-override
3344 Warn about overriding virtual functions that are not marked with
3345 the "override" keyword.
3346
3347 -Wuseless-cast (C++ and Objective-C++ only)
3348 Warn when an expression is casted to its own type.
3349
3350 -Wno-conversion-null (C++ and Objective-C++ only)
3351 Do not warn for conversions between "NULL" and non-pointer types.
3352 -Wconversion-null is enabled by default.
3353
3354 Options Controlling Objective-C and Objective-C++ Dialects
3355 (NOTE: This manual does not describe the Objective-C and Objective-C++
3356 languages themselves.
3357
3358 This section describes the command-line options that are only
3359 meaningful for Objective-C and Objective-C++ programs. You can also
3360 use most of the language-independent GNU compiler options. For
3361 example, you might compile a file some_class.m like this:
3362
3363 gcc -g -fgnu-runtime -O -c some_class.m
3364
3365 In this example, -fgnu-runtime is an option meant only for Objective-C
3366 and Objective-C++ programs; you can use the other options with any
3367 language supported by GCC.
3368
3369 Note that since Objective-C is an extension of the C language,
3370 Objective-C compilations may also use options specific to the C front-
3371 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3372 use C++-specific options (e.g., -Wabi).
3373
3374 Here is a list of options that are only for compiling Objective-C and
3375 Objective-C++ programs:
3376
3377 -fconstant-string-class=class-name
3378 Use class-name as the name of the class to instantiate for each
3379 literal string specified with the syntax "@"..."". The default
3380 class name is "NXConstantString" if the GNU runtime is being used,
3381 and "NSConstantString" if the NeXT runtime is being used (see
3382 below). The -fconstant-cfstrings option, if also present,
3383 overrides the -fconstant-string-class setting and cause "@"...""
3384 literals to be laid out as constant CoreFoundation strings.
3385
3386 -fgnu-runtime
3387 Generate object code compatible with the standard GNU Objective-C
3388 runtime. This is the default for most types of systems.
3389
3390 -fnext-runtime
3391 Generate output compatible with the NeXT runtime. This is the
3392 default for NeXT-based systems, including Darwin and Mac OS X. The
3393 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3394 is used.
3395
3396 -fno-nil-receivers
3397 Assume that all Objective-C message dispatches ("[receiver
3398 message:arg]") in this translation unit ensure that the receiver is
3399 not "nil". This allows for more efficient entry points in the
3400 runtime to be used. This option is only available in conjunction
3401 with the NeXT runtime and ABI version 0 or 1.
3402
3403 -fobjc-abi-version=n
3404 Use version n of the Objective-C ABI for the selected runtime.
3405 This option is currently supported only for the NeXT runtime. In
3406 that case, Version 0 is the traditional (32-bit) ABI without
3407 support for properties and other Objective-C 2.0 additions.
3408 Version 1 is the traditional (32-bit) ABI with support for
3409 properties and other Objective-C 2.0 additions. Version 2 is the
3410 modern (64-bit) ABI. If nothing is specified, the default is
3411 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3412 machines.
3413
3414 -fobjc-call-cxx-cdtors
3415 For each Objective-C class, check if any of its instance variables
3416 is a C++ object with a non-trivial default constructor. If so,
3417 synthesize a special "- (id) .cxx_construct" instance method which
3418 runs non-trivial default constructors on any such instance
3419 variables, in order, and then return "self". Similarly, check if
3420 any instance variable is a C++ object with a non-trivial
3421 destructor, and if so, synthesize a special "- (void)
3422 .cxx_destruct" method which runs all such default destructors, in
3423 reverse order.
3424
3425 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3426 thusly generated only operate on instance variables declared in the
3427 current Objective-C class, and not those inherited from
3428 superclasses. It is the responsibility of the Objective-C runtime
3429 to invoke all such methods in an object's inheritance hierarchy.
3430 The "- (id) .cxx_construct" methods are invoked by the runtime
3431 immediately after a new object instance is allocated; the "- (void)
3432 .cxx_destruct" methods are invoked immediately before the runtime
3433 deallocates an object instance.
3434
3435 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3436 later has support for invoking the "- (id) .cxx_construct" and "-
3437 (void) .cxx_destruct" methods.
3438
3439 -fobjc-direct-dispatch
3440 Allow fast jumps to the message dispatcher. On Darwin this is
3441 accomplished via the comm page.
3442
3443 -fobjc-exceptions
3444 Enable syntactic support for structured exception handling in
3445 Objective-C, similar to what is offered by C++. This option is
3446 required to use the Objective-C keywords @try, @throw, @catch,
3447 @finally and @synchronized. This option is available with both the
3448 GNU runtime and the NeXT runtime (but not available in conjunction
3449 with the NeXT runtime on Mac OS X 10.2 and earlier).
3450
3451 -fobjc-gc
3452 Enable garbage collection (GC) in Objective-C and Objective-C++
3453 programs. This option is only available with the NeXT runtime; the
3454 GNU runtime has a different garbage collection implementation that
3455 does not require special compiler flags.
3456
3457 -fobjc-nilcheck
3458 For the NeXT runtime with version 2 of the ABI, check for a nil
3459 receiver in method invocations before doing the actual method call.
3460 This is the default and can be disabled using -fno-objc-nilcheck.
3461 Class methods and super calls are never checked for nil in this way
3462 no matter what this flag is set to. Currently this flag does
3463 nothing when the GNU runtime, or an older version of the NeXT
3464 runtime ABI, is used.
3465
3466 -fobjc-std=objc1
3467 Conform to the language syntax of Objective-C 1.0, the language
3468 recognized by GCC 4.0. This only affects the Objective-C additions
3469 to the C/C++ language; it does not affect conformance to C/C++
3470 standards, which is controlled by the separate C/C++ dialect option
3471 flags. When this option is used with the Objective-C or
3472 Objective-C++ compiler, any Objective-C syntax that is not
3473 recognized by GCC 4.0 is rejected. This is useful if you need to
3474 make sure that your Objective-C code can be compiled with older
3475 versions of GCC.
3476
3477 -freplace-objc-classes
3478 Emit a special marker instructing ld(1) not to statically link in
3479 the resulting object file, and allow dyld(1) to load it in at run
3480 time instead. This is used in conjunction with the Fix-and-
3481 Continue debugging mode, where the object file in question may be
3482 recompiled and dynamically reloaded in the course of program
3483 execution, without the need to restart the program itself.
3484 Currently, Fix-and-Continue functionality is only available in
3485 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3486
3487 -fzero-link
3488 When compiling for the NeXT runtime, the compiler ordinarily
3489 replaces calls to "objc_getClass("...")" (when the name of the
3490 class is known at compile time) with static class references that
3491 get initialized at load time, which improves run-time performance.
3492 Specifying the -fzero-link flag suppresses this behavior and causes
3493 calls to "objc_getClass("...")" to be retained. This is useful in
3494 Zero-Link debugging mode, since it allows for individual class
3495 implementations to be modified during program execution. The GNU
3496 runtime currently always retains calls to "objc_get_class("...")"
3497 regardless of command-line options.
3498
3499 -fno-local-ivars
3500 By default instance variables in Objective-C can be accessed as if
3501 they were local variables from within the methods of the class
3502 they're declared in. This can lead to shadowing between instance
3503 variables and other variables declared either locally inside a
3504 class method or globally with the same name. Specifying the
3505 -fno-local-ivars flag disables this behavior thus avoiding variable
3506 shadowing issues.
3507
3508 -fivar-visibility=[public|protected|private|package]
3509 Set the default instance variable visibility to the specified
3510 option so that instance variables declared outside the scope of any
3511 access modifier directives default to the specified visibility.
3512
3513 -gen-decls
3514 Dump interface declarations for all classes seen in the source file
3515 to a file named sourcename.decl.
3516
3517 -Wassign-intercept (Objective-C and Objective-C++ only)
3518 Warn whenever an Objective-C assignment is being intercepted by the
3519 garbage collector.
3520
3521 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3522 Do not warn if a property for an Objective-C object has no assign
3523 semantics specified.
3524
3525 -Wno-protocol (Objective-C and Objective-C++ only)
3526 If a class is declared to implement a protocol, a warning is issued
3527 for every method in the protocol that is not implemented by the
3528 class. The default behavior is to issue a warning for every method
3529 not explicitly implemented in the class, even if a method
3530 implementation is inherited from the superclass. If you use the
3531 -Wno-protocol option, then methods inherited from the superclass
3532 are considered to be implemented, and no warning is issued for
3533 them.
3534
3535 -Wobjc-root-class (Objective-C and Objective-C++ only)
3536 Warn if a class interface lacks a superclass. Most classes will
3537 inherit from "NSObject" (or "Object") for example. When declaring
3538 classes intended to be root classes, the warning can be suppressed
3539 by marking their interfaces with
3540 "__attribute__((objc_root_class))".
3541
3542 -Wselector (Objective-C and Objective-C++ only)
3543 Warn if multiple methods of different types for the same selector
3544 are found during compilation. The check is performed on the list
3545 of methods in the final stage of compilation. Additionally, a
3546 check is performed for each selector appearing in a
3547 "@selector(...)" expression, and a corresponding method for that
3548 selector has been found during compilation. Because these checks
3549 scan the method table only at the end of compilation, these
3550 warnings are not produced if the final stage of compilation is not
3551 reached, for example because an error is found during compilation,
3552 or because the -fsyntax-only option is being used.
3553
3554 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3555 Warn if multiple methods with differing argument and/or return
3556 types are found for a given selector when attempting to send a
3557 message using this selector to a receiver of type "id" or "Class".
3558 When this flag is off (which is the default behavior), the compiler
3559 omits such warnings if any differences found are confined to types
3560 that share the same size and alignment.
3561
3562 -Wundeclared-selector (Objective-C and Objective-C++ only)
3563 Warn if a "@selector(...)" expression referring to an undeclared
3564 selector is found. A selector is considered undeclared if no
3565 method with that name has been declared before the "@selector(...)"
3566 expression, either explicitly in an @interface or @protocol
3567 declaration, or implicitly in an @implementation section. This
3568 option always performs its checks as soon as a "@selector(...)"
3569 expression is found, while -Wselector only performs its checks in
3570 the final stage of compilation. This also enforces the coding
3571 style convention that methods and selectors must be declared before
3572 being used.
3573
3574 -print-objc-runtime-info
3575 Generate C header describing the largest structure that is passed
3576 by value, if any.
3577
3578 Options to Control Diagnostic Messages Formatting
3579 Traditionally, diagnostic messages have been formatted irrespective of
3580 the output device's aspect (e.g. its width, ...). You can use the
3581 options described below to control the formatting algorithm for
3582 diagnostic messages, e.g. how many characters per line, how often
3583 source location information should be reported. Note that some
3584 language front ends may not honor these options.
3585
3586 -fmessage-length=n
3587 Try to format error messages so that they fit on lines of about n
3588 characters. If n is zero, then no line-wrapping is done; each
3589 error message appears on a single line. This is the default for
3590 all front ends.
3591
3592 Note - this option also affects the display of the #error and
3593 #warning pre-processor directives, and the deprecated
3594 function/type/variable attribute. It does not however affect the
3595 pragma GCC warning and pragma GCC error pragmas.
3596
3597 -fdiagnostics-plain-output
3598 This option requests that diagnostic output look as plain as
3599 possible, which may be useful when running dejagnu or other
3600 utilities that need to parse diagnostics output and prefer that it
3601 remain more stable over time. -fdiagnostics-plain-output is
3602 currently equivalent to the following options:
3603 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3604 -fdiagnostics-color=never -fdiagnostics-urls=never
3605 -fdiagnostics-path-format=separate-events In the future, if GCC
3606 changes the default appearance of its diagnostics, the
3607 corresponding option to disable the new behavior will be added to
3608 this list.
3609
3610 -fdiagnostics-show-location=once
3611 Only meaningful in line-wrapping mode. Instructs the diagnostic
3612 messages reporter to emit source location information once; that
3613 is, in case the message is too long to fit on a single physical
3614 line and has to be wrapped, the source location won't be emitted
3615 (as prefix) again, over and over, in subsequent continuation lines.
3616 This is the default behavior.
3617
3618 -fdiagnostics-show-location=every-line
3619 Only meaningful in line-wrapping mode. Instructs the diagnostic
3620 messages reporter to emit the same source location information (as
3621 prefix) for physical lines that result from the process of breaking
3622 a message which is too long to fit on a single line.
3623
3624 -fdiagnostics-color[=WHEN]
3625 -fno-diagnostics-color
3626 Use color in diagnostics. WHEN is never, always, or auto. The
3627 default depends on how the compiler has been configured, it can be
3628 any of the above WHEN options or also never if GCC_COLORS
3629 environment variable isn't present in the environment, and auto
3630 otherwise. auto makes GCC use color only when the standard error
3631 is a terminal, and when not executing in an emacs shell. The forms
3632 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3633 -fdiagnostics-color=always and -fdiagnostics-color=never,
3634 respectively.
3635
3636 The colors are defined by the environment variable GCC_COLORS. Its
3637 value is a colon-separated list of capabilities and Select Graphic
3638 Rendition (SGR) substrings. SGR commands are interpreted by the
3639 terminal or terminal emulator. (See the section in the
3640 documentation of your text terminal for permitted values and their
3641 meanings as character attributes.) These substring values are
3642 integers in decimal representation and can be concatenated with
3643 semicolons. Common values to concatenate include 1 for bold, 4 for
3644 underline, 5 for blink, 7 for inverse, 39 for default foreground
3645 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3646 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3647 modes foreground colors, 49 for default background color, 40 to 47
3648 for background colors, 100 to 107 for 16-color mode background
3649 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3650 background colors.
3651
3652 The default GCC_COLORS is
3653
3654 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3655 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3656 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3657 type-diff=01;32
3658
3659 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3660 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3661 GCC_COLORS to the empty string disables colors. Supported
3662 capabilities are as follows.
3663
3664 "error="
3665 SGR substring for error: markers.
3666
3667 "warning="
3668 SGR substring for warning: markers.
3669
3670 "note="
3671 SGR substring for note: markers.
3672
3673 "path="
3674 SGR substring for colorizing paths of control-flow events as
3675 printed via -fdiagnostics-path-format=, such as the identifiers
3676 of individual events and lines indicating interprocedural calls
3677 and returns.
3678
3679 "range1="
3680 SGR substring for first additional range.
3681
3682 "range2="
3683 SGR substring for second additional range.
3684
3685 "locus="
3686 SGR substring for location information, file:line or
3687 file:line:column etc.
3688
3689 "quote="
3690 SGR substring for information printed within quotes.
3691
3692 "fixit-insert="
3693 SGR substring for fix-it hints suggesting text to be inserted
3694 or replaced.
3695
3696 "fixit-delete="
3697 SGR substring for fix-it hints suggesting text to be deleted.
3698
3699 "diff-filename="
3700 SGR substring for filename headers within generated patches.
3701
3702 "diff-hunk="
3703 SGR substring for the starts of hunks within generated patches.
3704
3705 "diff-delete="
3706 SGR substring for deleted lines within generated patches.
3707
3708 "diff-insert="
3709 SGR substring for inserted lines within generated patches.
3710
3711 "type-diff="
3712 SGR substring for highlighting mismatching types within
3713 template arguments in the C++ frontend.
3714
3715 -fdiagnostics-urls[=WHEN]
3716 Use escape sequences to embed URLs in diagnostics. For example,
3717 when -fdiagnostics-show-option emits text showing the command-line
3718 option controlling a diagnostic, embed a URL for documentation of
3719 that option.
3720
3721 WHEN is never, always, or auto. auto makes GCC use URL escape
3722 sequences only when the standard error is a terminal, and when not
3723 executing in an emacs shell or any graphical terminal which is
3724 known to be incompatible with this feature, see below.
3725
3726 The default depends on how the compiler has been configured. It
3727 can be any of the above WHEN options.
3728
3729 GCC can also be configured (via the
3730 --with-diagnostics-urls=auto-if-env configure-time option) so that
3731 the default is affected by environment variables. Under such a
3732 configuration, GCC defaults to using auto if either GCC_URLS or
3733 TERM_URLS environment variables are present and non-empty in the
3734 environment of the compiler, or never if neither are.
3735
3736 However, even with -fdiagnostics-urls=always the behavior is
3737 dependent on those environment variables: If GCC_URLS is set to
3738 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3739 use ST escape sequences. If set to bel, the default, URLs use BEL
3740 escape sequences. Any other non-empty value enables the feature.
3741 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3742 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3743 character, CTRL-G that usually sounds like a beep.
3744
3745 At this time GCC tries to detect also a few terminals that are
3746 known to not implement the URL feature, and have bugs or at least
3747 had bugs in some versions that are still in use, where the URL
3748 escapes are likely to misbehave, i.e. print garbage on the screen.
3749 That list is currently xfce4-terminal, certain known to be buggy
3750 gnome-terminal versions, the linux console, and mingw. This check
3751 can be skipped with the -fdiagnostics-urls=always.
3752
3753 -fno-diagnostics-show-option
3754 By default, each diagnostic emitted includes text indicating the
3755 command-line option that directly controls the diagnostic (if such
3756 an option is known to the diagnostic machinery). Specifying the
3757 -fno-diagnostics-show-option flag suppresses that behavior.
3758
3759 -fno-diagnostics-show-caret
3760 By default, each diagnostic emitted includes the original source
3761 line and a caret ^ indicating the column. This option suppresses
3762 this information. The source line is truncated to n characters, if
3763 the -fmessage-length=n option is given. When the output is done to
3764 the terminal, the width is limited to the width given by the
3765 COLUMNS environment variable or, if not set, to the terminal width.
3766
3767 -fno-diagnostics-show-labels
3768 By default, when printing source code (via
3769 -fdiagnostics-show-caret), diagnostics can label ranges of source
3770 code with pertinent information, such as the types of expressions:
3771
3772 printf ("foo %s bar", long_i + long_j);
3773 ~^ ~~~~~~~~~~~~~~~
3774 | |
3775 char * long int
3776
3777 This option suppresses the printing of these labels (in the example
3778 above, the vertical bars and the "char *" and "long int" text).
3779
3780 -fno-diagnostics-show-cwe
3781 Diagnostic messages can optionally have an associated
3782 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3783 only provides such metadata for some of the -fanalyzer diagnostics.
3784 GCC plugins may also provide diagnostics with such metadata. By
3785 default, if this information is present, it will be printed with
3786 the diagnostic. This option suppresses the printing of this
3787 metadata.
3788
3789 -fno-diagnostics-show-line-numbers
3790 By default, when printing source code (via
3791 -fdiagnostics-show-caret), a left margin is printed, showing line
3792 numbers. This option suppresses this left margin.
3793
3794 -fdiagnostics-minimum-margin-width=width
3795 This option controls the minimum width of the left margin printed
3796 by -fdiagnostics-show-line-numbers. It defaults to 6.
3797
3798 -fdiagnostics-parseable-fixits
3799 Emit fix-it hints in a machine-parseable format, suitable for
3800 consumption by IDEs. For each fix-it, a line will be printed after
3801 the relevant diagnostic, starting with the string "fix-it:". For
3802 example:
3803
3804 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3805
3806 The location is expressed as a half-open range, expressed as a
3807 count of bytes, starting at byte 1 for the initial column. In the
3808 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3809 replaced with the given string:
3810
3811 00000000011111111112222222222
3812 12345678901234567890123456789
3813 gtk_widget_showall (dlg);
3814 ^^^^^^^^^^^^^^^^^^
3815 gtk_widget_show_all
3816
3817 The filename and replacement string escape backslash as "\\", tab
3818 as "\t", newline as "\n", double quotes as "\"", non-printable
3819 characters as octal (e.g. vertical tab as "\013").
3820
3821 An empty replacement string indicates that the given range is to be
3822 removed. An empty range (e.g. "45:3-45:3") indicates that the
3823 string is to be inserted at the given position.
3824
3825 -fdiagnostics-generate-patch
3826 Print fix-it hints to stderr in unified diff format, after any
3827 diagnostics are printed. For example:
3828
3829 --- test.c
3830 +++ test.c
3831 @ -42,5 +42,5 @
3832
3833 void show_cb(GtkDialog *dlg)
3834 {
3835 - gtk_widget_showall(dlg);
3836 + gtk_widget_show_all(dlg);
3837 }
3838
3839 The diff may or may not be colorized, following the same rules as
3840 for diagnostics (see -fdiagnostics-color).
3841
3842 -fdiagnostics-show-template-tree
3843 In the C++ frontend, when printing diagnostics showing mismatching
3844 template types, such as:
3845
3846 could not convert 'std::map<int, std::vector<double> >()'
3847 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3848
3849 the -fdiagnostics-show-template-tree flag enables printing a tree-
3850 like structure showing the common and differing parts of the types,
3851 such as:
3852
3853 map<
3854 [...],
3855 vector<
3856 [double != float]>>
3857
3858 The parts that differ are highlighted with color ("double" and
3859 "float" in this case).
3860
3861 -fno-elide-type
3862 By default when the C++ frontend prints diagnostics showing
3863 mismatching template types, common parts of the types are printed
3864 as "[...]" to simplify the error message. For example:
3865
3866 could not convert 'std::map<int, std::vector<double> >()'
3867 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3868
3869 Specifying the -fno-elide-type flag suppresses that behavior. This
3870 flag also affects the output of the
3871 -fdiagnostics-show-template-tree flag.
3872
3873 -fdiagnostics-path-format=KIND
3874 Specify how to print paths of control-flow events for diagnostics
3875 that have such a path associated with them.
3876
3877 KIND is none, separate-events, or inline-events, the default.
3878
3879 none means to not print diagnostic paths.
3880
3881 separate-events means to print a separate "note" diagnostic for
3882 each event within the diagnostic. For example:
3883
3884 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
3885 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
3886 test.c:27:3: note: (2) when 'i < count'
3887 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3888
3889 inline-events means to print the events "inline" within the source
3890 code. This view attempts to consolidate the events into runs of
3891 sufficiently-close events, printing them as labelled ranges within
3892 the source.
3893
3894 For example, the same events as above might be printed as:
3895
3896 'test': events 1-3
3897 |
3898 | 25 | list = PyList_New(0);
3899 | | ^~~~~~~~~~~~~
3900 | | |
3901 | | (1) when 'PyList_New' fails, returning NULL
3902 | 26 |
3903 | 27 | for (i = 0; i < count; i++) {
3904 | | ~~~
3905 | | |
3906 | | (2) when 'i < count'
3907 | 28 | item = PyLong_FromLong(random());
3908 | 29 | PyList_Append(list, item);
3909 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
3910 | | |
3911 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3912 |
3913
3914 Interprocedural control flow is shown by grouping the events by
3915 stack frame, and using indentation to show how stack frames are
3916 nested, pushed, and popped.
3917
3918 For example:
3919
3920 'test': events 1-2
3921 |
3922 | 133 | {
3923 | | ^
3924 | | |
3925 | | (1) entering 'test'
3926 | 134 | boxed_int *obj = make_boxed_int (i);
3927 | | ~~~~~~~~~~~~~~~~~~
3928 | | |
3929 | | (2) calling 'make_boxed_int'
3930 |
3931 +--> 'make_boxed_int': events 3-4
3932 |
3933 | 120 | {
3934 | | ^
3935 | | |
3936 | | (3) entering 'make_boxed_int'
3937 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
3938 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3939 | | |
3940 | | (4) calling 'wrapped_malloc'
3941 |
3942 +--> 'wrapped_malloc': events 5-6
3943 |
3944 | 7 | {
3945 | | ^
3946 | | |
3947 | | (5) entering 'wrapped_malloc'
3948 | 8 | return malloc (size);
3949 | | ~~~~~~~~~~~~~
3950 | | |
3951 | | (6) calling 'malloc'
3952 |
3953 <-------------+
3954 |
3955 'test': event 7
3956 |
3957 | 138 | free_boxed_int (obj);
3958 | | ^~~~~~~~~~~~~~~~~~~~
3959 | | |
3960 | | (7) calling 'free_boxed_int'
3961 |
3962 (etc)
3963
3964 -fdiagnostics-show-path-depths
3965 This option provides additional information when printing control-
3966 flow paths associated with a diagnostic.
3967
3968 If this is option is provided then the stack depth will be printed
3969 for each run of events within
3970 -fdiagnostics-path-format=separate-events.
3971
3972 This is intended for use by GCC developers and plugin developers
3973 when debugging diagnostics that report interprocedural control
3974 flow.
3975
3976 -fno-show-column
3977 Do not print column numbers in diagnostics. This may be necessary
3978 if diagnostics are being scanned by a program that does not
3979 understand the column numbers, such as dejagnu.
3980
3981 -fdiagnostics-column-unit=UNIT
3982 Select the units for the column number. This affects traditional
3983 diagnostics (in the absence of -fno-show-column), as well as JSON
3984 format diagnostics if requested.
3985
3986 The default UNIT, display, considers the number of display columns
3987 occupied by each character. This may be larger than the number of
3988 bytes required to encode the character, in the case of tab
3989 characters, or it may be smaller, in the case of multibyte
3990 characters. For example, the character "GREEK SMALL LETTER PI
3991 (U+03C0)" occupies one display column, and its UTF-8 encoding
3992 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
3993 occupies two display columns, and its UTF-8 encoding requires four
3994 bytes.
3995
3996 Setting UNIT to byte changes the column number to the raw byte
3997 count in all cases, as was traditionally output by GCC prior to
3998 version 11.1.0.
3999
4000 -fdiagnostics-column-origin=ORIGIN
4001 Select the origin for column numbers, i.e. the column number
4002 assigned to the first column. The default value of 1 corresponds
4003 to traditional GCC behavior and to the GNU style guide. Some
4004 utilities may perform better with an origin of 0; any non-negative
4005 value may be specified.
4006
4007 -fdiagnostics-format=FORMAT
4008 Select a different format for printing diagnostics. FORMAT is text
4009 or json. The default is text.
4010
4011 The json format consists of a top-level JSON array containing JSON
4012 objects representing the diagnostics.
4013
4014 The JSON is emitted as one line, without formatting; the examples
4015 below have been formatted for clarity.
4016
4017 Diagnostics can have child diagnostics. For example, this error
4018 and note:
4019
4020 misleading-indentation.c:15:3: warning: this 'if' clause does not
4021 guard... [-Wmisleading-indentation]
4022 15 | if (flag)
4023 | ^~
4024 misleading-indentation.c:17:5: note: ...this statement, but the latter
4025 is misleadingly indented as if it were guarded by the 'if'
4026 17 | y = 2;
4027 | ^
4028
4029 might be printed in JSON form (after formatting) like this:
4030
4031 [
4032 {
4033 "kind": "warning",
4034 "locations": [
4035 {
4036 "caret": {
4037 "display-column": 3,
4038 "byte-column": 3,
4039 "column": 3,
4040 "file": "misleading-indentation.c",
4041 "line": 15
4042 },
4043 "finish": {
4044 "display-column": 4,
4045 "byte-column": 4,
4046 "column": 4,
4047 "file": "misleading-indentation.c",
4048 "line": 15
4049 }
4050 }
4051 ],
4052 "message": "this \u2018if\u2019 clause does not guard...",
4053 "option": "-Wmisleading-indentation",
4054 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4055 "children": [
4056 {
4057 "kind": "note",
4058 "locations": [
4059 {
4060 "caret": {
4061 "display-column": 5,
4062 "byte-column": 5,
4063 "column": 5,
4064 "file": "misleading-indentation.c",
4065 "line": 17
4066 }
4067 }
4068 ],
4069 "message": "...this statement, but the latter is ..."
4070 }
4071 ]
4072 "column-origin": 1,
4073 },
4074 ...
4075 ]
4076
4077 where the "note" is a child of the "warning".
4078
4079 A diagnostic has a "kind". If this is "warning", then there is an
4080 "option" key describing the command-line option controlling the
4081 warning.
4082
4083 A diagnostic can contain zero or more locations. Each location has
4084 an optional "label" string and up to three positions within it: a
4085 "caret" position and optional "start" and "finish" positions. A
4086 position is described by a "file" name, a "line" number, and three
4087 numbers indicating a column position:
4088
4089 * "display-column" counts display columns, accounting for tabs
4090 and multibyte characters.
4091
4092 * "byte-column" counts raw bytes.
4093
4094 * "column" is equal to one of the previous two, as dictated by
4095 the -fdiagnostics-column-unit option.
4096
4097 All three columns are relative to the origin specified by
4098 -fdiagnostics-column-origin, which is typically equal to 1 but may
4099 be set, for instance, to 0 for compatibility with other utilities
4100 that number columns from 0. The column origin is recorded in the
4101 JSON output in the "column-origin" tag. In the remaining examples
4102 below, the extra column number outputs have been omitted for
4103 brevity.
4104
4105 For example, this error:
4106
4107 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4108 'struct s'} and 'T' {aka 'struct t'})
4109 64 | return callee_4a () + callee_4b ();
4110 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4111 | | |
4112 | | T {aka struct t}
4113 | S {aka struct s}
4114
4115 has three locations. Its primary location is at the "+" token at
4116 column 23. It has two secondary locations, describing the left and
4117 right-hand sides of the expression, which have labels. It might be
4118 printed in JSON form as:
4119
4120 {
4121 "children": [],
4122 "kind": "error",
4123 "locations": [
4124 {
4125 "caret": {
4126 "column": 23, "file": "bad-binary-ops.c", "line": 64
4127 }
4128 },
4129 {
4130 "caret": {
4131 "column": 10, "file": "bad-binary-ops.c", "line": 64
4132 },
4133 "finish": {
4134 "column": 21, "file": "bad-binary-ops.c", "line": 64
4135 },
4136 "label": "S {aka struct s}"
4137 },
4138 {
4139 "caret": {
4140 "column": 25, "file": "bad-binary-ops.c", "line": 64
4141 },
4142 "finish": {
4143 "column": 36, "file": "bad-binary-ops.c", "line": 64
4144 },
4145 "label": "T {aka struct t}"
4146 }
4147 ],
4148 "message": "invalid operands to binary + ..."
4149 }
4150
4151 If a diagnostic contains fix-it hints, it has a "fixits" array,
4152 consisting of half-open intervals, similar to the output of
4153 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4154 a replacement fix-it hint:
4155
4156 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4157 mean 'color'?
4158 8 | return ptr->colour;
4159 | ^~~~~~
4160 | color
4161
4162 might be printed in JSON form as:
4163
4164 {
4165 "children": [],
4166 "fixits": [
4167 {
4168 "next": {
4169 "column": 21,
4170 "file": "demo.c",
4171 "line": 8
4172 },
4173 "start": {
4174 "column": 15,
4175 "file": "demo.c",
4176 "line": 8
4177 },
4178 "string": "color"
4179 }
4180 ],
4181 "kind": "error",
4182 "locations": [
4183 {
4184 "caret": {
4185 "column": 15,
4186 "file": "demo.c",
4187 "line": 8
4188 },
4189 "finish": {
4190 "column": 20,
4191 "file": "demo.c",
4192 "line": 8
4193 }
4194 }
4195 ],
4196 "message": "\u2018struct s\u2019 has no member named ..."
4197 }
4198
4199 where the fix-it hint suggests replacing the text from "start" up
4200 to but not including "next" with "string"'s value. Deletions are
4201 expressed via an empty value for "string", insertions by having
4202 "start" equal "next".
4203
4204 If the diagnostic has a path of control-flow events associated with
4205 it, it has a "path" array of objects representing the events. Each
4206 event object has a "description" string, a "location" object, along
4207 with a "function" string and a "depth" number for representing
4208 interprocedural paths. The "function" represents the current
4209 function at that event, and the "depth" represents the stack depth
4210 relative to some baseline: the higher, the more frames are within
4211 the stack.
4212
4213 For example, the intraprocedural example shown for
4214 -fdiagnostics-path-format= might have this JSON for its path:
4215
4216 "path": [
4217 {
4218 "depth": 0,
4219 "description": "when 'PyList_New' fails, returning NULL",
4220 "function": "test",
4221 "location": {
4222 "column": 10,
4223 "file": "test.c",
4224 "line": 25
4225 }
4226 },
4227 {
4228 "depth": 0,
4229 "description": "when 'i < count'",
4230 "function": "test",
4231 "location": {
4232 "column": 3,
4233 "file": "test.c",
4234 "line": 27
4235 }
4236 },
4237 {
4238 "depth": 0,
4239 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4240 "function": "test",
4241 "location": {
4242 "column": 5,
4243 "file": "test.c",
4244 "line": 29
4245 }
4246 }
4247 ]
4248
4249 Options to Request or Suppress Warnings
4250 Warnings are diagnostic messages that report constructions that are not
4251 inherently erroneous but that are risky or suggest there may have been
4252 an error.
4253
4254 The following language-independent options do not enable specific
4255 warnings but control the kinds of diagnostics produced by GCC.
4256
4257 -fsyntax-only
4258 Check the code for syntax errors, but don't do anything beyond
4259 that.
4260
4261 -fmax-errors=n
4262 Limits the maximum number of error messages to n, at which point
4263 GCC bails out rather than attempting to continue processing the
4264 source code. If n is 0 (the default), there is no limit on the
4265 number of error messages produced. If -Wfatal-errors is also
4266 specified, then -Wfatal-errors takes precedence over this option.
4267
4268 -w Inhibit all warning messages.
4269
4270 -Werror
4271 Make all warnings into errors.
4272
4273 -Werror=
4274 Make the specified warning into an error. The specifier for a
4275 warning is appended; for example -Werror=switch turns the warnings
4276 controlled by -Wswitch into errors. This switch takes a negative
4277 form, to be used to negate -Werror for specific warnings; for
4278 example -Wno-error=switch makes -Wswitch warnings not be errors,
4279 even when -Werror is in effect.
4280
4281 The warning message for each controllable warning includes the
4282 option that controls the warning. That option can then be used
4283 with -Werror= and -Wno-error= as described above. (Printing of the
4284 option in the warning message can be disabled using the
4285 -fno-diagnostics-show-option flag.)
4286
4287 Note that specifying -Werror=foo automatically implies -Wfoo.
4288 However, -Wno-error=foo does not imply anything.
4289
4290 -Wfatal-errors
4291 This option causes the compiler to abort compilation on the first
4292 error occurred rather than trying to keep going and printing
4293 further error messages.
4294
4295 You can request many specific warnings with options beginning with -W,
4296 for example -Wimplicit to request warnings on implicit declarations.
4297 Each of these specific warning options also has a negative form
4298 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4299 manual lists only one of the two forms, whichever is not the default.
4300 For further language-specific options also refer to C++ Dialect Options
4301 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4302 can be produced by enabling the static analyzer;
4303
4304 Some options, such as -Wall and -Wextra, turn on other options, such as
4305 -Wunused, which may turn on further options, such as -Wunused-value.
4306 The combined effect of positive and negative forms is that more
4307 specific options have priority over less specific ones, independently
4308 of their position in the command-line. For options of the same
4309 specificity, the last one takes effect. Options enabled or disabled via
4310 pragmas take effect as if they appeared at the end of the command-line.
4311
4312 When an unrecognized warning option is requested (e.g.,
4313 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4314 not recognized. However, if the -Wno- form is used, the behavior is
4315 slightly different: no diagnostic is produced for -Wno-unknown-warning
4316 unless other diagnostics are being produced. This allows the use of
4317 new -Wno- options with old compilers, but if something goes wrong, the
4318 compiler warns that an unrecognized option is present.
4319
4320 The effectiveness of some warnings depends on optimizations also being
4321 enabled. For example -Wsuggest-final-types is more effective with link-
4322 time optimization and -Wmaybe-uninitialized does not warn at all unless
4323 optimization is enabled.
4324
4325 -Wpedantic
4326 -pedantic
4327 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4328 all programs that use forbidden extensions, and some other programs
4329 that do not follow ISO C and ISO C++. For ISO C, follows the
4330 version of the ISO C standard specified by any -std option used.
4331
4332 Valid ISO C and ISO C++ programs should compile properly with or
4333 without this option (though a rare few require -ansi or a -std
4334 option specifying the required version of ISO C). However, without
4335 this option, certain GNU extensions and traditional C and C++
4336 features are supported as well. With this option, they are
4337 rejected.
4338
4339 -Wpedantic does not cause warning messages for use of the alternate
4340 keywords whose names begin and end with __. This alternate format
4341 can also be used to disable warnings for non-ISO __intN types, i.e.
4342 __intN__. Pedantic warnings are also disabled in the expression
4343 that follows "__extension__". However, only system header files
4344 should use these escape routes; application programs should avoid
4345 them.
4346
4347 Some users try to use -Wpedantic to check programs for strict ISO C
4348 conformance. They soon find that it does not do quite what they
4349 want: it finds some non-ISO practices, but not all---only those for
4350 which ISO C requires a diagnostic, and some others for which
4351 diagnostics have been added.
4352
4353 A feature to report any failure to conform to ISO C might be useful
4354 in some instances, but would require considerable additional work
4355 and would be quite different from -Wpedantic. We don't have plans
4356 to support such a feature in the near future.
4357
4358 Where the standard specified with -std represents a GNU extended
4359 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4360 standard, the version of ISO C on which the GNU extended dialect is
4361 based. Warnings from -Wpedantic are given where they are required
4362 by the base standard. (It does not make sense for such warnings to
4363 be given only for features not in the specified GNU C dialect,
4364 since by definition the GNU dialects of C include all features the
4365 compiler supports with the given option, and there would be nothing
4366 to warn about.)
4367
4368 -pedantic-errors
4369 Give an error whenever the base standard (see -Wpedantic) requires
4370 a diagnostic, in some cases where there is undefined behavior at
4371 compile-time and in some other cases that do not prevent
4372 compilation of programs that are valid according to the standard.
4373 This is not equivalent to -Werror=pedantic, since there are errors
4374 enabled by this option and not enabled by the latter and vice
4375 versa.
4376
4377 -Wall
4378 This enables all the warnings about constructions that some users
4379 consider questionable, and that are easy to avoid (or modify to
4380 prevent the warning), even in conjunction with macros. This also
4381 enables some language-specific warnings described in C++ Dialect
4382 Options and Objective-C and Objective-C++ Dialect Options.
4383
4384 -Wall turns on the following warning flags:
4385
4386 -Waddress -Warray-bounds=1 (only with -O2) -Warray-parameter=2 (C
4387 and Objective-C only) -Wbool-compare -Wbool-operation
4388 -Wc++11-compat -Wc++14-compat -Wcatch-value (C++ and Objective-C++
4389 only) -Wchar-subscripts -Wcomment -Wduplicate-decl-specifier (C and
4390 Objective-C only) -Wenum-compare (in C/ObjC; this is on by default
4391 in C++) -Wformat -Wformat-overflow -Wformat-truncation
4392 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
4393 -Wimplicit-int (C and Objective-C only)
4394 -Wimplicit-function-declaration (C and Objective-C only)
4395 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
4396 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4397 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4398 (only for C/C++) -Wmissing-attributes -Wmissing-braces (only for
4399 C/ObjC) -Wmultistatement-macros -Wnarrowing (only for C++)
4400 -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses
4401 -Wpessimizing-move (only for C++) -Wpointer-sign
4402 -Wrange-loop-construct (only for C++) -Wreorder -Wrestrict
4403 -Wreturn-type -Wsequence-point -Wsign-compare (only in C++)
4404 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
4405 -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch
4406 -Wtautological-compare -Wtrigraphs -Wuninitialized
4407 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
4408 -Wunused-variable -Wvla-parameter (C and Objective-C only)
4409 -Wvolatile-register-var -Wzero-length-bounds
4410
4411 Note that some warning flags are not implied by -Wall. Some of
4412 them warn about constructions that users generally do not consider
4413 questionable, but which occasionally you might wish to check for;
4414 others warn about constructions that are necessary or hard to avoid
4415 in some cases, and there is no simple way to modify the code to
4416 suppress the warning. Some of them are enabled by -Wextra but many
4417 of them must be enabled individually.
4418
4419 -Wextra
4420 This enables some extra warning flags that are not enabled by
4421 -Wall. (This option used to be called -W. The older name is still
4422 supported, but the newer name is more descriptive.)
4423
4424 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4425 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4426 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4427 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4428 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4429 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4430 -Wshift-negative-value (in C++03 and in C99 and newer)
4431 -Wunused-parameter (only with -Wunused or -Wall)
4432 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4433
4434 The option -Wextra also prints warning messages for the following
4435 cases:
4436
4437 * A pointer is compared against integer zero with "<", "<=", ">",
4438 or ">=".
4439
4440 * (C++ only) An enumerator and a non-enumerator both appear in a
4441 conditional expression.
4442
4443 * (C++ only) Ambiguous virtual bases.
4444
4445 * (C++ only) Subscripting an array that has been declared
4446 "register".
4447
4448 * (C++ only) Taking the address of a variable that has been
4449 declared "register".
4450
4451 * (C++ only) A base class is not initialized in the copy
4452 constructor of a derived class.
4453
4454 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4455 Warn about code affected by ABI changes. This includes code that
4456 may not be compatible with the vendor-neutral C++ ABI as well as
4457 the psABI for the particular target.
4458
4459 Since G++ now defaults to updating the ABI with each major release,
4460 normally -Wabi warns only about C++ ABI compatibility problems if
4461 there is a check added later in a release series for an ABI issue
4462 discovered since the initial release. -Wabi warns about more
4463 things if an older ABI version is selected (with -fabi-version=n).
4464
4465 -Wabi can also be used with an explicit version number to warn
4466 about C++ ABI compatibility with a particular -fabi-version level,
4467 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4468
4469 If an explicit version number is provided and -fabi-compat-version
4470 is not specified, the version number from this option is used for
4471 compatibility aliases. If no explicit version number is provided
4472 with this option, but -fabi-compat-version is specified, that
4473 version number is used for C++ ABI warnings.
4474
4475 Although an effort has been made to warn about all such cases,
4476 there are probably some cases that are not warned about, even
4477 though G++ is generating incompatible code. There may also be
4478 cases where warnings are emitted even though the code that is
4479 generated is compatible.
4480
4481 You should rewrite your code to avoid these warnings if you are
4482 concerned about the fact that code generated by G++ may not be
4483 binary compatible with code generated by other compilers.
4484
4485 Known incompatibilities in -fabi-version=2 (which was the default
4486 from GCC 3.4 to 4.9) include:
4487
4488 * A template with a non-type template parameter of reference type
4489 was mangled incorrectly:
4490
4491 extern int N;
4492 template <int &> struct S {};
4493 void n (S<N>) {2}
4494
4495 This was fixed in -fabi-version=3.
4496
4497 * SIMD vector types declared using "__attribute ((vector_size))"
4498 were mangled in a non-standard way that does not allow for
4499 overloading of functions taking vectors of different sizes.
4500
4501 The mangling was changed in -fabi-version=4.
4502
4503 * "__attribute ((const))" and "noreturn" were mangled as type
4504 qualifiers, and "decltype" of a plain declaration was folded
4505 away.
4506
4507 These mangling issues were fixed in -fabi-version=5.
4508
4509 * Scoped enumerators passed as arguments to a variadic function
4510 are promoted like unscoped enumerators, causing "va_arg" to
4511 complain. On most targets this does not actually affect the
4512 parameter passing ABI, as there is no way to pass an argument
4513 smaller than "int".
4514
4515 Also, the ABI changed the mangling of template argument packs,
4516 "const_cast", "static_cast", prefix increment/decrement, and a
4517 class scope function used as a template argument.
4518
4519 These issues were corrected in -fabi-version=6.
4520
4521 * Lambdas in default argument scope were mangled incorrectly, and
4522 the ABI changed the mangling of "nullptr_t".
4523
4524 These issues were corrected in -fabi-version=7.
4525
4526 * When mangling a function type with function-cv-qualifiers, the
4527 un-qualified function type was incorrectly treated as a
4528 substitution candidate.
4529
4530 This was fixed in -fabi-version=8, the default for GCC 5.1.
4531
4532 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
4533 to unaligned accesses. Note that this did not affect the ABI
4534 of a function with a "nullptr_t" parameter, as parameters have
4535 a minimum alignment.
4536
4537 This was fixed in -fabi-version=9, the default for GCC 5.2.
4538
4539 * Target-specific attributes that affect the identity of a type,
4540 such as ia32 calling conventions on a function type (stdcall,
4541 regparm, etc.), did not affect the mangled name, leading to
4542 name collisions when function pointers were used as template
4543 arguments.
4544
4545 This was fixed in -fabi-version=10, the default for GCC 6.1.
4546
4547 This option also enables warnings about psABI-related changes. The
4548 known psABI changes at this point include:
4549
4550 * For SysV/x86-64, unions with "long double" members are passed
4551 in memory as specified in psABI. Prior to GCC 4.4, this was
4552 not the case. For example:
4553
4554 union U {
4555 long double ld;
4556 int i;
4557 };
4558
4559 "union U" is now always passed in memory.
4560
4561 -Wchar-subscripts
4562 Warn if an array subscript has type "char". This is a common cause
4563 of error, as programmers often forget that this type is signed on
4564 some machines. This warning is enabled by -Wall.
4565
4566 -Wno-coverage-mismatch
4567 Warn if feedback profiles do not match when using the -fprofile-use
4568 option. If a source file is changed between compiling with
4569 -fprofile-generate and with -fprofile-use, the files with the
4570 profile feedback can fail to match the source file and GCC cannot
4571 use the profile feedback information. By default, this warning is
4572 enabled and is treated as an error. -Wno-coverage-mismatch can be
4573 used to disable the warning or -Wno-error=coverage-mismatch can be
4574 used to disable the error. Disabling the error for this warning
4575 can result in poorly optimized code and is useful only in the case
4576 of very minor changes such as bug fixes to an existing code-base.
4577 Completely disabling the warning is not recommended.
4578
4579 -Wno-cpp
4580 (C, Objective-C, C++, Objective-C++ and Fortran only) Suppress
4581 warning messages emitted by "#warning" directives.
4582
4583 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
4584 Give a warning when a value of type "float" is implicitly promoted
4585 to "double". CPUs with a 32-bit "single-precision" floating-point
4586 unit implement "float" in hardware, but emulate "double" in
4587 software. On such a machine, doing computations using "double"
4588 values is much more expensive because of the overhead required for
4589 software emulation.
4590
4591 It is easy to accidentally do computations with "double" because
4592 floating-point literals are implicitly of type "double". For
4593 example, in:
4594
4595 float area(float radius)
4596 {
4597 return 3.14159 * radius * radius;
4598 }
4599
4600 the compiler performs the entire computation with "double" because
4601 the floating-point literal is a "double".
4602
4603 -Wduplicate-decl-specifier (C and Objective-C only)
4604 Warn if a declaration has duplicate "const", "volatile", "restrict"
4605 or "_Atomic" specifier. This warning is enabled by -Wall.
4606
4607 -Wformat
4608 -Wformat=n
4609 Check calls to "printf" and "scanf", etc., to make sure that the
4610 arguments supplied have types appropriate to the format string
4611 specified, and that the conversions specified in the format string
4612 make sense. This includes standard functions, and others specified
4613 by format attributes, in the "printf", "scanf", "strftime" and
4614 "strfmon" (an X/Open extension, not in the C standard) families (or
4615 other target-specific families). Which functions are checked
4616 without format attributes having been specified depends on the
4617 standard version selected, and such checks of functions without the
4618 attribute specified are disabled by -ffreestanding or -fno-builtin.
4619
4620 The formats are checked against the format features supported by
4621 GNU libc version 2.2. These include all ISO C90 and C99 features,
4622 as well as features from the Single Unix Specification and some BSD
4623 and GNU extensions. Other library implementations may not support
4624 all these features; GCC does not support warning about features
4625 that go beyond a particular library's limitations. However, if
4626 -Wpedantic is used with -Wformat, warnings are given about format
4627 features not in the selected standard version (but not for
4628 "strfmon" formats, since those are not in any version of the C
4629 standard).
4630
4631 -Wformat=1
4632 -Wformat
4633 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4634 equivalent to -Wformat=0. Since -Wformat also checks for null
4635 format arguments for several functions, -Wformat also implies
4636 -Wnonnull. Some aspects of this level of format checking can
4637 be disabled by the options: -Wno-format-contains-nul,
4638 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4639 is enabled by -Wall.
4640
4641 -Wformat=2
4642 Enable -Wformat plus additional format checks. Currently
4643 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4644 -Wformat-y2k.
4645
4646 -Wno-format-contains-nul
4647 If -Wformat is specified, do not warn about format strings that
4648 contain NUL bytes.
4649
4650 -Wno-format-extra-args
4651 If -Wformat is specified, do not warn about excess arguments to a
4652 "printf" or "scanf" format function. The C standard specifies that
4653 such arguments are ignored.
4654
4655 Where the unused arguments lie between used arguments that are
4656 specified with $ operand number specifications, normally warnings
4657 are still given, since the implementation could not know what type
4658 to pass to "va_arg" to skip the unused arguments. However, in the
4659 case of "scanf" formats, this option suppresses the warning if the
4660 unused arguments are all pointers, since the Single Unix
4661 Specification says that such unused arguments are allowed.
4662
4663 -Wformat-overflow
4664 -Wformat-overflow=level
4665 Warn about calls to formatted input/output functions such as
4666 "sprintf" and "vsprintf" that might overflow the destination
4667 buffer. When the exact number of bytes written by a format
4668 directive cannot be determined at compile-time it is estimated
4669 based on heuristics that depend on the level argument and on
4670 optimization. While enabling optimization will in most cases
4671 improve the accuracy of the warning, it may also result in false
4672 positives.
4673
4674 -Wformat-overflow
4675 -Wformat-overflow=1
4676 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4677 conservative approach that warns only about calls that most
4678 likely overflow the buffer. At this level, numeric arguments
4679 to format directives with unknown values are assumed to have
4680 the value of one, and strings of unknown length to be empty.
4681 Numeric arguments that are known to be bounded to a subrange of
4682 their type, or string arguments whose output is bounded either
4683 by their directive's precision or by a finite set of string
4684 literals, are assumed to take on the value within the range
4685 that results in the most bytes on output. For example, the
4686 call to "sprintf" below is diagnosed because even with both a
4687 and b equal to zero, the terminating NUL character ('\0')
4688 appended by the function to the destination buffer will be
4689 written past its end. Increasing the size of the buffer by a
4690 single byte is sufficient to avoid the warning, though it may
4691 not be sufficient to avoid the overflow.
4692
4693 void f (int a, int b)
4694 {
4695 char buf [13];
4696 sprintf (buf, "a = %i, b = %i\n", a, b);
4697 }
4698
4699 -Wformat-overflow=2
4700 Level 2 warns also about calls that might overflow the
4701 destination buffer given an argument of sufficient length or
4702 magnitude. At level 2, unknown numeric arguments are assumed
4703 to have the minimum representable value for signed types with a
4704 precision greater than 1, and the maximum representable value
4705 otherwise. Unknown string arguments whose length cannot be
4706 assumed to be bounded either by the directive's precision, or
4707 by a finite set of string literals they may evaluate to, or the
4708 character array they may point to, are assumed to be 1
4709 character long.
4710
4711 At level 2, the call in the example above is again diagnosed,
4712 but this time because with a equal to a 32-bit "INT_MIN" the
4713 first %i directive will write some of its digits beyond the end
4714 of the destination buffer. To make the call safe regardless of
4715 the values of the two variables, the size of the destination
4716 buffer must be increased to at least 34 bytes. GCC includes
4717 the minimum size of the buffer in an informational note
4718 following the warning.
4719
4720 An alternative to increasing the size of the destination buffer
4721 is to constrain the range of formatted values. The maximum
4722 length of string arguments can be bounded by specifying the
4723 precision in the format directive. When numeric arguments of
4724 format directives can be assumed to be bounded by less than the
4725 precision of their type, choosing an appropriate length
4726 modifier to the format specifier will reduce the required
4727 buffer size. For example, if a and b in the example above can
4728 be assumed to be within the precision of the "short int" type
4729 then using either the %hi format directive or casting the
4730 argument to "short" reduces the maximum required size of the
4731 buffer to 24 bytes.
4732
4733 void f (int a, int b)
4734 {
4735 char buf [23];
4736 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4737 }
4738
4739 -Wno-format-zero-length
4740 If -Wformat is specified, do not warn about zero-length formats.
4741 The C standard specifies that zero-length formats are allowed.
4742
4743 -Wformat-nonliteral
4744 If -Wformat is specified, also warn if the format string is not a
4745 string literal and so cannot be checked, unless the format function
4746 takes its format arguments as a "va_list".
4747
4748 -Wformat-security
4749 If -Wformat is specified, also warn about uses of format functions
4750 that represent possible security problems. At present, this warns
4751 about calls to "printf" and "scanf" functions where the format
4752 string is not a string literal and there are no format arguments,
4753 as in "printf (foo);". This may be a security hole if the format
4754 string came from untrusted input and contains %n. (This is
4755 currently a subset of what -Wformat-nonliteral warns about, but in
4756 future warnings may be added to -Wformat-security that are not
4757 included in -Wformat-nonliteral.)
4758
4759 -Wformat-signedness
4760 If -Wformat is specified, also warn if the format string requires
4761 an unsigned argument and the argument is signed and vice versa.
4762
4763 -Wformat-truncation
4764 -Wformat-truncation=level
4765 Warn about calls to formatted input/output functions such as
4766 "snprintf" and "vsnprintf" that might result in output truncation.
4767 When the exact number of bytes written by a format directive cannot
4768 be determined at compile-time it is estimated based on heuristics
4769 that depend on the level argument and on optimization. While
4770 enabling optimization will in most cases improve the accuracy of
4771 the warning, it may also result in false positives. Except as
4772 noted otherwise, the option uses the same logic -Wformat-overflow.
4773
4774 -Wformat-truncation
4775 -Wformat-truncation=1
4776 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4777 conservative approach that warns only about calls to bounded
4778 functions whose return value is unused and that will most
4779 likely result in output truncation.
4780
4781 -Wformat-truncation=2
4782 Level 2 warns also about calls to bounded functions whose
4783 return value is used and that might result in truncation given
4784 an argument of sufficient length or magnitude.
4785
4786 -Wformat-y2k
4787 If -Wformat is specified, also warn about "strftime" formats that
4788 may yield only a two-digit year.
4789
4790 -Wnonnull
4791 Warn about passing a null pointer for arguments marked as requiring
4792 a non-null value by the "nonnull" function attribute.
4793
4794 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4795 with the -Wno-nonnull option.
4796
4797 -Wnonnull-compare
4798 Warn when comparing an argument marked with the "nonnull" function
4799 attribute against null inside the function.
4800
4801 -Wnonnull-compare is included in -Wall. It can be disabled with
4802 the -Wno-nonnull-compare option.
4803
4804 -Wnull-dereference
4805 Warn if the compiler detects paths that trigger erroneous or
4806 undefined behavior due to dereferencing a null pointer. This
4807 option is only active when -fdelete-null-pointer-checks is active,
4808 which is enabled by optimizations in most targets. The precision
4809 of the warnings depends on the optimization options used.
4810
4811 -Winit-self (C, C++, Objective-C and Objective-C++ only)
4812 Warn about uninitialized variables that are initialized with
4813 themselves. Note this option can only be used with the
4814 -Wuninitialized option.
4815
4816 For example, GCC warns about "i" being uninitialized in the
4817 following snippet only when -Winit-self has been specified:
4818
4819 int f()
4820 {
4821 int i = i;
4822 return i;
4823 }
4824
4825 This warning is enabled by -Wall in C++.
4826
4827 -Wno-implicit-int (C and Objective-C only)
4828 This option controls warnings when a declaration does not specify a
4829 type. This warning is enabled by default in C99 and later dialects
4830 of C, and also by -Wall.
4831
4832 -Wno-implicit-function-declaration (C and Objective-C only)
4833 This option controls warnings when a function is used before being
4834 declared. This warning is enabled by default in C99 and later
4835 dialects of C, and also by -Wall. The warning is made into an
4836 error by -pedantic-errors.
4837
4838 -Wimplicit (C and Objective-C only)
4839 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
4840 warning is enabled by -Wall.
4841
4842 -Wimplicit-fallthrough
4843 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
4844 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
4845
4846 -Wimplicit-fallthrough=n
4847 Warn when a switch case falls through. For example:
4848
4849 switch (cond)
4850 {
4851 case 1:
4852 a = 1;
4853 break;
4854 case 2:
4855 a = 2;
4856 case 3:
4857 a = 3;
4858 break;
4859 }
4860
4861 This warning does not warn when the last statement of a case cannot
4862 fall through, e.g. when there is a return statement or a call to
4863 function declared with the noreturn attribute.
4864 -Wimplicit-fallthrough= also takes into account control flow
4865 statements, such as ifs, and only warns when appropriate. E.g.
4866
4867 switch (cond)
4868 {
4869 case 1:
4870 if (i > 3) {
4871 bar (5);
4872 break;
4873 } else if (i < 1) {
4874 bar (0);
4875 } else
4876 return;
4877 default:
4878 ...
4879 }
4880
4881 Since there are occasions where a switch case fall through is
4882 desirable, GCC provides an attribute, "__attribute__
4883 ((fallthrough))", that is to be used along with a null statement to
4884 suppress this warning that would normally occur:
4885
4886 switch (cond)
4887 {
4888 case 1:
4889 bar (0);
4890 __attribute__ ((fallthrough));
4891 default:
4892 ...
4893 }
4894
4895 C++17 provides a standard way to suppress the
4896 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
4897 the GNU attribute. In C++11 or C++14 users can use
4898 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
4899 these attributes, it is also possible to add a fallthrough comment
4900 to silence the warning. The whole body of the C or C++ style
4901 comment should match the given regular expressions listed below.
4902 The option argument n specifies what kind of comments are accepted:
4903
4904 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
4905 *<-Wimplicit-fallthrough=1 matches ".*" regular>
4906 expression, any comment is used as fallthrough comment.
4907
4908 *<-Wimplicit-fallthrough=2 case insensitively matches>
4909 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
4910
4911 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
4912 following regular expressions:
4913
4914 *<"-fallthrough">
4915 *<"@fallthrough@">
4916 *<"lint -fallthrough[ \t]*">
4917 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
4918 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
4919 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
4920 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4921 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
4922 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4923 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
4924 following regular expressions:
4925
4926 *<"-fallthrough">
4927 *<"@fallthrough@">
4928 *<"lint -fallthrough[ \t]*">
4929 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
4930 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
4931 fallthrough comments, only attributes disable the warning.
4932
4933 The comment needs to be followed after optional whitespace and
4934 other comments by "case" or "default" keywords or by a user label
4935 that precedes some "case" or "default" label.
4936
4937 switch (cond)
4938 {
4939 case 1:
4940 bar (0);
4941 /* FALLTHRU */
4942 default:
4943 ...
4944 }
4945
4946 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
4947
4948 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
4949 Control if warnings triggered by the "warn_if_not_aligned"
4950 attribute should be issued. These warnings are enabled by default.
4951
4952 -Wignored-qualifiers (C and C++ only)
4953 Warn if the return type of a function has a type qualifier such as
4954 "const". For ISO C such a type qualifier has no effect, since the
4955 value returned by a function is not an lvalue. For C++, the
4956 warning is only emitted for scalar types or "void". ISO C
4957 prohibits qualified "void" return types on function definitions, so
4958 such return types always receive a warning even without this
4959 option.
4960
4961 This warning is also enabled by -Wextra.
4962
4963 -Wno-ignored-attributes (C and C++ only)
4964 This option controls warnings when an attribute is ignored. This
4965 is different from the -Wattributes option in that it warns whenever
4966 the compiler decides to drop an attribute, not that the attribute
4967 is either unknown, used in a wrong place, etc. This warning is
4968 enabled by default.
4969
4970 -Wmain
4971 Warn if the type of "main" is suspicious. "main" should be a
4972 function with external linkage, returning int, taking either zero
4973 arguments, two, or three arguments of appropriate types. This
4974 warning is enabled by default in C++ and is enabled by either -Wall
4975 or -Wpedantic.
4976
4977 -Wmisleading-indentation (C and C++ only)
4978 Warn when the indentation of the code does not reflect the block
4979 structure. Specifically, a warning is issued for "if", "else",
4980 "while", and "for" clauses with a guarded statement that does not
4981 use braces, followed by an unguarded statement with the same
4982 indentation.
4983
4984 In the following example, the call to "bar" is misleadingly
4985 indented as if it were guarded by the "if" conditional.
4986
4987 if (some_condition ())
4988 foo ();
4989 bar (); /* Gotcha: this is not guarded by the "if". */
4990
4991 In the case of mixed tabs and spaces, the warning uses the
4992 -ftabstop= option to determine if the statements line up
4993 (defaulting to 8).
4994
4995 The warning is not issued for code involving multiline preprocessor
4996 logic such as the following example.
4997
4998 if (flagA)
4999 foo (0);
5000 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5001 if (flagB)
5002 #endif
5003 foo (1);
5004
5005 The warning is not issued after a "#line" directive, since this
5006 typically indicates autogenerated code, and no assumptions can be
5007 made about the layout of the file that the directive references.
5008
5009 This warning is enabled by -Wall in C and C++.
5010
5011 -Wmissing-attributes
5012 Warn when a declaration of a function is missing one or more
5013 attributes that a related function is declared with and whose
5014 absence may adversely affect the correctness or efficiency of
5015 generated code. For example, the warning is issued for
5016 declarations of aliases that use attributes to specify less
5017 restrictive requirements than those of their targets. This
5018 typically represents a potential optimization opportunity. By
5019 contrast, the -Wattribute-alias=2 option controls warnings issued
5020 when the alias is more restrictive than the target, which could
5021 lead to incorrect code generation. Attributes considered include
5022 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5023 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5024 "returns_nonnull", and "returns_twice".
5025
5026 In C++, the warning is issued when an explicit specialization of a
5027 primary template declared with attribute "alloc_align",
5028 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5029 or "nonnull" is declared without it. Attributes "deprecated",
5030 "error", and "warning" suppress the warning..
5031
5032 You can use the "copy" attribute to apply the same set of
5033 attributes to a declaration as that on another declaration without
5034 explicitly enumerating the attributes. This attribute can be
5035 applied to declarations of functions, variables, or types.
5036
5037 -Wmissing-attributes is enabled by -Wall.
5038
5039 For example, since the declaration of the primary function template
5040 below makes use of both attribute "malloc" and "alloc_size" the
5041 declaration of the explicit specialization of the template is
5042 diagnosed because it is missing one of the attributes.
5043
5044 template <class T>
5045 T* __attribute__ ((malloc, alloc_size (1)))
5046 allocate (size_t);
5047
5048 template <>
5049 void* __attribute__ ((malloc)) // missing alloc_size
5050 allocate<void> (size_t);
5051
5052 -Wmissing-braces
5053 Warn if an aggregate or union initializer is not fully bracketed.
5054 In the following example, the initializer for "a" is not fully
5055 bracketed, but that for "b" is fully bracketed.
5056
5057 int a[2][2] = { 0, 1, 2, 3 };
5058 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5059
5060 This warning is enabled by -Wall.
5061
5062 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
5063 Warn if a user-supplied include directory does not exist.
5064
5065 -Wno-missing-profile
5066 This option controls warnings if feedback profiles are missing when
5067 using the -fprofile-use option. This option diagnoses those cases
5068 where a new function or a new file is added between compiling with
5069 -fprofile-generate and with -fprofile-use, without regenerating the
5070 profiles. In these cases, the profile feedback data files do not
5071 contain any profile feedback information for the newly added
5072 function or file respectively. Also, in the case when profile
5073 count data (.gcda) files are removed, GCC cannot use any profile
5074 feedback information. In all these cases, warnings are issued to
5075 inform you that a profile generation step is due. Ignoring the
5076 warning can result in poorly optimized code. -Wno-missing-profile
5077 can be used to disable the warning, but this is not recommended and
5078 should be done only when non-existent profile data is justified.
5079
5080 -Wno-mismatched-dealloc
5081 Warn for calls to deallocation functions with pointer arguments
5082 returned from from allocations functions for which the former isn't
5083 a suitable deallocator. A pair of functions can be associated as
5084 matching allocators and deallocators by use of attribute "malloc".
5085 Unless disabled by the -fno-builtin option the standard functions
5086 "calloc", "malloc", "realloc", and "free", as well as the
5087 corresponding forms of C++ "operator new" and "operator delete" are
5088 implicitly associated as matching allocators and deallocators. In
5089 the following example "mydealloc" is the deallocator for pointers
5090 returned from "myalloc".
5091
5092 void mydealloc (void*);
5093
5094 __attribute__ ((malloc (mydealloc, 1))) void*
5095 myalloc (size_t);
5096
5097 void f (void)
5098 {
5099 void *p = myalloc (32);
5100 // ...use p...
5101 free (p); // warning: not a matching deallocator for myalloc
5102 mydealloc (p); // ok
5103 }
5104
5105 In C++, the related option -Wmismatched-new-delete diagnoses
5106 mismatches involving either "operator new" or "operator delete".
5107
5108 Option -Wmismatched-dealloc is enabled by default.
5109
5110 -Wmultistatement-macros
5111 Warn about unsafe multiple statement macros that appear to be
5112 guarded by a clause such as "if", "else", "for", "switch", or
5113 "while", in which only the first statement is actually guarded
5114 after the macro is expanded.
5115
5116 For example:
5117
5118 #define DOIT x++; y++
5119 if (c)
5120 DOIT;
5121
5122 will increment "y" unconditionally, not just when "c" holds. The
5123 can usually be fixed by wrapping the macro in a do-while loop:
5124
5125 #define DOIT do { x++; y++; } while (0)
5126 if (c)
5127 DOIT;
5128
5129 This warning is enabled by -Wall in C and C++.
5130
5131 -Wparentheses
5132 Warn if parentheses are omitted in certain contexts, such as when
5133 there is an assignment in a context where a truth value is
5134 expected, or when operators are nested whose precedence people
5135 often get confused about.
5136
5137 Also warn if a comparison like "x<=y<=z" appears; this is
5138 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5139 interpretation from that of ordinary mathematical notation.
5140
5141 Also warn for dangerous uses of the GNU extension to "?:" with
5142 omitted middle operand. When the condition in the "?": operator is
5143 a boolean expression, the omitted value is always 1. Often
5144 programmers expect it to be a value computed inside the conditional
5145 expression instead.
5146
5147 For C++ this also warns for some cases of unnecessary parentheses
5148 in declarations, which can indicate an attempt at a function call
5149 instead of a declaration:
5150
5151 {
5152 // Declares a local variable called mymutex.
5153 std::unique_lock<std::mutex> (mymutex);
5154 // User meant std::unique_lock<std::mutex> lock (mymutex);
5155 }
5156
5157 This warning is enabled by -Wall.
5158
5159 -Wsequence-point
5160 Warn about code that may have undefined semantics because of
5161 violations of sequence point rules in the C and C++ standards.
5162
5163 The C and C++ standards define the order in which expressions in a
5164 C/C++ program are evaluated in terms of sequence points, which
5165 represent a partial ordering between the execution of parts of the
5166 program: those executed before the sequence point, and those
5167 executed after it. These occur after the evaluation of a full
5168 expression (one which is not part of a larger expression), after
5169 the evaluation of the first operand of a "&&", "||", "? :" or ","
5170 (comma) operator, before a function is called (but after the
5171 evaluation of its arguments and the expression denoting the called
5172 function), and in certain other places. Other than as expressed by
5173 the sequence point rules, the order of evaluation of subexpressions
5174 of an expression is not specified. All these rules describe only a
5175 partial order rather than a total order, since, for example, if two
5176 functions are called within one expression with no sequence point
5177 between them, the order in which the functions are called is not
5178 specified. However, the standards committee have ruled that
5179 function calls do not overlap.
5180
5181 It is not specified when between sequence points modifications to
5182 the values of objects take effect. Programs whose behavior depends
5183 on this have undefined behavior; the C and C++ standards specify
5184 that "Between the previous and next sequence point an object shall
5185 have its stored value modified at most once by the evaluation of an
5186 expression. Furthermore, the prior value shall be read only to
5187 determine the value to be stored.". If a program breaks these
5188 rules, the results on any particular implementation are entirely
5189 unpredictable.
5190
5191 Examples of code with undefined behavior are "a = a++;", "a[n] =
5192 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5193 diagnosed by this option, and it may give an occasional false
5194 positive result, but in general it has been found fairly effective
5195 at detecting this sort of problem in programs.
5196
5197 The C++17 standard will define the order of evaluation of operands
5198 in more cases: in particular it requires that the right-hand side
5199 of an assignment be evaluated before the left-hand side, so the
5200 above examples are no longer undefined. But this option will still
5201 warn about them, to help people avoid writing code that is
5202 undefined in C and earlier revisions of C++.
5203
5204 The standard is worded confusingly, therefore there is some debate
5205 over the precise meaning of the sequence point rules in subtle
5206 cases. Links to discussions of the problem, including proposed
5207 formal definitions, may be found on the GCC readings page, at
5208 <http://gcc.gnu.org/readings.html>.
5209
5210 This warning is enabled by -Wall for C and C++.
5211
5212 -Wno-return-local-addr
5213 Do not warn about returning a pointer (or in C++, a reference) to a
5214 variable that goes out of scope after the function returns.
5215
5216 -Wreturn-type
5217 Warn whenever a function is defined with a return type that
5218 defaults to "int". Also warn about any "return" statement with no
5219 return value in a function whose return type is not "void" (falling
5220 off the end of the function body is considered returning without a
5221 value).
5222
5223 For C only, warn about a "return" statement with an expression in a
5224 function whose return type is "void", unless the expression type is
5225 also "void". As a GNU extension, the latter case is accepted
5226 without a warning unless -Wpedantic is used. Attempting to use the
5227 return value of a non-"void" function other than "main" that flows
5228 off the end by reaching the closing curly brace that terminates the
5229 function is undefined.
5230
5231 Unlike in C, in C++, flowing off the end of a non-"void" function
5232 other than "main" results in undefined behavior even when the value
5233 of the function is not used.
5234
5235 This warning is enabled by default in C++ and by -Wall otherwise.
5236
5237 -Wno-shift-count-negative
5238 Controls warnings if a shift count is negative. This warning is
5239 enabled by default.
5240
5241 -Wno-shift-count-overflow
5242 Controls warnings if a shift count is greater than or equal to the
5243 bit width of the type. This warning is enabled by default.
5244
5245 -Wshift-negative-value
5246 Warn if left shifting a negative value. This warning is enabled by
5247 -Wextra in C99 and C++11 modes (and newer).
5248
5249 -Wno-shift-overflow
5250 -Wshift-overflow=n
5251 These options control warnings about left shift overflows.
5252
5253 -Wshift-overflow=1
5254 This is the warning level of -Wshift-overflow and is enabled by
5255 default in C99 and C++11 modes (and newer). This warning level
5256 does not warn about left-shifting 1 into the sign bit.
5257 (However, in C, such an overflow is still rejected in contexts
5258 where an integer constant expression is required.) No warning
5259 is emitted in C++20 mode (and newer), as signed left shifts
5260 always wrap.
5261
5262 -Wshift-overflow=2
5263 This warning level also warns about left-shifting 1 into the
5264 sign bit, unless C++14 mode (or newer) is active.
5265
5266 -Wswitch
5267 Warn whenever a "switch" statement has an index of enumerated type
5268 and lacks a "case" for one or more of the named codes of that
5269 enumeration. (The presence of a "default" label prevents this
5270 warning.) "case" labels outside the enumeration range also provoke
5271 warnings when this option is used (even if there is a "default"
5272 label). This warning is enabled by -Wall.
5273
5274 -Wswitch-default
5275 Warn whenever a "switch" statement does not have a "default" case.
5276
5277 -Wswitch-enum
5278 Warn whenever a "switch" statement has an index of enumerated type
5279 and lacks a "case" for one or more of the named codes of that
5280 enumeration. "case" labels outside the enumeration range also
5281 provoke warnings when this option is used. The only difference
5282 between -Wswitch and this option is that this option gives a
5283 warning about an omitted enumeration code even if there is a
5284 "default" label.
5285
5286 -Wno-switch-bool
5287 Do not warn when a "switch" statement has an index of boolean type
5288 and the case values are outside the range of a boolean type. It is
5289 possible to suppress this warning by casting the controlling
5290 expression to a type other than "bool". For example:
5291
5292 switch ((int) (a == 4))
5293 {
5294 ...
5295 }
5296
5297 This warning is enabled by default for C and C++ programs.
5298
5299 -Wno-switch-outside-range
5300 This option controls warnings when a "switch" case has a value that
5301 is outside of its respective type range. This warning is enabled
5302 by default for C and C++ programs.
5303
5304 -Wno-switch-unreachable
5305 Do not warn when a "switch" statement contains statements between
5306 the controlling expression and the first case label, which will
5307 never be executed. For example:
5308
5309 switch (cond)
5310 {
5311 i = 15;
5312 ...
5313 case 5:
5314 ...
5315 }
5316
5317 -Wswitch-unreachable does not warn if the statement between the
5318 controlling expression and the first case label is just a
5319 declaration:
5320
5321 switch (cond)
5322 {
5323 int i;
5324 ...
5325 case 5:
5326 i = 5;
5327 ...
5328 }
5329
5330 This warning is enabled by default for C and C++ programs.
5331
5332 -Wsync-nand (C and C++ only)
5333 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5334 built-in functions are used. These functions changed semantics in
5335 GCC 4.4.
5336
5337 -Wunused-but-set-parameter
5338 Warn whenever a function parameter is assigned to, but otherwise
5339 unused (aside from its declaration).
5340
5341 To suppress this warning use the "unused" attribute.
5342
5343 This warning is also enabled by -Wunused together with -Wextra.
5344
5345 -Wunused-but-set-variable
5346 Warn whenever a local variable is assigned to, but otherwise unused
5347 (aside from its declaration). This warning is enabled by -Wall.
5348
5349 To suppress this warning use the "unused" attribute.
5350
5351 This warning is also enabled by -Wunused, which is enabled by
5352 -Wall.
5353
5354 -Wunused-function
5355 Warn whenever a static function is declared but not defined or a
5356 non-inline static function is unused. This warning is enabled by
5357 -Wall.
5358
5359 -Wunused-label
5360 Warn whenever a label is declared but not used. This warning is
5361 enabled by -Wall.
5362
5363 To suppress this warning use the "unused" attribute.
5364
5365 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5366 Warn when a typedef locally defined in a function is not used.
5367 This warning is enabled by -Wall.
5368
5369 -Wunused-parameter
5370 Warn whenever a function parameter is unused aside from its
5371 declaration.
5372
5373 To suppress this warning use the "unused" attribute.
5374
5375 -Wno-unused-result
5376 Do not warn if a caller of a function marked with attribute
5377 "warn_unused_result" does not use its return value. The default is
5378 -Wunused-result.
5379
5380 -Wunused-variable
5381 Warn whenever a local or static variable is unused aside from its
5382 declaration. This option implies -Wunused-const-variable=1 for C,
5383 but not for C++. This warning is enabled by -Wall.
5384
5385 To suppress this warning use the "unused" attribute.
5386
5387 -Wunused-const-variable
5388 -Wunused-const-variable=n
5389 Warn whenever a constant static variable is unused aside from its
5390 declaration. -Wunused-const-variable=1 is enabled by
5391 -Wunused-variable for C, but not for C++. In C this declares
5392 variable storage, but in C++ this is not an error since const
5393 variables take the place of "#define"s.
5394
5395 To suppress this warning use the "unused" attribute.
5396
5397 -Wunused-const-variable=1
5398 This is the warning level that is enabled by -Wunused-variable
5399 for C. It warns only about unused static const variables
5400 defined in the main compilation unit, but not about static
5401 const variables declared in any header included.
5402
5403 -Wunused-const-variable=2
5404 This warning level also warns for unused constant static
5405 variables in headers (excluding system headers). This is the
5406 warning level of -Wunused-const-variable and must be explicitly
5407 requested since in C++ this isn't an error and in C it might be
5408 harder to clean up all headers included.
5409
5410 -Wunused-value
5411 Warn whenever a statement computes a result that is explicitly not
5412 used. To suppress this warning cast the unused expression to
5413 "void". This includes an expression-statement or the left-hand side
5414 of a comma expression that contains no side effects. For example,
5415 an expression such as "x[i,j]" causes a warning, while
5416 "x[(void)i,j]" does not.
5417
5418 This warning is enabled by -Wall.
5419
5420 -Wunused
5421 All the above -Wunused options combined.
5422
5423 In order to get a warning about an unused function parameter, you
5424 must either specify -Wextra -Wunused (note that -Wall implies
5425 -Wunused), or separately specify -Wunused-parameter.
5426
5427 -Wuninitialized
5428 Warn if an object with automatic or allocated storage duration is
5429 used without having been initialized. In C++, also warn if a non-
5430 static reference or non-static "const" member appears in a class
5431 without constructors.
5432
5433 In addition, passing a pointer (or in C++, a reference) to an
5434 uninitialized object to a "const"-qualified argument of a built-in
5435 function known to read the object is also diagnosed by this
5436 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5437
5438 If you want to warn about code that uses the uninitialized value of
5439 the variable in its own initializer, use the -Winit-self option.
5440
5441 These warnings occur for individual uninitialized elements of
5442 structure, union or array variables as well as for variables that
5443 are uninitialized as a whole. They do not occur for variables or
5444 elements declared "volatile". Because these warnings depend on
5445 optimization, the exact variables or elements for which there are
5446 warnings depend on the precise optimization options and version of
5447 GCC used.
5448
5449 Note that there may be no warning about a variable that is used
5450 only to compute a value that itself is never used, because such
5451 computations may be deleted by data flow analysis before the
5452 warnings are printed.
5453
5454 -Wno-invalid-memory-model
5455 This option controls warnings for invocations of __atomic Builtins,
5456 __sync Builtins, and the C11 atomic generic functions with a memory
5457 consistency argument that is either invalid for the operation or
5458 outside the range of values of the "memory_order" enumeration. For
5459 example, since the "__atomic_store" and "__atomic_store_n" built-
5460 ins are only defined for the relaxed, release, and sequentially
5461 consistent memory orders the following code is diagnosed:
5462
5463 void store (int *i)
5464 {
5465 __atomic_store_n (i, 0, memory_order_consume);
5466 }
5467
5468 -Winvalid-memory-model is enabled by default.
5469
5470 -Wmaybe-uninitialized
5471 For an object with automatic or allocated storage duration, if
5472 there exists a path from the function entry to a use of the object
5473 that is initialized, but there exist some other paths for which the
5474 object is not initialized, the compiler emits a warning if it
5475 cannot prove the uninitialized paths are not executed at run time.
5476
5477 In addition, passing a pointer (or in C++, a reference) to an
5478 uninitialized object to a "const"-qualified function argument is
5479 also diagnosed by this warning. (-Wuninitialized is issued for
5480 built-in functions known to read the object.) Annotating the
5481 function with attribute "access (none)" indicates that the argument
5482 isn't used to access the object and avoids the warning.
5483
5484 These warnings are only possible in optimizing compilation, because
5485 otherwise GCC does not keep track of the state of variables.
5486
5487 These warnings are made optional because GCC may not be able to
5488 determine when the code is correct in spite of appearing to have an
5489 error. Here is one example of how this can happen:
5490
5491 {
5492 int x;
5493 switch (y)
5494 {
5495 case 1: x = 1;
5496 break;
5497 case 2: x = 4;
5498 break;
5499 case 3: x = 5;
5500 }
5501 foo (x);
5502 }
5503
5504 If the value of "y" is always 1, 2 or 3, then "x" is always
5505 initialized, but GCC doesn't know this. To suppress the warning,
5506 you need to provide a default case with assert(0) or similar code.
5507
5508 This option also warns when a non-volatile automatic variable might
5509 be changed by a call to "longjmp". The compiler sees only the
5510 calls to "setjmp". It cannot know where "longjmp" will be called;
5511 in fact, a signal handler could call it at any point in the code.
5512 As a result, you may get a warning even when there is in fact no
5513 problem because "longjmp" cannot in fact be called at the place
5514 that would cause a problem.
5515
5516 Some spurious warnings can be avoided if you declare all the
5517 functions you use that never return as "noreturn".
5518
5519 This warning is enabled by -Wall or -Wextra.
5520
5521 -Wunknown-pragmas
5522 Warn when a "#pragma" directive is encountered that is not
5523 understood by GCC. If this command-line option is used, warnings
5524 are even issued for unknown pragmas in system header files. This
5525 is not the case if the warnings are only enabled by the -Wall
5526 command-line option.
5527
5528 -Wno-pragmas
5529 Do not warn about misuses of pragmas, such as incorrect parameters,
5530 invalid syntax, or conflicts between pragmas. See also
5531 -Wunknown-pragmas.
5532
5533 -Wno-prio-ctor-dtor
5534 Do not warn if a priority from 0 to 100 is used for constructor or
5535 destructor. The use of constructor and destructor attributes allow
5536 you to assign a priority to the constructor/destructor to control
5537 its order of execution before "main" is called or after it returns.
5538 The priority values must be greater than 100 as the compiler
5539 reserves priority values between 0--100 for the implementation.
5540
5541 -Wstrict-aliasing
5542 This option is only active when -fstrict-aliasing is active. It
5543 warns about code that might break the strict aliasing rules that
5544 the compiler is using for optimization. The warning does not catch
5545 all cases, but does attempt to catch the more common pitfalls. It
5546 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
5547
5548 -Wstrict-aliasing=n
5549 This option is only active when -fstrict-aliasing is active. It
5550 warns about code that might break the strict aliasing rules that
5551 the compiler is using for optimization. Higher levels correspond
5552 to higher accuracy (fewer false positives). Higher levels also
5553 correspond to more effort, similar to the way -O works.
5554 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
5555
5556 Level 1: Most aggressive, quick, least accurate. Possibly useful
5557 when higher levels do not warn but -fstrict-aliasing still breaks
5558 the code, as it has very few false negatives. However, it has many
5559 false positives. Warns for all pointer conversions between
5560 possibly incompatible types, even if never dereferenced. Runs in
5561 the front end only.
5562
5563 Level 2: Aggressive, quick, not too precise. May still have many
5564 false positives (not as many as level 1 though), and few false
5565 negatives (but possibly more than level 1). Unlike level 1, it
5566 only warns when an address is taken. Warns about incomplete types.
5567 Runs in the front end only.
5568
5569 Level 3 (default for -Wstrict-aliasing): Should have very few false
5570 positives and few false negatives. Slightly slower than levels 1
5571 or 2 when optimization is enabled. Takes care of the common
5572 pun+dereference pattern in the front end: "*(int*)&some_float". If
5573 optimization is enabled, it also runs in the back end, where it
5574 deals with multiple statement cases using flow-sensitive points-to
5575 information. Only warns when the converted pointer is
5576 dereferenced. Does not warn about incomplete types.
5577
5578 -Wstrict-overflow
5579 -Wstrict-overflow=n
5580 This option is only active when signed overflow is undefined. It
5581 warns about cases where the compiler optimizes based on the
5582 assumption that signed overflow does not occur. Note that it does
5583 not warn about all cases where the code might overflow: it only
5584 warns about cases where the compiler implements some optimization.
5585 Thus this warning depends on the optimization level.
5586
5587 An optimization that assumes that signed overflow does not occur is
5588 perfectly safe if the values of the variables involved are such
5589 that overflow never does, in fact, occur. Therefore this warning
5590 can easily give a false positive: a warning about code that is not
5591 actually a problem. To help focus on important issues, several
5592 warning levels are defined. No warnings are issued for the use of
5593 undefined signed overflow when estimating how many iterations a
5594 loop requires, in particular when determining whether a loop will
5595 be executed at all.
5596
5597 -Wstrict-overflow=1
5598 Warn about cases that are both questionable and easy to avoid.
5599 For example the compiler simplifies "x + 1 > x" to 1. This
5600 level of -Wstrict-overflow is enabled by -Wall; higher levels
5601 are not, and must be explicitly requested.
5602
5603 -Wstrict-overflow=2
5604 Also warn about other cases where a comparison is simplified to
5605 a constant. For example: "abs (x) >= 0". This can only be
5606 simplified when signed integer overflow is undefined, because
5607 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
5608 zero. -Wstrict-overflow (with no level) is the same as
5609 -Wstrict-overflow=2.
5610
5611 -Wstrict-overflow=3
5612 Also warn about other cases where a comparison is simplified.
5613 For example: "x + 1 > 1" is simplified to "x > 0".
5614
5615 -Wstrict-overflow=4
5616 Also warn about other simplifications not covered by the above
5617 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
5618
5619 -Wstrict-overflow=5
5620 Also warn about cases where the compiler reduces the magnitude
5621 of a constant involved in a comparison. For example: "x + 2 >
5622 y" is simplified to "x + 1 >= y". This is reported only at the
5623 highest warning level because this simplification applies to
5624 many comparisons, so this warning level gives a very large
5625 number of false positives.
5626
5627 -Wstring-compare
5628 Warn for calls to "strcmp" and "strncmp" whose result is determined
5629 to be either zero or non-zero in tests for such equality owing to
5630 the length of one argument being greater than the size of the array
5631 the other argument is stored in (or the bound in the case of
5632 "strncmp"). Such calls could be mistakes. For example, the call
5633 to "strcmp" below is diagnosed because its result is necessarily
5634 non-zero irrespective of the contents of the array "a".
5635
5636 extern char a[4];
5637 void f (char *d)
5638 {
5639 strcpy (d, "string");
5640 ...
5641 if (0 == strcmp (a, d)) // cannot be true
5642 puts ("a and d are the same");
5643 }
5644
5645 -Wstring-compare is enabled by -Wextra.
5646
5647 -Wno-stringop-overflow
5648 -Wstringop-overflow
5649 -Wstringop-overflow=type
5650 Warn for calls to string manipulation functions such as "memcpy"
5651 and "strcpy" that are determined to overflow the destination
5652 buffer. The optional argument is one greater than the type of
5653 Object Size Checking to perform to determine the size of the
5654 destination. The argument is meaningful only for functions that
5655 operate on character arrays but not for raw memory functions like
5656 "memcpy" which always make use of Object Size type-0. The option
5657 also warns for calls that specify a size in excess of the largest
5658 possible object or at most "SIZE_MAX / 2" bytes. The option
5659 produces the best results with optimization enabled but can detect
5660 a small subset of simple buffer overflows even without optimization
5661 in calls to the GCC built-in functions like "__builtin_memcpy" that
5662 correspond to the standard functions. In any case, the option
5663 warns about just a subset of buffer overflows detected by the
5664 corresponding overflow checking built-ins. For example, the option
5665 issues a warning for the "strcpy" call below because it copies at
5666 least 5 characters (the string "blue" including the terminating
5667 NUL) into the buffer of size 4.
5668
5669 enum Color { blue, purple, yellow };
5670 const char* f (enum Color clr)
5671 {
5672 static char buf [4];
5673 const char *str;
5674 switch (clr)
5675 {
5676 case blue: str = "blue"; break;
5677 case purple: str = "purple"; break;
5678 case yellow: str = "yellow"; break;
5679 }
5680
5681 return strcpy (buf, str); // warning here
5682 }
5683
5684 Option -Wstringop-overflow=2 is enabled by default.
5685
5686 -Wstringop-overflow
5687 -Wstringop-overflow=1
5688 The -Wstringop-overflow=1 option uses type-zero Object Size
5689 Checking to determine the sizes of destination objects. At
5690 this setting the option does not warn for writes past the end
5691 of subobjects of larger objects accessed by pointers unless the
5692 size of the largest surrounding object is known. When the
5693 destination may be one of several objects it is assumed to be
5694 the largest one of them. On Linux systems, when optimization
5695 is enabled at this setting the option warns for the same code
5696 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
5697 value.
5698
5699 -Wstringop-overflow=2
5700 The -Wstringop-overflow=2 option uses type-one Object Size
5701 Checking to determine the sizes of destination objects. At
5702 this setting the option warns about overflows when writing to
5703 members of the largest complete objects whose exact size is
5704 known. However, it does not warn for excessive writes to the
5705 same members of unknown objects referenced by pointers since
5706 they may point to arrays containing unknown numbers of
5707 elements. This is the default setting of the option.
5708
5709 -Wstringop-overflow=3
5710 The -Wstringop-overflow=3 option uses type-two Object Size
5711 Checking to determine the sizes of destination objects. At
5712 this setting the option warns about overflowing the smallest
5713 object or data member. This is the most restrictive setting of
5714 the option that may result in warnings for safe code.
5715
5716 -Wstringop-overflow=4
5717 The -Wstringop-overflow=4 option uses type-three Object Size
5718 Checking to determine the sizes of destination objects. At
5719 this setting the option warns about overflowing any data
5720 members, and when the destination is one of several objects it
5721 uses the size of the largest of them to decide whether to issue
5722 a warning. Similarly to -Wstringop-overflow=3 this setting of
5723 the option may result in warnings for benign code.
5724
5725 -Wno-stringop-overread
5726 Warn for calls to string manipulation functions such as "memchr",
5727 or "strcpy" that are determined to read past the end of the source
5728 sequence.
5729
5730 Option -Wstringop-overread is enabled by default.
5731
5732 -Wno-stringop-truncation
5733 Do not warn for calls to bounded string manipulation functions such
5734 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5735 copied string or leave the destination unchanged.
5736
5737 In the following example, the call to "strncat" specifies a bound
5738 that is less than the length of the source string. As a result,
5739 the copy of the source will be truncated and so the call is
5740 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5741 as the bound.
5742
5743 void append (char *buf, size_t bufsize)
5744 {
5745 strncat (buf, ".txt", 3);
5746 }
5747
5748 As another example, the following call to "strncpy" results in
5749 copying to "d" just the characters preceding the terminating NUL,
5750 without appending the NUL to the end. Assuming the result of
5751 "strncpy" is necessarily a NUL-terminated string is a common
5752 mistake, and so the call is diagnosed. To avoid the warning when
5753 the result is not expected to be NUL-terminated, call "memcpy"
5754 instead.
5755
5756 void copy (char *d, const char *s)
5757 {
5758 strncpy (d, s, strlen (s));
5759 }
5760
5761 In the following example, the call to "strncpy" specifies the size
5762 of the destination buffer as the bound. If the length of the
5763 source string is equal to or greater than this size the result of
5764 the copy will not be NUL-terminated. Therefore, the call is also
5765 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5766 bound and set the last element of the buffer to "NUL".
5767
5768 void copy (const char *s)
5769 {
5770 char buf[80];
5771 strncpy (buf, s, sizeof buf);
5772 ...
5773 }
5774
5775 In situations where a character array is intended to store a
5776 sequence of bytes with no terminating "NUL" such an array may be
5777 annotated with attribute "nonstring" to avoid this warning. Such
5778 arrays, however, are not suitable arguments to functions that
5779 expect "NUL"-terminated strings. To help detect accidental misuses
5780 of such arrays GCC issues warnings unless it can prove that the use
5781 is safe.
5782
5783 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
5784 Warn for cases where adding an attribute may be beneficial. The
5785 attributes currently supported are listed below.
5786
5787 -Wsuggest-attribute=pure
5788 -Wsuggest-attribute=const
5789 -Wsuggest-attribute=noreturn
5790 -Wmissing-noreturn
5791 -Wsuggest-attribute=malloc
5792 Warn about functions that might be candidates for attributes
5793 "pure", "const" or "noreturn" or "malloc". The compiler only
5794 warns for functions visible in other compilation units or (in
5795 the case of "pure" and "const") if it cannot prove that the
5796 function returns normally. A function returns normally if it
5797 doesn't contain an infinite loop or return abnormally by
5798 throwing, calling "abort" or trapping. This analysis requires
5799 option -fipa-pure-const, which is enabled by default at -O and
5800 higher. Higher optimization levels improve the accuracy of the
5801 analysis.
5802
5803 -Wsuggest-attribute=format
5804 -Wmissing-format-attribute
5805 Warn about function pointers that might be candidates for
5806 "format" attributes. Note these are only possible candidates,
5807 not absolute ones. GCC guesses that function pointers with
5808 "format" attributes that are used in assignment,
5809 initialization, parameter passing or return statements should
5810 have a corresponding "format" attribute in the resulting type.
5811 I.e. the left-hand side of the assignment or initialization,
5812 the type of the parameter variable, or the return type of the
5813 containing function respectively should also have a "format"
5814 attribute to avoid the warning.
5815
5816 GCC also warns about function definitions that might be
5817 candidates for "format" attributes. Again, these are only
5818 possible candidates. GCC guesses that "format" attributes
5819 might be appropriate for any function that calls a function
5820 like "vprintf" or "vscanf", but this might not always be the
5821 case, and some functions for which "format" attributes are
5822 appropriate may not be detected.
5823
5824 -Wsuggest-attribute=cold
5825 Warn about functions that might be candidates for "cold"
5826 attribute. This is based on static detection and generally
5827 only warns about functions which always leads to a call to
5828 another "cold" function such as wrappers of C++ "throw" or
5829 fatal error reporting functions leading to "abort".
5830
5831 -Walloc-zero
5832 Warn about calls to allocation functions decorated with attribute
5833 "alloc_size" that specify zero bytes, including those to the built-
5834 in forms of the functions "aligned_alloc", "alloca", "calloc",
5835 "malloc", and "realloc". Because the behavior of these functions
5836 when called with a zero size differs among implementations (and in
5837 the case of "realloc" has been deprecated) relying on it may result
5838 in subtle portability bugs and should be avoided.
5839
5840 -Walloc-size-larger-than=byte-size
5841 Warn about calls to functions decorated with attribute "alloc_size"
5842 that attempt to allocate objects larger than the specified number
5843 of bytes, or where the result of the size computation in an integer
5844 type with infinite precision would exceed the value of PTRDIFF_MAX
5845 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
5846 default. Warnings controlled by the option can be disabled either
5847 by specifying byte-size of SIZE_MAX or more or by
5848 -Wno-alloc-size-larger-than.
5849
5850 -Wno-alloc-size-larger-than
5851 Disable -Walloc-size-larger-than= warnings. The option is
5852 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
5853
5854 -Walloca
5855 This option warns on all uses of "alloca" in the source.
5856
5857 -Walloca-larger-than=byte-size
5858 This option warns on calls to "alloca" with an integer argument
5859 whose value is either zero, or that is not bounded by a controlling
5860 predicate that limits its value to at most byte-size. It also
5861 warns for calls to "alloca" where the bound value is unknown.
5862 Arguments of non-integer types are considered unbounded even if
5863 they appear to be constrained to the expected range.
5864
5865 For example, a bounded case of "alloca" could be:
5866
5867 void func (size_t n)
5868 {
5869 void *p;
5870 if (n <= 1000)
5871 p = alloca (n);
5872 else
5873 p = malloc (n);
5874 f (p);
5875 }
5876
5877 In the above example, passing "-Walloca-larger-than=1000" would not
5878 issue a warning because the call to "alloca" is known to be at most
5879 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
5880 the compiler would emit a warning.
5881
5882 Unbounded uses, on the other hand, are uses of "alloca" with no
5883 controlling predicate constraining its integer argument. For
5884 example:
5885
5886 void func ()
5887 {
5888 void *p = alloca (n);
5889 f (p);
5890 }
5891
5892 If "-Walloca-larger-than=500" were passed, the above would trigger
5893 a warning, but this time because of the lack of bounds checking.
5894
5895 Note, that even seemingly correct code involving signed integers
5896 could cause a warning:
5897
5898 void func (signed int n)
5899 {
5900 if (n < 500)
5901 {
5902 p = alloca (n);
5903 f (p);
5904 }
5905 }
5906
5907 In the above example, n could be negative, causing a larger than
5908 expected argument to be implicitly cast into the "alloca" call.
5909
5910 This option also warns when "alloca" is used in a loop.
5911
5912 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
5913 usually only effective when -ftree-vrp is active (default for -O2
5914 and above).
5915
5916 See also -Wvla-larger-than=byte-size.
5917
5918 -Wno-alloca-larger-than
5919 Disable -Walloca-larger-than= warnings. The option is equivalent
5920 to -Walloca-larger-than=SIZE_MAX or larger.
5921
5922 -Warith-conversion
5923 Do warn about implicit conversions from arithmetic operations even
5924 when conversion of the operands to the same type cannot change
5925 their values. This affects warnings from -Wconversion,
5926 -Wfloat-conversion, and -Wsign-conversion.
5927
5928 void f (char c, int i)
5929 {
5930 c = c + i; // warns with B<-Wconversion>
5931 c = c + 1; // only warns with B<-Warith-conversion>
5932 }
5933
5934 -Warray-bounds
5935 -Warray-bounds=n
5936 This option is only active when -ftree-vrp is active (default for
5937 -O2 and above). It warns about subscripts to arrays that are always
5938 out of bounds. This warning is enabled by -Wall.
5939
5940 -Warray-bounds=1
5941 This is the warning level of -Warray-bounds and is enabled by
5942 -Wall; higher levels are not, and must be explicitly requested.
5943
5944 -Warray-bounds=2
5945 This warning level also warns about out of bounds access for
5946 arrays at the end of a struct and for arrays accessed through
5947 pointers. This warning level may give a larger number of false
5948 positives and is deactivated by default.
5949
5950 -Warray-parameter
5951 -Warray-parameter=n
5952 Warn about redeclarations of functions involving arguments of array
5953 or pointer types of inconsistent kinds or forms, and enable the
5954 detection of out-of-bounds accesses to such parameters by warnings
5955 such as -Warray-bounds.
5956
5957 If the first function declaration uses the array form the bound
5958 specified in the array is assumed to be the minimum number of
5959 elements expected to be provided in calls to the function and the
5960 maximum number of elements accessed by it. Failing to provide
5961 arguments of sufficient size or accessing more than the maximum
5962 number of elements may be diagnosed by warnings such as
5963 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
5964 involving array parameters declared using the "T[static N]" form.
5965
5966 For example, the warning triggers for the following redeclarations
5967 because the first one allows an array of any size to be passed to
5968 "f" while the second one with the keyword "static" specifies that
5969 the array argument must have at least four elements.
5970
5971 void f (int[static 4]);
5972 void f (int[]); // warning (inconsistent array form)
5973
5974 void g (void)
5975 {
5976 int *p = (int *)malloc (4);
5977 f (p); // warning (array too small)
5978 ...
5979 }
5980
5981 At level 2 the warning also triggers for redeclarations involving
5982 any other inconsistency in array or pointer argument forms denoting
5983 array sizes. Pointers and arrays of unspecified bound are
5984 considered equivalent and do not trigger a warning.
5985
5986 void g (int*);
5987 void g (int[]); // no warning
5988 void g (int[8]); // warning (inconsistent array bound)
5989
5990 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
5991 option triggers warnings for similar inconsistencies involving
5992 Variable Length Array arguments.
5993
5994 -Wattribute-alias=n
5995 -Wno-attribute-alias
5996 Warn about declarations using the "alias" and similar attributes
5997 whose target is incompatible with the type of the alias.
5998
5999 -Wattribute-alias=1
6000 The default warning level of the -Wattribute-alias option
6001 diagnoses incompatibilities between the type of the alias
6002 declaration and that of its target. Such incompatibilities are
6003 typically indicative of bugs.
6004
6005 -Wattribute-alias=2
6006 At this level -Wattribute-alias also diagnoses cases where the
6007 attributes of the alias declaration are more restrictive than
6008 the attributes applied to its target. These mismatches can
6009 potentially result in incorrect code generation. In other
6010 cases they may be benign and could be resolved simply by adding
6011 the missing attribute to the target. For comparison, see the
6012 -Wmissing-attributes option, which controls diagnostics when
6013 the alias declaration is less restrictive than the target,
6014 rather than more restrictive.
6015
6016 Attributes considered include "alloc_align", "alloc_size",
6017 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6018 "noreturn", "nothrow", "pure", "returns_nonnull", and
6019 "returns_twice".
6020
6021 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6022 the default. You can disable these warnings with either
6023 -Wno-attribute-alias or -Wattribute-alias=0.
6024
6025 -Wbool-compare
6026 Warn about boolean expression compared with an integer value
6027 different from "true"/"false". For instance, the following
6028 comparison is always false:
6029
6030 int n = 5;
6031 ...
6032 if ((n > 1) == 2) { ... }
6033
6034 This warning is enabled by -Wall.
6035
6036 -Wbool-operation
6037 Warn about suspicious operations on expressions of a boolean type.
6038 For instance, bitwise negation of a boolean is very likely a bug in
6039 the program. For C, this warning also warns about incrementing or
6040 decrementing a boolean, which rarely makes sense. (In C++,
6041 decrementing a boolean is always invalid. Incrementing a boolean
6042 is invalid in C++17, and deprecated otherwise.)
6043
6044 This warning is enabled by -Wall.
6045
6046 -Wduplicated-branches
6047 Warn when an if-else has identical branches. This warning detects
6048 cases like
6049
6050 if (p != NULL)
6051 return 0;
6052 else
6053 return 0;
6054
6055 It doesn't warn when both branches contain just a null statement.
6056 This warning also warn for conditional operators:
6057
6058 int i = x ? *p : *p;
6059
6060 -Wduplicated-cond
6061 Warn about duplicated conditions in an if-else-if chain. For
6062 instance, warn for the following code:
6063
6064 if (p->q != NULL) { ... }
6065 else if (p->q != NULL) { ... }
6066
6067 -Wframe-address
6068 Warn when the __builtin_frame_address or __builtin_return_address
6069 is called with an argument greater than 0. Such calls may return
6070 indeterminate values or crash the program. The warning is included
6071 in -Wall.
6072
6073 -Wno-discarded-qualifiers (C and Objective-C only)
6074 Do not warn if type qualifiers on pointers are being discarded.
6075 Typically, the compiler warns if a "const char *" variable is
6076 passed to a function that takes a "char *" parameter. This option
6077 can be used to suppress such a warning.
6078
6079 -Wno-discarded-array-qualifiers (C and Objective-C only)
6080 Do not warn if type qualifiers on arrays which are pointer targets
6081 are being discarded. Typically, the compiler warns if a "const int
6082 (*)[]" variable is passed to a function that takes a "int (*)[]"
6083 parameter. This option can be used to suppress such a warning.
6084
6085 -Wno-incompatible-pointer-types (C and Objective-C only)
6086 Do not warn when there is a conversion between pointers that have
6087 incompatible types. This warning is for cases not covered by
6088 -Wno-pointer-sign, which warns for pointer argument passing or
6089 assignment with different signedness.
6090
6091 -Wno-int-conversion (C and Objective-C only)
6092 Do not warn about incompatible integer to pointer and pointer to
6093 integer conversions. This warning is about implicit conversions;
6094 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6095 -Wno-pointer-to-int-cast may be used.
6096
6097 -Wzero-length-bounds
6098 Warn about accesses to elements of zero-length array members that
6099 might overlap other members of the same object. Declaring interior
6100 zero-length arrays is discouraged because accesses to them are
6101 undefined. See
6102
6103 For example, the first two stores in function "bad" are diagnosed
6104 because the array elements overlap the subsequent members "b" and
6105 "c". The third store is diagnosed by -Warray-bounds because it is
6106 beyond the bounds of the enclosing object.
6107
6108 struct X { int a[0]; int b, c; };
6109 struct X x;
6110
6111 void bad (void)
6112 {
6113 x.a[0] = 0; // -Wzero-length-bounds
6114 x.a[1] = 1; // -Wzero-length-bounds
6115 x.a[2] = 2; // -Warray-bounds
6116 }
6117
6118 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6119
6120 -Wno-div-by-zero
6121 Do not warn about compile-time integer division by zero. Floating-
6122 point division by zero is not warned about, as it can be a
6123 legitimate way of obtaining infinities and NaNs.
6124
6125 -Wsystem-headers
6126 Print warning messages for constructs found in system header files.
6127 Warnings from system headers are normally suppressed, on the
6128 assumption that they usually do not indicate real problems and
6129 would only make the compiler output harder to read. Using this
6130 command-line option tells GCC to emit warnings from system headers
6131 as if they occurred in user code. However, note that using -Wall
6132 in conjunction with this option does not warn about unknown pragmas
6133 in system headers---for that, -Wunknown-pragmas must also be used.
6134
6135 -Wtautological-compare
6136 Warn if a self-comparison always evaluates to true or false. This
6137 warning detects various mistakes such as:
6138
6139 int i = 1;
6140 ...
6141 if (i > i) { ... }
6142
6143 This warning also warns about bitwise comparisons that always
6144 evaluate to true or false, for instance:
6145
6146 if ((a & 16) == 10) { ... }
6147
6148 will always be false.
6149
6150 This warning is enabled by -Wall.
6151
6152 -Wtrampolines
6153 Warn about trampolines generated for pointers to nested functions.
6154 A trampoline is a small piece of data or code that is created at
6155 run time on the stack when the address of a nested function is
6156 taken, and is used to call the nested function indirectly. For
6157 some targets, it is made up of data only and thus requires no
6158 special treatment. But, for most targets, it is made up of code
6159 and thus requires the stack to be made executable in order for the
6160 program to work properly.
6161
6162 -Wfloat-equal
6163 Warn if floating-point values are used in equality comparisons.
6164
6165 The idea behind this is that sometimes it is convenient (for the
6166 programmer) to consider floating-point values as approximations to
6167 infinitely precise real numbers. If you are doing this, then you
6168 need to compute (by analyzing the code, or in some other way) the
6169 maximum or likely maximum error that the computation introduces,
6170 and allow for it when performing comparisons (and when producing
6171 output, but that's a different problem). In particular, instead of
6172 testing for equality, you should check to see whether the two
6173 values have ranges that overlap; and this is done with the
6174 relational operators, so equality comparisons are probably
6175 mistaken.
6176
6177 -Wtraditional (C and Objective-C only)
6178 Warn about certain constructs that behave differently in
6179 traditional and ISO C. Also warn about ISO C constructs that have
6180 no traditional C equivalent, and/or problematic constructs that
6181 should be avoided.
6182
6183 * Macro parameters that appear within string literals in the
6184 macro body. In traditional C macro replacement takes place
6185 within string literals, but in ISO C it does not.
6186
6187 * In traditional C, some preprocessor directives did not exist.
6188 Traditional preprocessors only considered a line to be a
6189 directive if the # appeared in column 1 on the line. Therefore
6190 -Wtraditional warns about directives that traditional C
6191 understands but ignores because the # does not appear as the
6192 first character on the line. It also suggests you hide
6193 directives like "#pragma" not understood by traditional C by
6194 indenting them. Some traditional implementations do not
6195 recognize "#elif", so this option suggests avoiding it
6196 altogether.
6197
6198 * A function-like macro that appears without arguments.
6199
6200 * The unary plus operator.
6201
6202 * The U integer constant suffix, or the F or L floating-point
6203 constant suffixes. (Traditional C does support the L suffix on
6204 integer constants.) Note, these suffixes appear in macros
6205 defined in the system headers of most modern systems, e.g. the
6206 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6207 code might normally lead to spurious warnings, however GCC's
6208 integrated preprocessor has enough context to avoid warning in
6209 these cases.
6210
6211 * A function declared external in one block and then used after
6212 the end of the block.
6213
6214 * A "switch" statement has an operand of type "long".
6215
6216 * A non-"static" function declaration follows a "static" one.
6217 This construct is not accepted by some traditional C compilers.
6218
6219 * The ISO type of an integer constant has a different width or
6220 signedness from its traditional type. This warning is only
6221 issued if the base of the constant is ten. I.e. hexadecimal or
6222 octal values, which typically represent bit patterns, are not
6223 warned about.
6224
6225 * Usage of ISO string concatenation is detected.
6226
6227 * Initialization of automatic aggregates.
6228
6229 * Identifier conflicts with labels. Traditional C lacks a
6230 separate namespace for labels.
6231
6232 * Initialization of unions. If the initializer is zero, the
6233 warning is omitted. This is done under the assumption that the
6234 zero initializer in user code appears conditioned on e.g.
6235 "__STDC__" to avoid missing initializer warnings and relies on
6236 default initialization to zero in the traditional C case.
6237
6238 * Conversions by prototypes between fixed/floating-point values
6239 and vice versa. The absence of these prototypes when compiling
6240 with traditional C causes serious problems. This is a subset
6241 of the possible conversion warnings; for the full set use
6242 -Wtraditional-conversion.
6243
6244 * Use of ISO C style function definitions. This warning
6245 intentionally is not issued for prototype declarations or
6246 variadic functions because these ISO C features appear in your
6247 code when using libiberty's traditional C compatibility macros,
6248 "PARAMS" and "VPARAMS". This warning is also bypassed for
6249 nested functions because that feature is already a GCC
6250 extension and thus not relevant to traditional C compatibility.
6251
6252 -Wtraditional-conversion (C and Objective-C only)
6253 Warn if a prototype causes a type conversion that is different from
6254 what would happen to the same argument in the absence of a
6255 prototype. This includes conversions of fixed point to floating
6256 and vice versa, and conversions changing the width or signedness of
6257 a fixed-point argument except when the same as the default
6258 promotion.
6259
6260 -Wdeclaration-after-statement (C and Objective-C only)
6261 Warn when a declaration is found after a statement in a block.
6262 This construct, known from C++, was introduced with ISO C99 and is
6263 by default allowed in GCC. It is not supported by ISO C90.
6264
6265 -Wshadow
6266 Warn whenever a local variable or type declaration shadows another
6267 variable, parameter, type, class member (in C++), or instance
6268 variable (in Objective-C) or whenever a built-in function is
6269 shadowed. Note that in C++, the compiler warns if a local variable
6270 shadows an explicit typedef, but not if it shadows a
6271 struct/class/enum. If this warning is enabled, it includes also
6272 all instances of local shadowing. This means that
6273 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6274 -Wshadow is used. Same as -Wshadow=global.
6275
6276 -Wno-shadow-ivar (Objective-C only)
6277 Do not warn whenever a local variable shadows an instance variable
6278 in an Objective-C method.
6279
6280 -Wshadow=global
6281 Warn for any shadowing. Same as -Wshadow.
6282
6283 -Wshadow=local
6284 Warn when a local variable shadows another local variable or
6285 parameter.
6286
6287 -Wshadow=compatible-local
6288 Warn when a local variable shadows another local variable or
6289 parameter whose type is compatible with that of the shadowing
6290 variable. In C++, type compatibility here means the type of the
6291 shadowing variable can be converted to that of the shadowed
6292 variable. The creation of this flag (in addition to
6293 -Wshadow=local) is based on the idea that when a local variable
6294 shadows another one of incompatible type, it is most likely
6295 intentional, not a bug or typo, as shown in the following example:
6296
6297 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6298 {
6299 for (int i = 0; i < N; ++i)
6300 {
6301 ...
6302 }
6303 ...
6304 }
6305
6306 Since the two variable "i" in the example above have incompatible
6307 types, enabling only -Wshadow=compatible-local does not emit a
6308 warning. Because their types are incompatible, if a programmer
6309 accidentally uses one in place of the other, type checking is
6310 expected to catch that and emit an error or warning. Use of this
6311 flag instead of -Wshadow=local can possibly reduce the number of
6312 warnings triggered by intentional shadowing. Note that this also
6313 means that shadowing "const char *i" by "char *i" does not emit a
6314 warning.
6315
6316 This warning is also enabled by -Wshadow=local.
6317
6318 -Wlarger-than=byte-size
6319 Warn whenever an object is defined whose size exceeds byte-size.
6320 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6321 controlled by the option can be disabled either by specifying byte-
6322 size of SIZE_MAX or more or by -Wno-larger-than.
6323
6324 Also warn for calls to bounded functions such as "memchr" or
6325 "strnlen" that specify a bound greater than the largest possible
6326 object, which is PTRDIFF_MAX bytes by default. These warnings can
6327 only be disabled by -Wno-larger-than.
6328
6329 -Wno-larger-than
6330 Disable -Wlarger-than= warnings. The option is equivalent to
6331 -Wlarger-than=SIZE_MAX or larger.
6332
6333 -Wframe-larger-than=byte-size
6334 Warn if the size of a function frame exceeds byte-size. The
6335 computation done to determine the stack frame size is approximate
6336 and not conservative. The actual requirements may be somewhat
6337 greater than byte-size even if you do not get a warning. In
6338 addition, any space allocated via "alloca", variable-length arrays,
6339 or related constructs is not included by the compiler when
6340 determining whether or not to issue a warning.
6341 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6342 controlled by the option can be disabled either by specifying byte-
6343 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6344
6345 -Wno-frame-larger-than
6346 Disable -Wframe-larger-than= warnings. The option is equivalent to
6347 -Wframe-larger-than=SIZE_MAX or larger.
6348
6349 -Wno-free-nonheap-object
6350 Warn when attempting to deallocate an object that was either not
6351 allocated on the heap, or by using a pointer that was not returned
6352 from a prior call to the corresponding allocation function. For
6353 example, because the call to "stpcpy" returns a pointer to the
6354 terminating nul character and not to the begginning of the object,
6355 the call to "free" below is diagnosed.
6356
6357 void f (char *p)
6358 {
6359 p = stpcpy (p, "abc");
6360 // ...
6361 free (p); // warning
6362 }
6363
6364 -Wfree-nonheap-object is enabled by default.
6365
6366 -Wstack-usage=byte-size
6367 Warn if the stack usage of a function might exceed byte-size. The
6368 computation done to determine the stack usage is conservative. Any
6369 space allocated via "alloca", variable-length arrays, or related
6370 constructs is included by the compiler when determining whether or
6371 not to issue a warning.
6372
6373 The message is in keeping with the output of -fstack-usage.
6374
6375 * If the stack usage is fully static but exceeds the specified
6376 amount, it's:
6377
6378 warning: stack usage is 1120 bytes
6379
6380 * If the stack usage is (partly) dynamic but bounded, it's:
6381
6382 warning: stack usage might be 1648 bytes
6383
6384 * If the stack usage is (partly) dynamic and not bounded, it's:
6385
6386 warning: stack usage might be unbounded
6387
6388 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
6389 controlled by the option can be disabled either by specifying byte-
6390 size of SIZE_MAX or more or by -Wno-stack-usage.
6391
6392 -Wno-stack-usage
6393 Disable -Wstack-usage= warnings. The option is equivalent to
6394 -Wstack-usage=SIZE_MAX or larger.
6395
6396 -Wunsafe-loop-optimizations
6397 Warn if the loop cannot be optimized because the compiler cannot
6398 assume anything on the bounds of the loop indices. With
6399 -funsafe-loop-optimizations warn if the compiler makes such
6400 assumptions.
6401
6402 -Wno-pedantic-ms-format (MinGW targets only)
6403 When used in combination with -Wformat and -pedantic without GNU
6404 extensions, this option disables the warnings about non-ISO
6405 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
6406 used on Windows targets, which depend on the MS runtime.
6407
6408 -Wpointer-arith
6409 Warn about anything that depends on the "size of" a function type
6410 or of "void". GNU C assigns these types a size of 1, for
6411 convenience in calculations with "void *" pointers and pointers to
6412 functions. In C++, warn also when an arithmetic operation involves
6413 "NULL". This warning is also enabled by -Wpedantic.
6414
6415 -Wno-pointer-compare
6416 Do not warn if a pointer is compared with a zero character
6417 constant. This usually means that the pointer was meant to be
6418 dereferenced. For example:
6419
6420 const char *p = foo ();
6421 if (p == '\0')
6422 return 42;
6423
6424 Note that the code above is invalid in C++11.
6425
6426 This warning is enabled by default.
6427
6428 -Wtsan
6429 Warn about unsupported features in ThreadSanitizer.
6430
6431 ThreadSanitizer does not support "std::atomic_thread_fence" and can
6432 report false positives.
6433
6434 This warning is enabled by default.
6435
6436 -Wtype-limits
6437 Warn if a comparison is always true or always false due to the
6438 limited range of the data type, but do not warn for constant
6439 expressions. For example, warn if an unsigned variable is compared
6440 against zero with "<" or ">=". This warning is also enabled by
6441 -Wextra.
6442
6443 -Wabsolute-value (C and Objective-C only)
6444 Warn for calls to standard functions that compute the absolute
6445 value of an argument when a more appropriate standard function is
6446 available. For example, calling "abs(3.14)" triggers the warning
6447 because the appropriate function to call to compute the absolute
6448 value of a double argument is "fabs". The option also triggers
6449 warnings when the argument in a call to such a function has an
6450 unsigned type. This warning can be suppressed with an explicit
6451 type cast and it is also enabled by -Wextra.
6452
6453 -Wcomment
6454 -Wcomments
6455 Warn whenever a comment-start sequence /* appears in a /* comment,
6456 or whenever a backslash-newline appears in a // comment. This
6457 warning is enabled by -Wall.
6458
6459 -Wtrigraphs
6460 Warn if any trigraphs are encountered that might change the meaning
6461 of the program. Trigraphs within comments are not warned about,
6462 except those that would form escaped newlines.
6463
6464 This option is implied by -Wall. If -Wall is not given, this
6465 option is still enabled unless trigraphs are enabled. To get
6466 trigraph conversion without warnings, but get the other -Wall
6467 warnings, use -trigraphs -Wall -Wno-trigraphs.
6468
6469 -Wundef
6470 Warn if an undefined identifier is evaluated in an "#if" directive.
6471 Such identifiers are replaced with zero.
6472
6473 -Wexpansion-to-defined
6474 Warn whenever defined is encountered in the expansion of a macro
6475 (including the case where the macro is expanded by an #if
6476 directive). Such usage is not portable. This warning is also
6477 enabled by -Wpedantic and -Wextra.
6478
6479 -Wunused-macros
6480 Warn about macros defined in the main file that are unused. A
6481 macro is used if it is expanded or tested for existence at least
6482 once. The preprocessor also warns if the macro has not been used
6483 at the time it is redefined or undefined.
6484
6485 Built-in macros, macros defined on the command line, and macros
6486 defined in include files are not warned about.
6487
6488 Note: If a macro is actually used, but only used in skipped
6489 conditional blocks, then the preprocessor reports it as unused. To
6490 avoid the warning in such a case, you might improve the scope of
6491 the macro's definition by, for example, moving it into the first
6492 skipped block. Alternatively, you could provide a dummy use with
6493 something like:
6494
6495 #if defined the_macro_causing_the_warning
6496 #endif
6497
6498 -Wno-endif-labels
6499 Do not warn whenever an "#else" or an "#endif" are followed by
6500 text. This sometimes happens in older programs with code of the
6501 form
6502
6503 #if FOO
6504 ...
6505 #else FOO
6506 ...
6507 #endif FOO
6508
6509 The second and third "FOO" should be in comments. This warning is
6510 on by default.
6511
6512 -Wbad-function-cast (C and Objective-C only)
6513 Warn when a function call is cast to a non-matching type. For
6514 example, warn if a call to a function returning an integer type is
6515 cast to a pointer type.
6516
6517 -Wc90-c99-compat (C and Objective-C only)
6518 Warn about features not present in ISO C90, but present in ISO C99.
6519 For instance, warn about use of variable length arrays, "long long"
6520 type, "bool" type, compound literals, designated initializers, and
6521 so on. This option is independent of the standards mode. Warnings
6522 are disabled in the expression that follows "__extension__".
6523
6524 -Wc99-c11-compat (C and Objective-C only)
6525 Warn about features not present in ISO C99, but present in ISO C11.
6526 For instance, warn about use of anonymous structures and unions,
6527 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
6528 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
6529 so on. This option is independent of the standards mode. Warnings
6530 are disabled in the expression that follows "__extension__".
6531
6532 -Wc11-c2x-compat (C and Objective-C only)
6533 Warn about features not present in ISO C11, but present in ISO C2X.
6534 For instance, warn about omitting the string in "_Static_assert",
6535 use of [[]] syntax for attributes, use of decimal floating-point
6536 types, and so on. This option is independent of the standards
6537 mode. Warnings are disabled in the expression that follows
6538 "__extension__".
6539
6540 -Wc++-compat (C and Objective-C only)
6541 Warn about ISO C constructs that are outside of the common subset
6542 of ISO C and ISO C++, e.g. request for implicit conversion from
6543 "void *" to a pointer to non-"void" type.
6544
6545 -Wc++11-compat (C++ and Objective-C++ only)
6546 Warn about C++ constructs whose meaning differs between ISO C++
6547 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
6548 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
6549 enabled by -Wall.
6550
6551 -Wc++14-compat (C++ and Objective-C++ only)
6552 Warn about C++ constructs whose meaning differs between ISO C++
6553 2011 and ISO C++ 2014. This warning is enabled by -Wall.
6554
6555 -Wc++17-compat (C++ and Objective-C++ only)
6556 Warn about C++ constructs whose meaning differs between ISO C++
6557 2014 and ISO C++ 2017. This warning is enabled by -Wall.
6558
6559 -Wc++20-compat (C++ and Objective-C++ only)
6560 Warn about C++ constructs whose meaning differs between ISO C++
6561 2017 and ISO C++ 2020. This warning is enabled by -Wall.
6562
6563 -Wcast-qual
6564 Warn whenever a pointer is cast so as to remove a type qualifier
6565 from the target type. For example, warn if a "const char *" is
6566 cast to an ordinary "char *".
6567
6568 Also warn when making a cast that introduces a type qualifier in an
6569 unsafe way. For example, casting "char **" to "const char **" is
6570 unsafe, as in this example:
6571
6572 /* p is char ** value. */
6573 const char **q = (const char **) p;
6574 /* Assignment of readonly string to const char * is OK. */
6575 *q = "string";
6576 /* Now char** pointer points to read-only memory. */
6577 **p = 'b';
6578
6579 -Wcast-align
6580 Warn whenever a pointer is cast such that the required alignment of
6581 the target is increased. For example, warn if a "char *" is cast
6582 to an "int *" on machines where integers can only be accessed at
6583 two- or four-byte boundaries.
6584
6585 -Wcast-align=strict
6586 Warn whenever a pointer is cast such that the required alignment of
6587 the target is increased. For example, warn if a "char *" is cast
6588 to an "int *" regardless of the target machine.
6589
6590 -Wcast-function-type
6591 Warn when a function pointer is cast to an incompatible function
6592 pointer. In a cast involving function types with a variable
6593 argument list only the types of initial arguments that are provided
6594 are considered. Any parameter of pointer-type matches any other
6595 pointer-type. Any benign differences in integral types are
6596 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
6597 qualifiers are ignored. The function type "void (*) (void)" is
6598 special and matches everything, which can be used to suppress this
6599 warning. In a cast involving pointer to member types this warning
6600 warns whenever the type cast is changing the pointer to member
6601 type. This warning is enabled by -Wextra.
6602
6603 -Wwrite-strings
6604 When compiling C, give string constants the type "const
6605 char[length]" so that copying the address of one into a non-"const"
6606 "char *" pointer produces a warning. These warnings help you find
6607 at compile time code that can try to write into a string constant,
6608 but only if you have been very careful about using "const" in
6609 declarations and prototypes. Otherwise, it is just a nuisance.
6610 This is why we did not make -Wall request these warnings.
6611
6612 When compiling C++, warn about the deprecated conversion from
6613 string literals to "char *". This warning is enabled by default
6614 for C++ programs.
6615
6616 -Wclobbered
6617 Warn for variables that might be changed by "longjmp" or "vfork".
6618 This warning is also enabled by -Wextra.
6619
6620 -Wconversion
6621 Warn for implicit conversions that may alter a value. This includes
6622 conversions between real and integer, like "abs (x)" when "x" is
6623 "double"; conversions between signed and unsigned, like "unsigned
6624 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
6625 not warn for explicit casts like "abs ((int) x)" and "ui =
6626 (unsigned) -1", or if the value is not changed by the conversion
6627 like in "abs (2.0)". Warnings about conversions between signed and
6628 unsigned integers can be disabled by using -Wno-sign-conversion.
6629
6630 For C++, also warn for confusing overload resolution for user-
6631 defined conversions; and conversions that never use a type
6632 conversion operator: conversions to "void", the same type, a base
6633 class or a reference to them. Warnings about conversions between
6634 signed and unsigned integers are disabled by default in C++ unless
6635 -Wsign-conversion is explicitly enabled.
6636
6637 Warnings about conversion from arithmetic on a small type back to
6638 that type are only given with -Warith-conversion.
6639
6640 -Wdangling-else
6641 Warn about constructions where there may be confusion to which "if"
6642 statement an "else" branch belongs. Here is an example of such a
6643 case:
6644
6645 {
6646 if (a)
6647 if (b)
6648 foo ();
6649 else
6650 bar ();
6651 }
6652
6653 In C/C++, every "else" branch belongs to the innermost possible
6654 "if" statement, which in this example is "if (b)". This is often
6655 not what the programmer expected, as illustrated in the above
6656 example by indentation the programmer chose. When there is the
6657 potential for this confusion, GCC issues a warning when this flag
6658 is specified. To eliminate the warning, add explicit braces around
6659 the innermost "if" statement so there is no way the "else" can
6660 belong to the enclosing "if". The resulting code looks like this:
6661
6662 {
6663 if (a)
6664 {
6665 if (b)
6666 foo ();
6667 else
6668 bar ();
6669 }
6670 }
6671
6672 This warning is enabled by -Wparentheses.
6673
6674 -Wdate-time
6675 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
6676 encountered as they might prevent bit-wise-identical reproducible
6677 compilations.
6678
6679 -Wempty-body
6680 Warn if an empty body occurs in an "if", "else" or "do while"
6681 statement. This warning is also enabled by -Wextra.
6682
6683 -Wno-endif-labels
6684 Do not warn about stray tokens after "#else" and "#endif".
6685
6686 -Wenum-compare
6687 Warn about a comparison between values of different enumerated
6688 types. In C++ enumerated type mismatches in conditional
6689 expressions are also diagnosed and the warning is enabled by
6690 default. In C this warning is enabled by -Wall.
6691
6692 -Wenum-conversion
6693 Warn when a value of enumerated type is implicitly converted to a
6694 different enumerated type. This warning is enabled by -Wextra in
6695 C.
6696
6697 -Wjump-misses-init (C, Objective-C only)
6698 Warn if a "goto" statement or a "switch" statement jumps forward
6699 across the initialization of a variable, or jumps backward to a
6700 label after the variable has been initialized. This only warns
6701 about variables that are initialized when they are declared. This
6702 warning is only supported for C and Objective-C; in C++ this sort
6703 of branch is an error in any case.
6704
6705 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
6706 with the -Wno-jump-misses-init option.
6707
6708 -Wsign-compare
6709 Warn when a comparison between signed and unsigned values could
6710 produce an incorrect result when the signed value is converted to
6711 unsigned. In C++, this warning is also enabled by -Wall. In C, it
6712 is also enabled by -Wextra.
6713
6714 -Wsign-conversion
6715 Warn for implicit conversions that may change the sign of an
6716 integer value, like assigning a signed integer expression to an
6717 unsigned integer variable. An explicit cast silences the warning.
6718 In C, this option is enabled also by -Wconversion.
6719
6720 -Wfloat-conversion
6721 Warn for implicit conversions that reduce the precision of a real
6722 value. This includes conversions from real to integer, and from
6723 higher precision real to lower precision real values. This option
6724 is also enabled by -Wconversion.
6725
6726 -Wno-scalar-storage-order
6727 Do not warn on suspicious constructs involving reverse scalar
6728 storage order.
6729
6730 -Wsizeof-array-div
6731 Warn about divisions of two sizeof operators when the first one is
6732 applied to an array and the divisor does not equal the size of the
6733 array element. In such a case, the computation will not yield the
6734 number of elements in the array, which is likely what the user
6735 intended. This warning warns e.g. about
6736
6737 int fn ()
6738 {
6739 int arr[10];
6740 return sizeof (arr) / sizeof (short);
6741 }
6742
6743 This warning is enabled by -Wall.
6744
6745 -Wsizeof-pointer-div
6746 Warn for suspicious divisions of two sizeof expressions that divide
6747 the pointer size by the element size, which is the usual way to
6748 compute the array size but won't work out correctly with pointers.
6749 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
6750 "ptr" is not an array, but a pointer. This warning is enabled by
6751 -Wall.
6752
6753 -Wsizeof-pointer-memaccess
6754 Warn for suspicious length parameters to certain string and memory
6755 built-in functions if the argument uses "sizeof". This warning
6756 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
6757 is not an array, but a pointer, and suggests a possible fix, or
6758 about "memcpy (&foo, ptr, sizeof (&foo));".
6759 -Wsizeof-pointer-memaccess also warns about calls to bounded string
6760 copy functions like "strncat" or "strncpy" that specify as the
6761 bound a "sizeof" expression of the source array. For example, in
6762 the following function the call to "strncat" specifies the size of
6763 the source string as the bound. That is almost certainly a mistake
6764 and so the call is diagnosed.
6765
6766 void make_file (const char *name)
6767 {
6768 char path[PATH_MAX];
6769 strncpy (path, name, sizeof path - 1);
6770 strncat (path, ".text", sizeof ".text");
6771 ...
6772 }
6773
6774 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
6775
6776 -Wno-sizeof-array-argument
6777 Do not warn when the "sizeof" operator is applied to a parameter
6778 that is declared as an array in a function definition. This
6779 warning is enabled by default for C and C++ programs.
6780
6781 -Wmemset-elt-size
6782 Warn for suspicious calls to the "memset" built-in function, if the
6783 first argument references an array, and the third argument is a
6784 number equal to the number of elements, but not equal to the size
6785 of the array in memory. This indicates that the user has omitted a
6786 multiplication by the element size. This warning is enabled by
6787 -Wall.
6788
6789 -Wmemset-transposed-args
6790 Warn for suspicious calls to the "memset" built-in function where
6791 the second argument is not zero and the third argument is zero.
6792 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
6793 because "memset (buf, 0, sizeof buf)" was meant instead. The
6794 diagnostic is only emitted if the third argument is a literal zero.
6795 Otherwise, if it is an expression that is folded to zero, or a cast
6796 of zero to some type, it is far less likely that the arguments have
6797 been mistakenly transposed and no warning is emitted. This warning
6798 is enabled by -Wall.
6799
6800 -Waddress
6801 Warn about suspicious uses of memory addresses. These include using
6802 the address of a function in a conditional expression, such as
6803 "void func(void); if (func)", and comparisons against the memory
6804 address of a string literal, such as "if (x == "abc")". Such uses
6805 typically indicate a programmer error: the address of a function
6806 always evaluates to true, so their use in a conditional usually
6807 indicate that the programmer forgot the parentheses in a function
6808 call; and comparisons against string literals result in unspecified
6809 behavior and are not portable in C, so they usually indicate that
6810 the programmer intended to use "strcmp". This warning is enabled
6811 by -Wall.
6812
6813 -Wno-address-of-packed-member
6814 Do not warn when the address of packed member of struct or union is
6815 taken, which usually results in an unaligned pointer value. This
6816 is enabled by default.
6817
6818 -Wlogical-op
6819 Warn about suspicious uses of logical operators in expressions.
6820 This includes using logical operators in contexts where a bit-wise
6821 operator is likely to be expected. Also warns when the operands of
6822 a logical operator are the same:
6823
6824 extern int a;
6825 if (a < 0 && a < 0) { ... }
6826
6827 -Wlogical-not-parentheses
6828 Warn about logical not used on the left hand side operand of a
6829 comparison. This option does not warn if the right operand is
6830 considered to be a boolean expression. Its purpose is to detect
6831 suspicious code like the following:
6832
6833 int a;
6834 ...
6835 if (!a > 1) { ... }
6836
6837 It is possible to suppress the warning by wrapping the LHS into
6838 parentheses:
6839
6840 if ((!a) > 1) { ... }
6841
6842 This warning is enabled by -Wall.
6843
6844 -Waggregate-return
6845 Warn if any functions that return structures or unions are defined
6846 or called. (In languages where you can return an array, this also
6847 elicits a warning.)
6848
6849 -Wno-aggressive-loop-optimizations
6850 Warn if in a loop with constant number of iterations the compiler
6851 detects undefined behavior in some statement during one or more of
6852 the iterations.
6853
6854 -Wno-attributes
6855 Do not warn if an unexpected "__attribute__" is used, such as
6856 unrecognized attributes, function attributes applied to variables,
6857 etc. This does not stop errors for incorrect use of supported
6858 attributes.
6859
6860 -Wno-builtin-declaration-mismatch
6861 Warn if a built-in function is declared with an incompatible
6862 signature or as a non-function, or when a built-in function
6863 declared with a type that does not include a prototype is called
6864 with arguments whose promoted types do not match those expected by
6865 the function. When -Wextra is specified, also warn when a built-in
6866 function that takes arguments is declared without a prototype. The
6867 -Wbuiltin-declaration-mismatch warning is enabled by default. To
6868 avoid the warning include the appropriate header to bring the
6869 prototypes of built-in functions into scope.
6870
6871 For example, the call to "memset" below is diagnosed by the warning
6872 because the function expects a value of type "size_t" as its
6873 argument but the type of 32 is "int". With -Wextra, the
6874 declaration of the function is diagnosed as well.
6875
6876 extern void* memset ();
6877 void f (void *d)
6878 {
6879 memset (d, '\0', 32);
6880 }
6881
6882 -Wno-builtin-macro-redefined
6883 Do not warn if certain built-in macros are redefined. This
6884 suppresses warnings for redefinition of "__TIMESTAMP__",
6885 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
6886
6887 -Wstrict-prototypes (C and Objective-C only)
6888 Warn if a function is declared or defined without specifying the
6889 argument types. (An old-style function definition is permitted
6890 without a warning if preceded by a declaration that specifies the
6891 argument types.)
6892
6893 -Wold-style-declaration (C and Objective-C only)
6894 Warn for obsolescent usages, according to the C Standard, in a
6895 declaration. For example, warn if storage-class specifiers like
6896 "static" are not the first things in a declaration. This warning
6897 is also enabled by -Wextra.
6898
6899 -Wold-style-definition (C and Objective-C only)
6900 Warn if an old-style function definition is used. A warning is
6901 given even if there is a previous prototype. A definition using ()
6902 is not considered an old-style definition in C2X mode, because it
6903 is equivalent to (void) in that case, but is considered an old-
6904 style definition for older standards.
6905
6906 -Wmissing-parameter-type (C and Objective-C only)
6907 A function parameter is declared without a type specifier in
6908 K&R-style functions:
6909
6910 void foo(bar) { }
6911
6912 This warning is also enabled by -Wextra.
6913
6914 -Wmissing-prototypes (C and Objective-C only)
6915 Warn if a global function is defined without a previous prototype
6916 declaration. This warning is issued even if the definition itself
6917 provides a prototype. Use this option to detect global functions
6918 that do not have a matching prototype declaration in a header file.
6919 This option is not valid for C++ because all function declarations
6920 provide prototypes and a non-matching declaration declares an
6921 overload rather than conflict with an earlier declaration. Use
6922 -Wmissing-declarations to detect missing declarations in C++.
6923
6924 -Wmissing-declarations
6925 Warn if a global function is defined without a previous
6926 declaration. Do so even if the definition itself provides a
6927 prototype. Use this option to detect global functions that are not
6928 declared in header files. In C, no warnings are issued for
6929 functions with previous non-prototype declarations; use
6930 -Wmissing-prototypes to detect missing prototypes. In C++, no
6931 warnings are issued for function templates, or for inline
6932 functions, or for functions in anonymous namespaces.
6933
6934 -Wmissing-field-initializers
6935 Warn if a structure's initializer has some fields missing. For
6936 example, the following code causes such a warning, because "x.h" is
6937 implicitly zero:
6938
6939 struct s { int f, g, h; };
6940 struct s x = { 3, 4 };
6941
6942 This option does not warn about designated initializers, so the
6943 following modification does not trigger a warning:
6944
6945 struct s { int f, g, h; };
6946 struct s x = { .f = 3, .g = 4 };
6947
6948 In C this option does not warn about the universal zero initializer
6949 { 0 }:
6950
6951 struct s { int f, g, h; };
6952 struct s x = { 0 };
6953
6954 Likewise, in C++ this option does not warn about the empty { }
6955 initializer, for example:
6956
6957 struct s { int f, g, h; };
6958 s x = { };
6959
6960 This warning is included in -Wextra. To get other -Wextra warnings
6961 without this one, use -Wextra -Wno-missing-field-initializers.
6962
6963 -Wno-multichar
6964 Do not warn if a multicharacter constant ('FOOF') is used. Usually
6965 they indicate a typo in the user's code, as they have
6966 implementation-defined values, and should not be used in portable
6967 code.
6968
6969 -Wnormalized=[none|id|nfc|nfkc]
6970 In ISO C and ISO C++, two identifiers are different if they are
6971 different sequences of characters. However, sometimes when
6972 characters outside the basic ASCII character set are used, you can
6973 have two different character sequences that look the same. To
6974 avoid confusion, the ISO 10646 standard sets out some normalization
6975 rules which when applied ensure that two sequences that look the
6976 same are turned into the same sequence. GCC can warn you if you
6977 are using identifiers that have not been normalized; this option
6978 controls that warning.
6979
6980 There are four levels of warning supported by GCC. The default is
6981 -Wnormalized=nfc, which warns about any identifier that is not in
6982 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
6983 form for most uses. It is equivalent to -Wnormalized.
6984
6985 Unfortunately, there are some characters allowed in identifiers by
6986 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6987 identifiers. That is, there's no way to use these symbols in
6988 portable ISO C or C++ and have all your identifiers in NFC.
6989 -Wnormalized=id suppresses the warning for these characters. It is
6990 hoped that future versions of the standards involved will correct
6991 this, which is why this option is not the default.
6992
6993 You can switch the warning off for all characters by writing
6994 -Wnormalized=none or -Wno-normalized. You should only do this if
6995 you are using some other normalization scheme (like "D"), because
6996 otherwise you can easily create bugs that are literally impossible
6997 to see.
6998
6999 Some characters in ISO 10646 have distinct meanings but look
7000 identical in some fonts or display methodologies, especially once
7001 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7002 LATIN SMALL LETTER N", displays just like a regular "n" that has
7003 been placed in a superscript. ISO 10646 defines the NFKC
7004 normalization scheme to convert all these into a standard form as
7005 well, and GCC warns if your code is not in NFKC if you use
7006 -Wnormalized=nfkc. This warning is comparable to warning about
7007 every identifier that contains the letter O because it might be
7008 confused with the digit 0, and so is not the default, but may be
7009 useful as a local coding convention if the programming environment
7010 cannot be fixed to display these characters distinctly.
7011
7012 -Wno-attribute-warning
7013 Do not warn about usage of functions declared with "warning"
7014 attribute. By default, this warning is enabled.
7015 -Wno-attribute-warning can be used to disable the warning or
7016 -Wno-error=attribute-warning can be used to disable the error when
7017 compiled with -Werror flag.
7018
7019 -Wno-deprecated
7020 Do not warn about usage of deprecated features.
7021
7022 -Wno-deprecated-declarations
7023 Do not warn about uses of functions, variables, and types marked as
7024 deprecated by using the "deprecated" attribute.
7025
7026 -Wno-overflow
7027 Do not warn about compile-time overflow in constant expressions.
7028
7029 -Wno-odr
7030 Warn about One Definition Rule violations during link-time
7031 optimization. Enabled by default.
7032
7033 -Wopenmp-simd
7034 Warn if the vectorizer cost model overrides the OpenMP simd
7035 directive set by user. The -fsimd-cost-model=unlimited option can
7036 be used to relax the cost model.
7037
7038 -Woverride-init (C and Objective-C only)
7039 Warn if an initialized field without side effects is overridden
7040 when using designated initializers.
7041
7042 This warning is included in -Wextra. To get other -Wextra warnings
7043 without this one, use -Wextra -Wno-override-init.
7044
7045 -Wno-override-init-side-effects (C and Objective-C only)
7046 Do not warn if an initialized field with side effects is overridden
7047 when using designated initializers. This warning is enabled by
7048 default.
7049
7050 -Wpacked
7051 Warn if a structure is given the packed attribute, but the packed
7052 attribute has no effect on the layout or size of the structure.
7053 Such structures may be mis-aligned for little benefit. For
7054 instance, in this code, the variable "f.x" in "struct bar" is
7055 misaligned even though "struct bar" does not itself have the packed
7056 attribute:
7057
7058 struct foo {
7059 int x;
7060 char a, b, c, d;
7061 } __attribute__((packed));
7062 struct bar {
7063 char z;
7064 struct foo f;
7065 };
7066
7067 -Wnopacked-bitfield-compat
7068 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7069 bit-fields of type "char". This was fixed in GCC 4.4 but the
7070 change can lead to differences in the structure layout. GCC
7071 informs you when the offset of such a field has changed in GCC 4.4.
7072 For example there is no longer a 4-bit padding between field "a"
7073 and "b" in this structure:
7074
7075 struct foo
7076 {
7077 char a:4;
7078 char b:8;
7079 } __attribute__ ((packed));
7080
7081 This warning is enabled by default. Use
7082 -Wno-packed-bitfield-compat to disable this warning.
7083
7084 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7085 Warn if a structure field with explicitly specified alignment in a
7086 packed struct or union is misaligned. For example, a warning will
7087 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7088 is less than 8", in this code:
7089
7090 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7091 struct __attribute__ ((packed)) S {
7092 struct S8 s8;
7093 };
7094
7095 This warning is enabled by -Wall.
7096
7097 -Wpadded
7098 Warn if padding is included in a structure, either to align an
7099 element of the structure or to align the whole structure.
7100 Sometimes when this happens it is possible to rearrange the fields
7101 of the structure to reduce the padding and so make the structure
7102 smaller.
7103
7104 -Wredundant-decls
7105 Warn if anything is declared more than once in the same scope, even
7106 in cases where multiple declaration is valid and changes nothing.
7107
7108 -Wrestrict
7109 Warn when an object referenced by a "restrict"-qualified parameter
7110 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7111 another argument, or when copies between such objects overlap. For
7112 example, the call to the "strcpy" function below attempts to
7113 truncate the string by replacing its initial characters with the
7114 last four. However, because the call writes the terminating NUL
7115 into "a[4]", the copies overlap and the call is diagnosed.
7116
7117 void foo (void)
7118 {
7119 char a[] = "abcd1234";
7120 strcpy (a, a + 4);
7121 ...
7122 }
7123
7124 The -Wrestrict option detects some instances of simple overlap even
7125 without optimization but works best at -O2 and above. It is
7126 included in -Wall.
7127
7128 -Wnested-externs (C and Objective-C only)
7129 Warn if an "extern" declaration is encountered within a function.
7130
7131 -Winline
7132 Warn if a function that is declared as inline cannot be inlined.
7133 Even with this option, the compiler does not warn about failures to
7134 inline functions declared in system headers.
7135
7136 The compiler uses a variety of heuristics to determine whether or
7137 not to inline a function. For example, the compiler takes into
7138 account the size of the function being inlined and the amount of
7139 inlining that has already been done in the current function.
7140 Therefore, seemingly insignificant changes in the source program
7141 can cause the warnings produced by -Winline to appear or disappear.
7142
7143 -Wint-in-bool-context
7144 Warn for suspicious use of integer values where boolean values are
7145 expected, such as conditional expressions (?:) using non-boolean
7146 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7147 Or left shifting of signed integers in boolean context, like "for
7148 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7149 regardless of the data type. This warning is enabled by -Wall.
7150
7151 -Wno-int-to-pointer-cast
7152 Suppress warnings from casts to pointer type of an integer of a
7153 different size. In C++, casting to a pointer type of smaller size
7154 is an error. Wint-to-pointer-cast is enabled by default.
7155
7156 -Wno-pointer-to-int-cast (C and Objective-C only)
7157 Suppress warnings from casts from a pointer to an integer type of a
7158 different size.
7159
7160 -Winvalid-pch
7161 Warn if a precompiled header is found in the search path but cannot
7162 be used.
7163
7164 -Wlong-long
7165 Warn if "long long" type is used. This is enabled by either
7166 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
7167 the warning messages, use -Wno-long-long.
7168
7169 -Wvariadic-macros
7170 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7171 alternate syntax is used in ISO C99 mode. This is enabled by
7172 either -Wpedantic or -Wtraditional. To inhibit the warning
7173 messages, use -Wno-variadic-macros.
7174
7175 -Wno-varargs
7176 Do not warn upon questionable usage of the macros used to handle
7177 variable arguments like "va_start". These warnings are enabled by
7178 default.
7179
7180 -Wvector-operation-performance
7181 Warn if vector operation is not implemented via SIMD capabilities
7182 of the architecture. Mainly useful for the performance tuning.
7183 Vector operation can be implemented "piecewise", which means that
7184 the scalar operation is performed on every vector element; "in
7185 parallel", which means that the vector operation is implemented
7186 using scalars of wider type, which normally is more performance
7187 efficient; and "as a single scalar", which means that vector fits
7188 into a scalar type.
7189
7190 -Wvla
7191 Warn if a variable-length array is used in the code. -Wno-vla
7192 prevents the -Wpedantic warning of the variable-length array.
7193
7194 -Wvla-larger-than=byte-size
7195 If this option is used, the compiler warns for declarations of
7196 variable-length arrays whose size is either unbounded, or bounded
7197 by an argument that allows the array size to exceed byte-size
7198 bytes. This is similar to how -Walloca-larger-than=byte-size
7199 works, but with variable-length arrays.
7200
7201 Note that GCC may optimize small variable-length arrays of a known
7202 value into plain arrays, so this warning may not get triggered for
7203 such arrays.
7204
7205 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
7206 typically only effective when -ftree-vrp is active (default for -O2
7207 and above).
7208
7209 See also -Walloca-larger-than=byte-size.
7210
7211 -Wno-vla-larger-than
7212 Disable -Wvla-larger-than= warnings. The option is equivalent to
7213 -Wvla-larger-than=SIZE_MAX or larger.
7214
7215 -Wvla-parameter
7216 Warn about redeclarations of functions involving arguments of
7217 Variable Length Array types of inconsistent kinds or forms, and
7218 enable the detection of out-of-bounds accesses to such parameters
7219 by warnings such as -Warray-bounds.
7220
7221 If the first function declaration uses the VLA form the bound
7222 specified in the array is assumed to be the minimum number of
7223 elements expected to be provided in calls to the function and the
7224 maximum number of elements accessed by it. Failing to provide
7225 arguments of sufficient size or accessing more than the maximum
7226 number of elements may be diagnosed.
7227
7228 For example, the warning triggers for the following redeclarations
7229 because the first one allows an array of any size to be passed to
7230 "f" while the second one specifies that the array argument must
7231 have at least "n" elements. In addition, calling "f" with the
7232 assotiated VLA bound parameter in excess of the actual VLA bound
7233 triggers a warning as well.
7234
7235 void f (int n, int[n]);
7236 void f (int, int[]); // warning: argument 2 previously declared as a VLA
7237
7238 void g (int n)
7239 {
7240 if (n > 4)
7241 return;
7242 int a[n];
7243 f (sizeof a, a); // warning: access to a by f may be out of bounds
7244 ...
7245 }
7246
7247 -Wvla-parameter is included in -Wall. The -Warray-parameter option
7248 triggers warnings for similar problems involving ordinary array
7249 arguments.
7250
7251 -Wvolatile-register-var
7252 Warn if a register variable is declared volatile. The volatile
7253 modifier does not inhibit all optimizations that may eliminate
7254 reads and/or writes to register variables. This warning is enabled
7255 by -Wall.
7256
7257 -Wdisabled-optimization
7258 Warn if a requested optimization pass is disabled. This warning
7259 does not generally indicate that there is anything wrong with your
7260 code; it merely indicates that GCC's optimizers are unable to
7261 handle the code effectively. Often, the problem is that your code
7262 is too big or too complex; GCC refuses to optimize programs when
7263 the optimization itself is likely to take inordinate amounts of
7264 time.
7265
7266 -Wpointer-sign (C and Objective-C only)
7267 Warn for pointer argument passing or assignment with different
7268 signedness. This option is only supported for C and Objective-C.
7269 It is implied by -Wall and by -Wpedantic, which can be disabled
7270 with -Wno-pointer-sign.
7271
7272 -Wstack-protector
7273 This option is only active when -fstack-protector is active. It
7274 warns about functions that are not protected against stack
7275 smashing.
7276
7277 -Woverlength-strings
7278 Warn about string constants that are longer than the "minimum
7279 maximum" length specified in the C standard. Modern compilers
7280 generally allow string constants that are much longer than the
7281 standard's minimum limit, but very portable programs should avoid
7282 using longer strings.
7283
7284 The limit applies after string constant concatenation, and does not
7285 count the trailing NUL. In C90, the limit was 509 characters; in
7286 C99, it was raised to 4095. C++98 does not specify a normative
7287 minimum maximum, so we do not diagnose overlength strings in C++.
7288
7289 This option is implied by -Wpedantic, and can be disabled with
7290 -Wno-overlength-strings.
7291
7292 -Wunsuffixed-float-constants (C and Objective-C only)
7293 Issue a warning for any floating constant that does not have a
7294 suffix. When used together with -Wsystem-headers it warns about
7295 such constants in system header files. This can be useful when
7296 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
7297 the decimal floating-point extension to C99.
7298
7299 -Wno-lto-type-mismatch
7300 During the link-time optimization, do not warn about type
7301 mismatches in global declarations from different compilation units.
7302 Requires -flto to be enabled. Enabled by default.
7303
7304 -Wno-designated-init (C and Objective-C only)
7305 Suppress warnings when a positional initializer is used to
7306 initialize a structure that has been marked with the
7307 "designated_init" attribute.
7308
7309 Options That Control Static Analysis
7310 -fanalyzer
7311 This option enables an static analysis of program flow which looks
7312 for "interesting" interprocedural paths through the code, and
7313 issues warnings for problems found on them.
7314
7315 This analysis is much more expensive than other GCC warnings.
7316
7317 Enabling this option effectively enables the following warnings:
7318
7319 -Wanalyzer-double-fclose -Wanalyzer-double-free
7320 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
7321 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
7322 -Wanalyzer-mismatching-deallocation
7323 -Wanalyzer-possible-null-argument
7324 -Wanalyzer-possible-null-dereference -Wanalyzer-null-argument
7325 -Wanalyzer-null-dereference -Wanalyzer-shift-count-negative
7326 -Wanalyzer-shift-count-overflow -Wanalyzer-stale-setjmp-buffer
7327 -Wanalyzer-tainted-array-index
7328 -Wanalyzer-unsafe-call-within-signal-handler
7329 -Wanalyzer-use-after-free
7330 -Wanalyzer-use-of-pointer-in-stale-stack-frame
7331 -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal
7332
7333 This option is only available if GCC was configured with analyzer
7334 support enabled.
7335
7336 -Wanalyzer-too-complex
7337 If -fanalyzer is enabled, the analyzer uses various heuristics to
7338 attempt to explore the control flow and data flow in the program,
7339 but these can be defeated by sufficiently complicated code.
7340
7341 By default, the analysis silently stops if the code is too
7342 complicated for the analyzer to fully explore and it reaches an
7343 internal limit. The -Wanalyzer-too-complex option warns if this
7344 occurs.
7345
7346 -Wno-analyzer-double-fclose
7347 This warning requires -fanalyzer, which enables it; use
7348 -Wno-analyzer-double-fclose to disable it.
7349
7350 This diagnostic warns for paths through the code in which a "FILE
7351 *" can have "fclose" called on it more than once.
7352
7353 -Wno-analyzer-double-free
7354 This warning requires -fanalyzer, which enables it; use
7355 -Wno-analyzer-double-free to disable it.
7356
7357 This diagnostic warns for paths through the code in which a pointer
7358 can have a deallocator called on it more than once, either "free",
7359 or a deallocator referenced by attribute "malloc".
7360
7361 -Wno-analyzer-exposure-through-output-file
7362 This warning requires -fanalyzer, which enables it; use
7363 -Wno-analyzer-exposure-through-output-file to disable it.
7364
7365 This diagnostic warns for paths through the code in which a
7366 security-sensitive value is written to an output file (such as
7367 writing a password to a log file).
7368
7369 -Wno-analyzer-file-leak
7370 This warning requires -fanalyzer, which enables it; use
7371 -Wno-analyzer-file-leak to disable it.
7372
7373 This diagnostic warns for paths through the code in which a
7374 "<stdio.h>" "FILE *" stream object is leaked.
7375
7376 -Wno-analyzer-free-of-non-heap
7377 This warning requires -fanalyzer, which enables it; use
7378 -Wno-analyzer-free-of-non-heap to disable it.
7379
7380 This diagnostic warns for paths through the code in which "free" is
7381 called on a non-heap pointer (e.g. an on-stack buffer, or a
7382 global).
7383
7384 -Wno-analyzer-malloc-leak
7385 This warning requires -fanalyzer, which enables it; use
7386 -Wno-analyzer-malloc-leak to disable it.
7387
7388 This diagnostic warns for paths through the code in which a pointer
7389 allocated via an allocator is leaked: either "malloc", or a
7390 function marked with attribute "malloc".
7391
7392 -Wno-analyzer-mismatching-deallocation
7393 This warning requires -fanalyzer, which enables it; use
7394 -Wno-analyzer-mismatching-deallocation to disable it.
7395
7396 This diagnostic warns for paths through the code in which the wrong
7397 deallocation function is called on a pointer value, based on which
7398 function was used to allocate the pointer value. The diagnostic
7399 will warn about mismatches between "free", scalar "delete" and
7400 vector "delete[]", and those marked as allocator/deallocator pairs
7401 using attribute "malloc".
7402
7403 -Wno-analyzer-possible-null-argument
7404 This warning requires -fanalyzer, which enables it; use
7405 -Wno-analyzer-possible-null-argument to disable it.
7406
7407 This diagnostic warns for paths through the code in which a
7408 possibly-NULL value is passed to a function argument marked with
7409 "__attribute__((nonnull))" as requiring a non-NULL value.
7410
7411 -Wno-analyzer-possible-null-dereference
7412 This warning requires -fanalyzer, which enables it; use
7413 -Wno-analyzer-possible-null-dereference to disable it.
7414
7415 This diagnostic warns for paths through the code in which a
7416 possibly-NULL value is dereferenced.
7417
7418 -Wno-analyzer-null-argument
7419 This warning requires -fanalyzer, which enables it; use
7420 -Wno-analyzer-null-argument to disable it.
7421
7422 This diagnostic warns for paths through the code in which a value
7423 known to be NULL is passed to a function argument marked with
7424 "__attribute__((nonnull))" as requiring a non-NULL value.
7425
7426 -Wno-analyzer-null-dereference
7427 This warning requires -fanalyzer, which enables it; use
7428 -Wno-analyzer-null-dereference to disable it.
7429
7430 This diagnostic warns for paths through the code in which a value
7431 known to be NULL is dereferenced.
7432
7433 -Wno-analyzer-shift-count-negative
7434 This warning requires -fanalyzer, which enables it; use
7435 -Wno-analyzer-shift-count-negative to disable it.
7436
7437 This diagnostic warns for paths through the code in which a shift
7438 is attempted with a negative count. It is analogous to the
7439 -Wshift-count-negative diagnostic implemented in the C/C++ front
7440 ends, but is implemented based on analyzing interprocedural paths,
7441 rather than merely parsing the syntax tree. However, the analyzer
7442 does not prioritize detection of such paths, so false negatives are
7443 more likely relative to other warnings.
7444
7445 -Wno-analyzer-shift-count-overflow
7446 This warning requires -fanalyzer, which enables it; use
7447 -Wno-analyzer-shift-count-overflow to disable it.
7448
7449 This diagnostic warns for paths through the code in which a shift
7450 is attempted with a count greater than or equal to the precision of
7451 the operand's type. It is analogous to the -Wshift-count-overflow
7452 diagnostic implemented in the C/C++ front ends, but is implemented
7453 based on analyzing interprocedural paths, rather than merely
7454 parsing the syntax tree. However, the analyzer does not prioritize
7455 detection of such paths, so false negatives are more likely
7456 relative to other warnings.
7457
7458 -Wno-analyzer-stale-setjmp-buffer
7459 This warning requires -fanalyzer, which enables it; use
7460 -Wno-analyzer-stale-setjmp-buffer to disable it.
7461
7462 This diagnostic warns for paths through the code in which "longjmp"
7463 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
7464 function that has returned.
7465
7466 When "setjmp" is called on a "jmp_buf" to record a rewind location,
7467 it records the stack frame. The stack frame becomes invalid when
7468 the function containing the "setjmp" call returns. Attempting to
7469 rewind to it via "longjmp" would reference a stack frame that no
7470 longer exists, and likely lead to a crash (or worse).
7471
7472 -Wno-analyzer-tainted-array-index
7473 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7474 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
7475
7476 This diagnostic warns for paths through the code in which a value
7477 that could be under an attacker's control is used as the index of
7478 an array access without being sanitized.
7479
7480 -Wno-analyzer-unsafe-call-within-signal-handler
7481 This warning requires -fanalyzer, which enables it; use
7482 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
7483
7484 This diagnostic warns for paths through the code in which a
7485 function known to be async-signal-unsafe (such as "fprintf") is
7486 called from a signal handler.
7487
7488 -Wno-analyzer-use-after-free
7489 This warning requires -fanalyzer, which enables it; use
7490 -Wno-analyzer-use-after-free to disable it.
7491
7492 This diagnostic warns for paths through the code in which a pointer
7493 is used after a deallocator is called on it: either "free", or a
7494 deallocator referenced by attribute "malloc".
7495
7496 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
7497 This warning requires -fanalyzer, which enables it; use
7498 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
7499
7500 This diagnostic warns for paths through the code in which a pointer
7501 is dereferenced that points to a variable in a stale stack frame.
7502
7503 -Wno-analyzer-write-to-const
7504 This warning requires -fanalyzer, which enables it; use
7505 -Wno-analyzer-write-to-const to disable it.
7506
7507 This diagnostic warns for paths through the code in which the
7508 analyzer detects an attempt to write through a pointer to a "const"
7509 object. However, the analyzer does not prioritize detection of
7510 such paths, so false negatives are more likely relative to other
7511 warnings.
7512
7513 -Wno-analyzer-write-to-string-literal
7514 This warning requires -fanalyzer, which enables it; use
7515 -Wno-analyzer-write-to-string-literal to disable it.
7516
7517 This diagnostic warns for paths through the code in which the
7518 analyzer detects an attempt to write through a pointer to a string
7519 literal. However, the analyzer does not prioritize detection of
7520 such paths, so false negatives are more likely relative to other
7521 warnings.
7522
7523 Pertinent parameters for controlling the exploration are: --param
7524 analyzer-bb-explosion-factor=value, --param
7525 analyzer-max-enodes-per-program-point=value, --param
7526 analyzer-max-recursion-depth=value, and --param
7527 analyzer-min-snodes-for-call-summary=value.
7528
7529 The following options control the analyzer.
7530
7531 -fanalyzer-call-summaries
7532 Simplify interprocedural analysis by computing the effect of
7533 certain calls, rather than exploring all paths through the function
7534 from callsite to each possible return.
7535
7536 If enabled, call summaries are only used for functions with more
7537 than one call site, and that are sufficiently complicated (as per
7538 --param analyzer-min-snodes-for-call-summary=value).
7539
7540 -fanalyzer-checker=name
7541 Restrict the analyzer to run just the named checker, and enable it.
7542
7543 Some checkers are disabled by default (even with -fanalyzer), such
7544 as the "taint" checker that implements
7545 -Wanalyzer-tainted-array-index, and this option is required to
7546 enable them.
7547
7548 -fno-analyzer-feasibility
7549 This option is intended for analyzer developers.
7550
7551 By default the analyzer verifies that there is a feasible control
7552 flow path for each diagnostic it emits: that the conditions that
7553 hold are not mutually exclusive. Diagnostics for which no feasible
7554 path can be found are rejected. This filtering can be suppressed
7555 with -fno-analyzer-feasibility, for debugging issues in this code.
7556
7557 -fanalyzer-fine-grained
7558 This option is intended for analyzer developers.
7559
7560 Internally the analyzer builds an "exploded graph" that combines
7561 control flow graphs with data flow information.
7562
7563 By default, an edge in this graph can contain the effects of a run
7564 of multiple statements within a basic block. With
7565 -fanalyzer-fine-grained, each statement gets its own edge.
7566
7567 -fanalyzer-show-duplicate-count
7568 This option is intended for analyzer developers: if multiple
7569 diagnostics have been detected as being duplicates of each other,
7570 it emits a note when reporting the best diagnostic, giving the
7571 number of additional diagnostics that were suppressed by the
7572 deduplication logic.
7573
7574 -fno-analyzer-state-merge
7575 This option is intended for analyzer developers.
7576
7577 By default the analyzer attempts to simplify analysis by merging
7578 sufficiently similar states at each program point as it builds its
7579 "exploded graph". With -fno-analyzer-state-merge this merging can
7580 be suppressed, for debugging state-handling issues.
7581
7582 -fno-analyzer-state-purge
7583 This option is intended for analyzer developers.
7584
7585 By default the analyzer attempts to simplify analysis by purging
7586 aspects of state at a program point that appear to no longer be
7587 relevant e.g. the values of locals that aren't accessed later in
7588 the function and which aren't relevant to leak analysis.
7589
7590 With -fno-analyzer-state-purge this purging of state can be
7591 suppressed, for debugging state-handling issues.
7592
7593 -fanalyzer-transitivity
7594 This option enables transitivity of constraints within the
7595 analyzer.
7596
7597 -fanalyzer-verbose-edges
7598 This option is intended for analyzer developers. It enables more
7599 verbose, lower-level detail in the descriptions of control flow
7600 within diagnostic paths.
7601
7602 -fanalyzer-verbose-state-changes
7603 This option is intended for analyzer developers. It enables more
7604 verbose, lower-level detail in the descriptions of events relating
7605 to state machines within diagnostic paths.
7606
7607 -fanalyzer-verbosity=level
7608 This option controls the complexity of the control flow paths that
7609 are emitted for analyzer diagnostics.
7610
7611 The level can be one of:
7612
7613 0 At this level, interprocedural call and return events are
7614 displayed, along with the most pertinent state-change events
7615 relating to a diagnostic. For example, for a double-"free"
7616 diagnostic, both calls to "free" will be shown.
7617
7618 1 As per the previous level, but also show events for the entry
7619 to each function.
7620
7621 2 As per the previous level, but also show events relating to
7622 control flow that are significant to triggering the issue (e.g.
7623 "true path taken" at a conditional).
7624
7625 This level is the default.
7626
7627 3 As per the previous level, but show all control flow events,
7628 not just significant ones.
7629
7630 4 This level is intended for analyzer developers; it adds various
7631 other events intended for debugging the analyzer.
7632
7633 -fdump-analyzer
7634 Dump internal details about what the analyzer is doing to
7635 file.analyzer.txt. This option is overridden by
7636 -fdump-analyzer-stderr.
7637
7638 -fdump-analyzer-stderr
7639 Dump internal details about what the analyzer is doing to stderr.
7640 This option overrides -fdump-analyzer.
7641
7642 -fdump-analyzer-callgraph
7643 Dump a representation of the call graph suitable for viewing with
7644 GraphViz to file.callgraph.dot.
7645
7646 -fdump-analyzer-exploded-graph
7647 Dump a representation of the "exploded graph" suitable for viewing
7648 with GraphViz to file.eg.dot. Nodes are color-coded based on
7649 state-machine states to emphasize state changes.
7650
7651 -fdump-analyzer-exploded-nodes
7652 Emit diagnostics showing where nodes in the "exploded graph" are in
7653 relation to the program source.
7654
7655 -fdump-analyzer-exploded-nodes-2
7656 Dump a textual representation of the "exploded graph" to
7657 file.eg.txt.
7658
7659 -fdump-analyzer-exploded-nodes-3
7660 Dump a textual representation of the "exploded graph" to one dump
7661 file per node, to file.eg-id.txt. This is typically a large number
7662 of dump files.
7663
7664 -fdump-analyzer-feasibility
7665 Dump internal details about the analyzer's search for feasible
7666 paths. The details are written in a form suitable for viewing with
7667 GraphViz to filenames of the form file.*.fg.dot and file.*.tg.dot.
7668
7669 -fdump-analyzer-json
7670 Dump a compressed JSON representation of analyzer internals to
7671 file.analyzer.json.gz. The precise format is subject to change.
7672
7673 -fdump-analyzer-state-purge
7674 As per -fdump-analyzer-supergraph, dump a representation of the
7675 "supergraph" suitable for viewing with GraphViz, but annotate the
7676 graph with information on what state will be purged at each node.
7677 The graph is written to file.state-purge.dot.
7678
7679 -fdump-analyzer-supergraph
7680 Dump representations of the "supergraph" suitable for viewing with
7681 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
7682 These show all of the control flow graphs in the program, with
7683 interprocedural edges for calls and returns. The second dump
7684 contains annotations showing nodes in the "exploded graph" and
7685 diagnostics associated with them.
7686
7687 Options for Debugging Your Program
7688 To tell GCC to emit extra information for use by a debugger, in almost
7689 all cases you need only to add -g to your other options.
7690
7691 GCC allows you to use -g with -O. The shortcuts taken by optimized
7692 code may occasionally be surprising: some variables you declared may
7693 not exist at all; flow of control may briefly move where you did not
7694 expect it; some statements may not be executed because they compute
7695 constant results or their values are already at hand; some statements
7696 may execute in different places because they have been moved out of
7697 loops. Nevertheless it is possible to debug optimized output. This
7698 makes it reasonable to use the optimizer for programs that might have
7699 bugs.
7700
7701 If you are not using some other optimization option, consider using -Og
7702 with -g. With no -O option at all, some compiler passes that collect
7703 information useful for debugging do not run at all, so that -Og may
7704 result in a better debugging experience.
7705
7706 -g Produce debugging information in the operating system's native
7707 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
7708 debugging information.
7709
7710 On most systems that use stabs format, -g enables use of extra
7711 debugging information that only GDB can use; this extra information
7712 makes debugging work better in GDB but probably makes other
7713 debuggers crash or refuse to read the program. If you want to
7714 control for certain whether to generate the extra information, use
7715 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
7716
7717 -ggdb
7718 Produce debugging information for use by GDB. This means to use
7719 the most expressive format available (DWARF, stabs, or the native
7720 format if neither of those are supported), including GDB extensions
7721 if at all possible.
7722
7723 -gdwarf
7724 -gdwarf-version
7725 Produce debugging information in DWARF format (if that is
7726 supported). The value of version may be either 2, 3, 4 or 5; the
7727 default version for most targets is 5 (with the exception of
7728 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
7729 AIX, which defaults to version 4).
7730
7731 Note that with DWARF Version 2, some ports require and always use
7732 some non-conflicting DWARF 3 extensions in the unwind tables.
7733
7734 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
7735 maximum benefit. Version 5 requires GDB 8.0 or higher.
7736
7737 GCC no longer supports DWARF Version 1, which is substantially
7738 different than Version 2 and later. For historical reasons, some
7739 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
7740 reference to DWARF Version 2 in their names, but apply to all
7741 currently-supported versions of DWARF.
7742
7743 -gstabs
7744 Produce debugging information in stabs format (if that is
7745 supported), without GDB extensions. This is the format used by DBX
7746 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
7747 this option produces stabs debugging output that is not understood
7748 by DBX. On System V Release 4 systems this option requires the GNU
7749 assembler.
7750
7751 -gstabs+
7752 Produce debugging information in stabs format (if that is
7753 supported), using GNU extensions understood only by the GNU
7754 debugger (GDB). The use of these extensions is likely to make
7755 other debuggers crash or refuse to read the program.
7756
7757 -gxcoff
7758 Produce debugging information in XCOFF format (if that is
7759 supported). This is the format used by the DBX debugger on IBM
7760 RS/6000 systems.
7761
7762 -gxcoff+
7763 Produce debugging information in XCOFF format (if that is
7764 supported), using GNU extensions understood only by the GNU
7765 debugger (GDB). The use of these extensions is likely to make
7766 other debuggers crash or refuse to read the program, and may cause
7767 assemblers other than the GNU assembler (GAS) to fail with an
7768 error.
7769
7770 -gvms
7771 Produce debugging information in Alpha/VMS debug format (if that is
7772 supported). This is the format used by DEBUG on Alpha/VMS systems.
7773
7774 -glevel
7775 -ggdblevel
7776 -gstabslevel
7777 -gxcofflevel
7778 -gvmslevel
7779 Request debugging information and also use level to specify how
7780 much information. The default level is 2.
7781
7782 Level 0 produces no debug information at all. Thus, -g0 negates
7783 -g.
7784
7785 Level 1 produces minimal information, enough for making backtraces
7786 in parts of the program that you don't plan to debug. This
7787 includes descriptions of functions and external variables, and line
7788 number tables, but no information about local variables.
7789
7790 Level 3 includes extra information, such as all the macro
7791 definitions present in the program. Some debuggers support macro
7792 expansion when you use -g3.
7793
7794 If you use multiple -g options, with or without level numbers, the
7795 last such option is the one that is effective.
7796
7797 -gdwarf does not accept a concatenated debug level, to avoid
7798 confusion with -gdwarf-level. Instead use an additional -glevel
7799 option to change the debug level for DWARF.
7800
7801 -fno-eliminate-unused-debug-symbols
7802 By default, no debug information is produced for symbols that are
7803 not actually used. Use this option if you want debug information
7804 for all symbols.
7805
7806 -femit-class-debug-always
7807 Instead of emitting debugging information for a C++ class in only
7808 one object file, emit it in all object files using the class. This
7809 option should be used only with debuggers that are unable to handle
7810 the way GCC normally emits debugging information for classes
7811 because using this option increases the size of debugging
7812 information by as much as a factor of two.
7813
7814 -fno-merge-debug-strings
7815 Direct the linker to not merge together strings in the debugging
7816 information that are identical in different object files. Merging
7817 is not supported by all assemblers or linkers. Merging decreases
7818 the size of the debug information in the output file at the cost of
7819 increasing link processing time. Merging is enabled by default.
7820
7821 -fdebug-prefix-map=old=new
7822 When compiling files residing in directory old, record debugging
7823 information describing them as if the files resided in directory
7824 new instead. This can be used to replace a build-time path with an
7825 install-time path in the debug info. It can also be used to change
7826 an absolute path to a relative path by using . for new. This can
7827 give more reproducible builds, which are location independent, but
7828 may require an extra command to tell GDB where to find the source
7829 files. See also -ffile-prefix-map.
7830
7831 -fvar-tracking
7832 Run variable tracking pass. It computes where variables are stored
7833 at each position in code. Better debugging information is then
7834 generated (if the debugging information format supports this
7835 information).
7836
7837 It is enabled by default when compiling with optimization (-Os, -O,
7838 -O2, ...), debugging information (-g) and the debug info format
7839 supports it.
7840
7841 -fvar-tracking-assignments
7842 Annotate assignments to user variables early in the compilation and
7843 attempt to carry the annotations over throughout the compilation
7844 all the way to the end, in an attempt to improve debug information
7845 while optimizing. Use of -gdwarf-4 is recommended along with it.
7846
7847 It can be enabled even if var-tracking is disabled, in which case
7848 annotations are created and maintained, but discarded at the end.
7849 By default, this flag is enabled together with -fvar-tracking,
7850 except when selective scheduling is enabled.
7851
7852 -gsplit-dwarf
7853 If DWARF debugging information is enabled, separate as much
7854 debugging information as possible into a separate output file with
7855 the extension .dwo. This option allows the build system to avoid
7856 linking files with debug information. To be useful, this option
7857 requires a debugger capable of reading .dwo files.
7858
7859 -gdwarf32
7860 -gdwarf64
7861 If DWARF debugging information is enabled, the -gdwarf32 selects
7862 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
7863 format. The default is target specific, on most targets it is
7864 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
7865 support more than 2GiB of debug information in any of the DWARF
7866 debug information sections. The 64-bit DWARF format allows larger
7867 debug information and might not be well supported by all consumers
7868 yet.
7869
7870 -gdescribe-dies
7871 Add description attributes to some DWARF DIEs that have no name
7872 attribute, such as artificial variables, external references and
7873 call site parameter DIEs.
7874
7875 -gpubnames
7876 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
7877
7878 -ggnu-pubnames
7879 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
7880 format suitable for conversion into a GDB index. This option is
7881 only useful with a linker that can produce GDB index version 7.
7882
7883 -fdebug-types-section
7884 When using DWARF Version 4 or higher, type DIEs can be put into
7885 their own ".debug_types" section instead of making them part of the
7886 ".debug_info" section. It is more efficient to put them in a
7887 separate comdat section since the linker can then remove
7888 duplicates. But not all DWARF consumers support ".debug_types"
7889 sections yet and on some objects ".debug_types" produces larger
7890 instead of smaller debugging information.
7891
7892 -grecord-gcc-switches
7893 -gno-record-gcc-switches
7894 This switch causes the command-line options used to invoke the
7895 compiler that may affect code generation to be appended to the
7896 DW_AT_producer attribute in DWARF debugging information. The
7897 options are concatenated with spaces separating them from each
7898 other and from the compiler version. It is enabled by default.
7899 See also -frecord-gcc-switches for another way of storing compiler
7900 options into the object file.
7901
7902 -gstrict-dwarf
7903 Disallow using extensions of later DWARF standard version than
7904 selected with -gdwarf-version. On most targets using non-
7905 conflicting DWARF extensions from later standard versions is
7906 allowed.
7907
7908 -gno-strict-dwarf
7909 Allow using extensions of later DWARF standard version than
7910 selected with -gdwarf-version.
7911
7912 -gas-loc-support
7913 Inform the compiler that the assembler supports ".loc" directives.
7914 It may then use them for the assembler to generate DWARF2+ line
7915 number tables.
7916
7917 This is generally desirable, because assembler-generated line-
7918 number tables are a lot more compact than those the compiler can
7919 generate itself.
7920
7921 This option will be enabled by default if, at GCC configure time,
7922 the assembler was found to support such directives.
7923
7924 -gno-as-loc-support
7925 Force GCC to generate DWARF2+ line number tables internally, if
7926 DWARF2+ line number tables are to be generated.
7927
7928 -gas-locview-support
7929 Inform the compiler that the assembler supports "view" assignment
7930 and reset assertion checking in ".loc" directives.
7931
7932 This option will be enabled by default if, at GCC configure time,
7933 the assembler was found to support them.
7934
7935 -gno-as-locview-support
7936 Force GCC to assign view numbers internally, if
7937 -gvariable-location-views are explicitly requested.
7938
7939 -gcolumn-info
7940 -gno-column-info
7941 Emit location column information into DWARF debugging information,
7942 rather than just file and line. This option is enabled by default.
7943
7944 -gstatement-frontiers
7945 -gno-statement-frontiers
7946 This option causes GCC to create markers in the internal
7947 representation at the beginning of statements, and to keep them
7948 roughly in place throughout compilation, using them to guide the
7949 output of "is_stmt" markers in the line number table. This is
7950 enabled by default when compiling with optimization (-Os, -O, -O2,
7951 ...), and outputting DWARF 2 debug information at the normal level.
7952
7953 -gvariable-location-views
7954 -gvariable-location-views=incompat5
7955 -gno-variable-location-views
7956 Augment variable location lists with progressive view numbers
7957 implied from the line number table. This enables debug information
7958 consumers to inspect state at certain points of the program, even
7959 if no instructions associated with the corresponding source
7960 locations are present at that point. If the assembler lacks
7961 support for view numbers in line number tables, this will cause the
7962 compiler to emit the line number table, which generally makes them
7963 somewhat less compact. The augmented line number tables and
7964 location lists are fully backward-compatible, so they can be
7965 consumed by debug information consumers that are not aware of these
7966 augmentations, but they won't derive any benefit from them either.
7967
7968 This is enabled by default when outputting DWARF 2 debug
7969 information at the normal level, as long as there is assembler
7970 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
7971 is not. When assembler support is not available, this may still be
7972 enabled, but it will force GCC to output internal line number
7973 tables, and if -ginternal-reset-location-views is not enabled, that
7974 will most certainly lead to silently mismatching location views.
7975
7976 There is a proposed representation for view numbers that is not
7977 backward compatible with the location list format introduced in
7978 DWARF 5, that can be enabled with
7979 -gvariable-location-views=incompat5. This option may be removed in
7980 the future, is only provided as a reference implementation of the
7981 proposed representation. Debug information consumers are not
7982 expected to support this extended format, and they would be
7983 rendered unable to decode location lists using it.
7984
7985 -ginternal-reset-location-views
7986 -gno-internal-reset-location-views
7987 Attempt to determine location views that can be omitted from
7988 location view lists. This requires the compiler to have very
7989 accurate insn length estimates, which isn't always the case, and it
7990 may cause incorrect view lists to be generated silently when using
7991 an assembler that does not support location view lists. The GNU
7992 assembler will flag any such error as a "view number mismatch".
7993 This is only enabled on ports that define a reliable estimation
7994 function.
7995
7996 -ginline-points
7997 -gno-inline-points
7998 Generate extended debug information for inlined functions.
7999 Location view tracking markers are inserted at inlined entry
8000 points, so that address and view numbers can be computed and output
8001 in debug information. This can be enabled independently of
8002 location views, in which case the view numbers won't be output, but
8003 it can only be enabled along with statement frontiers, and it is
8004 only enabled by default if location views are enabled.
8005
8006 -gz[=type]
8007 Produce compressed debug sections in DWARF format, if that is
8008 supported. If type is not given, the default type depends on the
8009 capabilities of the assembler and linker used. type may be one of
8010 none (don't compress debug sections), zlib (use zlib compression in
8011 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8012 GNU format). If the linker doesn't support writing compressed
8013 debug sections, the option is rejected. Otherwise, if the
8014 assembler does not support them, -gz is silently ignored when
8015 producing object files.
8016
8017 -femit-struct-debug-baseonly
8018 Emit debug information for struct-like types only when the base
8019 name of the compilation source file matches the base name of file
8020 in which the struct is defined.
8021
8022 This option substantially reduces the size of debugging
8023 information, but at significant potential loss in type information
8024 to the debugger. See -femit-struct-debug-reduced for a less
8025 aggressive option. See -femit-struct-debug-detailed for more
8026 detailed control.
8027
8028 This option works only with DWARF debug output.
8029
8030 -femit-struct-debug-reduced
8031 Emit debug information for struct-like types only when the base
8032 name of the compilation source file matches the base name of file
8033 in which the type is defined, unless the struct is a template or
8034 defined in a system header.
8035
8036 This option significantly reduces the size of debugging
8037 information, with some potential loss in type information to the
8038 debugger. See -femit-struct-debug-baseonly for a more aggressive
8039 option. See -femit-struct-debug-detailed for more detailed
8040 control.
8041
8042 This option works only with DWARF debug output.
8043
8044 -femit-struct-debug-detailed[=spec-list]
8045 Specify the struct-like types for which the compiler generates
8046 debug information. The intent is to reduce duplicate struct debug
8047 information between different object files within the same program.
8048
8049 This option is a detailed version of -femit-struct-debug-reduced
8050 and -femit-struct-debug-baseonly, which serves for most needs.
8051
8052 A specification has the
8053 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8054
8055 The optional first word limits the specification to structs that
8056 are used directly (dir:) or used indirectly (ind:). A struct type
8057 is used directly when it is the type of a variable, member.
8058 Indirect uses arise through pointers to structs. That is, when use
8059 of an incomplete struct is valid, the use is indirect. An example
8060 is struct one direct; struct two * indirect;.
8061
8062 The optional second word limits the specification to ordinary
8063 structs (ord:) or generic structs (gen:). Generic structs are a
8064 bit complicated to explain. For C++, these are non-explicit
8065 specializations of template classes, or non-template classes within
8066 the above. Other programming languages have generics, but
8067 -femit-struct-debug-detailed does not yet implement them.
8068
8069 The third word specifies the source files for those structs for
8070 which the compiler should emit debug information. The values none
8071 and any have the normal meaning. The value base means that the
8072 base of name of the file in which the type declaration appears must
8073 match the base of the name of the main compilation file. In
8074 practice, this means that when compiling foo.c, debug information
8075 is generated for types declared in that file and foo.h, but not
8076 other header files. The value sys means those types satisfying
8077 base or declared in system or compiler headers.
8078
8079 You may need to experiment to determine the best settings for your
8080 application.
8081
8082 The default is -femit-struct-debug-detailed=all.
8083
8084 This option works only with DWARF debug output.
8085
8086 -fno-dwarf2-cfi-asm
8087 Emit DWARF unwind info as compiler generated ".eh_frame" section
8088 instead of using GAS ".cfi_*" directives.
8089
8090 -fno-eliminate-unused-debug-types
8091 Normally, when producing DWARF output, GCC avoids producing debug
8092 symbol output for types that are nowhere used in the source file
8093 being compiled. Sometimes it is useful to have GCC emit debugging
8094 information for all types declared in a compilation unit,
8095 regardless of whether or not they are actually used in that
8096 compilation unit, for example if, in the debugger, you want to cast
8097 a value to a type that is not actually used in your program (but is
8098 declared). More often, however, this results in a significant
8099 amount of wasted space.
8100
8101 Options That Control Optimization
8102 These options control various sorts of optimizations.
8103
8104 Without any optimization option, the compiler's goal is to reduce the
8105 cost of compilation and to make debugging produce the expected results.
8106 Statements are independent: if you stop the program with a breakpoint
8107 between statements, you can then assign a new value to any variable or
8108 change the program counter to any other statement in the function and
8109 get exactly the results you expect from the source code.
8110
8111 Turning on optimization flags makes the compiler attempt to improve the
8112 performance and/or code size at the expense of compilation time and
8113 possibly the ability to debug the program.
8114
8115 The compiler performs optimization based on the knowledge it has of the
8116 program. Compiling multiple files at once to a single output file mode
8117 allows the compiler to use information gained from all of the files
8118 when compiling each of them.
8119
8120 Not all optimizations are controlled directly by a flag. Only
8121 optimizations that have a flag are listed in this section.
8122
8123 Most optimizations are completely disabled at -O0 or if an -O level is
8124 not set on the command line, even if individual optimization flags are
8125 specified. Similarly, -Og suppresses many optimization passes.
8126
8127 Depending on the target and how GCC was configured, a slightly
8128 different set of optimizations may be enabled at each -O level than
8129 those listed here. You can invoke GCC with -Q --help=optimizers to
8130 find out the exact set of optimizations that are enabled at each level.
8131
8132 -O
8133 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8134 lot more memory for a large function.
8135
8136 With -O, the compiler tries to reduce code size and execution time,
8137 without performing any optimizations that take a great deal of
8138 compilation time.
8139
8140 -O turns on the following optimization flags:
8141
8142 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8143 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8144 -fdse -fforward-propagate -fguess-branch-probability
8145 -fif-conversion -fif-conversion2 -finline-functions-called-once
8146 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8147 -fipa-reference-addressable -fmerge-constants
8148 -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks
8149 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types
8150 -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch
8151 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
8152 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
8153 -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr
8154 -ftree-sra -ftree-ter -funit-at-a-time
8155
8156 -O2 Optimize even more. GCC performs nearly all supported
8157 optimizations that do not involve a space-speed tradeoff. As
8158 compared to -O, this option increases both compilation time and the
8159 performance of the generated code.
8160
8161 -O2 turns on all optimization flags specified by -O. It also turns
8162 on the following optimization flags:
8163
8164 -falign-functions -falign-jumps -falign-labels -falign-loops
8165 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8166 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8167 -fdevirtualize-speculatively -fexpensive-optimizations
8168 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8169 -finline-functions -finline-small-functions -findirect-inlining
8170 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8171 -fisolate-erroneous-paths-dereference -flra-remat
8172 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8173 -fpeephole2 -freorder-blocks-algorithm=stc
8174 -freorder-blocks-and-partition -freorder-functions
8175 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8176 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8177 -fthread-jumps -ftree-builtin-call-dce -ftree-pre
8178 -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
8179
8180 Please note the warning under -fgcse about invoking -O2 on programs
8181 that use computed gotos.
8182
8183 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8184 and also turns on the following optimization flags:
8185
8186 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8187 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8188 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8189 -ftree-loop-vectorize -ftree-partial-pre -ftree-slp-vectorize
8190 -funswitch-loops -fvect-cost-model -fvect-cost-model=dynamic
8191 -fversion-loops-for-strides
8192
8193 -O0 Reduce compilation time and make debugging produce the expected
8194 results. This is the default.
8195
8196 -Os Optimize for size. -Os enables all -O2 optimizations except those
8197 that often increase code size:
8198
8199 -falign-functions -falign-jumps -falign-labels -falign-loops
8200 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8201
8202 It also enables -finline-functions, causes the compiler to tune for
8203 code size rather than execution speed, and performs further
8204 optimizations designed to reduce code size.
8205
8206 -Ofast
8207 Disregard strict standards compliance. -Ofast enables all -O3
8208 optimizations. It also enables optimizations that are not valid
8209 for all standard-compliant programs. It turns on -ffast-math,
8210 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8211 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8212
8213 -Og Optimize debugging experience. -Og should be the optimization
8214 level of choice for the standard edit-compile-debug cycle, offering
8215 a reasonable level of optimization while maintaining fast
8216 compilation and a good debugging experience. It is a better choice
8217 than -O0 for producing debuggable code because some compiler passes
8218 that collect debug information are disabled at -O0.
8219
8220 Like -O0, -Og completely disables a number of optimization passes
8221 so that individual options controlling them have no effect.
8222 Otherwise -Og enables all -O1 optimization flags except for those
8223 that may interfere with debugging:
8224
8225 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8226 -fif-conversion2 -finline-functions-called-once
8227 -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-dse
8228 -ftree-pta -ftree-sra
8229
8230 If you use multiple -O options, with or without level numbers, the last
8231 such option is the one that is effective.
8232
8233 Options of the form -fflag specify machine-independent flags. Most
8234 flags have both positive and negative forms; the negative form of -ffoo
8235 is -fno-foo. In the table below, only one of the forms is listed---the
8236 one you typically use. You can figure out the other form by either
8237 removing no- or adding it.
8238
8239 The following options control specific optimizations. They are either
8240 activated by -O options or are related to ones that are. You can use
8241 the following flags in the rare cases when "fine-tuning" of
8242 optimizations to be performed is desired.
8243
8244 -fno-defer-pop
8245 For machines that must pop arguments after a function call, always
8246 pop the arguments as soon as each function returns. At levels -O1
8247 and higher, -fdefer-pop is the default; this allows the compiler to
8248 let arguments accumulate on the stack for several function calls
8249 and pop them all at once.
8250
8251 -fforward-propagate
8252 Perform a forward propagation pass on RTL. The pass tries to
8253 combine two instructions and checks if the result can be
8254 simplified. If loop unrolling is active, two passes are performed
8255 and the second is scheduled after loop unrolling.
8256
8257 This option is enabled by default at optimization levels -O, -O2,
8258 -O3, -Os.
8259
8260 -ffp-contract=style
8261 -ffp-contract=off disables floating-point expression contraction.
8262 -ffp-contract=fast enables floating-point expression contraction
8263 such as forming of fused multiply-add operations if the target has
8264 native support for them. -ffp-contract=on enables floating-point
8265 expression contraction if allowed by the language standard. This
8266 is currently not implemented and treated equal to
8267 -ffp-contract=off.
8268
8269 The default is -ffp-contract=fast.
8270
8271 -fomit-frame-pointer
8272 Omit the frame pointer in functions that don't need one. This
8273 avoids the instructions to save, set up and restore the frame
8274 pointer; on many targets it also makes an extra register available.
8275
8276 On some targets this flag has no effect because the standard
8277 calling sequence always uses a frame pointer, so it cannot be
8278 omitted.
8279
8280 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8281 pointer is used in all functions. Several targets always omit the
8282 frame pointer in leaf functions.
8283
8284 Enabled by default at -O and higher.
8285
8286 -foptimize-sibling-calls
8287 Optimize sibling and tail recursive calls.
8288
8289 Enabled at levels -O2, -O3, -Os.
8290
8291 -foptimize-strlen
8292 Optimize various standard C string functions (e.g. "strlen",
8293 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8294 faster alternatives.
8295
8296 Enabled at levels -O2, -O3.
8297
8298 -fno-inline
8299 Do not expand any functions inline apart from those marked with the
8300 "always_inline" attribute. This is the default when not
8301 optimizing.
8302
8303 Single functions can be exempted from inlining by marking them with
8304 the "noinline" attribute.
8305
8306 -finline-small-functions
8307 Integrate functions into their callers when their body is smaller
8308 than expected function call code (so overall size of program gets
8309 smaller). The compiler heuristically decides which functions are
8310 simple enough to be worth integrating in this way. This inlining
8311 applies to all functions, even those not declared inline.
8312
8313 Enabled at levels -O2, -O3, -Os.
8314
8315 -findirect-inlining
8316 Inline also indirect calls that are discovered to be known at
8317 compile time thanks to previous inlining. This option has any
8318 effect only when inlining itself is turned on by the
8319 -finline-functions or -finline-small-functions options.
8320
8321 Enabled at levels -O2, -O3, -Os.
8322
8323 -finline-functions
8324 Consider all functions for inlining, even if they are not declared
8325 inline. The compiler heuristically decides which functions are
8326 worth integrating in this way.
8327
8328 If all calls to a given function are integrated, and the function
8329 is declared "static", then the function is normally not output as
8330 assembler code in its own right.
8331
8332 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8333 -fauto-profile.
8334
8335 -finline-functions-called-once
8336 Consider all "static" functions called once for inlining into their
8337 caller even if they are not marked "inline". If a call to a given
8338 function is integrated, then the function is not output as
8339 assembler code in its own right.
8340
8341 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8342
8343 -fearly-inlining
8344 Inline functions marked by "always_inline" and functions whose body
8345 seems smaller than the function call overhead early before doing
8346 -fprofile-generate instrumentation and real inlining pass. Doing
8347 so makes profiling significantly cheaper and usually inlining
8348 faster on programs having large chains of nested wrapper functions.
8349
8350 Enabled by default.
8351
8352 -fipa-sra
8353 Perform interprocedural scalar replacement of aggregates, removal
8354 of unused parameters and replacement of parameters passed by
8355 reference by parameters passed by value.
8356
8357 Enabled at levels -O2, -O3 and -Os.
8358
8359 -finline-limit=n
8360 By default, GCC limits the size of functions that can be inlined.
8361 This flag allows coarse control of this limit. n is the size of
8362 functions that can be inlined in number of pseudo instructions.
8363
8364 Inlining is actually controlled by a number of parameters, which
8365 may be specified individually by using --param name=value. The
8366 -finline-limit=n option sets some of these parameters as follows:
8367
8368 max-inline-insns-single
8369 is set to n/2.
8370
8371 max-inline-insns-auto
8372 is set to n/2.
8373
8374 See below for a documentation of the individual parameters
8375 controlling inlining and for the defaults of these parameters.
8376
8377 Note: there may be no value to -finline-limit that results in
8378 default behavior.
8379
8380 Note: pseudo instruction represents, in this particular context, an
8381 abstract measurement of function's size. In no way does it
8382 represent a count of assembly instructions and as such its exact
8383 meaning might change from one release to an another.
8384
8385 -fno-keep-inline-dllexport
8386 This is a more fine-grained version of -fkeep-inline-functions,
8387 which applies only to functions that are declared using the
8388 "dllexport" attribute or declspec.
8389
8390 -fkeep-inline-functions
8391 In C, emit "static" functions that are declared "inline" into the
8392 object file, even if the function has been inlined into all of its
8393 callers. This switch does not affect functions using the "extern
8394 inline" extension in GNU C90. In C++, emit any and all inline
8395 functions into the object file.
8396
8397 -fkeep-static-functions
8398 Emit "static" functions into the object file, even if the function
8399 is never used.
8400
8401 -fkeep-static-consts
8402 Emit variables declared "static const" when optimization isn't
8403 turned on, even if the variables aren't referenced.
8404
8405 GCC enables this option by default. If you want to force the
8406 compiler to check if a variable is referenced, regardless of
8407 whether or not optimization is turned on, use the
8408 -fno-keep-static-consts option.
8409
8410 -fmerge-constants
8411 Attempt to merge identical constants (string constants and
8412 floating-point constants) across compilation units.
8413
8414 This option is the default for optimized compilation if the
8415 assembler and linker support it. Use -fno-merge-constants to
8416 inhibit this behavior.
8417
8418 Enabled at levels -O, -O2, -O3, -Os.
8419
8420 -fmerge-all-constants
8421 Attempt to merge identical constants and identical variables.
8422
8423 This option implies -fmerge-constants. In addition to
8424 -fmerge-constants this considers e.g. even constant initialized
8425 arrays or initialized constant variables with integral or floating-
8426 point types. Languages like C or C++ require each variable,
8427 including multiple instances of the same variable in recursive
8428 calls, to have distinct locations, so using this option results in
8429 non-conforming behavior.
8430
8431 -fmodulo-sched
8432 Perform swing modulo scheduling immediately before the first
8433 scheduling pass. This pass looks at innermost loops and reorders
8434 their instructions by overlapping different iterations.
8435
8436 -fmodulo-sched-allow-regmoves
8437 Perform more aggressive SMS-based modulo scheduling with register
8438 moves allowed. By setting this flag certain anti-dependences edges
8439 are deleted, which triggers the generation of reg-moves based on
8440 the life-range analysis. This option is effective only with
8441 -fmodulo-sched enabled.
8442
8443 -fno-branch-count-reg
8444 Disable the optimization pass that scans for opportunities to use
8445 "decrement and branch" instructions on a count register instead of
8446 instruction sequences that decrement a register, compare it against
8447 zero, and then branch based upon the result. This option is only
8448 meaningful on architectures that support such instructions, which
8449 include x86, PowerPC, IA-64 and S/390. Note that the
8450 -fno-branch-count-reg option doesn't remove the decrement and
8451 branch instructions from the generated instruction stream
8452 introduced by other optimization passes.
8453
8454 The default is -fbranch-count-reg at -O1 and higher, except for
8455 -Og.
8456
8457 -fno-function-cse
8458 Do not put function addresses in registers; make each instruction
8459 that calls a constant function contain the function's address
8460 explicitly.
8461
8462 This option results in less efficient code, but some strange hacks
8463 that alter the assembler output may be confused by the
8464 optimizations performed when this option is not used.
8465
8466 The default is -ffunction-cse
8467
8468 -fno-zero-initialized-in-bss
8469 If the target supports a BSS section, GCC by default puts variables
8470 that are initialized to zero into BSS. This can save space in the
8471 resulting code.
8472
8473 This option turns off this behavior because some programs
8474 explicitly rely on variables going to the data section---e.g., so
8475 that the resulting executable can find the beginning of that
8476 section and/or make assumptions based on that.
8477
8478 The default is -fzero-initialized-in-bss.
8479
8480 -fthread-jumps
8481 Perform optimizations that check to see if a jump branches to a
8482 location where another comparison subsumed by the first is found.
8483 If so, the first branch is redirected to either the destination of
8484 the second branch or a point immediately following it, depending on
8485 whether the condition is known to be true or false.
8486
8487 Enabled at levels -O2, -O3, -Os.
8488
8489 -fsplit-wide-types
8490 When using a type that occupies multiple registers, such as "long
8491 long" on a 32-bit system, split the registers apart and allocate
8492 them independently. This normally generates better code for those
8493 types, but may make debugging more difficult.
8494
8495 Enabled at levels -O, -O2, -O3, -Os.
8496
8497 -fsplit-wide-types-early
8498 Fully split wide types early, instead of very late. This option
8499 has no effect unless -fsplit-wide-types is turned on.
8500
8501 This is the default on some targets.
8502
8503 -fcse-follow-jumps
8504 In common subexpression elimination (CSE), scan through jump
8505 instructions when the target of the jump is not reached by any
8506 other path. For example, when CSE encounters an "if" statement
8507 with an "else" clause, CSE follows the jump when the condition
8508 tested is false.
8509
8510 Enabled at levels -O2, -O3, -Os.
8511
8512 -fcse-skip-blocks
8513 This is similar to -fcse-follow-jumps, but causes CSE to follow
8514 jumps that conditionally skip over blocks. When CSE encounters a
8515 simple "if" statement with no else clause, -fcse-skip-blocks causes
8516 CSE to follow the jump around the body of the "if".
8517
8518 Enabled at levels -O2, -O3, -Os.
8519
8520 -frerun-cse-after-loop
8521 Re-run common subexpression elimination after loop optimizations
8522 are performed.
8523
8524 Enabled at levels -O2, -O3, -Os.
8525
8526 -fgcse
8527 Perform a global common subexpression elimination pass. This pass
8528 also performs global constant and copy propagation.
8529
8530 Note: When compiling a program using computed gotos, a GCC
8531 extension, you may get better run-time performance if you disable
8532 the global common subexpression elimination pass by adding
8533 -fno-gcse to the command line.
8534
8535 Enabled at levels -O2, -O3, -Os.
8536
8537 -fgcse-lm
8538 When -fgcse-lm is enabled, global common subexpression elimination
8539 attempts to move loads that are only killed by stores into
8540 themselves. This allows a loop containing a load/store sequence to
8541 be changed to a load outside the loop, and a copy/store within the
8542 loop.
8543
8544 Enabled by default when -fgcse is enabled.
8545
8546 -fgcse-sm
8547 When -fgcse-sm is enabled, a store motion pass is run after global
8548 common subexpression elimination. This pass attempts to move
8549 stores out of loops. When used in conjunction with -fgcse-lm,
8550 loops containing a load/store sequence can be changed to a load
8551 before the loop and a store after the loop.
8552
8553 Not enabled at any optimization level.
8554
8555 -fgcse-las
8556 When -fgcse-las is enabled, the global common subexpression
8557 elimination pass eliminates redundant loads that come after stores
8558 to the same memory location (both partial and full redundancies).
8559
8560 Not enabled at any optimization level.
8561
8562 -fgcse-after-reload
8563 When -fgcse-after-reload is enabled, a redundant load elimination
8564 pass is performed after reload. The purpose of this pass is to
8565 clean up redundant spilling.
8566
8567 Enabled by -fprofile-use and -fauto-profile.
8568
8569 -faggressive-loop-optimizations
8570 This option tells the loop optimizer to use language constraints to
8571 derive bounds for the number of iterations of a loop. This assumes
8572 that loop code does not invoke undefined behavior by for example
8573 causing signed integer overflows or out-of-bound array accesses.
8574 The bounds for the number of iterations of a loop are used to guide
8575 loop unrolling and peeling and loop exit test optimizations. This
8576 option is enabled by default.
8577
8578 -funconstrained-commons
8579 This option tells the compiler that variables declared in common
8580 blocks (e.g. Fortran) may later be overridden with longer trailing
8581 arrays. This prevents certain optimizations that depend on knowing
8582 the array bounds.
8583
8584 -fcrossjumping
8585 Perform cross-jumping transformation. This transformation unifies
8586 equivalent code and saves code size. The resulting code may or may
8587 not perform better than without cross-jumping.
8588
8589 Enabled at levels -O2, -O3, -Os.
8590
8591 -fauto-inc-dec
8592 Combine increments or decrements of addresses with memory accesses.
8593 This pass is always skipped on architectures that do not have
8594 instructions to support this. Enabled by default at -O and higher
8595 on architectures that support this.
8596
8597 -fdce
8598 Perform dead code elimination (DCE) on RTL. Enabled by default at
8599 -O and higher.
8600
8601 -fdse
8602 Perform dead store elimination (DSE) on RTL. Enabled by default at
8603 -O and higher.
8604
8605 -fif-conversion
8606 Attempt to transform conditional jumps into branch-less
8607 equivalents. This includes use of conditional moves, min, max, set
8608 flags and abs instructions, and some tricks doable by standard
8609 arithmetics. The use of conditional execution on chips where it is
8610 available is controlled by -fif-conversion2.
8611
8612 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8613
8614 -fif-conversion2
8615 Use conditional execution (where available) to transform
8616 conditional jumps into branch-less equivalents.
8617
8618 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8619
8620 -fdeclone-ctor-dtor
8621 The C++ ABI requires multiple entry points for constructors and
8622 destructors: one for a base subobject, one for a complete object,
8623 and one for a virtual destructor that calls operator delete
8624 afterwards. For a hierarchy with virtual bases, the base and
8625 complete variants are clones, which means two copies of the
8626 function. With this option, the base and complete variants are
8627 changed to be thunks that call a common implementation.
8628
8629 Enabled by -Os.
8630
8631 -fdelete-null-pointer-checks
8632 Assume that programs cannot safely dereference null pointers, and
8633 that no code or data element resides at address zero. This option
8634 enables simple constant folding optimizations at all optimization
8635 levels. In addition, other optimization passes in GCC use this
8636 flag to control global dataflow analyses that eliminate useless
8637 checks for null pointers; these assume that a memory access to
8638 address zero always results in a trap, so that if a pointer is
8639 checked after it has already been dereferenced, it cannot be null.
8640
8641 Note however that in some environments this assumption is not true.
8642 Use -fno-delete-null-pointer-checks to disable this optimization
8643 for programs that depend on that behavior.
8644
8645 This option is enabled by default on most targets. On Nios II ELF,
8646 it defaults to off. On AVR, CR16, and MSP430, this option is
8647 completely disabled.
8648
8649 Passes that use the dataflow information are enabled independently
8650 at different optimization levels.
8651
8652 -fdevirtualize
8653 Attempt to convert calls to virtual functions to direct calls.
8654 This is done both within a procedure and interprocedurally as part
8655 of indirect inlining (-findirect-inlining) and interprocedural
8656 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
8657
8658 -fdevirtualize-speculatively
8659 Attempt to convert calls to virtual functions to speculative direct
8660 calls. Based on the analysis of the type inheritance graph,
8661 determine for a given call the set of likely targets. If the set is
8662 small, preferably of size 1, change the call into a conditional
8663 deciding between direct and indirect calls. The speculative calls
8664 enable more optimizations, such as inlining. When they seem
8665 useless after further optimization, they are converted back into
8666 original form.
8667
8668 -fdevirtualize-at-ltrans
8669 Stream extra information needed for aggressive devirtualization
8670 when running the link-time optimizer in local transformation mode.
8671 This option enables more devirtualization but significantly
8672 increases the size of streamed data. For this reason it is disabled
8673 by default.
8674
8675 -fexpensive-optimizations
8676 Perform a number of minor optimizations that are relatively
8677 expensive.
8678
8679 Enabled at levels -O2, -O3, -Os.
8680
8681 -free
8682 Attempt to remove redundant extension instructions. This is
8683 especially helpful for the x86-64 architecture, which implicitly
8684 zero-extends in 64-bit registers after writing to their lower
8685 32-bit half.
8686
8687 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
8688
8689 -fno-lifetime-dse
8690 In C++ the value of an object is only affected by changes within
8691 its lifetime: when the constructor begins, the object has an
8692 indeterminate value, and any changes during the lifetime of the
8693 object are dead when the object is destroyed. Normally dead store
8694 elimination will take advantage of this; if your code relies on the
8695 value of the object storage persisting beyond the lifetime of the
8696 object, you can use this flag to disable this optimization. To
8697 preserve stores before the constructor starts (e.g. because your
8698 operator new clears the object storage) but still treat the object
8699 as dead after the destructor, you can use -flifetime-dse=1. The
8700 default behavior can be explicitly selected with -flifetime-dse=2.
8701 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
8702
8703 -flive-range-shrinkage
8704 Attempt to decrease register pressure through register live range
8705 shrinkage. This is helpful for fast processors with small or
8706 moderate size register sets.
8707
8708 -fira-algorithm=algorithm
8709 Use the specified coloring algorithm for the integrated register
8710 allocator. The algorithm argument can be priority, which specifies
8711 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
8712 coloring. Chaitin-Briggs coloring is not implemented for all
8713 architectures, but for those targets that do support it, it is the
8714 default because it generates better code.
8715
8716 -fira-region=region
8717 Use specified regions for the integrated register allocator. The
8718 region argument should be one of the following:
8719
8720 all Use all loops as register allocation regions. This can give
8721 the best results for machines with a small and/or irregular
8722 register set.
8723
8724 mixed
8725 Use all loops except for loops with small register pressure as
8726 the regions. This value usually gives the best results in most
8727 cases and for most architectures, and is enabled by default
8728 when compiling with optimization for speed (-O, -O2, ...).
8729
8730 one Use all functions as a single region. This typically results
8731 in the smallest code size, and is enabled by default for -Os or
8732 -O0.
8733
8734 -fira-hoist-pressure
8735 Use IRA to evaluate register pressure in the code hoisting pass for
8736 decisions to hoist expressions. This option usually results in
8737 smaller code, but it can slow the compiler down.
8738
8739 This option is enabled at level -Os for all targets.
8740
8741 -fira-loop-pressure
8742 Use IRA to evaluate register pressure in loops for decisions to
8743 move loop invariants. This option usually results in generation of
8744 faster and smaller code on machines with large register files (>=
8745 32 registers), but it can slow the compiler down.
8746
8747 This option is enabled at level -O3 for some targets.
8748
8749 -fno-ira-share-save-slots
8750 Disable sharing of stack slots used for saving call-used hard
8751 registers living through a call. Each hard register gets a
8752 separate stack slot, and as a result function stack frames are
8753 larger.
8754
8755 -fno-ira-share-spill-slots
8756 Disable sharing of stack slots allocated for pseudo-registers.
8757 Each pseudo-register that does not get a hard register gets a
8758 separate stack slot, and as a result function stack frames are
8759 larger.
8760
8761 -flra-remat
8762 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8763 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8764 values if it is profitable.
8765
8766 Enabled at levels -O2, -O3, -Os.
8767
8768 -fdelayed-branch
8769 If supported for the target machine, attempt to reorder
8770 instructions to exploit instruction slots available after delayed
8771 branch instructions.
8772
8773 Enabled at levels -O, -O2, -O3, -Os, but not at -Og.
8774
8775 -fschedule-insns
8776 If supported for the target machine, attempt to reorder
8777 instructions to eliminate execution stalls due to required data
8778 being unavailable. This helps machines that have slow floating
8779 point or memory load instructions by allowing other instructions to
8780 be issued until the result of the load or floating-point
8781 instruction is required.
8782
8783 Enabled at levels -O2, -O3.
8784
8785 -fschedule-insns2
8786 Similar to -fschedule-insns, but requests an additional pass of
8787 instruction scheduling after register allocation has been done.
8788 This is especially useful on machines with a relatively small
8789 number of registers and where memory load instructions take more
8790 than one cycle.
8791
8792 Enabled at levels -O2, -O3, -Os.
8793
8794 -fno-sched-interblock
8795 Disable instruction scheduling across basic blocks, which is
8796 normally enabled when scheduling before register allocation, i.e.
8797 with -fschedule-insns or at -O2 or higher.
8798
8799 -fno-sched-spec
8800 Disable speculative motion of non-load instructions, which is
8801 normally enabled when scheduling before register allocation, i.e.
8802 with -fschedule-insns or at -O2 or higher.
8803
8804 -fsched-pressure
8805 Enable register pressure sensitive insn scheduling before register
8806 allocation. This only makes sense when scheduling before register
8807 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
8808 higher. Usage of this option can improve the generated code and
8809 decrease its size by preventing register pressure increase above
8810 the number of available hard registers and subsequent spills in
8811 register allocation.
8812
8813 -fsched-spec-load
8814 Allow speculative motion of some load instructions. This only
8815 makes sense when scheduling before register allocation, i.e. with
8816 -fschedule-insns or at -O2 or higher.
8817
8818 -fsched-spec-load-dangerous
8819 Allow speculative motion of more load instructions. This only
8820 makes sense when scheduling before register allocation, i.e. with
8821 -fschedule-insns or at -O2 or higher.
8822
8823 -fsched-stalled-insns
8824 -fsched-stalled-insns=n
8825 Define how many insns (if any) can be moved prematurely from the
8826 queue of stalled insns into the ready list during the second
8827 scheduling pass. -fno-sched-stalled-insns means that no insns are
8828 moved prematurely, -fsched-stalled-insns=0 means there is no limit
8829 on how many queued insns can be moved prematurely.
8830 -fsched-stalled-insns without a value is equivalent to
8831 -fsched-stalled-insns=1.
8832
8833 -fsched-stalled-insns-dep
8834 -fsched-stalled-insns-dep=n
8835 Define how many insn groups (cycles) are examined for a dependency
8836 on a stalled insn that is a candidate for premature removal from
8837 the queue of stalled insns. This has an effect only during the
8838 second scheduling pass, and only if -fsched-stalled-insns is used.
8839 -fno-sched-stalled-insns-dep is equivalent to
8840 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
8841 value is equivalent to -fsched-stalled-insns-dep=1.
8842
8843 -fsched2-use-superblocks
8844 When scheduling after register allocation, use superblock
8845 scheduling. This allows motion across basic block boundaries,
8846 resulting in faster schedules. This option is experimental, as not
8847 all machine descriptions used by GCC model the CPU closely enough
8848 to avoid unreliable results from the algorithm.
8849
8850 This only makes sense when scheduling after register allocation,
8851 i.e. with -fschedule-insns2 or at -O2 or higher.
8852
8853 -fsched-group-heuristic
8854 Enable the group heuristic in the scheduler. This heuristic favors
8855 the instruction that belongs to a schedule group. This is enabled
8856 by default when scheduling is enabled, i.e. with -fschedule-insns
8857 or -fschedule-insns2 or at -O2 or higher.
8858
8859 -fsched-critical-path-heuristic
8860 Enable the critical-path heuristic in the scheduler. This
8861 heuristic favors instructions on the critical path. This is
8862 enabled by default when scheduling is enabled, i.e. with
8863 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
8864
8865 -fsched-spec-insn-heuristic
8866 Enable the speculative instruction heuristic in the scheduler.
8867 This heuristic favors speculative instructions with greater
8868 dependency weakness. This is enabled by default when scheduling is
8869 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8870 or higher.
8871
8872 -fsched-rank-heuristic
8873 Enable the rank heuristic in the scheduler. This heuristic favors
8874 the instruction belonging to a basic block with greater size or
8875 frequency. This is enabled by default when scheduling is enabled,
8876 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
8877 higher.
8878
8879 -fsched-last-insn-heuristic
8880 Enable the last-instruction heuristic in the scheduler. This
8881 heuristic favors the instruction that is less dependent on the last
8882 instruction scheduled. This is enabled by default when scheduling
8883 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
8884 -O2 or higher.
8885
8886 -fsched-dep-count-heuristic
8887 Enable the dependent-count heuristic in the scheduler. This
8888 heuristic favors the instruction that has more instructions
8889 depending on it. This is enabled by default when scheduling is
8890 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8891 or higher.
8892
8893 -freschedule-modulo-scheduled-loops
8894 Modulo scheduling is performed before traditional scheduling. If a
8895 loop is modulo scheduled, later scheduling passes may change its
8896 schedule. Use this option to control that behavior.
8897
8898 -fselective-scheduling
8899 Schedule instructions using selective scheduling algorithm.
8900 Selective scheduling runs instead of the first scheduler pass.
8901
8902 -fselective-scheduling2
8903 Schedule instructions using selective scheduling algorithm.
8904 Selective scheduling runs instead of the second scheduler pass.
8905
8906 -fsel-sched-pipelining
8907 Enable software pipelining of innermost loops during selective
8908 scheduling. This option has no effect unless one of
8909 -fselective-scheduling or -fselective-scheduling2 is turned on.
8910
8911 -fsel-sched-pipelining-outer-loops
8912 When pipelining loops during selective scheduling, also pipeline
8913 outer loops. This option has no effect unless
8914 -fsel-sched-pipelining is turned on.
8915
8916 -fsemantic-interposition
8917 Some object formats, like ELF, allow interposing of symbols by the
8918 dynamic linker. This means that for symbols exported from the DSO,
8919 the compiler cannot perform interprocedural propagation, inlining
8920 and other optimizations in anticipation that the function or
8921 variable in question may change. While this feature is useful, for
8922 example, to rewrite memory allocation functions by a debugging
8923 implementation, it is expensive in the terms of code quality. With
8924 -fno-semantic-interposition the compiler assumes that if
8925 interposition happens for functions the overwriting function will
8926 have precisely the same semantics (and side effects). Similarly if
8927 interposition happens for variables, the constructor of the
8928 variable will be the same. The flag has no effect for functions
8929 explicitly declared inline (where it is never allowed for
8930 interposition to change semantics) and for symbols explicitly
8931 declared weak.
8932
8933 -fshrink-wrap
8934 Emit function prologues only before parts of the function that need
8935 it, rather than at the top of the function. This flag is enabled
8936 by default at -O and higher.
8937
8938 -fshrink-wrap-separate
8939 Shrink-wrap separate parts of the prologue and epilogue separately,
8940 so that those parts are only executed when needed. This option is
8941 on by default, but has no effect unless -fshrink-wrap is also
8942 turned on and the target supports this.
8943
8944 -fcaller-saves
8945 Enable allocation of values to registers that are clobbered by
8946 function calls, by emitting extra instructions to save and restore
8947 the registers around such calls. Such allocation is done only when
8948 it seems to result in better code.
8949
8950 This option is always enabled by default on certain machines,
8951 usually those which have no call-preserved registers to use
8952 instead.
8953
8954 Enabled at levels -O2, -O3, -Os.
8955
8956 -fcombine-stack-adjustments
8957 Tracks stack adjustments (pushes and pops) and stack memory
8958 references and then tries to find ways to combine them.
8959
8960 Enabled by default at -O1 and higher.
8961
8962 -fipa-ra
8963 Use caller save registers for allocation if those registers are not
8964 used by any called function. In that case it is not necessary to
8965 save and restore them around calls. This is only possible if
8966 called functions are part of same compilation unit as current
8967 function and they are compiled before it.
8968
8969 Enabled at levels -O2, -O3, -Os, however the option is disabled if
8970 generated code will be instrumented for profiling (-p, or -pg) or
8971 if callee's register usage cannot be known exactly (this happens on
8972 targets that do not expose prologues and epilogues in RTL).
8973
8974 -fconserve-stack
8975 Attempt to minimize stack usage. The compiler attempts to use less
8976 stack space, even if that makes the program slower. This option
8977 implies setting the large-stack-frame parameter to 100 and the
8978 large-stack-frame-growth parameter to 400.
8979
8980 -ftree-reassoc
8981 Perform reassociation on trees. This flag is enabled by default at
8982 -O and higher.
8983
8984 -fcode-hoisting
8985 Perform code hoisting. Code hoisting tries to move the evaluation
8986 of expressions executed on all paths to the function exit as early
8987 as possible. This is especially useful as a code size
8988 optimization, but it often helps for code speed as well. This flag
8989 is enabled by default at -O2 and higher.
8990
8991 -ftree-pre
8992 Perform partial redundancy elimination (PRE) on trees. This flag
8993 is enabled by default at -O2 and -O3.
8994
8995 -ftree-partial-pre
8996 Make partial redundancy elimination (PRE) more aggressive. This
8997 flag is enabled by default at -O3.
8998
8999 -ftree-forwprop
9000 Perform forward propagation on trees. This flag is enabled by
9001 default at -O and higher.
9002
9003 -ftree-fre
9004 Perform full redundancy elimination (FRE) on trees. The difference
9005 between FRE and PRE is that FRE only considers expressions that are
9006 computed on all paths leading to the redundant computation. This
9007 analysis is faster than PRE, though it exposes fewer redundancies.
9008 This flag is enabled by default at -O and higher.
9009
9010 -ftree-phiprop
9011 Perform hoisting of loads from conditional pointers on trees. This
9012 pass is enabled by default at -O and higher.
9013
9014 -fhoist-adjacent-loads
9015 Speculatively hoist loads from both branches of an if-then-else if
9016 the loads are from adjacent locations in the same structure and the
9017 target architecture has a conditional move instruction. This flag
9018 is enabled by default at -O2 and higher.
9019
9020 -ftree-copy-prop
9021 Perform copy propagation on trees. This pass eliminates
9022 unnecessary copy operations. This flag is enabled by default at -O
9023 and higher.
9024
9025 -fipa-pure-const
9026 Discover which functions are pure or constant. Enabled by default
9027 at -O and higher.
9028
9029 -fipa-reference
9030 Discover which static variables do not escape the compilation unit.
9031 Enabled by default at -O and higher.
9032
9033 -fipa-reference-addressable
9034 Discover read-only, write-only and non-addressable static
9035 variables. Enabled by default at -O and higher.
9036
9037 -fipa-stack-alignment
9038 Reduce stack alignment on call sites if possible. Enabled by
9039 default.
9040
9041 -fipa-pta
9042 Perform interprocedural pointer analysis and interprocedural
9043 modification and reference analysis. This option can cause
9044 excessive memory and compile-time usage on large compilation units.
9045 It is not enabled by default at any optimization level.
9046
9047 -fipa-profile
9048 Perform interprocedural profile propagation. The functions called
9049 only from cold functions are marked as cold. Also functions
9050 executed once (such as "cold", "noreturn", static constructors or
9051 destructors) are identified. Cold functions and loop less parts of
9052 functions executed once are then optimized for size. Enabled by
9053 default at -O and higher.
9054
9055 -fipa-modref
9056 Perform interprocedural mod/ref analysis. This optimization
9057 analyzes the side effects of functions (memory locations that are
9058 modified or referenced) and enables better optimization across the
9059 function call boundary. This flag is enabled by default at -O and
9060 higher.
9061
9062 -fipa-cp
9063 Perform interprocedural constant propagation. This optimization
9064 analyzes the program to determine when values passed to functions
9065 are constants and then optimizes accordingly. This optimization
9066 can substantially increase performance if the application has
9067 constants passed to functions. This flag is enabled by default at
9068 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9069 -fauto-profile.
9070
9071 -fipa-cp-clone
9072 Perform function cloning to make interprocedural constant
9073 propagation stronger. When enabled, interprocedural constant
9074 propagation performs function cloning when externally visible
9075 function can be called with constant arguments. Because this
9076 optimization can create multiple copies of functions, it may
9077 significantly increase code size (see --param
9078 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9079 It is also enabled by -fprofile-use and -fauto-profile.
9080
9081 -fipa-bit-cp
9082 When enabled, perform interprocedural bitwise constant propagation.
9083 This flag is enabled by default at -O2 and by -fprofile-use and
9084 -fauto-profile. It requires that -fipa-cp is enabled.
9085
9086 -fipa-vrp
9087 When enabled, perform interprocedural propagation of value ranges.
9088 This flag is enabled by default at -O2. It requires that -fipa-cp
9089 is enabled.
9090
9091 -fipa-icf
9092 Perform Identical Code Folding for functions and read-only
9093 variables. The optimization reduces code size and may disturb
9094 unwind stacks by replacing a function by equivalent one with a
9095 different name. The optimization works more effectively with link-
9096 time optimization enabled.
9097
9098 Although the behavior is similar to the Gold Linker's ICF
9099 optimization, GCC ICF works on different levels and thus the
9100 optimizations are not same - there are equivalences that are found
9101 only by GCC and equivalences found only by Gold.
9102
9103 This flag is enabled by default at -O2 and -Os.
9104
9105 -flive-patching=level
9106 Control GCC's optimizations to produce output suitable for live-
9107 patching.
9108
9109 If the compiler's optimization uses a function's body or
9110 information extracted from its body to optimize/change another
9111 function, the latter is called an impacted function of the former.
9112 If a function is patched, its impacted functions should be patched
9113 too.
9114
9115 The impacted functions are determined by the compiler's
9116 interprocedural optimizations. For example, a caller is impacted
9117 when inlining a function into its caller, cloning a function and
9118 changing its caller to call this new clone, or extracting a
9119 function's pureness/constness information to optimize its direct or
9120 indirect callers, etc.
9121
9122 Usually, the more IPA optimizations enabled, the larger the number
9123 of impacted functions for each function. In order to control the
9124 number of impacted functions and more easily compute the list of
9125 impacted function, IPA optimizations can be partially enabled at
9126 two different levels.
9127
9128 The level argument should be one of the following:
9129
9130 inline-clone
9131 Only enable inlining and cloning optimizations, which includes
9132 inlining, cloning, interprocedural scalar replacement of
9133 aggregates and partial inlining. As a result, when patching a
9134 function, all its callers and its clones' callers are impacted,
9135 therefore need to be patched as well.
9136
9137 -flive-patching=inline-clone disables the following
9138 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9139 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9140 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9141 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9142
9143 inline-only-static
9144 Only enable inlining of static functions. As a result, when
9145 patching a static function, all its callers are impacted and so
9146 need to be patched as well.
9147
9148 In addition to all the flags that -flive-patching=inline-clone
9149 disables, -flive-patching=inline-only-static disables the
9150 following additional optimization flags: -fipa-cp-clone
9151 -fipa-sra -fpartial-inlining -fipa-cp
9152
9153 When -flive-patching is specified without any value, the default
9154 value is inline-clone.
9155
9156 This flag is disabled by default.
9157
9158 Note that -flive-patching is not supported with link-time
9159 optimization (-flto).
9160
9161 -fisolate-erroneous-paths-dereference
9162 Detect paths that trigger erroneous or undefined behavior due to
9163 dereferencing a null pointer. Isolate those paths from the main
9164 control flow and turn the statement with erroneous or undefined
9165 behavior into a trap. This flag is enabled by default at -O2 and
9166 higher and depends on -fdelete-null-pointer-checks also being
9167 enabled.
9168
9169 -fisolate-erroneous-paths-attribute
9170 Detect paths that trigger erroneous or undefined behavior due to a
9171 null value being used in a way forbidden by a "returns_nonnull" or
9172 "nonnull" attribute. Isolate those paths from the main control
9173 flow and turn the statement with erroneous or undefined behavior
9174 into a trap. This is not currently enabled, but may be enabled by
9175 -O2 in the future.
9176
9177 -ftree-sink
9178 Perform forward store motion on trees. This flag is enabled by
9179 default at -O and higher.
9180
9181 -ftree-bit-ccp
9182 Perform sparse conditional bit constant propagation on trees and
9183 propagate pointer alignment information. This pass only operates
9184 on local scalar variables and is enabled by default at -O1 and
9185 higher, except for -Og. It requires that -ftree-ccp is enabled.
9186
9187 -ftree-ccp
9188 Perform sparse conditional constant propagation (CCP) on trees.
9189 This pass only operates on local scalar variables and is enabled by
9190 default at -O and higher.
9191
9192 -fssa-backprop
9193 Propagate information about uses of a value up the definition chain
9194 in order to simplify the definitions. For example, this pass
9195 strips sign operations if the sign of a value never matters. The
9196 flag is enabled by default at -O and higher.
9197
9198 -fssa-phiopt
9199 Perform pattern matching on SSA PHI nodes to optimize conditional
9200 code. This pass is enabled by default at -O1 and higher, except
9201 for -Og.
9202
9203 -ftree-switch-conversion
9204 Perform conversion of simple initializations in a switch to
9205 initializations from a scalar array. This flag is enabled by
9206 default at -O2 and higher.
9207
9208 -ftree-tail-merge
9209 Look for identical code sequences. When found, replace one with a
9210 jump to the other. This optimization is known as tail merging or
9211 cross jumping. This flag is enabled by default at -O2 and higher.
9212 The compilation time in this pass can be limited using max-tail-
9213 merge-comparisons parameter and max-tail-merge-iterations
9214 parameter.
9215
9216 -ftree-dce
9217 Perform dead code elimination (DCE) on trees. This flag is enabled
9218 by default at -O and higher.
9219
9220 -ftree-builtin-call-dce
9221 Perform conditional dead code elimination (DCE) for calls to built-
9222 in functions that may set "errno" but are otherwise free of side
9223 effects. This flag is enabled by default at -O2 and higher if -Os
9224 is not also specified.
9225
9226 -ffinite-loops
9227 Assume that a loop with an exit will eventually take the exit and
9228 not loop indefinitely. This allows the compiler to remove loops
9229 that otherwise have no side-effects, not considering eventual
9230 endless looping as such.
9231
9232 This option is enabled by default at -O2 for C++ with -std=c++11 or
9233 higher.
9234
9235 -ftree-dominator-opts
9236 Perform a variety of simple scalar cleanups (constant/copy
9237 propagation, redundancy elimination, range propagation and
9238 expression simplification) based on a dominator tree traversal.
9239 This also performs jump threading (to reduce jumps to jumps). This
9240 flag is enabled by default at -O and higher.
9241
9242 -ftree-dse
9243 Perform dead store elimination (DSE) on trees. A dead store is a
9244 store into a memory location that is later overwritten by another
9245 store without any intervening loads. In this case the earlier
9246 store can be deleted. This flag is enabled by default at -O and
9247 higher.
9248
9249 -ftree-ch
9250 Perform loop header copying on trees. This is beneficial since it
9251 increases effectiveness of code motion optimizations. It also
9252 saves one jump. This flag is enabled by default at -O and higher.
9253 It is not enabled for -Os, since it usually increases code size.
9254
9255 -ftree-loop-optimize
9256 Perform loop optimizations on trees. This flag is enabled by
9257 default at -O and higher.
9258
9259 -ftree-loop-linear
9260 -floop-strip-mine
9261 -floop-block
9262 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9263 use this code transformation, GCC has to be configured with
9264 --with-isl to enable the Graphite loop transformation
9265 infrastructure.
9266
9267 -fgraphite-identity
9268 Enable the identity transformation for graphite. For every SCoP we
9269 generate the polyhedral representation and transform it back to
9270 gimple. Using -fgraphite-identity we can check the costs or
9271 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9272 minimal optimizations are also performed by the code generator isl,
9273 like index splitting and dead code elimination in loops.
9274
9275 -floop-nest-optimize
9276 Enable the isl based loop nest optimizer. This is a generic loop
9277 nest optimizer based on the Pluto optimization algorithms. It
9278 calculates a loop structure optimized for data-locality and
9279 parallelism. This option is experimental.
9280
9281 -floop-parallelize-all
9282 Use the Graphite data dependence analysis to identify loops that
9283 can be parallelized. Parallelize all the loops that can be
9284 analyzed to not contain loop carried dependences without checking
9285 that it is profitable to parallelize the loops.
9286
9287 -ftree-coalesce-vars
9288 While transforming the program out of the SSA representation,
9289 attempt to reduce copying by coalescing versions of different user-
9290 defined variables, instead of just compiler temporaries. This may
9291 severely limit the ability to debug an optimized program compiled
9292 with -fno-var-tracking-assignments. In the negated form, this flag
9293 prevents SSA coalescing of user variables. This option is enabled
9294 by default if optimization is enabled, and it does very little
9295 otherwise.
9296
9297 -ftree-loop-if-convert
9298 Attempt to transform conditional jumps in the innermost loops to
9299 branch-less equivalents. The intent is to remove control-flow from
9300 the innermost loops in order to improve the ability of the
9301 vectorization pass to handle these loops. This is enabled by
9302 default if vectorization is enabled.
9303
9304 -ftree-loop-distribution
9305 Perform loop distribution. This flag can improve cache performance
9306 on big loop bodies and allow further loop optimizations, like
9307 parallelization or vectorization, to take place. For example, the
9308 loop
9309
9310 DO I = 1, N
9311 A(I) = B(I) + C
9312 D(I) = E(I) * F
9313 ENDDO
9314
9315 is transformed to
9316
9317 DO I = 1, N
9318 A(I) = B(I) + C
9319 ENDDO
9320 DO I = 1, N
9321 D(I) = E(I) * F
9322 ENDDO
9323
9324 This flag is enabled by default at -O3. It is also enabled by
9325 -fprofile-use and -fauto-profile.
9326
9327 -ftree-loop-distribute-patterns
9328 Perform loop distribution of patterns that can be code generated
9329 with calls to a library. This flag is enabled by default at -O2
9330 and higher, and by -fprofile-use and -fauto-profile.
9331
9332 This pass distributes the initialization loops and generates a call
9333 to memset zero. For example, the loop
9334
9335 DO I = 1, N
9336 A(I) = 0
9337 B(I) = A(I) + I
9338 ENDDO
9339
9340 is transformed to
9341
9342 DO I = 1, N
9343 A(I) = 0
9344 ENDDO
9345 DO I = 1, N
9346 B(I) = A(I) + I
9347 ENDDO
9348
9349 and the initialization loop is transformed into a call to memset
9350 zero. This flag is enabled by default at -O3. It is also enabled
9351 by -fprofile-use and -fauto-profile.
9352
9353 -floop-interchange
9354 Perform loop interchange outside of graphite. This flag can
9355 improve cache performance on loop nest and allow further loop
9356 optimizations, like vectorization, to take place. For example, the
9357 loop
9358
9359 for (int i = 0; i < N; i++)
9360 for (int j = 0; j < N; j++)
9361 for (int k = 0; k < N; k++)
9362 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9363
9364 is transformed to
9365
9366 for (int i = 0; i < N; i++)
9367 for (int k = 0; k < N; k++)
9368 for (int j = 0; j < N; j++)
9369 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9370
9371 This flag is enabled by default at -O3. It is also enabled by
9372 -fprofile-use and -fauto-profile.
9373
9374 -floop-unroll-and-jam
9375 Apply unroll and jam transformations on feasible loops. In a loop
9376 nest this unrolls the outer loop by some factor and fuses the
9377 resulting multiple inner loops. This flag is enabled by default at
9378 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9379
9380 -ftree-loop-im
9381 Perform loop invariant motion on trees. This pass moves only
9382 invariants that are hard to handle at RTL level (function calls,
9383 operations that expand to nontrivial sequences of insns). With
9384 -funswitch-loops it also moves operands of conditions that are
9385 invariant out of the loop, so that we can use just trivial
9386 invariantness analysis in loop unswitching. The pass also includes
9387 store motion.
9388
9389 -ftree-loop-ivcanon
9390 Create a canonical counter for number of iterations in loops for
9391 which determining number of iterations requires complicated
9392 analysis. Later optimizations then may determine the number
9393 easily. Useful especially in connection with unrolling.
9394
9395 -ftree-scev-cprop
9396 Perform final value replacement. If a variable is modified in a
9397 loop in such a way that its value when exiting the loop can be
9398 determined using only its initial value and the number of loop
9399 iterations, replace uses of the final value by such a computation,
9400 provided it is sufficiently cheap. This reduces data dependencies
9401 and may allow further simplifications. Enabled by default at -O
9402 and higher.
9403
9404 -fivopts
9405 Perform induction variable optimizations (strength reduction,
9406 induction variable merging and induction variable elimination) on
9407 trees.
9408
9409 -ftree-parallelize-loops=n
9410 Parallelize loops, i.e., split their iteration space to run in n
9411 threads. This is only possible for loops whose iterations are
9412 independent and can be arbitrarily reordered. The optimization is
9413 only profitable on multiprocessor machines, for loops that are CPU-
9414 intensive, rather than constrained e.g. by memory bandwidth. This
9415 option implies -pthread, and thus is only supported on targets that
9416 have support for -pthread.
9417
9418 -ftree-pta
9419 Perform function-local points-to analysis on trees. This flag is
9420 enabled by default at -O1 and higher, except for -Og.
9421
9422 -ftree-sra
9423 Perform scalar replacement of aggregates. This pass replaces
9424 structure references with scalars to prevent committing structures
9425 to memory too early. This flag is enabled by default at -O1 and
9426 higher, except for -Og.
9427
9428 -fstore-merging
9429 Perform merging of narrow stores to consecutive memory addresses.
9430 This pass merges contiguous stores of immediate values narrower
9431 than a word into fewer wider stores to reduce the number of
9432 instructions. This is enabled by default at -O2 and higher as well
9433 as -Os.
9434
9435 -ftree-ter
9436 Perform temporary expression replacement during the SSA->normal
9437 phase. Single use/single def temporaries are replaced at their use
9438 location with their defining expression. This results in non-
9439 GIMPLE code, but gives the expanders much more complex trees to
9440 work on resulting in better RTL generation. This is enabled by
9441 default at -O and higher.
9442
9443 -ftree-slsr
9444 Perform straight-line strength reduction on trees. This recognizes
9445 related expressions involving multiplications and replaces them by
9446 less expensive calculations when possible. This is enabled by
9447 default at -O and higher.
9448
9449 -ftree-vectorize
9450 Perform vectorization on trees. This flag enables
9451 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
9452 specified.
9453
9454 -ftree-loop-vectorize
9455 Perform loop vectorization on trees. This flag is enabled by
9456 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9457 -fauto-profile.
9458
9459 -ftree-slp-vectorize
9460 Perform basic block vectorization on trees. This flag is enabled by
9461 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9462 -fauto-profile.
9463
9464 -fvect-cost-model=model
9465 Alter the cost model used for vectorization. The model argument
9466 should be one of unlimited, dynamic, cheap or very-cheap. With the
9467 unlimited model the vectorized code-path is assumed to be
9468 profitable while with the dynamic model a runtime check guards the
9469 vectorized code-path to enable it only for iteration counts that
9470 will likely execute faster than when executing the original scalar
9471 loop. The cheap model disables vectorization of loops where doing
9472 so would be cost prohibitive for example due to required runtime
9473 checks for data dependence or alignment but otherwise is equal to
9474 the dynamic model. The very-cheap model only allows vectorization
9475 if the vector code would entirely replace the scalar code that is
9476 being vectorized. For example, if each iteration of a vectorized
9477 loop would only be able to handle exactly four iterations of the
9478 scalar loop, the very-cheap model would only allow vectorization if
9479 the scalar iteration count is known to be a multiple of four.
9480
9481 The default cost model depends on other optimization flags and is
9482 either dynamic or cheap.
9483
9484 -fsimd-cost-model=model
9485 Alter the cost model used for vectorization of loops marked with
9486 the OpenMP simd directive. The model argument should be one of
9487 unlimited, dynamic, cheap. All values of model have the same
9488 meaning as described in -fvect-cost-model and by default a cost
9489 model defined with -fvect-cost-model is used.
9490
9491 -ftree-vrp
9492 Perform Value Range Propagation on trees. This is similar to the
9493 constant propagation pass, but instead of values, ranges of values
9494 are propagated. This allows the optimizers to remove unnecessary
9495 range checks like array bound checks and null pointer checks. This
9496 is enabled by default at -O2 and higher. Null pointer check
9497 elimination is only done if -fdelete-null-pointer-checks is
9498 enabled.
9499
9500 -fsplit-paths
9501 Split paths leading to loop backedges. This can improve dead code
9502 elimination and common subexpression elimination. This is enabled
9503 by default at -O3 and above.
9504
9505 -fsplit-ivs-in-unroller
9506 Enables expression of values of induction variables in later
9507 iterations of the unrolled loop using the value in the first
9508 iteration. This breaks long dependency chains, thus improving
9509 efficiency of the scheduling passes.
9510
9511 A combination of -fweb and CSE is often sufficient to obtain the
9512 same effect. However, that is not reliable in cases where the loop
9513 body is more complicated than a single basic block. It also does
9514 not work at all on some architectures due to restrictions in the
9515 CSE pass.
9516
9517 This optimization is enabled by default.
9518
9519 -fvariable-expansion-in-unroller
9520 With this option, the compiler creates multiple copies of some
9521 local variables when unrolling a loop, which can result in superior
9522 code.
9523
9524 This optimization is enabled by default for PowerPC targets, but
9525 disabled by default otherwise.
9526
9527 -fpartial-inlining
9528 Inline parts of functions. This option has any effect only when
9529 inlining itself is turned on by the -finline-functions or
9530 -finline-small-functions options.
9531
9532 Enabled at levels -O2, -O3, -Os.
9533
9534 -fpredictive-commoning
9535 Perform predictive commoning optimization, i.e., reusing
9536 computations (especially memory loads and stores) performed in
9537 previous iterations of loops.
9538
9539 This option is enabled at level -O3. It is also enabled by
9540 -fprofile-use and -fauto-profile.
9541
9542 -fprefetch-loop-arrays
9543 If supported by the target machine, generate instructions to
9544 prefetch memory to improve the performance of loops that access
9545 large arrays.
9546
9547 This option may generate better or worse code; results are highly
9548 dependent on the structure of loops within the source code.
9549
9550 Disabled at level -Os.
9551
9552 -fno-printf-return-value
9553 Do not substitute constants for known return value of formatted
9554 output functions such as "sprintf", "snprintf", "vsprintf", and
9555 "vsnprintf" (but not "printf" of "fprintf"). This transformation
9556 allows GCC to optimize or even eliminate branches based on the
9557 known return value of these functions called with arguments that
9558 are either constant, or whose values are known to be in a range
9559 that makes determining the exact return value possible. For
9560 example, when -fprintf-return-value is in effect, both the branch
9561 and the body of the "if" statement (but not the call to "snprint")
9562 can be optimized away when "i" is a 32-bit or smaller integer
9563 because the return value is guaranteed to be at most 8.
9564
9565 char buf[9];
9566 if (snprintf (buf, "%08x", i) >= sizeof buf)
9567 ...
9568
9569 The -fprintf-return-value option relies on other optimizations and
9570 yields best results with -O2 and above. It works in tandem with
9571 the -Wformat-overflow and -Wformat-truncation options. The
9572 -fprintf-return-value option is enabled by default.
9573
9574 -fno-peephole
9575 -fno-peephole2
9576 Disable any machine-specific peephole optimizations. The
9577 difference between -fno-peephole and -fno-peephole2 is in how they
9578 are implemented in the compiler; some targets use one, some use the
9579 other, a few use both.
9580
9581 -fpeephole is enabled by default. -fpeephole2 enabled at levels
9582 -O2, -O3, -Os.
9583
9584 -fno-guess-branch-probability
9585 Do not guess branch probabilities using heuristics.
9586
9587 GCC uses heuristics to guess branch probabilities if they are not
9588 provided by profiling feedback (-fprofile-arcs). These heuristics
9589 are based on the control flow graph. If some branch probabilities
9590 are specified by "__builtin_expect", then the heuristics are used
9591 to guess branch probabilities for the rest of the control flow
9592 graph, taking the "__builtin_expect" info into account. The
9593 interactions between the heuristics and "__builtin_expect" can be
9594 complex, and in some cases, it may be useful to disable the
9595 heuristics so that the effects of "__builtin_expect" are easier to
9596 understand.
9597
9598 It is also possible to specify expected probability of the
9599 expression with "__builtin_expect_with_probability" built-in
9600 function.
9601
9602 The default is -fguess-branch-probability at levels -O, -O2, -O3,
9603 -Os.
9604
9605 -freorder-blocks
9606 Reorder basic blocks in the compiled function in order to reduce
9607 number of taken branches and improve code locality.
9608
9609 Enabled at levels -O, -O2, -O3, -Os.
9610
9611 -freorder-blocks-algorithm=algorithm
9612 Use the specified algorithm for basic block reordering. The
9613 algorithm argument can be simple, which does not increase code size
9614 (except sometimes due to secondary effects like alignment), or stc,
9615 the "software trace cache" algorithm, which tries to put all often
9616 executed code together, minimizing the number of branches executed
9617 by making extra copies of code.
9618
9619 The default is simple at levels -O, -Os, and stc at levels -O2,
9620 -O3.
9621
9622 -freorder-blocks-and-partition
9623 In addition to reordering basic blocks in the compiled function, in
9624 order to reduce number of taken branches, partitions hot and cold
9625 basic blocks into separate sections of the assembly and .o files,
9626 to improve paging and cache locality performance.
9627
9628 This optimization is automatically turned off in the presence of
9629 exception handling or unwind tables (on targets using
9630 setjump/longjump or target specific scheme), for linkonce sections,
9631 for functions with a user-defined section attribute and on any
9632 architecture that does not support named sections. When
9633 -fsplit-stack is used this option is not enabled by default (to
9634 avoid linker errors), but may be enabled explicitly (if using a
9635 working linker).
9636
9637 Enabled for x86 at levels -O2, -O3, -Os.
9638
9639 -freorder-functions
9640 Reorder functions in the object file in order to improve code
9641 locality. This is implemented by using special subsections
9642 ".text.hot" for most frequently executed functions and
9643 ".text.unlikely" for unlikely executed functions. Reordering is
9644 done by the linker so object file format must support named
9645 sections and linker must place them in a reasonable way.
9646
9647 This option isn't effective unless you either provide profile
9648 feedback (see -fprofile-arcs for details) or manually annotate
9649 functions with "hot" or "cold" attributes.
9650
9651 Enabled at levels -O2, -O3, -Os.
9652
9653 -fstrict-aliasing
9654 Allow the compiler to assume the strictest aliasing rules
9655 applicable to the language being compiled. For C (and C++), this
9656 activates optimizations based on the type of expressions. In
9657 particular, an object of one type is assumed never to reside at the
9658 same address as an object of a different type, unless the types are
9659 almost the same. For example, an "unsigned int" can alias an
9660 "int", but not a "void*" or a "double". A character type may alias
9661 any other type.
9662
9663 Pay special attention to code like this:
9664
9665 union a_union {
9666 int i;
9667 double d;
9668 };
9669
9670 int f() {
9671 union a_union t;
9672 t.d = 3.0;
9673 return t.i;
9674 }
9675
9676 The practice of reading from a different union member than the one
9677 most recently written to (called "type-punning") is common. Even
9678 with -fstrict-aliasing, type-punning is allowed, provided the
9679 memory is accessed through the union type. So, the code above
9680 works as expected. However, this code might not:
9681
9682 int f() {
9683 union a_union t;
9684 int* ip;
9685 t.d = 3.0;
9686 ip = &t.i;
9687 return *ip;
9688 }
9689
9690 Similarly, access by taking the address, casting the resulting
9691 pointer and dereferencing the result has undefined behavior, even
9692 if the cast uses a union type, e.g.:
9693
9694 int f() {
9695 double d = 3.0;
9696 return ((union a_union *) &d)->i;
9697 }
9698
9699 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
9700
9701 -falign-functions
9702 -falign-functions=n
9703 -falign-functions=n:m
9704 -falign-functions=n:m:n2
9705 -falign-functions=n:m:n2:m2
9706 Align the start of functions to the next power-of-two greater than
9707 or equal to n, skipping up to m-1 bytes. This ensures that at
9708 least the first m bytes of the function can be fetched by the CPU
9709 without crossing an n-byte alignment boundary.
9710
9711 If m is not specified, it defaults to n.
9712
9713 Examples: -falign-functions=32 aligns functions to the next 32-byte
9714 boundary, -falign-functions=24 aligns to the next 32-byte boundary
9715 only if this can be done by skipping 23 bytes or less,
9716 -falign-functions=32:7 aligns to the next 32-byte boundary only if
9717 this can be done by skipping 6 bytes or less.
9718
9719 The second pair of n2:m2 values allows you to specify a secondary
9720 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
9721 boundary if this can be done by skipping 6 bytes or less, otherwise
9722 aligns to the next 32-byte boundary if this can be done by skipping
9723 2 bytes or less. If m2 is not specified, it defaults to n2.
9724
9725 Some assemblers only support this flag when n is a power of two; in
9726 that case, it is rounded up.
9727
9728 -fno-align-functions and -falign-functions=1 are equivalent and
9729 mean that functions are not aligned.
9730
9731 If n is not specified or is zero, use a machine-dependent default.
9732 The maximum allowed n option value is 65536.
9733
9734 Enabled at levels -O2, -O3.
9735
9736 -flimit-function-alignment
9737 If this option is enabled, the compiler tries to avoid
9738 unnecessarily overaligning functions. It attempts to instruct the
9739 assembler to align by the amount specified by -falign-functions,
9740 but not to skip more bytes than the size of the function.
9741
9742 -falign-labels
9743 -falign-labels=n
9744 -falign-labels=n:m
9745 -falign-labels=n:m:n2
9746 -falign-labels=n:m:n2:m2
9747 Align all branch targets to a power-of-two boundary.
9748
9749 Parameters of this option are analogous to the -falign-functions
9750 option. -fno-align-labels and -falign-labels=1 are equivalent and
9751 mean that labels are not aligned.
9752
9753 If -falign-loops or -falign-jumps are applicable and are greater
9754 than this value, then their values are used instead.
9755
9756 If n is not specified or is zero, use a machine-dependent default
9757 which is very likely to be 1, meaning no alignment. The maximum
9758 allowed n option value is 65536.
9759
9760 Enabled at levels -O2, -O3.
9761
9762 -falign-loops
9763 -falign-loops=n
9764 -falign-loops=n:m
9765 -falign-loops=n:m:n2
9766 -falign-loops=n:m:n2:m2
9767 Align loops to a power-of-two boundary. If the loops are executed
9768 many times, this makes up for any execution of the dummy padding
9769 instructions.
9770
9771 If -falign-labels is greater than this value, then its value is
9772 used instead.
9773
9774 Parameters of this option are analogous to the -falign-functions
9775 option. -fno-align-loops and -falign-loops=1 are equivalent and
9776 mean that loops are not aligned. The maximum allowed n option
9777 value is 65536.
9778
9779 If n is not specified or is zero, use a machine-dependent default.
9780
9781 Enabled at levels -O2, -O3.
9782
9783 -falign-jumps
9784 -falign-jumps=n
9785 -falign-jumps=n:m
9786 -falign-jumps=n:m:n2
9787 -falign-jumps=n:m:n2:m2
9788 Align branch targets to a power-of-two boundary, for branch targets
9789 where the targets can only be reached by jumping. In this case, no
9790 dummy operations need be executed.
9791
9792 If -falign-labels is greater than this value, then its value is
9793 used instead.
9794
9795 Parameters of this option are analogous to the -falign-functions
9796 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
9797 mean that loops are not aligned.
9798
9799 If n is not specified or is zero, use a machine-dependent default.
9800 The maximum allowed n option value is 65536.
9801
9802 Enabled at levels -O2, -O3.
9803
9804 -fno-allocation-dce
9805 Do not remove unused C++ allocations in dead code elimination.
9806
9807 -fallow-store-data-races
9808 Allow the compiler to perform optimizations that may introduce new
9809 data races on stores, without proving that the variable cannot be
9810 concurrently accessed by other threads. Does not affect
9811 optimization of local data. It is safe to use this option if it is
9812 known that global data will not be accessed by multiple threads.
9813
9814 Examples of optimizations enabled by -fallow-store-data-races
9815 include hoisting or if-conversions that may cause a value that was
9816 already in memory to be re-written with that same value. Such re-
9817 writing is safe in a single threaded context but may be unsafe in a
9818 multi-threaded context. Note that on some processors, if-
9819 conversions may be required in order to enable vectorization.
9820
9821 Enabled at level -Ofast.
9822
9823 -funit-at-a-time
9824 This option is left for compatibility reasons. -funit-at-a-time has
9825 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
9826 and -fno-section-anchors.
9827
9828 Enabled by default.
9829
9830 -fno-toplevel-reorder
9831 Do not reorder top-level functions, variables, and "asm"
9832 statements. Output them in the same order that they appear in the
9833 input file. When this option is used, unreferenced static
9834 variables are not removed. This option is intended to support
9835 existing code that relies on a particular ordering. For new code,
9836 it is better to use attributes when possible.
9837
9838 -ftoplevel-reorder is the default at -O1 and higher, and also at
9839 -O0 if -fsection-anchors is explicitly requested. Additionally
9840 -fno-toplevel-reorder implies -fno-section-anchors.
9841
9842 -fweb
9843 Constructs webs as commonly used for register allocation purposes
9844 and assign each web individual pseudo register. This allows the
9845 register allocation pass to operate on pseudos directly, but also
9846 strengthens several other optimization passes, such as CSE, loop
9847 optimizer and trivial dead code remover. It can, however, make
9848 debugging impossible, since variables no longer stay in a "home
9849 register".
9850
9851 Enabled by default with -funroll-loops.
9852
9853 -fwhole-program
9854 Assume that the current compilation unit represents the whole
9855 program being compiled. All public functions and variables with
9856 the exception of "main" and those merged by attribute
9857 "externally_visible" become static functions and in effect are
9858 optimized more aggressively by interprocedural optimizers.
9859
9860 This option should not be used in combination with -flto. Instead
9861 relying on a linker plugin should provide safer and more precise
9862 information.
9863
9864 -flto[=n]
9865 This option runs the standard link-time optimizer. When invoked
9866 with source code, it generates GIMPLE (one of GCC's internal
9867 representations) and writes it to special ELF sections in the
9868 object file. When the object files are linked together, all the
9869 function bodies are read from these ELF sections and instantiated
9870 as if they had been part of the same translation unit.
9871
9872 To use the link-time optimizer, -flto and optimization options
9873 should be specified at compile time and during the final link. It
9874 is recommended that you compile all the files participating in the
9875 same link with the same options and also specify those options at
9876 link time. For example:
9877
9878 gcc -c -O2 -flto foo.c
9879 gcc -c -O2 -flto bar.c
9880 gcc -o myprog -flto -O2 foo.o bar.o
9881
9882 The first two invocations to GCC save a bytecode representation of
9883 GIMPLE into special ELF sections inside foo.o and bar.o. The final
9884 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
9885 the two files into a single internal image, and compiles the result
9886 as usual. Since both foo.o and bar.o are merged into a single
9887 image, this causes all the interprocedural analyses and
9888 optimizations in GCC to work across the two files as if they were a
9889 single one. This means, for example, that the inliner is able to
9890 inline functions in bar.o into functions in foo.o and vice-versa.
9891
9892 Another (simpler) way to enable link-time optimization is:
9893
9894 gcc -o myprog -flto -O2 foo.c bar.c
9895
9896 The above generates bytecode for foo.c and bar.c, merges them
9897 together into a single GIMPLE representation and optimizes them as
9898 usual to produce myprog.
9899
9900 The important thing to keep in mind is that to enable link-time
9901 optimizations you need to use the GCC driver to perform the link
9902 step. GCC automatically performs link-time optimization if any of
9903 the objects involved were compiled with the -flto command-line
9904 option. You can always override the automatic decision to do link-
9905 time optimization by passing -fno-lto to the link command.
9906
9907 To make whole program optimization effective, it is necessary to
9908 make certain whole program assumptions. The compiler needs to know
9909 what functions and variables can be accessed by libraries and
9910 runtime outside of the link-time optimized unit. When supported by
9911 the linker, the linker plugin (see -fuse-linker-plugin) passes
9912 information to the compiler about used and externally visible
9913 symbols. When the linker plugin is not available, -fwhole-program
9914 should be used to allow the compiler to make these assumptions,
9915 which leads to more aggressive optimization decisions.
9916
9917 When a file is compiled with -flto without -fuse-linker-plugin, the
9918 generated object file is larger than a regular object file because
9919 it contains GIMPLE bytecodes and the usual final code (see
9920 -ffat-lto-objects). This means that object files with LTO
9921 information can be linked as normal object files; if -fno-lto is
9922 passed to the linker, no interprocedural optimizations are applied.
9923 Note that when -fno-fat-lto-objects is enabled the compile stage is
9924 faster but you cannot perform a regular, non-LTO link on them.
9925
9926 When producing the final binary, GCC only applies link-time
9927 optimizations to those files that contain bytecode. Therefore, you
9928 can mix and match object files and libraries with GIMPLE bytecodes
9929 and final object code. GCC automatically selects which files to
9930 optimize in LTO mode and which files to link without further
9931 processing.
9932
9933 Generally, options specified at link time override those specified
9934 at compile time, although in some cases GCC attempts to infer link-
9935 time options from the settings used to compile the input files.
9936
9937 If you do not specify an optimization level option -O at link time,
9938 then GCC uses the highest optimization level used when compiling
9939 the object files. Note that it is generally ineffective to specify
9940 an optimization level option only at link time and not at compile
9941 time, for two reasons. First, compiling without optimization
9942 suppresses compiler passes that gather information needed for
9943 effective optimization at link time. Second, some early
9944 optimization passes can be performed only at compile time and not
9945 at link time.
9946
9947 There are some code generation flags preserved by GCC when
9948 generating bytecodes, as they need to be used during the final
9949 link. Currently, the following options and their settings are
9950 taken from the first object file that explicitly specifies them:
9951 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
9952 -m target flags.
9953
9954 The following options -fPIC, -fpic, -fpie and -fPIE are combined
9955 based on the following scheme:
9956
9957 B<-fPIC> + B<-fpic> = B<-fpic>
9958 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
9959 B<-fpic/-fPIC> + (no option) = (no option)
9960 B<-fPIC> + B<-fPIE> = B<-fPIE>
9961 B<-fpic> + B<-fPIE> = B<-fpie>
9962 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
9963
9964 Certain ABI-changing flags are required to match in all compilation
9965 units, and trying to override this at link time with a conflicting
9966 value is ignored. This includes options such as
9967 -freg-struct-return and -fpcc-struct-return.
9968
9969 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
9970 -fno-trapv or -fno-strict-aliasing are passed through to the link
9971 stage and merged conservatively for conflicting translation units.
9972 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
9973 precedence; and for example -ffp-contract=off takes precedence over
9974 -ffp-contract=fast. You can override them at link time.
9975
9976 Diagnostic options such as -Wstringop-overflow are passed through
9977 to the link stage and their setting matches that of the compile-
9978 step at function granularity. Note that this matters only for
9979 diagnostics emitted during optimization. Note that code transforms
9980 such as inlining can lead to warnings being enabled or disabled for
9981 regions if code not consistent with the setting at compile time.
9982
9983 When you need to pass options to the assembler via -Wa or
9984 -Xassembler make sure to either compile such translation units with
9985 -fno-lto or consistently use the same assembler options on all
9986 translation units. You can alternatively also specify assembler
9987 options at LTO link time.
9988
9989 To enable debug info generation you need to supply -g at compile
9990 time. If any of the input files at link time were built with debug
9991 info generation enabled the link will enable debug info generation
9992 as well. Any elaborate debug info settings like the dwarf level
9993 -gdwarf-5 need to be explicitly repeated at the linker command line
9994 and mixing different settings in different translation units is
9995 discouraged.
9996
9997 If LTO encounters objects with C linkage declared with incompatible
9998 types in separate translation units to be linked together
9999 (undefined behavior according to ISO C99 6.2.7), a non-fatal
10000 diagnostic may be issued. The behavior is still undefined at run
10001 time. Similar diagnostics may be raised for other languages.
10002
10003 Another feature of LTO is that it is possible to apply
10004 interprocedural optimizations on files written in different
10005 languages:
10006
10007 gcc -c -flto foo.c
10008 g++ -c -flto bar.cc
10009 gfortran -c -flto baz.f90
10010 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10011
10012 Notice that the final link is done with g++ to get the C++ runtime
10013 libraries and -lgfortran is added to get the Fortran runtime
10014 libraries. In general, when mixing languages in LTO mode, you
10015 should use the same link command options as when mixing languages
10016 in a regular (non-LTO) compilation.
10017
10018 If object files containing GIMPLE bytecode are stored in a library
10019 archive, say libfoo.a, it is possible to extract and use them in an
10020 LTO link if you are using a linker with plugin support. To create
10021 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10022 instead of ar and ranlib; to show the symbols of object files with
10023 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10024 ranlib and nm have been compiled with plugin support. At link
10025 time, use the flag -fuse-linker-plugin to ensure that the library
10026 participates in the LTO optimization process:
10027
10028 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10029
10030 With the linker plugin enabled, the linker extracts the needed
10031 GIMPLE files from libfoo.a and passes them on to the running GCC to
10032 make them part of the aggregated GIMPLE image to be optimized.
10033
10034 If you are not using a linker with plugin support and/or do not
10035 enable the linker plugin, then the objects inside libfoo.a are
10036 extracted and linked as usual, but they do not participate in the
10037 LTO optimization process. In order to make a static library
10038 suitable for both LTO optimization and usual linkage, compile its
10039 object files with -flto -ffat-lto-objects.
10040
10041 Link-time optimizations do not require the presence of the whole
10042 program to operate. If the program does not require any symbols to
10043 be exported, it is possible to combine -flto and -fwhole-program to
10044 allow the interprocedural optimizers to use more aggressive
10045 assumptions which may lead to improved optimization opportunities.
10046 Use of -fwhole-program is not needed when linker plugin is active
10047 (see -fuse-linker-plugin).
10048
10049 The current implementation of LTO makes no attempt to generate
10050 bytecode that is portable between different types of hosts. The
10051 bytecode files are versioned and there is a strict version check,
10052 so bytecode files generated in one version of GCC do not work with
10053 an older or newer version of GCC.
10054
10055 Link-time optimization does not work well with generation of
10056 debugging information on systems other than those using a
10057 combination of ELF and DWARF.
10058
10059 If you specify the optional n, the optimization and code generation
10060 done at link time is executed in parallel using n parallel jobs by
10061 utilizing an installed make program. The environment variable MAKE
10062 may be used to override the program used.
10063
10064 You can also specify -flto=jobserver to use GNU make's job server
10065 mode to determine the number of parallel jobs. This is useful when
10066 the Makefile calling GCC is already executing in parallel. You
10067 must prepend a + to the command recipe in the parent Makefile for
10068 this to work. This option likely only works if MAKE is GNU make.
10069 Even without the option value, GCC tries to automatically detect a
10070 running GNU make's job server.
10071
10072 Use -flto=auto to use GNU make's job server, if available, or
10073 otherwise fall back to autodetection of the number of CPU threads
10074 present in your system.
10075
10076 -flto-partition=alg
10077 Specify the partitioning algorithm used by the link-time optimizer.
10078 The value is either 1to1 to specify a partitioning mirroring the
10079 original source files or balanced to specify partitioning into
10080 equally sized chunks (whenever possible) or max to create new
10081 partition for every symbol where possible. Specifying none as an
10082 algorithm disables partitioning and streaming completely. The
10083 default value is balanced. While 1to1 can be used as an workaround
10084 for various code ordering issues, the max partitioning is intended
10085 for internal testing only. The value one specifies that exactly
10086 one partition should be used while the value none bypasses
10087 partitioning and executes the link-time optimization step directly
10088 from the WPA phase.
10089
10090 -flto-compression-level=n
10091 This option specifies the level of compression used for
10092 intermediate language written to LTO object files, and is only
10093 meaningful in conjunction with LTO mode (-flto). GCC currently
10094 supports two LTO compression algorithms. For zstd, valid values are
10095 0 (no compression) to 19 (maximum compression), while zlib supports
10096 values from 0 to 9. Values outside this range are clamped to
10097 either minimum or maximum of the supported values. If the option
10098 is not given, a default balanced compression setting is used.
10099
10100 -fuse-linker-plugin
10101 Enables the use of a linker plugin during link-time optimization.
10102 This option relies on plugin support in the linker, which is
10103 available in gold or in GNU ld 2.21 or newer.
10104
10105 This option enables the extraction of object files with GIMPLE
10106 bytecode out of library archives. This improves the quality of
10107 optimization by exposing more code to the link-time optimizer.
10108 This information specifies what symbols can be accessed externally
10109 (by non-LTO object or during dynamic linking). Resulting code
10110 quality improvements on binaries (and shared libraries that use
10111 hidden visibility) are similar to -fwhole-program. See -flto for a
10112 description of the effect of this flag and how to use it.
10113
10114 This option is enabled by default when LTO support in GCC is
10115 enabled and GCC was configured for use with a linker supporting
10116 plugins (GNU ld 2.21 or newer or gold).
10117
10118 -ffat-lto-objects
10119 Fat LTO objects are object files that contain both the intermediate
10120 language and the object code. This makes them usable for both LTO
10121 linking and normal linking. This option is effective only when
10122 compiling with -flto and is ignored at link time.
10123
10124 -fno-fat-lto-objects improves compilation time over plain LTO, but
10125 requires the complete toolchain to be aware of LTO. It requires a
10126 linker with linker plugin support for basic functionality.
10127 Additionally, nm, ar and ranlib need to support linker plugins to
10128 allow a full-featured build environment (capable of building static
10129 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10130 wrappers to pass the right options to these tools. With non fat LTO
10131 makefiles need to be modified to use them.
10132
10133 Note that modern binutils provide plugin auto-load mechanism.
10134 Installing the linker plugin into $libdir/bfd-plugins has the same
10135 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10136 ranlib).
10137
10138 The default is -fno-fat-lto-objects on targets with linker plugin
10139 support.
10140
10141 -fcompare-elim
10142 After register allocation and post-register allocation instruction
10143 splitting, identify arithmetic instructions that compute processor
10144 flags similar to a comparison operation based on that arithmetic.
10145 If possible, eliminate the explicit comparison operation.
10146
10147 This pass only applies to certain targets that cannot explicitly
10148 represent the comparison operation before register allocation is
10149 complete.
10150
10151 Enabled at levels -O, -O2, -O3, -Os.
10152
10153 -fcprop-registers
10154 After register allocation and post-register allocation instruction
10155 splitting, perform a copy-propagation pass to try to reduce
10156 scheduling dependencies and occasionally eliminate the copy.
10157
10158 Enabled at levels -O, -O2, -O3, -Os.
10159
10160 -fprofile-correction
10161 Profiles collected using an instrumented binary for multi-threaded
10162 programs may be inconsistent due to missed counter updates. When
10163 this option is specified, GCC uses heuristics to correct or smooth
10164 out such inconsistencies. By default, GCC emits an error message
10165 when an inconsistent profile is detected.
10166
10167 This option is enabled by -fauto-profile.
10168
10169 -fprofile-partial-training
10170 With "-fprofile-use" all portions of programs not executed during
10171 train run are optimized agressively for size rather than speed. In
10172 some cases it is not practical to train all possible hot paths in
10173 the program. (For example, program may contain functions specific
10174 for a given hardware and trianing may not cover all hardware
10175 configurations program is run on.) With
10176 "-fprofile-partial-training" profile feedback will be ignored for
10177 all functions not executed during the train run leading them to be
10178 optimized as if they were compiled without profile feedback. This
10179 leads to better performance when train run is not representative
10180 but also leads to significantly bigger code.
10181
10182 -fprofile-use
10183 -fprofile-use=path
10184 Enable profile feedback-directed optimizations, and the following
10185 optimizations, many of which are generally profitable only with
10186 profile feedback available:
10187
10188 -fbranch-probabilities -fprofile-values -funroll-loops
10189 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10190 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10191 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10192 -ftree-slp-vectorize -fvect-cost-model=dynamic
10193 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10194
10195 Before you can use this option, you must first generate profiling
10196 information.
10197
10198 By default, GCC emits an error message if the feedback profiles do
10199 not match the source code. This error can be turned into a warning
10200 by using -Wno-error=coverage-mismatch. Note this may result in
10201 poorly optimized code. Additionally, by default, GCC also emits a
10202 warning message if the feedback profiles do not exist (see
10203 -Wmissing-profile).
10204
10205 If path is specified, GCC looks at the path to find the profile
10206 feedback data files. See -fprofile-dir.
10207
10208 -fauto-profile
10209 -fauto-profile=path
10210 Enable sampling-based feedback-directed optimizations, and the
10211 following optimizations, many of which are generally profitable
10212 only with profile feedback available:
10213
10214 -fbranch-probabilities -fprofile-values -funroll-loops
10215 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10216 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10217 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10218 -ftree-slp-vectorize -fvect-cost-model=dynamic
10219 -ftree-loop-distribute-patterns -fprofile-correction
10220
10221 path is the name of a file containing AutoFDO profile information.
10222 If omitted, it defaults to fbdata.afdo in the current directory.
10223
10224 Producing an AutoFDO profile data file requires running your
10225 program with the perf utility on a supported GNU/Linux target
10226 system. For more information, see <https://perf.wiki.kernel.org/>.
10227
10228 E.g.
10229
10230 perf record -e br_inst_retired:near_taken -b -o perf.data \
10231 -- your_program
10232
10233 Then use the create_gcov tool to convert the raw profile data to a
10234 format that can be used by GCC. You must also supply the
10235 unstripped binary for your program to this tool. See
10236 <https://github.com/google/autofdo>.
10237
10238 E.g.
10239
10240 create_gcov --binary=your_program.unstripped --profile=perf.data \
10241 --gcov=profile.afdo
10242
10243 The following options control compiler behavior regarding floating-
10244 point arithmetic. These options trade off between speed and
10245 correctness. All must be specifically enabled.
10246
10247 -ffloat-store
10248 Do not store floating-point variables in registers, and inhibit
10249 other options that might change whether a floating-point value is
10250 taken from a register or memory.
10251
10252 This option prevents undesirable excess precision on machines such
10253 as the 68000 where the floating registers (of the 68881) keep more
10254 precision than a "double" is supposed to have. Similarly for the
10255 x86 architecture. For most programs, the excess precision does
10256 only good, but a few programs rely on the precise definition of
10257 IEEE floating point. Use -ffloat-store for such programs, after
10258 modifying them to store all pertinent intermediate computations
10259 into variables.
10260
10261 -fexcess-precision=style
10262 This option allows further control over excess precision on
10263 machines where floating-point operations occur in a format with
10264 more precision or range than the IEEE standard and interchange
10265 floating-point types. By default, -fexcess-precision=fast is in
10266 effect; this means that operations may be carried out in a wider
10267 precision than the types specified in the source if that would
10268 result in faster code, and it is unpredictable when rounding to the
10269 types specified in the source code takes place. When compiling C,
10270 if -fexcess-precision=standard is specified then excess precision
10271 follows the rules specified in ISO C99; in particular, both casts
10272 and assignments cause values to be rounded to their semantic types
10273 (whereas -ffloat-store only affects assignments). This option is
10274 enabled by default for C if a strict conformance option such as
10275 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10276 default regardless of whether a strict conformance option is used.
10277
10278 -fexcess-precision=standard is not implemented for languages other
10279 than C. On the x86, it has no effect if -mfpmath=sse or
10280 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10281 apply without excess precision, and in the latter, rounding is
10282 unpredictable.
10283
10284 -ffast-math
10285 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10286 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10287 -fcx-limited-range and -fexcess-precision=fast.
10288
10289 This option causes the preprocessor macro "__FAST_MATH__" to be
10290 defined.
10291
10292 This option is not turned on by any -O option besides -Ofast since
10293 it can result in incorrect output for programs that depend on an
10294 exact implementation of IEEE or ISO rules/specifications for math
10295 functions. It may, however, yield faster code for programs that do
10296 not require the guarantees of these specifications.
10297
10298 -fno-math-errno
10299 Do not set "errno" after calling math functions that are executed
10300 with a single instruction, e.g., "sqrt". A program that relies on
10301 IEEE exceptions for math error handling may want to use this flag
10302 for speed while maintaining IEEE arithmetic compatibility.
10303
10304 This option is not turned on by any -O option since it can result
10305 in incorrect output for programs that depend on an exact
10306 implementation of IEEE or ISO rules/specifications for math
10307 functions. It may, however, yield faster code for programs that do
10308 not require the guarantees of these specifications.
10309
10310 The default is -fmath-errno.
10311
10312 On Darwin systems, the math library never sets "errno". There is
10313 therefore no reason for the compiler to consider the possibility
10314 that it might, and -fno-math-errno is the default.
10315
10316 -funsafe-math-optimizations
10317 Allow optimizations for floating-point arithmetic that (a) assume
10318 that arguments and results are valid and (b) may violate IEEE or
10319 ANSI standards. When used at link time, it may include libraries
10320 or startup files that change the default FPU control word or other
10321 similar optimizations.
10322
10323 This option is not turned on by any -O option since it can result
10324 in incorrect output for programs that depend on an exact
10325 implementation of IEEE or ISO rules/specifications for math
10326 functions. It may, however, yield faster code for programs that do
10327 not require the guarantees of these specifications. Enables
10328 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10329 -freciprocal-math.
10330
10331 The default is -fno-unsafe-math-optimizations.
10332
10333 -fassociative-math
10334 Allow re-association of operands in series of floating-point
10335 operations. This violates the ISO C and C++ language standard by
10336 possibly changing computation result. NOTE: re-ordering may change
10337 the sign of zero as well as ignore NaNs and inhibit or create
10338 underflow or overflow (and thus cannot be used on code that relies
10339 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10340 floating-point comparisons and thus may not be used when ordered
10341 comparisons are required. This option requires that both
10342 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10343 it doesn't make much sense with -frounding-math. For Fortran the
10344 option is automatically enabled when both -fno-signed-zeros and
10345 -fno-trapping-math are in effect.
10346
10347 The default is -fno-associative-math.
10348
10349 -freciprocal-math
10350 Allow the reciprocal of a value to be used instead of dividing by
10351 the value if this enables optimizations. For example "x / y" can
10352 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10353 to common subexpression elimination. Note that this loses
10354 precision and increases the number of flops operating on the value.
10355
10356 The default is -fno-reciprocal-math.
10357
10358 -ffinite-math-only
10359 Allow optimizations for floating-point arithmetic that assume that
10360 arguments and results are not NaNs or +-Infs.
10361
10362 This option is not turned on by any -O option since it can result
10363 in incorrect output for programs that depend on an exact
10364 implementation of IEEE or ISO rules/specifications for math
10365 functions. It may, however, yield faster code for programs that do
10366 not require the guarantees of these specifications.
10367
10368 The default is -fno-finite-math-only.
10369
10370 -fno-signed-zeros
10371 Allow optimizations for floating-point arithmetic that ignore the
10372 signedness of zero. IEEE arithmetic specifies the behavior of
10373 distinct +0.0 and -0.0 values, which then prohibits simplification
10374 of expressions such as x+0.0 or 0.0*x (even with
10375 -ffinite-math-only). This option implies that the sign of a zero
10376 result isn't significant.
10377
10378 The default is -fsigned-zeros.
10379
10380 -fno-trapping-math
10381 Compile code assuming that floating-point operations cannot
10382 generate user-visible traps. These traps include division by zero,
10383 overflow, underflow, inexact result and invalid operation. This
10384 option requires that -fno-signaling-nans be in effect. Setting
10385 this option may allow faster code if one relies on "non-stop" IEEE
10386 arithmetic, for example.
10387
10388 This option should never be turned on by any -O option since it can
10389 result in incorrect output for programs that depend on an exact
10390 implementation of IEEE or ISO rules/specifications for math
10391 functions.
10392
10393 The default is -ftrapping-math.
10394
10395 -frounding-math
10396 Disable transformations and optimizations that assume default
10397 floating-point rounding behavior. This is round-to-zero for all
10398 floating point to integer conversions, and round-to-nearest for all
10399 other arithmetic truncations. This option should be specified for
10400 programs that change the FP rounding mode dynamically, or that may
10401 be executed with a non-default rounding mode. This option disables
10402 constant folding of floating-point expressions at compile time
10403 (which may be affected by rounding mode) and arithmetic
10404 transformations that are unsafe in the presence of sign-dependent
10405 rounding modes.
10406
10407 The default is -fno-rounding-math.
10408
10409 This option is experimental and does not currently guarantee to
10410 disable all GCC optimizations that are affected by rounding mode.
10411 Future versions of GCC may provide finer control of this setting
10412 using C99's "FENV_ACCESS" pragma. This command-line option will be
10413 used to specify the default state for "FENV_ACCESS".
10414
10415 -fsignaling-nans
10416 Compile code assuming that IEEE signaling NaNs may generate user-
10417 visible traps during floating-point operations. Setting this
10418 option disables optimizations that may change the number of
10419 exceptions visible with signaling NaNs. This option implies
10420 -ftrapping-math.
10421
10422 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
10423 defined.
10424
10425 The default is -fno-signaling-nans.
10426
10427 This option is experimental and does not currently guarantee to
10428 disable all GCC optimizations that affect signaling NaN behavior.
10429
10430 -fno-fp-int-builtin-inexact
10431 Do not allow the built-in functions "ceil", "floor", "round" and
10432 "trunc", and their "float" and "long double" variants, to generate
10433 code that raises the "inexact" floating-point exception for
10434 noninteger arguments. ISO C99 and C11 allow these functions to
10435 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
10436 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
10437 allow these functions to do so.
10438
10439 The default is -ffp-int-builtin-inexact, allowing the exception to
10440 be raised, unless C2X or a later C standard is selected. This
10441 option does nothing unless -ftrapping-math is in effect.
10442
10443 Even if -fno-fp-int-builtin-inexact is used, if the functions
10444 generate a call to a library function then the "inexact" exception
10445 may be raised if the library implementation does not follow TS
10446 18661.
10447
10448 -fsingle-precision-constant
10449 Treat floating-point constants as single precision instead of
10450 implicitly converting them to double-precision constants.
10451
10452 -fcx-limited-range
10453 When enabled, this option states that a range reduction step is not
10454 needed when performing complex division. Also, there is no
10455 checking whether the result of a complex multiplication or division
10456 is "NaN + I*NaN", with an attempt to rescue the situation in that
10457 case. The default is -fno-cx-limited-range, but is enabled by
10458 -ffast-math.
10459
10460 This option controls the default setting of the ISO C99
10461 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
10462 languages.
10463
10464 -fcx-fortran-rules
10465 Complex multiplication and division follow Fortran rules. Range
10466 reduction is done as part of complex division, but there is no
10467 checking whether the result of a complex multiplication or division
10468 is "NaN + I*NaN", with an attempt to rescue the situation in that
10469 case.
10470
10471 The default is -fno-cx-fortran-rules.
10472
10473 The following options control optimizations that may improve
10474 performance, but are not enabled by any -O options. This section
10475 includes experimental options that may produce broken code.
10476
10477 -fbranch-probabilities
10478 After running a program compiled with -fprofile-arcs, you can
10479 compile it a second time using -fbranch-probabilities, to improve
10480 optimizations based on the number of times each branch was taken.
10481 When a program compiled with -fprofile-arcs exits, it saves arc
10482 execution counts to a file called sourcename.gcda for each source
10483 file. The information in this data file is very dependent on the
10484 structure of the generated code, so you must use the same source
10485 code and the same optimization options for both compilations.
10486
10487 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
10488 JUMP_INSN and CALL_INSN. These can be used to improve
10489 optimization. Currently, they are only used in one place: in
10490 reorg.c, instead of guessing which path a branch is most likely to
10491 take, the REG_BR_PROB values are used to exactly determine which
10492 path is taken more often.
10493
10494 Enabled by -fprofile-use and -fauto-profile.
10495
10496 -fprofile-values
10497 If combined with -fprofile-arcs, it adds code so that some data
10498 about values of expressions in the program is gathered.
10499
10500 With -fbranch-probabilities, it reads back the data gathered from
10501 profiling values of expressions for usage in optimizations.
10502
10503 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
10504
10505 -fprofile-reorder-functions
10506 Function reordering based on profile instrumentation collects first
10507 time of execution of a function and orders these functions in
10508 ascending order.
10509
10510 Enabled with -fprofile-use.
10511
10512 -fvpt
10513 If combined with -fprofile-arcs, this option instructs the compiler
10514 to add code to gather information about values of expressions.
10515
10516 With -fbranch-probabilities, it reads back the data gathered and
10517 actually performs the optimizations based on them. Currently the
10518 optimizations include specialization of division operations using
10519 the knowledge about the value of the denominator.
10520
10521 Enabled with -fprofile-use and -fauto-profile.
10522
10523 -frename-registers
10524 Attempt to avoid false dependencies in scheduled code by making use
10525 of registers left over after register allocation. This
10526 optimization most benefits processors with lots of registers.
10527 Depending on the debug information format adopted by the target,
10528 however, it can make debugging impossible, since variables no
10529 longer stay in a "home register".
10530
10531 Enabled by default with -funroll-loops.
10532
10533 -fschedule-fusion
10534 Performs a target dependent pass over the instruction stream to
10535 schedule instructions of same type together because target machine
10536 can execute them more efficiently if they are adjacent to each
10537 other in the instruction flow.
10538
10539 Enabled at levels -O2, -O3, -Os.
10540
10541 -ftracer
10542 Perform tail duplication to enlarge superblock size. This
10543 transformation simplifies the control flow of the function allowing
10544 other optimizations to do a better job.
10545
10546 Enabled by -fprofile-use and -fauto-profile.
10547
10548 -funroll-loops
10549 Unroll loops whose number of iterations can be determined at
10550 compile time or upon entry to the loop. -funroll-loops implies
10551 -frerun-cse-after-loop, -fweb and -frename-registers. It also
10552 turns on complete loop peeling (i.e. complete removal of loops with
10553 a small constant number of iterations). This option makes code
10554 larger, and may or may not make it run faster.
10555
10556 Enabled by -fprofile-use and -fauto-profile.
10557
10558 -funroll-all-loops
10559 Unroll all loops, even if their number of iterations is uncertain
10560 when the loop is entered. This usually makes programs run more
10561 slowly. -funroll-all-loops implies the same options as
10562 -funroll-loops.
10563
10564 -fpeel-loops
10565 Peels loops for which there is enough information that they do not
10566 roll much (from profile feedback or static analysis). It also
10567 turns on complete loop peeling (i.e. complete removal of loops with
10568 small constant number of iterations).
10569
10570 Enabled by -O3, -fprofile-use, and -fauto-profile.
10571
10572 -fmove-loop-invariants
10573 Enables the loop invariant motion pass in the RTL loop optimizer.
10574 Enabled at level -O1 and higher, except for -Og.
10575
10576 -fsplit-loops
10577 Split a loop into two if it contains a condition that's always true
10578 for one side of the iteration space and false for the other.
10579
10580 Enabled by -fprofile-use and -fauto-profile.
10581
10582 -funswitch-loops
10583 Move branches with loop invariant conditions out of the loop, with
10584 duplicates of the loop on both branches (modified according to
10585 result of the condition).
10586
10587 Enabled by -fprofile-use and -fauto-profile.
10588
10589 -fversion-loops-for-strides
10590 If a loop iterates over an array with a variable stride, create
10591 another version of the loop that assumes the stride is always one.
10592 For example:
10593
10594 for (int i = 0; i < n; ++i)
10595 x[i * stride] = ...;
10596
10597 becomes:
10598
10599 if (stride == 1)
10600 for (int i = 0; i < n; ++i)
10601 x[i] = ...;
10602 else
10603 for (int i = 0; i < n; ++i)
10604 x[i * stride] = ...;
10605
10606 This is particularly useful for assumed-shape arrays in Fortran
10607 where (for example) it allows better vectorization assuming
10608 contiguous accesses. This flag is enabled by default at -O3. It
10609 is also enabled by -fprofile-use and -fauto-profile.
10610
10611 -ffunction-sections
10612 -fdata-sections
10613 Place each function or data item into its own section in the output
10614 file if the target supports arbitrary sections. The name of the
10615 function or the name of the data item determines the section's name
10616 in the output file.
10617
10618 Use these options on systems where the linker can perform
10619 optimizations to improve locality of reference in the instruction
10620 space. Most systems using the ELF object format have linkers with
10621 such optimizations. On AIX, the linker rearranges sections
10622 (CSECTs) based on the call graph. The performance impact varies.
10623
10624 Together with a linker garbage collection (linker --gc-sections
10625 option) these options may lead to smaller statically-linked
10626 executables (after stripping).
10627
10628 On ELF/DWARF systems these options do not degenerate the quality of
10629 the debug information. There could be issues with other object
10630 files/debug info formats.
10631
10632 Only use these options when there are significant benefits from
10633 doing so. When you specify these options, the assembler and linker
10634 create larger object and executable files and are also slower.
10635 These options affect code generation. They prevent optimizations
10636 by the compiler and assembler using relative locations inside a
10637 translation unit since the locations are unknown until link time.
10638 An example of such an optimization is relaxing calls to short call
10639 instructions.
10640
10641 -fstdarg-opt
10642 Optimize the prologue of variadic argument functions with respect
10643 to usage of those arguments.
10644
10645 -fsection-anchors
10646 Try to reduce the number of symbolic address calculations by using
10647 shared "anchor" symbols to address nearby objects. This
10648 transformation can help to reduce the number of GOT entries and GOT
10649 accesses on some targets.
10650
10651 For example, the implementation of the following function "foo":
10652
10653 static int a, b, c;
10654 int foo (void) { return a + b + c; }
10655
10656 usually calculates the addresses of all three variables, but if you
10657 compile it with -fsection-anchors, it accesses the variables from a
10658 common anchor point instead. The effect is similar to the
10659 following pseudocode (which isn't valid C):
10660
10661 int foo (void)
10662 {
10663 register int *xr = &x;
10664 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10665 }
10666
10667 Not all targets support this option.
10668
10669 -fzero-call-used-regs=choice
10670 Zero call-used registers at function return to increase program
10671 security by either mitigating Return-Oriented Programming (ROP)
10672 attacks or preventing information leakage through registers.
10673
10674 The possible values of choice are the same as for the
10675 "zero_call_used_regs" attribute. The default is skip.
10676
10677 You can control this behavior for a specific function by using the
10678 function attribute "zero_call_used_regs".
10679
10680 --param name=value
10681 In some places, GCC uses various constants to control the amount of
10682 optimization that is done. For example, GCC does not inline
10683 functions that contain more than a certain number of instructions.
10684 You can control some of these constants on the command line using
10685 the --param option.
10686
10687 The names of specific parameters, and the meaning of the values,
10688 are tied to the internals of the compiler, and are subject to
10689 change without notice in future releases.
10690
10691 In order to get minimal, maximal and default value of a parameter,
10692 one can use --help=param -Q options.
10693
10694 In each case, the value is an integer. The following choices of
10695 name are recognized for all targets:
10696
10697 predictable-branch-outcome
10698 When branch is predicted to be taken with probability lower
10699 than this threshold (in percent), then it is considered well
10700 predictable.
10701
10702 max-rtl-if-conversion-insns
10703 RTL if-conversion tries to remove conditional branches around a
10704 block and replace them with conditionally executed
10705 instructions. This parameter gives the maximum number of
10706 instructions in a block which should be considered for if-
10707 conversion. The compiler will also use other heuristics to
10708 decide whether if-conversion is likely to be profitable.
10709
10710 max-rtl-if-conversion-predictable-cost
10711 RTL if-conversion will try to remove conditional branches
10712 around a block and replace them with conditionally executed
10713 instructions. These parameters give the maximum permissible
10714 cost for the sequence that would be generated by if-conversion
10715 depending on whether the branch is statically determined to be
10716 predictable or not. The units for this parameter are the same
10717 as those for the GCC internal seq_cost metric. The compiler
10718 will try to provide a reasonable default for this parameter
10719 using the BRANCH_COST target macro.
10720
10721 max-crossjump-edges
10722 The maximum number of incoming edges to consider for cross-
10723 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
10724 number of edges incoming to each block. Increasing values mean
10725 more aggressive optimization, making the compilation time
10726 increase with probably small improvement in executable size.
10727
10728 min-crossjump-insns
10729 The minimum number of instructions that must be matched at the
10730 end of two blocks before cross-jumping is performed on them.
10731 This value is ignored in the case where all instructions in the
10732 block being cross-jumped from are matched.
10733
10734 max-grow-copy-bb-insns
10735 The maximum code size expansion factor when copying basic
10736 blocks instead of jumping. The expansion is relative to a jump
10737 instruction.
10738
10739 max-goto-duplication-insns
10740 The maximum number of instructions to duplicate to a block that
10741 jumps to a computed goto. To avoid O(N^2) behavior in a number
10742 of passes, GCC factors computed gotos early in the compilation
10743 process, and unfactors them as late as possible. Only computed
10744 jumps at the end of a basic blocks with no more than max-goto-
10745 duplication-insns are unfactored.
10746
10747 max-delay-slot-insn-search
10748 The maximum number of instructions to consider when looking for
10749 an instruction to fill a delay slot. If more than this
10750 arbitrary number of instructions are searched, the time savings
10751 from filling the delay slot are minimal, so stop searching.
10752 Increasing values mean more aggressive optimization, making the
10753 compilation time increase with probably small improvement in
10754 execution time.
10755
10756 max-delay-slot-live-search
10757 When trying to fill delay slots, the maximum number of
10758 instructions to consider when searching for a block with valid
10759 live register information. Increasing this arbitrarily chosen
10760 value means more aggressive optimization, increasing the
10761 compilation time. This parameter should be removed when the
10762 delay slot code is rewritten to maintain the control-flow
10763 graph.
10764
10765 max-gcse-memory
10766 The approximate maximum amount of memory in "kB" that can be
10767 allocated in order to perform the global common subexpression
10768 elimination optimization. If more memory than specified is
10769 required, the optimization is not done.
10770
10771 max-gcse-insertion-ratio
10772 If the ratio of expression insertions to deletions is larger
10773 than this value for any expression, then RTL PRE inserts or
10774 removes the expression and thus leaves partially redundant
10775 computations in the instruction stream.
10776
10777 max-pending-list-length
10778 The maximum number of pending dependencies scheduling allows
10779 before flushing the current state and starting over. Large
10780 functions with few branches or calls can create excessively
10781 large lists which needlessly consume memory and resources.
10782
10783 max-modulo-backtrack-attempts
10784 The maximum number of backtrack attempts the scheduler should
10785 make when modulo scheduling a loop. Larger values can
10786 exponentially increase compilation time.
10787
10788 max-inline-insns-single
10789 Several parameters control the tree inliner used in GCC. This
10790 number sets the maximum number of instructions (counted in
10791 GCC's internal representation) in a single function that the
10792 tree inliner considers for inlining. This only affects
10793 functions declared inline and methods implemented in a class
10794 declaration (C++).
10795
10796 max-inline-insns-auto
10797 When you use -finline-functions (included in -O3), a lot of
10798 functions that would otherwise not be considered for inlining
10799 by the compiler are investigated. To those functions, a
10800 different (more restrictive) limit compared to functions
10801 declared inline can be applied (--param max-inline-insns-auto).
10802
10803 max-inline-insns-small
10804 This is bound applied to calls which are considered relevant
10805 with -finline-small-functions.
10806
10807 max-inline-insns-size
10808 This is bound applied to calls which are optimized for size.
10809 Small growth may be desirable to anticipate optimization
10810 oppurtunities exposed by inlining.
10811
10812 uninlined-function-insns
10813 Number of instructions accounted by inliner for function
10814 overhead such as function prologue and epilogue.
10815
10816 uninlined-function-time
10817 Extra time accounted by inliner for function overhead such as
10818 time needed to execute function prologue and epilogue
10819
10820 inline-heuristics-hint-percent
10821 The scale (in percents) applied to inline-insns-single,
10822 inline-insns-single-O2, inline-insns-auto when inline
10823 heuristics hints that inlining is very profitable (will enable
10824 later optimizations).
10825
10826 uninlined-thunk-insns
10827 uninlined-thunk-time
10828 Same as --param uninlined-function-insns and --param uninlined-
10829 function-time but applied to function thunks
10830
10831 inline-min-speedup
10832 When estimated performance improvement of caller + callee
10833 runtime exceeds this threshold (in percent), the function can
10834 be inlined regardless of the limit on --param max-inline-insns-
10835 single and --param max-inline-insns-auto.
10836
10837 large-function-insns
10838 The limit specifying really large functions. For functions
10839 larger than this limit after inlining, inlining is constrained
10840 by --param large-function-growth. This parameter is useful
10841 primarily to avoid extreme compilation time caused by non-
10842 linear algorithms used by the back end.
10843
10844 large-function-growth
10845 Specifies maximal growth of large function caused by inlining
10846 in percents. For example, parameter value 100 limits large
10847 function growth to 2.0 times the original size.
10848
10849 large-unit-insns
10850 The limit specifying large translation unit. Growth caused by
10851 inlining of units larger than this limit is limited by --param
10852 inline-unit-growth. For small units this might be too tight.
10853 For example, consider a unit consisting of function A that is
10854 inline and B that just calls A three times. If B is small
10855 relative to A, the growth of unit is 300\% and yet such
10856 inlining is very sane. For very large units consisting of
10857 small inlineable functions, however, the overall unit growth
10858 limit is needed to avoid exponential explosion of code size.
10859 Thus for smaller units, the size is increased to --param large-
10860 unit-insns before applying --param inline-unit-growth.
10861
10862 lazy-modules
10863 Maximum number of concurrently open C++ module files when lazy
10864 loading.
10865
10866 inline-unit-growth
10867 Specifies maximal overall growth of the compilation unit caused
10868 by inlining. For example, parameter value 20 limits unit
10869 growth to 1.2 times the original size. Cold functions (either
10870 marked cold via an attribute or by profile feedback) are not
10871 accounted into the unit size.
10872
10873 ipa-cp-unit-growth
10874 Specifies maximal overall growth of the compilation unit caused
10875 by interprocedural constant propagation. For example,
10876 parameter value 10 limits unit growth to 1.1 times the original
10877 size.
10878
10879 ipa-cp-large-unit-insns
10880 The size of translation unit that IPA-CP pass considers large.
10881
10882 large-stack-frame
10883 The limit specifying large stack frames. While inlining the
10884 algorithm is trying to not grow past this limit too much.
10885
10886 large-stack-frame-growth
10887 Specifies maximal growth of large stack frames caused by
10888 inlining in percents. For example, parameter value 1000 limits
10889 large stack frame growth to 11 times the original size.
10890
10891 max-inline-insns-recursive
10892 max-inline-insns-recursive-auto
10893 Specifies the maximum number of instructions an out-of-line
10894 copy of a self-recursive inline function can grow into by
10895 performing recursive inlining.
10896
10897 --param max-inline-insns-recursive applies to functions
10898 declared inline. For functions not declared inline, recursive
10899 inlining happens only when -finline-functions (included in -O3)
10900 is enabled; --param max-inline-insns-recursive-auto applies
10901 instead.
10902
10903 max-inline-recursive-depth
10904 max-inline-recursive-depth-auto
10905 Specifies the maximum recursion depth used for recursive
10906 inlining.
10907
10908 --param max-inline-recursive-depth applies to functions
10909 declared inline. For functions not declared inline, recursive
10910 inlining happens only when -finline-functions (included in -O3)
10911 is enabled; --param max-inline-recursive-depth-auto applies
10912 instead.
10913
10914 min-inline-recursive-probability
10915 Recursive inlining is profitable only for function having deep
10916 recursion in average and can hurt for function having little
10917 recursion depth by increasing the prologue size or complexity
10918 of function body to other optimizers.
10919
10920 When profile feedback is available (see -fprofile-generate) the
10921 actual recursion depth can be guessed from the probability that
10922 function recurses via a given call expression. This parameter
10923 limits inlining only to call expressions whose probability
10924 exceeds the given threshold (in percents).
10925
10926 early-inlining-insns
10927 Specify growth that the early inliner can make. In effect it
10928 increases the amount of inlining for code having a large
10929 abstraction penalty.
10930
10931 max-early-inliner-iterations
10932 Limit of iterations of the early inliner. This basically
10933 bounds the number of nested indirect calls the early inliner
10934 can resolve. Deeper chains are still handled by late inlining.
10935
10936 comdat-sharing-probability
10937 Probability (in percent) that C++ inline function with comdat
10938 visibility are shared across multiple compilation units.
10939
10940 modref-max-bases
10941 modref-max-refs
10942 modref-max-accesses
10943 Specifies the maximal number of base pointers, references and
10944 accesses stored for a single function by mod/ref analysis.
10945
10946 modref-max-tests
10947 Specifies the maxmal number of tests alias oracle can perform
10948 to disambiguate memory locations using the mod/ref information.
10949 This parameter ought to be bigger than --param modref-max-bases
10950 and --param modref-max-refs.
10951
10952 modref-max-depth
10953 Specifies the maximum depth of DFS walk used by modref escape
10954 analysis. Setting to 0 disables the analysis completely.
10955
10956 modref-max-escape-points
10957 Specifies the maximum number of escape points tracked by modref
10958 per SSA-name.
10959
10960 profile-func-internal-id
10961 A parameter to control whether to use function internal id in
10962 profile database lookup. If the value is 0, the compiler uses
10963 an id that is based on function assembler name and filename,
10964 which makes old profile data more tolerant to source changes
10965 such as function reordering etc.
10966
10967 min-vect-loop-bound
10968 The minimum number of iterations under which loops are not
10969 vectorized when -ftree-vectorize is used. The number of
10970 iterations after vectorization needs to be greater than the
10971 value specified by this option to allow vectorization.
10972
10973 gcse-cost-distance-ratio
10974 Scaling factor in calculation of maximum distance an expression
10975 can be moved by GCSE optimizations. This is currently
10976 supported only in the code hoisting pass. The bigger the
10977 ratio, the more aggressive code hoisting is with simple
10978 expressions, i.e., the expressions that have cost less than
10979 gcse-unrestricted-cost. Specifying 0 disables hoisting of
10980 simple expressions.
10981
10982 gcse-unrestricted-cost
10983 Cost, roughly measured as the cost of a single typical machine
10984 instruction, at which GCSE optimizations do not constrain the
10985 distance an expression can travel. This is currently supported
10986 only in the code hoisting pass. The lesser the cost, the more
10987 aggressive code hoisting is. Specifying 0 allows all
10988 expressions to travel unrestricted distances.
10989
10990 max-hoist-depth
10991 The depth of search in the dominator tree for expressions to
10992 hoist. This is used to avoid quadratic behavior in hoisting
10993 algorithm. The value of 0 does not limit on the search, but
10994 may slow down compilation of huge functions.
10995
10996 max-tail-merge-comparisons
10997 The maximum amount of similar bbs to compare a bb with. This
10998 is used to avoid quadratic behavior in tree tail merging.
10999
11000 max-tail-merge-iterations
11001 The maximum amount of iterations of the pass over the function.
11002 This is used to limit compilation time in tree tail merging.
11003
11004 store-merging-allow-unaligned
11005 Allow the store merging pass to introduce unaligned stores if
11006 it is legal to do so.
11007
11008 max-stores-to-merge
11009 The maximum number of stores to attempt to merge into wider
11010 stores in the store merging pass.
11011
11012 max-store-chains-to-track
11013 The maximum number of store chains to track at the same time in
11014 the attempt to merge them into wider stores in the store
11015 merging pass.
11016
11017 max-stores-to-track
11018 The maximum number of stores to track at the same time in the
11019 attemt to to merge them into wider stores in the store merging
11020 pass.
11021
11022 max-unrolled-insns
11023 The maximum number of instructions that a loop may have to be
11024 unrolled. If a loop is unrolled, this parameter also
11025 determines how many times the loop code is unrolled.
11026
11027 max-average-unrolled-insns
11028 The maximum number of instructions biased by probabilities of
11029 their execution that a loop may have to be unrolled. If a loop
11030 is unrolled, this parameter also determines how many times the
11031 loop code is unrolled.
11032
11033 max-unroll-times
11034 The maximum number of unrollings of a single loop.
11035
11036 max-peeled-insns
11037 The maximum number of instructions that a loop may have to be
11038 peeled. If a loop is peeled, this parameter also determines
11039 how many times the loop code is peeled.
11040
11041 max-peel-times
11042 The maximum number of peelings of a single loop.
11043
11044 max-peel-branches
11045 The maximum number of branches on the hot path through the
11046 peeled sequence.
11047
11048 max-completely-peeled-insns
11049 The maximum number of insns of a completely peeled loop.
11050
11051 max-completely-peel-times
11052 The maximum number of iterations of a loop to be suitable for
11053 complete peeling.
11054
11055 max-completely-peel-loop-nest-depth
11056 The maximum depth of a loop nest suitable for complete peeling.
11057
11058 max-unswitch-insns
11059 The maximum number of insns of an unswitched loop.
11060
11061 max-unswitch-level
11062 The maximum number of branches unswitched in a single loop.
11063
11064 lim-expensive
11065 The minimum cost of an expensive expression in the loop
11066 invariant motion.
11067
11068 min-loop-cond-split-prob
11069 When FDO profile information is available, min-loop-cond-split-
11070 prob specifies minimum threshold for probability of semi-
11071 invariant condition statement to trigger loop split.
11072
11073 iv-consider-all-candidates-bound
11074 Bound on number of candidates for induction variables, below
11075 which all candidates are considered for each use in induction
11076 variable optimizations. If there are more candidates than
11077 this, only the most relevant ones are considered to avoid
11078 quadratic time complexity.
11079
11080 iv-max-considered-uses
11081 The induction variable optimizations give up on loops that
11082 contain more induction variable uses.
11083
11084 iv-always-prune-cand-set-bound
11085 If the number of candidates in the set is smaller than this
11086 value, always try to remove unnecessary ivs from the set when
11087 adding a new one.
11088
11089 avg-loop-niter
11090 Average number of iterations of a loop.
11091
11092 dse-max-object-size
11093 Maximum size (in bytes) of objects tracked bytewise by dead
11094 store elimination. Larger values may result in larger
11095 compilation times.
11096
11097 dse-max-alias-queries-per-store
11098 Maximum number of queries into the alias oracle per store.
11099 Larger values result in larger compilation times and may result
11100 in more removed dead stores.
11101
11102 scev-max-expr-size
11103 Bound on size of expressions used in the scalar evolutions
11104 analyzer. Large expressions slow the analyzer.
11105
11106 scev-max-expr-complexity
11107 Bound on the complexity of the expressions in the scalar
11108 evolutions analyzer. Complex expressions slow the analyzer.
11109
11110 max-tree-if-conversion-phi-args
11111 Maximum number of arguments in a PHI supported by TREE if
11112 conversion unless the loop is marked with simd pragma.
11113
11114 vect-max-version-for-alignment-checks
11115 The maximum number of run-time checks that can be performed
11116 when doing loop versioning for alignment in the vectorizer.
11117
11118 vect-max-version-for-alias-checks
11119 The maximum number of run-time checks that can be performed
11120 when doing loop versioning for alias in the vectorizer.
11121
11122 vect-max-peeling-for-alignment
11123 The maximum number of loop peels to enhance access alignment
11124 for vectorizer. Value -1 means no limit.
11125
11126 max-iterations-to-track
11127 The maximum number of iterations of a loop the brute-force
11128 algorithm for analysis of the number of iterations of the loop
11129 tries to evaluate.
11130
11131 hot-bb-count-fraction
11132 The denominator n of fraction 1/n of the maximal execution
11133 count of a basic block in the entire program that a basic block
11134 needs to at least have in order to be considered hot. The
11135 default is 10000, which means that a basic block is considered
11136 hot if its execution count is greater than 1/10000 of the
11137 maximal execution count. 0 means that it is never considered
11138 hot. Used in non-LTO mode.
11139
11140 hot-bb-count-ws-permille
11141 The number of most executed permilles, ranging from 0 to 1000,
11142 of the profiled execution of the entire program to which the
11143 execution count of a basic block must be part of in order to be
11144 considered hot. The default is 990, which means that a basic
11145 block is considered hot if its execution count contributes to
11146 the upper 990 permilles, or 99.0%, of the profiled execution of
11147 the entire program. 0 means that it is never considered hot.
11148 Used in LTO mode.
11149
11150 hot-bb-frequency-fraction
11151 The denominator n of fraction 1/n of the execution frequency of
11152 the entry block of a function that a basic block of this
11153 function needs to at least have in order to be considered hot.
11154 The default is 1000, which means that a basic block is
11155 considered hot in a function if it is executed more frequently
11156 than 1/1000 of the frequency of the entry block of the
11157 function. 0 means that it is never considered hot.
11158
11159 unlikely-bb-count-fraction
11160 The denominator n of fraction 1/n of the number of profiled
11161 runs of the entire program below which the execution count of a
11162 basic block must be in order for the basic block to be
11163 considered unlikely executed. The default is 20, which means
11164 that a basic block is considered unlikely executed if it is
11165 executed in fewer than 1/20, or 5%, of the runs of the program.
11166 0 means that it is always considered unlikely executed.
11167
11168 max-predicted-iterations
11169 The maximum number of loop iterations we predict statically.
11170 This is useful in cases where a function contains a single loop
11171 with known bound and another loop with unknown bound. The
11172 known number of iterations is predicted correctly, while the
11173 unknown number of iterations average to roughly 10. This means
11174 that the loop without bounds appears artificially cold relative
11175 to the other one.
11176
11177 builtin-expect-probability
11178 Control the probability of the expression having the specified
11179 value. This parameter takes a percentage (i.e. 0 ... 100) as
11180 input.
11181
11182 builtin-string-cmp-inline-length
11183 The maximum length of a constant string for a builtin string
11184 cmp call eligible for inlining.
11185
11186 align-threshold
11187 Select fraction of the maximal frequency of executions of a
11188 basic block in a function to align the basic block.
11189
11190 align-loop-iterations
11191 A loop expected to iterate at least the selected number of
11192 iterations is aligned.
11193
11194 tracer-dynamic-coverage
11195 tracer-dynamic-coverage-feedback
11196 This value is used to limit superblock formation once the given
11197 percentage of executed instructions is covered. This limits
11198 unnecessary code size expansion.
11199
11200 The tracer-dynamic-coverage-feedback parameter is used only
11201 when profile feedback is available. The real profiles (as
11202 opposed to statically estimated ones) are much less balanced
11203 allowing the threshold to be larger value.
11204
11205 tracer-max-code-growth
11206 Stop tail duplication once code growth has reached given
11207 percentage. This is a rather artificial limit, as most of the
11208 duplicates are eliminated later in cross jumping, so it may be
11209 set to much higher values than is the desired code growth.
11210
11211 tracer-min-branch-ratio
11212 Stop reverse growth when the reverse probability of best edge
11213 is less than this threshold (in percent).
11214
11215 tracer-min-branch-probability
11216 tracer-min-branch-probability-feedback
11217 Stop forward growth if the best edge has probability lower than
11218 this threshold.
11219
11220 Similarly to tracer-dynamic-coverage two parameters are
11221 provided. tracer-min-branch-probability-feedback is used for
11222 compilation with profile feedback and tracer-min-branch-
11223 probability compilation without. The value for compilation
11224 with profile feedback needs to be more conservative (higher) in
11225 order to make tracer effective.
11226
11227 stack-clash-protection-guard-size
11228 Specify the size of the operating system provided stack guard
11229 as 2 raised to num bytes. Higher values may reduce the number
11230 of explicit probes, but a value larger than the operating
11231 system provided guard will leave code vulnerable to stack clash
11232 style attacks.
11233
11234 stack-clash-protection-probe-interval
11235 Stack clash protection involves probing stack space as it is
11236 allocated. This param controls the maximum distance between
11237 probes into the stack as 2 raised to num bytes. Higher values
11238 may reduce the number of explicit probes, but a value larger
11239 than the operating system provided guard will leave code
11240 vulnerable to stack clash style attacks.
11241
11242 max-cse-path-length
11243 The maximum number of basic blocks on path that CSE considers.
11244
11245 max-cse-insns
11246 The maximum number of instructions CSE processes before
11247 flushing.
11248
11249 ggc-min-expand
11250 GCC uses a garbage collector to manage its own memory
11251 allocation. This parameter specifies the minimum percentage by
11252 which the garbage collector's heap should be allowed to expand
11253 between collections. Tuning this may improve compilation
11254 speed; it has no effect on code generation.
11255
11256 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11257 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11258 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11259 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11260 particular platform, the lower bound of 30% is used. Setting
11261 this parameter and ggc-min-heapsize to zero causes a full
11262 collection to occur at every opportunity. This is extremely
11263 slow, but can be useful for debugging.
11264
11265 ggc-min-heapsize
11266 Minimum size of the garbage collector's heap before it begins
11267 bothering to collect garbage. The first collection occurs
11268 after the heap expands by ggc-min-expand% beyond ggc-min-
11269 heapsize. Again, tuning this may improve compilation speed,
11270 and has no effect on code generation.
11271
11272 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11273 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11274 exceeded, but with a lower bound of 4096 (four megabytes) and
11275 an upper bound of 131072 (128 megabytes). If GCC is not able
11276 to calculate RAM on a particular platform, the lower bound is
11277 used. Setting this parameter very large effectively disables
11278 garbage collection. Setting this parameter and ggc-min-expand
11279 to zero causes a full collection to occur at every opportunity.
11280
11281 max-reload-search-insns
11282 The maximum number of instruction reload should look backward
11283 for equivalent register. Increasing values mean more
11284 aggressive optimization, making the compilation time increase
11285 with probably slightly better performance.
11286
11287 max-cselib-memory-locations
11288 The maximum number of memory locations cselib should take into
11289 account. Increasing values mean more aggressive optimization,
11290 making the compilation time increase with probably slightly
11291 better performance.
11292
11293 max-sched-ready-insns
11294 The maximum number of instructions ready to be issued the
11295 scheduler should consider at any given time during the first
11296 scheduling pass. Increasing values mean more thorough
11297 searches, making the compilation time increase with probably
11298 little benefit.
11299
11300 max-sched-region-blocks
11301 The maximum number of blocks in a region to be considered for
11302 interblock scheduling.
11303
11304 max-pipeline-region-blocks
11305 The maximum number of blocks in a region to be considered for
11306 pipelining in the selective scheduler.
11307
11308 max-sched-region-insns
11309 The maximum number of insns in a region to be considered for
11310 interblock scheduling.
11311
11312 max-pipeline-region-insns
11313 The maximum number of insns in a region to be considered for
11314 pipelining in the selective scheduler.
11315
11316 min-spec-prob
11317 The minimum probability (in percents) of reaching a source
11318 block for interblock speculative scheduling.
11319
11320 max-sched-extend-regions-iters
11321 The maximum number of iterations through CFG to extend regions.
11322 A value of 0 disables region extensions.
11323
11324 max-sched-insn-conflict-delay
11325 The maximum conflict delay for an insn to be considered for
11326 speculative motion.
11327
11328 sched-spec-prob-cutoff
11329 The minimal probability of speculation success (in percents),
11330 so that speculative insns are scheduled.
11331
11332 sched-state-edge-prob-cutoff
11333 The minimum probability an edge must have for the scheduler to
11334 save its state across it.
11335
11336 sched-mem-true-dep-cost
11337 Minimal distance (in CPU cycles) between store and load
11338 targeting same memory locations.
11339
11340 selsched-max-lookahead
11341 The maximum size of the lookahead window of selective
11342 scheduling. It is a depth of search for available
11343 instructions.
11344
11345 selsched-max-sched-times
11346 The maximum number of times that an instruction is scheduled
11347 during selective scheduling. This is the limit on the number
11348 of iterations through which the instruction may be pipelined.
11349
11350 selsched-insns-to-rename
11351 The maximum number of best instructions in the ready list that
11352 are considered for renaming in the selective scheduler.
11353
11354 sms-min-sc
11355 The minimum value of stage count that swing modulo scheduler
11356 generates.
11357
11358 max-last-value-rtl
11359 The maximum size measured as number of RTLs that can be
11360 recorded in an expression in combiner for a pseudo register as
11361 last known value of that register.
11362
11363 max-combine-insns
11364 The maximum number of instructions the RTL combiner tries to
11365 combine.
11366
11367 integer-share-limit
11368 Small integer constants can use a shared data structure,
11369 reducing the compiler's memory usage and increasing its speed.
11370 This sets the maximum value of a shared integer constant.
11371
11372 ssp-buffer-size
11373 The minimum size of buffers (i.e. arrays) that receive stack
11374 smashing protection when -fstack-protection is used.
11375
11376 min-size-for-stack-sharing
11377 The minimum size of variables taking part in stack slot sharing
11378 when not optimizing.
11379
11380 max-jump-thread-duplication-stmts
11381 Maximum number of statements allowed in a block that needs to
11382 be duplicated when threading jumps.
11383
11384 max-fields-for-field-sensitive
11385 Maximum number of fields in a structure treated in a field
11386 sensitive manner during pointer analysis.
11387
11388 prefetch-latency
11389 Estimate on average number of instructions that are executed
11390 before prefetch finishes. The distance prefetched ahead is
11391 proportional to this constant. Increasing this number may also
11392 lead to less streams being prefetched (see simultaneous-
11393 prefetches).
11394
11395 simultaneous-prefetches
11396 Maximum number of prefetches that can run at the same time.
11397
11398 l1-cache-line-size
11399 The size of cache line in L1 data cache, in bytes.
11400
11401 l1-cache-size
11402 The size of L1 data cache, in kilobytes.
11403
11404 l2-cache-size
11405 The size of L2 data cache, in kilobytes.
11406
11407 prefetch-dynamic-strides
11408 Whether the loop array prefetch pass should issue software
11409 prefetch hints for strides that are non-constant. In some
11410 cases this may be beneficial, though the fact the stride is
11411 non-constant may make it hard to predict when there is clear
11412 benefit to issuing these hints.
11413
11414 Set to 1 if the prefetch hints should be issued for non-
11415 constant strides. Set to 0 if prefetch hints should be issued
11416 only for strides that are known to be constant and below
11417 prefetch-minimum-stride.
11418
11419 prefetch-minimum-stride
11420 Minimum constant stride, in bytes, to start using prefetch
11421 hints for. If the stride is less than this threshold, prefetch
11422 hints will not be issued.
11423
11424 This setting is useful for processors that have hardware
11425 prefetchers, in which case there may be conflicts between the
11426 hardware prefetchers and the software prefetchers. If the
11427 hardware prefetchers have a maximum stride they can handle, it
11428 should be used here to improve the use of software prefetchers.
11429
11430 A value of -1 means we don't have a threshold and therefore
11431 prefetch hints can be issued for any constant stride.
11432
11433 This setting is only useful for strides that are known and
11434 constant.
11435
11436 loop-interchange-max-num-stmts
11437 The maximum number of stmts in a loop to be interchanged.
11438
11439 loop-interchange-stride-ratio
11440 The minimum ratio between stride of two loops for interchange
11441 to be profitable.
11442
11443 min-insn-to-prefetch-ratio
11444 The minimum ratio between the number of instructions and the
11445 number of prefetches to enable prefetching in a loop.
11446
11447 prefetch-min-insn-to-mem-ratio
11448 The minimum ratio between the number of instructions and the
11449 number of memory references to enable prefetching in a loop.
11450
11451 use-canonical-types
11452 Whether the compiler should use the "canonical" type system.
11453 Should always be 1, which uses a more efficient internal
11454 mechanism for comparing types in C++ and Objective-C++.
11455 However, if bugs in the canonical type system are causing
11456 compilation failures, set this value to 0 to disable canonical
11457 types.
11458
11459 switch-conversion-max-branch-ratio
11460 Switch initialization conversion refuses to create arrays that
11461 are bigger than switch-conversion-max-branch-ratio times the
11462 number of branches in the switch.
11463
11464 max-partial-antic-length
11465 Maximum length of the partial antic set computed during the
11466 tree partial redundancy elimination optimization (-ftree-pre)
11467 when optimizing at -O3 and above. For some sorts of source
11468 code the enhanced partial redundancy elimination optimization
11469 can run away, consuming all of the memory available on the host
11470 machine. This parameter sets a limit on the length of the sets
11471 that are computed, which prevents the runaway behavior.
11472 Setting a value of 0 for this parameter allows an unlimited set
11473 length.
11474
11475 rpo-vn-max-loop-depth
11476 Maximum loop depth that is value-numbered optimistically. When
11477 the limit hits the innermost rpo-vn-max-loop-depth loops and
11478 the outermost loop in the loop nest are value-numbered
11479 optimistically and the remaining ones not.
11480
11481 sccvn-max-alias-queries-per-access
11482 Maximum number of alias-oracle queries we perform when looking
11483 for redundancies for loads and stores. If this limit is hit
11484 the search is aborted and the load or store is not considered
11485 redundant. The number of queries is algorithmically limited to
11486 the number of stores on all paths from the load to the function
11487 entry.
11488
11489 ira-max-loops-num
11490 IRA uses regional register allocation by default. If a
11491 function contains more loops than the number given by this
11492 parameter, only at most the given number of the most
11493 frequently-executed loops form regions for regional register
11494 allocation.
11495
11496 ira-max-conflict-table-size
11497 Although IRA uses a sophisticated algorithm to compress the
11498 conflict table, the table can still require excessive amounts
11499 of memory for huge functions. If the conflict table for a
11500 function could be more than the size in MB given by this
11501 parameter, the register allocator instead uses a faster,
11502 simpler, and lower-quality algorithm that does not require
11503 building a pseudo-register conflict table.
11504
11505 ira-loop-reserved-regs
11506 IRA can be used to evaluate more accurate register pressure in
11507 loops for decisions to move loop invariants (see -O3). The
11508 number of available registers reserved for some other purposes
11509 is given by this parameter. Default of the parameter is the
11510 best found from numerous experiments.
11511
11512 lra-inheritance-ebb-probability-cutoff
11513 LRA tries to reuse values reloaded in registers in subsequent
11514 insns. This optimization is called inheritance. EBB is used
11515 as a region to do this optimization. The parameter defines a
11516 minimal fall-through edge probability in percentage used to add
11517 BB to inheritance EBB in LRA. The default value was chosen
11518 from numerous runs of SPEC2000 on x86-64.
11519
11520 loop-invariant-max-bbs-in-loop
11521 Loop invariant motion can be very expensive, both in
11522 compilation time and in amount of needed compile-time memory,
11523 with very large loops. Loops with more basic blocks than this
11524 parameter won't have loop invariant motion optimization
11525 performed on them.
11526
11527 loop-max-datarefs-for-datadeps
11528 Building data dependencies is expensive for very large loops.
11529 This parameter limits the number of data references in loops
11530 that are considered for data dependence analysis. These large
11531 loops are no handled by the optimizations using loop data
11532 dependencies.
11533
11534 max-vartrack-size
11535 Sets a maximum number of hash table slots to use during
11536 variable tracking dataflow analysis of any function. If this
11537 limit is exceeded with variable tracking at assignments
11538 enabled, analysis for that function is retried without it,
11539 after removing all debug insns from the function. If the limit
11540 is exceeded even without debug insns, var tracking analysis is
11541 completely disabled for the function. Setting the parameter to
11542 zero makes it unlimited.
11543
11544 max-vartrack-expr-depth
11545 Sets a maximum number of recursion levels when attempting to
11546 map variable names or debug temporaries to value expressions.
11547 This trades compilation time for more complete debug
11548 information. If this is set too low, value expressions that
11549 are available and could be represented in debug information may
11550 end up not being used; setting this higher may enable the
11551 compiler to find more complex debug expressions, but compile
11552 time and memory use may grow.
11553
11554 max-debug-marker-count
11555 Sets a threshold on the number of debug markers (e.g. begin
11556 stmt markers) to avoid complexity explosion at inlining or
11557 expanding to RTL. If a function has more such gimple stmts
11558 than the set limit, such stmts will be dropped from the inlined
11559 copy of a function, and from its RTL expansion.
11560
11561 min-nondebug-insn-uid
11562 Use uids starting at this parameter for nondebug insns. The
11563 range below the parameter is reserved exclusively for debug
11564 insns created by -fvar-tracking-assignments, but debug insns
11565 may get (non-overlapping) uids above it if the reserved range
11566 is exhausted.
11567
11568 ipa-sra-ptr-growth-factor
11569 IPA-SRA replaces a pointer to an aggregate with one or more new
11570 parameters only when their cumulative size is less or equal to
11571 ipa-sra-ptr-growth-factor times the size of the original
11572 pointer parameter.
11573
11574 ipa-sra-max-replacements
11575 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11576 consequence, it is also the maximum number of replacements of a
11577 formal parameter.
11578
11579 sra-max-scalarization-size-Ospeed
11580 sra-max-scalarization-size-Osize
11581 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
11582 aim to replace scalar parts of aggregates with uses of
11583 independent scalar variables. These parameters control the
11584 maximum size, in storage units, of aggregate which is
11585 considered for replacement when compiling for speed (sra-max-
11586 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
11587 Osize) respectively.
11588
11589 sra-max-propagations
11590 The maximum number of artificial accesses that Scalar
11591 Replacement of Aggregates (SRA) will track, per one local
11592 variable, in order to facilitate copy propagation.
11593
11594 tm-max-aggregate-size
11595 When making copies of thread-local variables in a transaction,
11596 this parameter specifies the size in bytes after which
11597 variables are saved with the logging functions as opposed to
11598 save/restore code sequence pairs. This option only applies
11599 when using -fgnu-tm.
11600
11601 graphite-max-nb-scop-params
11602 To avoid exponential effects in the Graphite loop transforms,
11603 the number of parameters in a Static Control Part (SCoP) is
11604 bounded. A value of zero can be used to lift the bound. A
11605 variable whose value is unknown at compilation time and defined
11606 outside a SCoP is a parameter of the SCoP.
11607
11608 loop-block-tile-size
11609 Loop blocking or strip mining transforms, enabled with
11610 -floop-block or -floop-strip-mine, strip mine each loop in the
11611 loop nest by a given number of iterations. The strip length
11612 can be changed using the loop-block-tile-size parameter.
11613
11614 ipa-jump-function-lookups
11615 Specifies number of statements visited during jump function
11616 offset discovery.
11617
11618 ipa-cp-value-list-size
11619 IPA-CP attempts to track all possible values and types passed
11620 to a function's parameter in order to propagate them and
11621 perform devirtualization. ipa-cp-value-list-size is the
11622 maximum number of values and types it stores per one formal
11623 parameter of a function.
11624
11625 ipa-cp-eval-threshold
11626 IPA-CP calculates its own score of cloning profitability
11627 heuristics and performs those cloning opportunities with scores
11628 that exceed ipa-cp-eval-threshold.
11629
11630 ipa-cp-max-recursive-depth
11631 Maximum depth of recursive cloning for self-recursive function.
11632
11633 ipa-cp-min-recursive-probability
11634 Recursive cloning only when the probability of call being
11635 executed exceeds the parameter.
11636
11637 ipa-cp-recursion-penalty
11638 Percentage penalty the recursive functions will receive when
11639 they are evaluated for cloning.
11640
11641 ipa-cp-single-call-penalty
11642 Percentage penalty functions containing a single call to
11643 another function will receive when they are evaluated for
11644 cloning.
11645
11646 ipa-max-agg-items
11647 IPA-CP is also capable to propagate a number of scalar values
11648 passed in an aggregate. ipa-max-agg-items controls the maximum
11649 number of such values per one parameter.
11650
11651 ipa-cp-loop-hint-bonus
11652 When IPA-CP determines that a cloning candidate would make the
11653 number of iterations of a loop known, it adds a bonus of ipa-
11654 cp-loop-hint-bonus to the profitability score of the candidate.
11655
11656 ipa-max-loop-predicates
11657 The maximum number of different predicates IPA will use to
11658 describe when loops in a function have known properties.
11659
11660 ipa-max-aa-steps
11661 During its analysis of function bodies, IPA-CP employs alias
11662 analysis in order to track values pointed to by function
11663 parameters. In order not spend too much time analyzing huge
11664 functions, it gives up and consider all memory clobbered after
11665 examining ipa-max-aa-steps statements modifying memory.
11666
11667 ipa-max-switch-predicate-bounds
11668 Maximal number of boundary endpoints of case ranges of switch
11669 statement. For switch exceeding this limit, IPA-CP will not
11670 construct cloning cost predicate, which is used to estimate
11671 cloning benefit, for default case of the switch statement.
11672
11673 ipa-max-param-expr-ops
11674 IPA-CP will analyze conditional statement that references some
11675 function parameter to estimate benefit for cloning upon certain
11676 constant value. But if number of operations in a parameter
11677 expression exceeds ipa-max-param-expr-ops, the expression is
11678 treated as complicated one, and is not handled by IPA analysis.
11679
11680 lto-partitions
11681 Specify desired number of partitions produced during WHOPR
11682 compilation. The number of partitions should exceed the number
11683 of CPUs used for compilation.
11684
11685 lto-min-partition
11686 Size of minimal partition for WHOPR (in estimated
11687 instructions). This prevents expenses of splitting very small
11688 programs into too many partitions.
11689
11690 lto-max-partition
11691 Size of max partition for WHOPR (in estimated instructions).
11692 to provide an upper bound for individual size of partition.
11693 Meant to be used only with balanced partitioning.
11694
11695 lto-max-streaming-parallelism
11696 Maximal number of parallel processes used for LTO streaming.
11697
11698 cxx-max-namespaces-for-diagnostic-help
11699 The maximum number of namespaces to consult for suggestions
11700 when C++ name lookup fails for an identifier.
11701
11702 sink-frequency-threshold
11703 The maximum relative execution frequency (in percents) of the
11704 target block relative to a statement's original block to allow
11705 statement sinking of a statement. Larger numbers result in
11706 more aggressive statement sinking. A small positive adjustment
11707 is applied for statements with memory operands as those are
11708 even more profitable so sink.
11709
11710 max-stores-to-sink
11711 The maximum number of conditional store pairs that can be sunk.
11712 Set to 0 if either vectorization (-ftree-vectorize) or if-
11713 conversion (-ftree-loop-if-convert) is disabled.
11714
11715 case-values-threshold
11716 The smallest number of different values for which it is best to
11717 use a jump-table instead of a tree of conditional branches. If
11718 the value is 0, use the default for the machine.
11719
11720 jump-table-max-growth-ratio-for-size
11721 The maximum code size growth ratio when expanding into a jump
11722 table (in percent). The parameter is used when optimizing for
11723 size.
11724
11725 jump-table-max-growth-ratio-for-speed
11726 The maximum code size growth ratio when expanding into a jump
11727 table (in percent). The parameter is used when optimizing for
11728 speed.
11729
11730 tree-reassoc-width
11731 Set the maximum number of instructions executed in parallel in
11732 reassociated tree. This parameter overrides target dependent
11733 heuristics used by default if has non zero value.
11734
11735 sched-pressure-algorithm
11736 Choose between the two available implementations of
11737 -fsched-pressure. Algorithm 1 is the original implementation
11738 and is the more likely to prevent instructions from being
11739 reordered. Algorithm 2 was designed to be a compromise between
11740 the relatively conservative approach taken by algorithm 1 and
11741 the rather aggressive approach taken by the default scheduler.
11742 It relies more heavily on having a regular register file and
11743 accurate register pressure classes. See haifa-sched.c in the
11744 GCC sources for more details.
11745
11746 The default choice depends on the target.
11747
11748 max-slsr-cand-scan
11749 Set the maximum number of existing candidates that are
11750 considered when seeking a basis for a new straight-line
11751 strength reduction candidate.
11752
11753 asan-globals
11754 Enable buffer overflow detection for global objects. This kind
11755 of protection is enabled by default if you are using
11756 -fsanitize=address option. To disable global objects
11757 protection use --param asan-globals=0.
11758
11759 asan-stack
11760 Enable buffer overflow detection for stack objects. This kind
11761 of protection is enabled by default when using
11762 -fsanitize=address. To disable stack protection use --param
11763 asan-stack=0 option.
11764
11765 asan-instrument-reads
11766 Enable buffer overflow detection for memory reads. This kind
11767 of protection is enabled by default when using
11768 -fsanitize=address. To disable memory reads protection use
11769 --param asan-instrument-reads=0.
11770
11771 asan-instrument-writes
11772 Enable buffer overflow detection for memory writes. This kind
11773 of protection is enabled by default when using
11774 -fsanitize=address. To disable memory writes protection use
11775 --param asan-instrument-writes=0 option.
11776
11777 asan-memintrin
11778 Enable detection for built-in functions. This kind of
11779 protection is enabled by default when using -fsanitize=address.
11780 To disable built-in functions protection use --param
11781 asan-memintrin=0.
11782
11783 asan-use-after-return
11784 Enable detection of use-after-return. This kind of protection
11785 is enabled by default when using the -fsanitize=address option.
11786 To disable it use --param asan-use-after-return=0.
11787
11788 Note: By default the check is disabled at run time. To enable
11789 it, add "detect_stack_use_after_return=1" to the environment
11790 variable ASAN_OPTIONS.
11791
11792 asan-instrumentation-with-call-threshold
11793 If number of memory accesses in function being instrumented is
11794 greater or equal to this number, use callbacks instead of
11795 inline checks. E.g. to disable inline code use --param
11796 asan-instrumentation-with-call-threshold=0.
11797
11798 hwasan-instrument-stack
11799 Enable hwasan instrumentation of statically sized stack-
11800 allocated variables. This kind of instrumentation is enabled
11801 by default when using -fsanitize=hwaddress and disabled by
11802 default when using -fsanitize=kernel-hwaddress. To disable
11803 stack instrumentation use --param hwasan-instrument-stack=0,
11804 and to enable it use --param hwasan-instrument-stack=1.
11805
11806 hwasan-random-frame-tag
11807 When using stack instrumentation, decide tags for stack
11808 variables using a deterministic sequence beginning at a random
11809 tag for each frame. With this parameter unset tags are chosen
11810 using the same sequence but beginning from 1. This is enabled
11811 by default for -fsanitize=hwaddress and unavailable for
11812 -fsanitize=kernel-hwaddress. To disable it use --param
11813 hwasan-random-frame-tag=0.
11814
11815 hwasan-instrument-allocas
11816 Enable hwasan instrumentation of dynamically sized stack-
11817 allocated variables. This kind of instrumentation is enabled
11818 by default when using -fsanitize=hwaddress and disabled by
11819 default when using -fsanitize=kernel-hwaddress. To disable
11820 instrumentation of such variables use --param
11821 hwasan-instrument-allocas=0, and to enable it use --param
11822 hwasan-instrument-allocas=1.
11823
11824 hwasan-instrument-reads
11825 Enable hwasan checks on memory reads. Instrumentation of reads
11826 is enabled by default for both -fsanitize=hwaddress and
11827 -fsanitize=kernel-hwaddress. To disable checking memory reads
11828 use --param hwasan-instrument-reads=0.
11829
11830 hwasan-instrument-writes
11831 Enable hwasan checks on memory writes. Instrumentation of
11832 writes is enabled by default for both -fsanitize=hwaddress and
11833 -fsanitize=kernel-hwaddress. To disable checking memory writes
11834 use --param hwasan-instrument-writes=0.
11835
11836 hwasan-instrument-mem-intrinsics
11837 Enable hwasan instrumentation of builtin functions.
11838 Instrumentation of these builtin functions is enabled by
11839 default for both -fsanitize=hwaddress and
11840 -fsanitize=kernel-hwaddress. To disable instrumentation of
11841 builtin functions use --param
11842 hwasan-instrument-mem-intrinsics=0.
11843
11844 use-after-scope-direct-emission-threshold
11845 If the size of a local variable in bytes is smaller or equal to
11846 this number, directly poison (or unpoison) shadow memory
11847 instead of using run-time callbacks.
11848
11849 tsan-distinguish-volatile
11850 Emit special instrumentation for accesses to volatiles.
11851
11852 tsan-instrument-func-entry-exit
11853 Emit instrumentation calls to __tsan_func_entry() and
11854 __tsan_func_exit().
11855
11856 max-fsm-thread-path-insns
11857 Maximum number of instructions to copy when duplicating blocks
11858 on a finite state automaton jump thread path.
11859
11860 max-fsm-thread-length
11861 Maximum number of basic blocks on a finite state automaton jump
11862 thread path.
11863
11864 max-fsm-thread-paths
11865 Maximum number of new jump thread paths to create for a finite
11866 state automaton.
11867
11868 parloops-chunk-size
11869 Chunk size of omp schedule for loops parallelized by parloops.
11870
11871 parloops-schedule
11872 Schedule type of omp schedule for loops parallelized by
11873 parloops (static, dynamic, guided, auto, runtime).
11874
11875 parloops-min-per-thread
11876 The minimum number of iterations per thread of an innermost
11877 parallelized loop for which the parallelized variant is
11878 preferred over the single threaded one. Note that for a
11879 parallelized loop nest the minimum number of iterations of the
11880 outermost loop per thread is two.
11881
11882 max-ssa-name-query-depth
11883 Maximum depth of recursion when querying properties of SSA
11884 names in things like fold routines. One level of recursion
11885 corresponds to following a use-def chain.
11886
11887 max-speculative-devirt-maydefs
11888 The maximum number of may-defs we analyze when looking for a
11889 must-def specifying the dynamic type of an object that invokes
11890 a virtual call we may be able to devirtualize speculatively.
11891
11892 max-vrp-switch-assertions
11893 The maximum number of assertions to add along the default edge
11894 of a switch statement during VRP.
11895
11896 evrp-mode
11897 Specifies the mode Early VRP should operate in.
11898
11899 unroll-jam-min-percent
11900 The minimum percentage of memory references that must be
11901 optimized away for the unroll-and-jam transformation to be
11902 considered profitable.
11903
11904 unroll-jam-max-unroll
11905 The maximum number of times the outer loop should be unrolled
11906 by the unroll-and-jam transformation.
11907
11908 max-rtl-if-conversion-unpredictable-cost
11909 Maximum permissible cost for the sequence that would be
11910 generated by the RTL if-conversion pass for a branch that is
11911 considered unpredictable.
11912
11913 max-variable-expansions-in-unroller
11914 If -fvariable-expansion-in-unroller is used, the maximum number
11915 of times that an individual variable will be expanded during
11916 loop unrolling.
11917
11918 tracer-min-branch-probability-feedback
11919 Stop forward growth if the probability of best edge is less
11920 than this threshold (in percent). Used when profile feedback is
11921 available.
11922
11923 partial-inlining-entry-probability
11924 Maximum probability of the entry BB of split region (in percent
11925 relative to entry BB of the function) to make partial inlining
11926 happen.
11927
11928 max-tracked-strlens
11929 Maximum number of strings for which strlen optimization pass
11930 will track string lengths.
11931
11932 gcse-after-reload-partial-fraction
11933 The threshold ratio for performing partial redundancy
11934 elimination after reload.
11935
11936 gcse-after-reload-critical-fraction
11937 The threshold ratio of critical edges execution count that
11938 permit performing redundancy elimination after reload.
11939
11940 max-loop-header-insns
11941 The maximum number of insns in loop header duplicated by the
11942 copy loop headers pass.
11943
11944 vect-epilogues-nomask
11945 Enable loop epilogue vectorization using smaller vector size.
11946
11947 vect-partial-vector-usage
11948 Controls when the loop vectorizer considers using partial
11949 vector loads and stores as an alternative to falling back to
11950 scalar code. 0 stops the vectorizer from ever using partial
11951 vector loads and stores. 1 allows partial vector loads and
11952 stores if vectorization removes the need for the code to
11953 iterate. 2 allows partial vector loads and stores in all
11954 loops. The parameter only has an effect on targets that
11955 support partial vector loads and stores.
11956
11957 avoid-fma-max-bits
11958 Maximum number of bits for which we avoid creating FMAs.
11959
11960 sms-loop-average-count-threshold
11961 A threshold on the average loop count considered by the swing
11962 modulo scheduler.
11963
11964 sms-dfa-history
11965 The number of cycles the swing modulo scheduler considers when
11966 checking conflicts using DFA.
11967
11968 max-inline-insns-recursive-auto
11969 The maximum number of instructions non-inline function can grow
11970 to via recursive inlining.
11971
11972 graphite-allow-codegen-errors
11973 Whether codegen errors should be ICEs when -fchecking.
11974
11975 sms-max-ii-factor
11976 A factor for tuning the upper bound that swing modulo scheduler
11977 uses for scheduling a loop.
11978
11979 lra-max-considered-reload-pseudos
11980 The max number of reload pseudos which are considered during
11981 spilling a non-reload pseudo.
11982
11983 max-pow-sqrt-depth
11984 Maximum depth of sqrt chains to use when synthesizing
11985 exponentiation by a real constant.
11986
11987 max-dse-active-local-stores
11988 Maximum number of active local stores in RTL dead store
11989 elimination.
11990
11991 asan-instrument-allocas
11992 Enable asan allocas/VLAs protection.
11993
11994 max-iterations-computation-cost
11995 Bound on the cost of an expression to compute the number of
11996 iterations.
11997
11998 max-isl-operations
11999 Maximum number of isl operations, 0 means unlimited.
12000
12001 graphite-max-arrays-per-scop
12002 Maximum number of arrays per scop.
12003
12004 max-vartrack-reverse-op-size
12005 Max. size of loc list for which reverse ops should be added.
12006
12007 tracer-dynamic-coverage-feedback
12008 The percentage of function, weighted by execution frequency,
12009 that must be covered by trace formation. Used when profile
12010 feedback is available.
12011
12012 max-inline-recursive-depth-auto
12013 The maximum depth of recursive inlining for non-inline
12014 functions.
12015
12016 fsm-scale-path-stmts
12017 Scale factor to apply to the number of statements in a
12018 threading path when comparing to the number of (scaled) blocks.
12019
12020 fsm-maximum-phi-arguments
12021 Maximum number of arguments a PHI may have before the FSM
12022 threader will not try to thread through its block.
12023
12024 uninit-control-dep-attempts
12025 Maximum number of nested calls to search for control
12026 dependencies during uninitialized variable analysis.
12027
12028 sra-max-scalarization-size-Osize
12029 Maximum size, in storage units, of an aggregate which should be
12030 considered for scalarization when compiling for size.
12031
12032 fsm-scale-path-blocks
12033 Scale factor to apply to the number of blocks in a threading
12034 path when comparing to the number of (scaled) statements.
12035
12036 sched-autopref-queue-depth
12037 Hardware autoprefetcher scheduler model control flag. Number
12038 of lookahead cycles the model looks into; at ' ' only enable
12039 instruction sorting heuristic.
12040
12041 loop-versioning-max-inner-insns
12042 The maximum number of instructions that an inner loop can have
12043 before the loop versioning pass considers it too big to copy.
12044
12045 loop-versioning-max-outer-insns
12046 The maximum number of instructions that an outer loop can have
12047 before the loop versioning pass considers it too big to copy,
12048 discounting any instructions in inner loops that directly
12049 benefit from versioning.
12050
12051 ssa-name-def-chain-limit
12052 The maximum number of SSA_NAME assignments to follow in
12053 determining a property of a variable such as its value. This
12054 limits the number of iterations or recursive calls GCC performs
12055 when optimizing certain statements or when determining their
12056 validity prior to issuing diagnostics.
12057
12058 store-merging-max-size
12059 Maximum size of a single store merging region in bytes.
12060
12061 hash-table-verification-limit
12062 The number of elements for which hash table verification is
12063 done for each searched element.
12064
12065 max-find-base-term-values
12066 Maximum number of VALUEs handled during a single find_base_term
12067 call.
12068
12069 analyzer-max-enodes-per-program-point
12070 The maximum number of exploded nodes per program point within
12071 the analyzer, before terminating analysis of that point.
12072
12073 analyzer-max-constraints
12074 The maximum number of constraints per state.
12075
12076 analyzer-min-snodes-for-call-summary
12077 The minimum number of supernodes within a function for the
12078 analyzer to consider summarizing its effects at call sites.
12079
12080 analyzer-max-enodes-for-full-dump
12081 The maximum depth of exploded nodes that should appear in a dot
12082 dump before switching to a less verbose format.
12083
12084 analyzer-max-recursion-depth
12085 The maximum number of times a callsite can appear in a call
12086 stack within the analyzer, before terminating analysis of a
12087 call that would recurse deeper.
12088
12089 analyzer-max-svalue-depth
12090 The maximum depth of a symbolic value, before approximating the
12091 value as unknown.
12092
12093 analyzer-max-infeasible-edges
12094 The maximum number of infeasible edges to reject before
12095 declaring a diagnostic as infeasible.
12096
12097 gimple-fe-computed-hot-bb-threshold
12098 The number of executions of a basic block which is considered
12099 hot. The parameter is used only in GIMPLE FE.
12100
12101 analyzer-bb-explosion-factor
12102 The maximum number of 'after supernode' exploded nodes within
12103 the analyzer per supernode, before terminating analysis.
12104
12105 ranger-logical-depth
12106 Maximum depth of logical expression evaluation ranger will look
12107 through when evaluating outgoing edge ranges.
12108
12109 openacc-kernels
12110 Specify mode of OpenACC `kernels' constructs handling. With
12111 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12112 are decomposed into parts, a sequence of compute constructs,
12113 each then handled individually. This is work in progress.
12114 With --param=openacc-kernels=parloops, OpenACC `kernels'
12115 constructs are handled by the parloops pass, en bloc. This is
12116 the current default.
12117
12118 The following choices of name are available on AArch64 targets:
12119
12120 aarch64-sve-compare-costs
12121 When vectorizing for SVE, consider using "unpacked" vectors for
12122 smaller elements and use the cost model to pick the cheapest
12123 approach. Also use the cost model to choose between SVE and
12124 Advanced SIMD vectorization.
12125
12126 Using unpacked vectors includes storing smaller elements in
12127 larger containers and accessing elements with extending loads
12128 and truncating stores.
12129
12130 aarch64-float-recp-precision
12131 The number of Newton iterations for calculating the reciprocal
12132 for float type. The precision of division is proportional to
12133 this param when division approximation is enabled. The default
12134 value is 1.
12135
12136 aarch64-double-recp-precision
12137 The number of Newton iterations for calculating the reciprocal
12138 for double type. The precision of division is propotional to
12139 this param when division approximation is enabled. The default
12140 value is 2.
12141
12142 aarch64-autovec-preference
12143 Force an ISA selection strategy for auto-vectorization.
12144 Accepts values from 0 to 4, inclusive.
12145
12146 0 Use the default heuristics.
12147
12148 1 Use only Advanced SIMD for auto-vectorization.
12149
12150 2 Use only SVE for auto-vectorization.
12151
12152 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12153 the costs are deemed equal.
12154
12155 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12156 are deemed equal.
12157
12158 The default value is 0.
12159
12160 aarch64-loop-vect-issue-rate-niters
12161 The tuning for some AArch64 CPUs tries to take both latencies
12162 and issue rates into account when deciding whether a loop
12163 should be vectorized using SVE, vectorized using Advanced SIMD,
12164 or not vectorized at all. If this parameter is set to n, GCC
12165 will not use this heuristic for loops that are known to execute
12166 in fewer than n Advanced SIMD iterations.
12167
12168 Program Instrumentation Options
12169 GCC supports a number of command-line options that control adding run-
12170 time instrumentation to the code it normally generates. For example,
12171 one purpose of instrumentation is collect profiling statistics for use
12172 in finding program hot spots, code coverage analysis, or profile-guided
12173 optimizations. Another class of program instrumentation is adding run-
12174 time checking to detect programming errors like invalid pointer
12175 dereferences or out-of-bounds array accesses, as well as deliberately
12176 hostile attacks such as stack smashing or C++ vtable hijacking. There
12177 is also a general hook which can be used to implement other forms of
12178 tracing or function-level instrumentation for debug or program analysis
12179 purposes.
12180
12181 -p
12182 -pg Generate extra code to write profile information suitable for the
12183 analysis program prof (for -p) or gprof (for -pg). You must use
12184 this option when compiling the source files you want data about,
12185 and you must also use it when linking.
12186
12187 You can use the function attribute "no_instrument_function" to
12188 suppress profiling of individual functions when compiling with
12189 these options.
12190
12191 -fprofile-arcs
12192 Add code so that program flow arcs are instrumented. During
12193 execution the program records how many times each branch and call
12194 is executed and how many times it is taken or returns. On targets
12195 that support constructors with priority support, profiling properly
12196 handles constructors, destructors and C++ constructors (and
12197 destructors) of classes which are used as a type of a global
12198 variable.
12199
12200 When the compiled program exits it saves this data to a file called
12201 auxname.gcda for each source file. The data may be used for
12202 profile-directed optimizations (-fbranch-probabilities), or for
12203 test coverage analysis (-ftest-coverage). Each object file's
12204 auxname is generated from the name of the output file, if
12205 explicitly specified and it is not the final executable, otherwise
12206 it is the basename of the source file. In both cases any suffix is
12207 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12208 for output file specified as -o dir/foo.o).
12209
12210 --coverage
12211 This option is used to compile and link code instrumented for
12212 coverage analysis. The option is a synonym for -fprofile-arcs
12213 -ftest-coverage (when compiling) and -lgcov (when linking). See
12214 the documentation for those options for more details.
12215
12216 * Compile the source files with -fprofile-arcs plus optimization
12217 and code generation options. For test coverage analysis, use
12218 the additional -ftest-coverage option. You do not need to
12219 profile every source file in a program.
12220
12221 * Compile the source files additionally with -fprofile-abs-path
12222 to create absolute path names in the .gcno files. This allows
12223 gcov to find the correct sources in projects where compilations
12224 occur with different working directories.
12225
12226 * Link your object files with -lgcov or -fprofile-arcs (the
12227 latter implies the former).
12228
12229 * Run the program on a representative workload to generate the
12230 arc profile information. This may be repeated any number of
12231 times. You can run concurrent instances of your program, and
12232 provided that the file system supports locking, the data files
12233 will be correctly updated. Unless a strict ISO C dialect
12234 option is in effect, "fork" calls are detected and correctly
12235 handled without double counting.
12236
12237 * For profile-directed optimizations, compile the source files
12238 again with the same optimization and code generation options
12239 plus -fbranch-probabilities.
12240
12241 * For test coverage analysis, use gcov to produce human readable
12242 information from the .gcno and .gcda files. Refer to the gcov
12243 documentation for further information.
12244
12245 With -fprofile-arcs, for each function of your program GCC creates
12246 a program flow graph, then finds a spanning tree for the graph.
12247 Only arcs that are not on the spanning tree have to be
12248 instrumented: the compiler adds code to count the number of times
12249 that these arcs are executed. When an arc is the only exit or only
12250 entrance to a block, the instrumentation code can be added to the
12251 block; otherwise, a new basic block must be created to hold the
12252 instrumentation code.
12253
12254 -ftest-coverage
12255 Produce a notes file that the gcov code-coverage utility can use to
12256 show program coverage. Each source file's note file is called
12257 auxname.gcno. Refer to the -fprofile-arcs option above for a
12258 description of auxname and instructions on how to generate test
12259 coverage data. Coverage data matches the source files more closely
12260 if you do not optimize.
12261
12262 -fprofile-abs-path
12263 Automatically convert relative source file names to absolute path
12264 names in the .gcno files. This allows gcov to find the correct
12265 sources in projects where compilations occur with different working
12266 directories.
12267
12268 -fprofile-dir=path
12269 Set the directory to search for the profile data files in to path.
12270 This option affects only the profile data generated by
12271 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12272 -fprofile-use and -fbranch-probabilities and its related options.
12273 Both absolute and relative paths can be used. By default, GCC uses
12274 the current directory as path, thus the profile data file appears
12275 in the same directory as the object file. In order to prevent the
12276 file name clashing, if the object file name is not an absolute
12277 path, we mangle the absolute path of the sourcename.gcda file and
12278 use it as the file name of a .gcda file. See similar option
12279 -fprofile-note.
12280
12281 When an executable is run in a massive parallel environment, it is
12282 recommended to save profile to different folders. That can be done
12283 with variables in path that are exported during run-time:
12284
12285 %p process ID.
12286
12287 %q{VAR}
12288 value of environment variable VAR
12289
12290 -fprofile-generate
12291 -fprofile-generate=path
12292 Enable options usually used for instrumenting application to
12293 produce profile useful for later recompilation with profile
12294 feedback based optimization. You must use -fprofile-generate both
12295 when compiling and when linking your program.
12296
12297 The following options are enabled: -fprofile-arcs,
12298 -fprofile-values, -finline-functions, and -fipa-bit-cp.
12299
12300 If path is specified, GCC looks at the path to find the profile
12301 feedback data files. See -fprofile-dir.
12302
12303 To optimize the program based on the collected profile information,
12304 use -fprofile-use.
12305
12306 -fprofile-info-section
12307 -fprofile-info-section=name
12308 Register the profile information in the specified section instead
12309 of using a constructor/destructor. The section name is name if it
12310 is specified, otherwise the section name defaults to ".gcov_info".
12311 A pointer to the profile information generated by -fprofile-arcs or
12312 -ftest-coverage is placed in the specified section for each
12313 translation unit. This option disables the profile information
12314 registration through a constructor and it disables the profile
12315 information processing through a destructor. This option is not
12316 intended to be used in hosted environments such as GNU/Linux. It
12317 targets systems with limited resources which do not support
12318 constructors and destructors. The linker could collect the input
12319 sections in a continuous memory block and define start and end
12320 symbols. The runtime support could dump the profiling information
12321 registered in this linker set during program termination to a
12322 serial line for example. A GNU linker script example which defines
12323 a linker output section follows:
12324
12325 .gcov_info :
12326 {
12327 PROVIDE (__gcov_info_start = .);
12328 KEEP (*(.gcov_info))
12329 PROVIDE (__gcov_info_end = .);
12330 }
12331
12332 -fprofile-note=path
12333 If path is specified, GCC saves .gcno file into path location. If
12334 you combine the option with multiple source files, the .gcno file
12335 will be overwritten.
12336
12337 -fprofile-prefix-path=path
12338 This option can be used in combination with
12339 profile-generate=profile_dir and profile-use=profile_dir to inform
12340 GCC where is the base directory of built source tree. By default
12341 profile_dir will contain files with mangled absolute paths of all
12342 object files in the built project. This is not desirable when
12343 directory used to build the instrumented binary differs from the
12344 directory used to build the binary optimized with profile feedback
12345 because the profile data will not be found during the optimized
12346 build. In such setups -fprofile-prefix-path=path with path
12347 pointing to the base directory of the build can be used to strip
12348 the irrelevant part of the path and keep all file names relative to
12349 the main build directory.
12350
12351 -fprofile-update=method
12352 Alter the update method for an application instrumented for profile
12353 feedback based optimization. The method argument should be one of
12354 single, atomic or prefer-atomic. The first one is useful for
12355 single-threaded applications, while the second one prevents profile
12356 corruption by emitting thread-safe code.
12357
12358 Warning: When an application does not properly join all threads (or
12359 creates an detached thread), a profile file can be still corrupted.
12360
12361 Using prefer-atomic would be transformed either to atomic, when
12362 supported by a target, or to single otherwise. The GCC driver
12363 automatically selects prefer-atomic when -pthread is present in the
12364 command line.
12365
12366 -fprofile-filter-files=regex
12367 Instrument only functions from files whose name matches any of the
12368 regular expressions (separated by semi-colons).
12369
12370 For example, -fprofile-filter-files=main\.c;module.*\.c will
12371 instrument only main.c and all C files starting with 'module'.
12372
12373 -fprofile-exclude-files=regex
12374 Instrument only functions from files whose name does not match any
12375 of the regular expressions (separated by semi-colons).
12376
12377 For example, -fprofile-exclude-files=/usr/.* will prevent
12378 instrumentation of all files that are located in the /usr/ folder.
12379
12380 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
12381 Control level of reproducibility of profile gathered by
12382 "-fprofile-generate". This makes it possible to rebuild program
12383 with same outcome which is useful, for example, for distribution
12384 packages.
12385
12386 With -fprofile-reproducible=serial the profile gathered by
12387 -fprofile-generate is reproducible provided the trained program
12388 behaves the same at each invocation of the train run, it is not
12389 multi-threaded and profile data streaming is always done in the
12390 same order. Note that profile streaming happens at the end of
12391 program run but also before "fork" function is invoked.
12392
12393 Note that it is quite common that execution counts of some part of
12394 programs depends, for example, on length of temporary file names or
12395 memory space randomization (that may affect hash-table collision
12396 rate). Such non-reproducible part of programs may be annotated by
12397 "no_instrument_function" function attribute. gcov-dump with -l can
12398 be used to dump gathered data and verify that they are indeed
12399 reproducible.
12400
12401 With -fprofile-reproducible=parallel-runs collected profile stays
12402 reproducible regardless the order of streaming of the data into
12403 gcda files. This setting makes it possible to run multiple
12404 instances of instrumented program in parallel (such as with "make
12405 -j"). This reduces quality of gathered data, in particular of
12406 indirect call profiling.
12407
12408 -fsanitize=address
12409 Enable AddressSanitizer, a fast memory error detector. Memory
12410 access instructions are instrumented to detect out-of-bounds and
12411 use-after-free bugs. The option enables
12412 -fsanitize-address-use-after-scope. See
12413 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
12414 more details. The run-time behavior can be influenced using the
12415 ASAN_OPTIONS environment variable. When set to "help=1", the
12416 available options are shown at startup of the instrumented program.
12417 See
12418 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
12419 for a list of supported options. The option cannot be combined
12420 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
12421 target -fsanitize=hwaddress is currently supported on is AArch64.
12422
12423 -fsanitize=kernel-address
12424 Enable AddressSanitizer for Linux kernel. See
12425 <https://github.com/google/kasan> for more details.
12426
12427 -fsanitize=hwaddress
12428 Enable Hardware-assisted AddressSanitizer, which uses a hardware
12429 ability to ignore the top byte of a pointer to allow the detection
12430 of memory errors with a low memory overhead. Memory access
12431 instructions are instrumented to detect out-of-bounds and use-
12432 after-free bugs. The option enables
12433 -fsanitize-address-use-after-scope. See
12434 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
12435 for more details. The run-time behavior can be influenced using
12436 the HWASAN_OPTIONS environment variable. When set to "help=1", the
12437 available options are shown at startup of the instrumented program.
12438 The option cannot be combined with -fsanitize=thread or
12439 -fsanitize=address, and is currently only available on AArch64.
12440
12441 -fsanitize=kernel-hwaddress
12442 Enable Hardware-assisted AddressSanitizer for compilation of the
12443 Linux kernel. Similar to -fsanitize=kernel-address but using an
12444 alternate instrumentation method, and similar to
12445 -fsanitize=hwaddress but with instrumentation differences necessary
12446 for compiling the Linux kernel. These differences are to avoid
12447 hwasan library initialization calls and to account for the stack
12448 pointer having a different value in its top byte.
12449
12450 Note: This option has different defaults to the
12451 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
12452 not on by default but are still possible by specifying the command-
12453 line options --param hwasan-instrument-stack=1 and --param
12454 hwasan-instrument-allocas=1 respectively. Using a random frame tag
12455 is not implemented for kernel instrumentation.
12456
12457 -fsanitize=pointer-compare
12458 Instrument comparison operation (<, <=, >, >=) with pointer
12459 operands. The option must be combined with either
12460 -fsanitize=kernel-address or -fsanitize=address The option cannot
12461 be combined with -fsanitize=thread. Note: By default the check is
12462 disabled at run time. To enable it, add
12463 "detect_invalid_pointer_pairs=2" to the environment variable
12464 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
12465 invalid operation only when both pointers are non-null.
12466
12467 -fsanitize=pointer-subtract
12468 Instrument subtraction with pointer operands. The option must be
12469 combined with either -fsanitize=kernel-address or
12470 -fsanitize=address The option cannot be combined with
12471 -fsanitize=thread. Note: By default the check is disabled at run
12472 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
12473 environment variable ASAN_OPTIONS. Using
12474 "detect_invalid_pointer_pairs=1" detects invalid operation only
12475 when both pointers are non-null.
12476
12477 -fsanitize=thread
12478 Enable ThreadSanitizer, a fast data race detector. Memory access
12479 instructions are instrumented to detect data race bugs. See
12480 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
12481 more details. The run-time behavior can be influenced using the
12482 TSAN_OPTIONS environment variable; see
12483 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
12484 for a list of supported options. The option cannot be combined
12485 with -fsanitize=address, -fsanitize=leak.
12486
12487 Note that sanitized atomic builtins cannot throw exceptions when
12488 operating on invalid memory addresses with non-call exceptions
12489 (-fnon-call-exceptions).
12490
12491 -fsanitize=leak
12492 Enable LeakSanitizer, a memory leak detector. This option only
12493 matters for linking of executables and the executable is linked
12494 against a library that overrides "malloc" and other allocator
12495 functions. See
12496 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
12497 for more details. The run-time behavior can be influenced using
12498 the LSAN_OPTIONS environment variable. The option cannot be
12499 combined with -fsanitize=thread.
12500
12501 -fsanitize=undefined
12502 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
12503 detector. Various computations are instrumented to detect
12504 undefined behavior at runtime. Current suboptions are:
12505
12506 -fsanitize=shift
12507 This option enables checking that the result of a shift
12508 operation is not undefined. Note that what exactly is
12509 considered undefined differs slightly between C and C++, as
12510 well as between ISO C90 and C99, etc. This option has two
12511 suboptions, -fsanitize=shift-base and
12512 -fsanitize=shift-exponent.
12513
12514 -fsanitize=shift-exponent
12515 This option enables checking that the second argument of a
12516 shift operation is not negative and is smaller than the
12517 precision of the promoted first argument.
12518
12519 -fsanitize=shift-base
12520 If the second argument of a shift operation is within range,
12521 check that the result of a shift operation is not undefined.
12522 Note that what exactly is considered undefined differs slightly
12523 between C and C++, as well as between ISO C90 and C99, etc.
12524
12525 -fsanitize=integer-divide-by-zero
12526 Detect integer division by zero as well as "INT_MIN / -1"
12527 division.
12528
12529 -fsanitize=unreachable
12530 With this option, the compiler turns the
12531 "__builtin_unreachable" call into a diagnostics message call
12532 instead. When reaching the "__builtin_unreachable" call, the
12533 behavior is undefined.
12534
12535 -fsanitize=vla-bound
12536 This option instructs the compiler to check that the size of a
12537 variable length array is positive.
12538
12539 -fsanitize=null
12540 This option enables pointer checking. Particularly, the
12541 application built with this option turned on will issue an
12542 error message when it tries to dereference a NULL pointer, or
12543 if a reference (possibly an rvalue reference) is bound to a
12544 NULL pointer, or if a method is invoked on an object pointed by
12545 a NULL pointer.
12546
12547 -fsanitize=return
12548 This option enables return statement checking. Programs built
12549 with this option turned on will issue an error message when the
12550 end of a non-void function is reached without actually
12551 returning a value. This option works in C++ only.
12552
12553 -fsanitize=signed-integer-overflow
12554 This option enables signed integer overflow checking. We check
12555 that the result of "+", "*", and both unary and binary "-" does
12556 not overflow in the signed arithmetics. Note, integer
12557 promotion rules must be taken into account. That is, the
12558 following is not an overflow:
12559
12560 signed char a = SCHAR_MAX;
12561 a++;
12562
12563 -fsanitize=bounds
12564 This option enables instrumentation of array bounds. Various
12565 out of bounds accesses are detected. Flexible array members,
12566 flexible array member-like arrays, and initializers of
12567 variables with static storage are not instrumented.
12568
12569 -fsanitize=bounds-strict
12570 This option enables strict instrumentation of array bounds.
12571 Most out of bounds accesses are detected, including flexible
12572 array members and flexible array member-like arrays.
12573 Initializers of variables with static storage are not
12574 instrumented.
12575
12576 -fsanitize=alignment
12577 This option enables checking of alignment of pointers when they
12578 are dereferenced, or when a reference is bound to
12579 insufficiently aligned target, or when a method or constructor
12580 is invoked on insufficiently aligned object.
12581
12582 -fsanitize=object-size
12583 This option enables instrumentation of memory references using
12584 the "__builtin_object_size" function. Various out of bounds
12585 pointer accesses are detected.
12586
12587 -fsanitize=float-divide-by-zero
12588 Detect floating-point division by zero. Unlike other similar
12589 options, -fsanitize=float-divide-by-zero is not enabled by
12590 -fsanitize=undefined, since floating-point division by zero can
12591 be a legitimate way of obtaining infinities and NaNs.
12592
12593 -fsanitize=float-cast-overflow
12594 This option enables floating-point type to integer conversion
12595 checking. We check that the result of the conversion does not
12596 overflow. Unlike other similar options,
12597 -fsanitize=float-cast-overflow is not enabled by
12598 -fsanitize=undefined. This option does not work well with
12599 "FE_INVALID" exceptions enabled.
12600
12601 -fsanitize=nonnull-attribute
12602 This option enables instrumentation of calls, checking whether
12603 null values are not passed to arguments marked as requiring a
12604 non-null value by the "nonnull" function attribute.
12605
12606 -fsanitize=returns-nonnull-attribute
12607 This option enables instrumentation of return statements in
12608 functions marked with "returns_nonnull" function attribute, to
12609 detect returning of null values from such functions.
12610
12611 -fsanitize=bool
12612 This option enables instrumentation of loads from bool. If a
12613 value other than 0/1 is loaded, a run-time error is issued.
12614
12615 -fsanitize=enum
12616 This option enables instrumentation of loads from an enum type.
12617 If a value outside the range of values for the enum type is
12618 loaded, a run-time error is issued.
12619
12620 -fsanitize=vptr
12621 This option enables instrumentation of C++ member function
12622 calls, member accesses and some conversions between pointers to
12623 base and derived classes, to verify the referenced object has
12624 the correct dynamic type.
12625
12626 -fsanitize=pointer-overflow
12627 This option enables instrumentation of pointer arithmetics. If
12628 the pointer arithmetics overflows, a run-time error is issued.
12629
12630 -fsanitize=builtin
12631 This option enables instrumentation of arguments to selected
12632 builtin functions. If an invalid value is passed to such
12633 arguments, a run-time error is issued. E.g. passing 0 as the
12634 argument to "__builtin_ctz" or "__builtin_clz" invokes
12635 undefined behavior and is diagnosed by this option.
12636
12637 While -ftrapv causes traps for signed overflows to be emitted,
12638 -fsanitize=undefined gives a diagnostic message. This currently
12639 works only for the C family of languages.
12640
12641 -fno-sanitize=all
12642 This option disables all previously enabled sanitizers.
12643 -fsanitize=all is not allowed, as some sanitizers cannot be used
12644 together.
12645
12646 -fasan-shadow-offset=number
12647 This option forces GCC to use custom shadow offset in
12648 AddressSanitizer checks. It is useful for experimenting with
12649 different shadow memory layouts in Kernel AddressSanitizer.
12650
12651 -fsanitize-sections=s1,s2,...
12652 Sanitize global variables in selected user-defined sections. si
12653 may contain wildcards.
12654
12655 -fsanitize-recover[=opts]
12656 -fsanitize-recover= controls error recovery mode for sanitizers
12657 mentioned in comma-separated list of opts. Enabling this option
12658 for a sanitizer component causes it to attempt to continue running
12659 the program as if no error happened. This means multiple runtime
12660 errors can be reported in a single program run, and the exit code
12661 of the program may indicate success even when errors have been
12662 reported. The -fno-sanitize-recover= option can be used to alter
12663 this behavior: only the first detected error is reported and
12664 program then exits with a non-zero exit code.
12665
12666 Currently this feature only works for -fsanitize=undefined (and its
12667 suboptions except for -fsanitize=unreachable and
12668 -fsanitize=return), -fsanitize=float-cast-overflow,
12669 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
12670 -fsanitize=kernel-address and -fsanitize=address. For these
12671 sanitizers error recovery is turned on by default, except
12672 -fsanitize=address, for which this feature is experimental.
12673 -fsanitize-recover=all and -fno-sanitize-recover=all is also
12674 accepted, the former enables recovery for all sanitizers that
12675 support it, the latter disables recovery for all sanitizers that
12676 support it.
12677
12678 Even if a recovery mode is turned on the compiler side, it needs to
12679 be also enabled on the runtime library side, otherwise the failures
12680 are still fatal. The runtime library defaults to "halt_on_error=0"
12681 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
12682 value for AddressSanitizer is "halt_on_error=1". This can be
12683 overridden through setting the "halt_on_error" flag in the
12684 corresponding environment variable.
12685
12686 Syntax without an explicit opts parameter is deprecated. It is
12687 equivalent to specifying an opts list of:
12688
12689 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12690
12691 -fsanitize-address-use-after-scope
12692 Enable sanitization of local variables to detect use-after-scope
12693 bugs. The option sets -fstack-reuse to none.
12694
12695 -fsanitize-undefined-trap-on-error
12696 The -fsanitize-undefined-trap-on-error option instructs the
12697 compiler to report undefined behavior using "__builtin_trap" rather
12698 than a "libubsan" library routine. The advantage of this is that
12699 the "libubsan" library is not needed and is not linked in, so this
12700 is usable even in freestanding environments.
12701
12702 -fsanitize-coverage=trace-pc
12703 Enable coverage-guided fuzzing code instrumentation. Inserts a
12704 call to "__sanitizer_cov_trace_pc" into every basic block.
12705
12706 -fsanitize-coverage=trace-cmp
12707 Enable dataflow guided fuzzing code instrumentation. Inserts a
12708 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
12709 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
12710 integral comparison with both operands variable or
12711 "__sanitizer_cov_trace_const_cmp1",
12712 "__sanitizer_cov_trace_const_cmp2",
12713 "__sanitizer_cov_trace_const_cmp4" or
12714 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
12715 operand constant, "__sanitizer_cov_trace_cmpf" or
12716 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
12717 "__sanitizer_cov_trace_switch" for switch statements.
12718
12719 -fcf-protection=[full|branch|return|none|check]
12720 Enable code instrumentation of control-flow transfers to increase
12721 program security by checking that target addresses of control-flow
12722 transfer instructions (such as indirect function call, function
12723 return, indirect jump) are valid. This prevents diverting the flow
12724 of control to an unexpected target. This is intended to protect
12725 against such threats as Return-oriented Programming (ROP), and
12726 similarly call/jmp-oriented programming (COP/JOP).
12727
12728 The value "branch" tells the compiler to implement checking of
12729 validity of control-flow transfer at the point of indirect branch
12730 instructions, i.e. call/jmp instructions. The value "return"
12731 implements checking of validity at the point of returning from a
12732 function. The value "full" is an alias for specifying both
12733 "branch" and "return". The value "none" turns off instrumentation.
12734
12735 The value "check" is used for the final link with link-time
12736 optimization (LTO). An error is issued if LTO object files are
12737 compiled with different -fcf-protection values. The value "check"
12738 is ignored at the compile time.
12739
12740 The macro "__CET__" is defined when -fcf-protection is used. The
12741 first bit of "__CET__" is set to 1 for the value "branch" and the
12742 second bit of "__CET__" is set to 1 for the "return".
12743
12744 You can also use the "nocf_check" attribute to identify which
12745 functions and calls should be skipped from instrumentation.
12746
12747 Currently the x86 GNU/Linux target provides an implementation based
12748 on Intel Control-flow Enforcement Technology (CET).
12749
12750 -fstack-protector
12751 Emit extra code to check for buffer overflows, such as stack
12752 smashing attacks. This is done by adding a guard variable to
12753 functions with vulnerable objects. This includes functions that
12754 call "alloca", and functions with buffers larger than or equal to 8
12755 bytes. The guards are initialized when a function is entered and
12756 then checked when the function exits. If a guard check fails, an
12757 error message is printed and the program exits. Only variables
12758 that are actually allocated on the stack are considered, optimized
12759 away variables or variables allocated in registers don't count.
12760
12761 -fstack-protector-all
12762 Like -fstack-protector except that all functions are protected.
12763
12764 -fstack-protector-strong
12765 Like -fstack-protector but includes additional functions to be
12766 protected --- those that have local array definitions, or have
12767 references to local frame addresses. Only variables that are
12768 actually allocated on the stack are considered, optimized away
12769 variables or variables allocated in registers don't count.
12770
12771 -fstack-protector-explicit
12772 Like -fstack-protector but only protects those functions which have
12773 the "stack_protect" attribute.
12774
12775 -fstack-check
12776 Generate code to verify that you do not go beyond the boundary of
12777 the stack. You should specify this flag if you are running in an
12778 environment with multiple threads, but you only rarely need to
12779 specify it in a single-threaded environment since stack overflow is
12780 automatically detected on nearly all systems if there is only one
12781 stack.
12782
12783 Note that this switch does not actually cause checking to be done;
12784 the operating system or the language runtime must do that. The
12785 switch causes generation of code to ensure that they see the stack
12786 being extended.
12787
12788 You can additionally specify a string parameter: no means no
12789 checking, generic means force the use of old-style checking,
12790 specific means use the best checking method and is equivalent to
12791 bare -fstack-check.
12792
12793 Old-style checking is a generic mechanism that requires no specific
12794 target support in the compiler but comes with the following
12795 drawbacks:
12796
12797 1. Modified allocation strategy for large objects: they are always
12798 allocated dynamically if their size exceeds a fixed threshold.
12799 Note this may change the semantics of some code.
12800
12801 2. Fixed limit on the size of the static frame of functions: when
12802 it is topped by a particular function, stack checking is not
12803 reliable and a warning is issued by the compiler.
12804
12805 3. Inefficiency: because of both the modified allocation strategy
12806 and the generic implementation, code performance is hampered.
12807
12808 Note that old-style stack checking is also the fallback method for
12809 specific if no target support has been added in the compiler.
12810
12811 -fstack-check= is designed for Ada's needs to detect infinite
12812 recursion and stack overflows. specific is an excellent choice
12813 when compiling Ada code. It is not generally sufficient to protect
12814 against stack-clash attacks. To protect against those you want
12815 -fstack-clash-protection.
12816
12817 -fstack-clash-protection
12818 Generate code to prevent stack clash style attacks. When this
12819 option is enabled, the compiler will only allocate one page of
12820 stack space at a time and each page is accessed immediately after
12821 allocation. Thus, it prevents allocations from jumping over any
12822 stack guard page provided by the operating system.
12823
12824 Most targets do not fully support stack clash protection. However,
12825 on those targets -fstack-clash-protection will protect dynamic
12826 stack allocations. -fstack-clash-protection may also provide
12827 limited protection for static stack allocations if the target
12828 supports -fstack-check=specific.
12829
12830 -fstack-limit-register=reg
12831 -fstack-limit-symbol=sym
12832 -fno-stack-limit
12833 Generate code to ensure that the stack does not grow beyond a
12834 certain value, either the value of a register or the address of a
12835 symbol. If a larger stack is required, a signal is raised at run
12836 time. For most targets, the signal is raised before the stack
12837 overruns the boundary, so it is possible to catch the signal
12838 without taking special precautions.
12839
12840 For instance, if the stack starts at absolute address 0x80000000
12841 and grows downwards, you can use the flags
12842 -fstack-limit-symbol=__stack_limit and
12843 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
12844 128KB. Note that this may only work with the GNU linker.
12845
12846 You can locally override stack limit checking by using the
12847 "no_stack_limit" function attribute.
12848
12849 -fsplit-stack
12850 Generate code to automatically split the stack before it overflows.
12851 The resulting program has a discontiguous stack which can only
12852 overflow if the program is unable to allocate any more memory.
12853 This is most useful when running threaded programs, as it is no
12854 longer necessary to calculate a good stack size to use for each
12855 thread. This is currently only implemented for the x86 targets
12856 running GNU/Linux.
12857
12858 When code compiled with -fsplit-stack calls code compiled without
12859 -fsplit-stack, there may not be much stack space available for the
12860 latter code to run. If compiling all code, including library code,
12861 with -fsplit-stack is not an option, then the linker can fix up
12862 these calls so that the code compiled without -fsplit-stack always
12863 has a large stack. Support for this is implemented in the gold
12864 linker in GNU binutils release 2.21 and later.
12865
12866 -fvtable-verify=[std|preinit|none]
12867 This option is only available when compiling C++ code. It turns on
12868 (or off, if using -fvtable-verify=none) the security feature that
12869 verifies at run time, for every virtual call, that the vtable
12870 pointer through which the call is made is valid for the type of the
12871 object, and has not been corrupted or overwritten. If an invalid
12872 vtable pointer is detected at run time, an error is reported and
12873 execution of the program is immediately halted.
12874
12875 This option causes run-time data structures to be built at program
12876 startup, which are used for verifying the vtable pointers. The
12877 options std and preinit control the timing of when these data
12878 structures are built. In both cases the data structures are built
12879 before execution reaches "main". Using -fvtable-verify=std causes
12880 the data structures to be built after shared libraries have been
12881 loaded and initialized. -fvtable-verify=preinit causes them to be
12882 built before shared libraries have been loaded and initialized.
12883
12884 If this option appears multiple times in the command line with
12885 different values specified, none takes highest priority over both
12886 std and preinit; preinit takes priority over std.
12887
12888 -fvtv-debug
12889 When used in conjunction with -fvtable-verify=std or
12890 -fvtable-verify=preinit, causes debug versions of the runtime
12891 functions for the vtable verification feature to be called. This
12892 flag also causes the compiler to log information about which vtable
12893 pointers it finds for each class. This information is written to a
12894 file named vtv_set_ptr_data.log in the directory named by the
12895 environment variable VTV_LOGS_DIR if that is defined or the current
12896 working directory otherwise.
12897
12898 Note: This feature appends data to the log file. If you want a
12899 fresh log file, be sure to delete any existing one.
12900
12901 -fvtv-counts
12902 This is a debugging flag. When used in conjunction with
12903 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
12904 compiler to keep track of the total number of virtual calls it
12905 encounters and the number of verifications it inserts. It also
12906 counts the number of calls to certain run-time library functions
12907 that it inserts and logs this information for each compilation
12908 unit. The compiler writes this information to a file named
12909 vtv_count_data.log in the directory named by the environment
12910 variable VTV_LOGS_DIR if that is defined or the current working
12911 directory otherwise. It also counts the size of the vtable pointer
12912 sets for each class, and writes this information to
12913 vtv_class_set_sizes.log in the same directory.
12914
12915 Note: This feature appends data to the log files. To get fresh
12916 log files, be sure to delete any existing ones.
12917
12918 -finstrument-functions
12919 Generate instrumentation calls for entry and exit to functions.
12920 Just after function entry and just before function exit, the
12921 following profiling functions are called with the address of the
12922 current function and its call site. (On some platforms,
12923 "__builtin_return_address" does not work beyond the current
12924 function, so the call site information may not be available to the
12925 profiling functions otherwise.)
12926
12927 void __cyg_profile_func_enter (void *this_fn,
12928 void *call_site);
12929 void __cyg_profile_func_exit (void *this_fn,
12930 void *call_site);
12931
12932 The first argument is the address of the start of the current
12933 function, which may be looked up exactly in the symbol table.
12934
12935 This instrumentation is also done for functions expanded inline in
12936 other functions. The profiling calls indicate where, conceptually,
12937 the inline function is entered and exited. This means that
12938 addressable versions of such functions must be available. If all
12939 your uses of a function are expanded inline, this may mean an
12940 additional expansion of code size. If you use "extern inline" in
12941 your C code, an addressable version of such functions must be
12942 provided. (This is normally the case anyway, but if you get lucky
12943 and the optimizer always expands the functions inline, you might
12944 have gotten away without providing static copies.)
12945
12946 A function may be given the attribute "no_instrument_function", in
12947 which case this instrumentation is not done. This can be used, for
12948 example, for the profiling functions listed above, high-priority
12949 interrupt routines, and any functions from which the profiling
12950 functions cannot safely be called (perhaps signal handlers, if the
12951 profiling routines generate output or allocate memory).
12952
12953 -finstrument-functions-exclude-file-list=file,file,...
12954 Set the list of functions that are excluded from instrumentation
12955 (see the description of -finstrument-functions). If the file that
12956 contains a function definition matches with one of file, then that
12957 function is not instrumented. The match is done on substrings: if
12958 the file parameter is a substring of the file name, it is
12959 considered to be a match.
12960
12961 For example:
12962
12963 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12964
12965 excludes any inline function defined in files whose pathnames
12966 contain /bits/stl or include/sys.
12967
12968 If, for some reason, you want to include letter , in one of sym,
12969 write ,. For example,
12970 -finstrument-functions-exclude-file-list=',,tmp' (note the single
12971 quote surrounding the option).
12972
12973 -finstrument-functions-exclude-function-list=sym,sym,...
12974 This is similar to -finstrument-functions-exclude-file-list, but
12975 this option sets the list of function names to be excluded from
12976 instrumentation. The function name to be matched is its user-
12977 visible name, such as "vector<int> blah(const vector<int> &)", not
12978 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
12979 match is done on substrings: if the sym parameter is a substring of
12980 the function name, it is considered to be a match. For C99 and C++
12981 extended identifiers, the function name must be given in UTF-8, not
12982 using universal character names.
12983
12984 -fpatchable-function-entry=N[,M]
12985 Generate N NOPs right at the beginning of each function, with the
12986 function entry point before the Mth NOP. If M is omitted, it
12987 defaults to 0 so the function entry points to the address just at
12988 the first NOP. The NOP instructions reserve extra space which can
12989 be used to patch in any desired instrumentation at run time,
12990 provided that the code segment is writable. The amount of space is
12991 controllable indirectly via the number of NOPs; the NOP instruction
12992 used corresponds to the instruction emitted by the internal GCC
12993 back-end interface "gen_nop". This behavior is target-specific and
12994 may also depend on the architecture variant and/or other
12995 compilation options.
12996
12997 For run-time identification, the starting addresses of these areas,
12998 which correspond to their respective function entries minus M, are
12999 additionally collected in the "__patchable_function_entries"
13000 section of the resulting binary.
13001
13002 Note that the value of "__attribute__ ((patchable_function_entry
13003 (N,M)))" takes precedence over command-line option
13004 -fpatchable-function-entry=N,M. This can be used to increase the
13005 area size or to remove it completely on a single function. If
13006 "N=0", no pad location is recorded.
13007
13008 The NOP instructions are inserted at---and maybe before, depending
13009 on M---the function entry address, even before the prologue.
13010
13011 The maximum value of N and M is 65535.
13012
13013 Options Controlling the Preprocessor
13014 These options control the C preprocessor, which is run on each C source
13015 file before actual compilation.
13016
13017 If you use the -E option, nothing is done except preprocessing. Some
13018 of these options make sense only together with -E because they cause
13019 the preprocessor output to be unsuitable for actual compilation.
13020
13021 In addition to the options listed here, there are a number of options
13022 to control search paths for include files documented in Directory
13023 Options. Options to control preprocessor diagnostics are listed in
13024 Warning Options.
13025
13026 -D name
13027 Predefine name as a macro, with definition 1.
13028
13029 -D name=definition
13030 The contents of definition are tokenized and processed as if they
13031 appeared during translation phase three in a #define directive. In
13032 particular, the definition is truncated by embedded newline
13033 characters.
13034
13035 If you are invoking the preprocessor from a shell or shell-like
13036 program you may need to use the shell's quoting syntax to protect
13037 characters such as spaces that have a meaning in the shell syntax.
13038
13039 If you wish to define a function-like macro on the command line,
13040 write its argument list with surrounding parentheses before the
13041 equals sign (if any). Parentheses are meaningful to most shells,
13042 so you should quote the option. With sh and csh,
13043 -D'name(args...)=definition' works.
13044
13045 -D and -U options are processed in the order they are given on the
13046 command line. All -imacros file and -include file options are
13047 processed after all -D and -U options.
13048
13049 -U name
13050 Cancel any previous definition of name, either built in or provided
13051 with a -D option.
13052
13053 -include file
13054 Process file as if "#include "file"" appeared as the first line of
13055 the primary source file. However, the first directory searched for
13056 file is the preprocessor's working directory instead of the
13057 directory containing the main source file. If not found there, it
13058 is searched for in the remainder of the "#include "..."" search
13059 chain as normal.
13060
13061 If multiple -include options are given, the files are included in
13062 the order they appear on the command line.
13063
13064 -imacros file
13065 Exactly like -include, except that any output produced by scanning
13066 file is thrown away. Macros it defines remain defined. This
13067 allows you to acquire all the macros from a header without also
13068 processing its declarations.
13069
13070 All files specified by -imacros are processed before all files
13071 specified by -include.
13072
13073 -undef
13074 Do not predefine any system-specific or GCC-specific macros. The
13075 standard predefined macros remain defined.
13076
13077 -pthread
13078 Define additional macros required for using the POSIX threads
13079 library. You should use this option consistently for both
13080 compilation and linking. This option is supported on GNU/Linux
13081 targets, most other Unix derivatives, and also on x86 Cygwin and
13082 MinGW targets.
13083
13084 -M Instead of outputting the result of preprocessing, output a rule
13085 suitable for make describing the dependencies of the main source
13086 file. The preprocessor outputs one make rule containing the object
13087 file name for that source file, a colon, and the names of all the
13088 included files, including those coming from -include or -imacros
13089 command-line options.
13090
13091 Unless specified explicitly (with -MT or -MQ), the object file name
13092 consists of the name of the source file with any suffix replaced
13093 with object file suffix and with any leading directory parts
13094 removed. If there are many included files then the rule is split
13095 into several lines using \-newline. The rule has no commands.
13096
13097 This option does not suppress the preprocessor's debug output, such
13098 as -dM. To avoid mixing such debug output with the dependency
13099 rules you should explicitly specify the dependency output file with
13100 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13101 Debug output is still sent to the regular output stream as normal.
13102
13103 Passing -M to the driver implies -E, and suppresses warnings with
13104 an implicit -w.
13105
13106 -MM Like -M but do not mention header files that are found in system
13107 header directories, nor header files that are included, directly or
13108 indirectly, from such a header.
13109
13110 This implies that the choice of angle brackets or double quotes in
13111 an #include directive does not in itself determine whether that
13112 header appears in -MM dependency output.
13113
13114 -MF file
13115 When used with -M or -MM, specifies a file to write the
13116 dependencies to. If no -MF switch is given the preprocessor sends
13117 the rules to the same place it would send preprocessed output.
13118
13119 When used with the driver options -MD or -MMD, -MF overrides the
13120 default dependency output file.
13121
13122 If file is -, then the dependencies are written to stdout.
13123
13124 -MG In conjunction with an option such as -M requesting dependency
13125 generation, -MG assumes missing header files are generated files
13126 and adds them to the dependency list without raising an error. The
13127 dependency filename is taken directly from the "#include" directive
13128 without prepending any path. -MG also suppresses preprocessed
13129 output, as a missing header file renders this useless.
13130
13131 This feature is used in automatic updating of makefiles.
13132
13133 -Mno-modules
13134 Disable dependency generation for compiled module interfaces.
13135
13136 -MP This option instructs CPP to add a phony target for each dependency
13137 other than the main file, causing each to depend on nothing. These
13138 dummy rules work around errors make gives if you remove header
13139 files without updating the Makefile to match.
13140
13141 This is typical output:
13142
13143 test.o: test.c test.h
13144
13145 test.h:
13146
13147 -MT target
13148 Change the target of the rule emitted by dependency generation. By
13149 default CPP takes the name of the main input file, deletes any
13150 directory components and any file suffix such as .c, and appends
13151 the platform's usual object suffix. The result is the target.
13152
13153 An -MT option sets the target to be exactly the string you specify.
13154 If you want multiple targets, you can specify them as a single
13155 argument to -MT, or use multiple -MT options.
13156
13157 For example, -MT '$(objpfx)foo.o' might give
13158
13159 $(objpfx)foo.o: foo.c
13160
13161 -MQ target
13162 Same as -MT, but it quotes any characters which are special to
13163 Make. -MQ '$(objpfx)foo.o' gives
13164
13165 $$(objpfx)foo.o: foo.c
13166
13167 The default target is automatically quoted, as if it were given
13168 with -MQ.
13169
13170 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
13171 The driver determines file based on whether an -o option is given.
13172 If it is, the driver uses its argument but with a suffix of .d,
13173 otherwise it takes the name of the input file, removes any
13174 directory components and suffix, and applies a .d suffix.
13175
13176 If -MD is used in conjunction with -E, any -o switch is understood
13177 to specify the dependency output file, but if used without -E, each
13178 -o is understood to specify a target object file.
13179
13180 Since -E is not implied, -MD can be used to generate a dependency
13181 output file as a side effect of the compilation process.
13182
13183 -MMD
13184 Like -MD except mention only user header files, not system header
13185 files.
13186
13187 -fpreprocessed
13188 Indicate to the preprocessor that the input file has already been
13189 preprocessed. This suppresses things like macro expansion,
13190 trigraph conversion, escaped newline splicing, and processing of
13191 most directives. The preprocessor still recognizes and removes
13192 comments, so that you can pass a file preprocessed with -C to the
13193 compiler without problems. In this mode the integrated
13194 preprocessor is little more than a tokenizer for the front ends.
13195
13196 -fpreprocessed is implicit if the input file has one of the
13197 extensions .i, .ii or .mi. These are the extensions that GCC uses
13198 for preprocessed files created by -save-temps.
13199
13200 -fdirectives-only
13201 When preprocessing, handle directives, but do not expand macros.
13202
13203 The option's behavior depends on the -E and -fpreprocessed options.
13204
13205 With -E, preprocessing is limited to the handling of directives
13206 such as "#define", "#ifdef", and "#error". Other preprocessor
13207 operations, such as macro expansion and trigraph conversion are not
13208 performed. In addition, the -dD option is implicitly enabled.
13209
13210 With -fpreprocessed, predefinition of command line and most builtin
13211 macros is disabled. Macros such as "__LINE__", which are
13212 contextually dependent, are handled normally. This enables
13213 compilation of files previously preprocessed with "-E
13214 -fdirectives-only".
13215
13216 With both -E and -fpreprocessed, the rules for -fpreprocessed take
13217 precedence. This enables full preprocessing of files previously
13218 preprocessed with "-E -fdirectives-only".
13219
13220 -fdollars-in-identifiers
13221 Accept $ in identifiers.
13222
13223 -fextended-identifiers
13224 Accept universal character names and extended characters in
13225 identifiers. This option is enabled by default for C99 (and later
13226 C standard versions) and C++.
13227
13228 -fno-canonical-system-headers
13229 When preprocessing, do not shorten system header paths with
13230 canonicalization.
13231
13232 -fmax-include-depth=depth
13233 Set the maximum depth of the nested #include. The default is 200.
13234
13235 -ftabstop=width
13236 Set the distance between tab stops. This helps the preprocessor
13237 report correct column numbers in warnings or errors, even if tabs
13238 appear on the line. If the value is less than 1 or greater than
13239 100, the option is ignored. The default is 8.
13240
13241 -ftrack-macro-expansion[=level]
13242 Track locations of tokens across macro expansions. This allows the
13243 compiler to emit diagnostic about the current macro expansion stack
13244 when a compilation error occurs in a macro expansion. Using this
13245 option makes the preprocessor and the compiler consume more memory.
13246 The level parameter can be used to choose the level of precision of
13247 token location tracking thus decreasing the memory consumption if
13248 necessary. Value 0 of level de-activates this option. Value 1
13249 tracks tokens locations in a degraded mode for the sake of minimal
13250 memory overhead. In this mode all tokens resulting from the
13251 expansion of an argument of a function-like macro have the same
13252 location. Value 2 tracks tokens locations completely. This value is
13253 the most memory hungry. When this option is given no argument, the
13254 default parameter value is 2.
13255
13256 Note that "-ftrack-macro-expansion=2" is activated by default.
13257
13258 -fmacro-prefix-map=old=new
13259 When preprocessing files residing in directory old, expand the
13260 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
13261 directory new instead. This can be used to change an absolute path
13262 to a relative path by using . for new which can result in more
13263 reproducible builds that are location independent. This option
13264 also affects "__builtin_FILE()" during compilation. See also
13265 -ffile-prefix-map.
13266
13267 -fexec-charset=charset
13268 Set the execution character set, used for string and character
13269 constants. The default is UTF-8. charset can be any encoding
13270 supported by the system's "iconv" library routine.
13271
13272 -fwide-exec-charset=charset
13273 Set the wide execution character set, used for wide string and
13274 character constants. The default is UTF-32 or UTF-16, whichever
13275 corresponds to the width of "wchar_t". As with -fexec-charset,
13276 charset can be any encoding supported by the system's "iconv"
13277 library routine; however, you will have problems with encodings
13278 that do not fit exactly in "wchar_t".
13279
13280 -finput-charset=charset
13281 Set the input character set, used for translation from the
13282 character set of the input file to the source character set used by
13283 GCC. If the locale does not specify, or GCC cannot get this
13284 information from the locale, the default is UTF-8. This can be
13285 overridden by either the locale or this command-line option.
13286 Currently the command-line option takes precedence if there's a
13287 conflict. charset can be any encoding supported by the system's
13288 "iconv" library routine.
13289
13290 -fpch-deps
13291 When using precompiled headers, this flag causes the dependency-
13292 output flags to also list the files from the precompiled header's
13293 dependencies. If not specified, only the precompiled header are
13294 listed and not the files that were used to create it, because those
13295 files are not consulted when a precompiled header is used.
13296
13297 -fpch-preprocess
13298 This option allows use of a precompiled header together with -E.
13299 It inserts a special "#pragma", "#pragma GCC pch_preprocess
13300 "filename"" in the output to mark the place where the precompiled
13301 header was found, and its filename. When -fpreprocessed is in use,
13302 GCC recognizes this "#pragma" and loads the PCH.
13303
13304 This option is off by default, because the resulting preprocessed
13305 output is only really suitable as input to GCC. It is switched on
13306 by -save-temps.
13307
13308 You should not write this "#pragma" in your own code, but it is
13309 safe to edit the filename if the PCH file is available in a
13310 different location. The filename may be absolute or it may be
13311 relative to GCC's current directory.
13312
13313 -fworking-directory
13314 Enable generation of linemarkers in the preprocessor output that
13315 let the compiler know the current working directory at the time of
13316 preprocessing. When this option is enabled, the preprocessor
13317 emits, after the initial linemarker, a second linemarker with the
13318 current working directory followed by two slashes. GCC uses this
13319 directory, when it's present in the preprocessed input, as the
13320 directory emitted as the current working directory in some
13321 debugging information formats. This option is implicitly enabled
13322 if debugging information is enabled, but this can be inhibited with
13323 the negated form -fno-working-directory. If the -P flag is present
13324 in the command line, this option has no effect, since no "#line"
13325 directives are emitted whatsoever.
13326
13327 -A predicate=answer
13328 Make an assertion with the predicate predicate and answer answer.
13329 This form is preferred to the older form -A predicate(answer),
13330 which is still supported, because it does not use shell special
13331 characters.
13332
13333 -A -predicate=answer
13334 Cancel an assertion with the predicate predicate and answer answer.
13335
13336 -C Do not discard comments. All comments are passed through to the
13337 output file, except for comments in processed directives, which are
13338 deleted along with the directive.
13339
13340 You should be prepared for side effects when using -C; it causes
13341 the preprocessor to treat comments as tokens in their own right.
13342 For example, comments appearing at the start of what would be a
13343 directive line have the effect of turning that line into an
13344 ordinary source line, since the first token on the line is no
13345 longer a #.
13346
13347 -CC Do not discard comments, including during macro expansion. This is
13348 like -C, except that comments contained within macros are also
13349 passed through to the output file where the macro is expanded.
13350
13351 In addition to the side effects of the -C option, the -CC option
13352 causes all C++-style comments inside a macro to be converted to
13353 C-style comments. This is to prevent later use of that macro from
13354 inadvertently commenting out the remainder of the source line.
13355
13356 The -CC option is generally used to support lint comments.
13357
13358 -P Inhibit generation of linemarkers in the output from the
13359 preprocessor. This might be useful when running the preprocessor
13360 on something that is not C code, and will be sent to a program
13361 which might be confused by the linemarkers.
13362
13363 -traditional
13364 -traditional-cpp
13365 Try to imitate the behavior of pre-standard C preprocessors, as
13366 opposed to ISO C preprocessors. See the GNU CPP manual for
13367 details.
13368
13369 Note that GCC does not otherwise attempt to emulate a pre-standard
13370 C compiler, and these options are only supported with the -E
13371 switch, or when invoking CPP explicitly.
13372
13373 -trigraphs
13374 Support ISO C trigraphs. These are three-character sequences, all
13375 starting with ??, that are defined by ISO C to stand for single
13376 characters. For example, ??/ stands for \, so '??/n' is a
13377 character constant for a newline.
13378
13379 The nine trigraphs and their replacements are
13380
13381 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
13382 Replacement: [ ] { } # \ ^ | ~
13383
13384 By default, GCC ignores trigraphs, but in standard-conforming modes
13385 it converts them. See the -std and -ansi options.
13386
13387 -remap
13388 Enable special code to work around file systems which only permit
13389 very short file names, such as MS-DOS.
13390
13391 -H Print the name of each header file used, in addition to other
13392 normal activities. Each name is indented to show how deep in the
13393 #include stack it is. Precompiled header files are also printed,
13394 even if they are found to be invalid; an invalid precompiled header
13395 file is printed with ...x and a valid one with ...! .
13396
13397 -dletters
13398 Says to make debugging dumps during compilation as specified by
13399 letters. The flags documented here are those relevant to the
13400 preprocessor. Other letters are interpreted by the compiler
13401 proper, or reserved for future versions of GCC, and so are silently
13402 ignored. If you specify letters whose behavior conflicts, the
13403 result is undefined.
13404
13405 -dM Instead of the normal output, generate a list of #define
13406 directives for all the macros defined during the execution of
13407 the preprocessor, including predefined macros. This gives you
13408 a way of finding out what is predefined in your version of the
13409 preprocessor. Assuming you have no file foo.h, the command
13410
13411 touch foo.h; cpp -dM foo.h
13412
13413 shows all the predefined macros.
13414
13415 If you use -dM without the -E option, -dM is interpreted as a
13416 synonym for -fdump-rtl-mach.
13417
13418 -dD Like -dM except in two respects: it does not include the
13419 predefined macros, and it outputs both the #define directives
13420 and the result of preprocessing. Both kinds of output go to
13421 the standard output file.
13422
13423 -dN Like -dD, but emit only the macro names, not their expansions.
13424
13425 -dI Output #include directives in addition to the result of
13426 preprocessing.
13427
13428 -dU Like -dD except that only macros that are expanded, or whose
13429 definedness is tested in preprocessor directives, are output;
13430 the output is delayed until the use or test of the macro; and
13431 #undef directives are also output for macros tested but
13432 undefined at the time.
13433
13434 -fdebug-cpp
13435 This option is only useful for debugging GCC. When used from CPP
13436 or with -E, it dumps debugging information about location maps.
13437 Every token in the output is preceded by the dump of the map its
13438 location belongs to.
13439
13440 When used from GCC without -E, this option has no effect.
13441
13442 -Wp,option
13443 You can use -Wp,option to bypass the compiler driver and pass
13444 option directly through to the preprocessor. If option contains
13445 commas, it is split into multiple options at the commas. However,
13446 many options are modified, translated or interpreted by the
13447 compiler driver before being passed to the preprocessor, and -Wp
13448 forcibly bypasses this phase. The preprocessor's direct interface
13449 is undocumented and subject to change, so whenever possible you
13450 should avoid using -Wp and let the driver handle the options
13451 instead.
13452
13453 -Xpreprocessor option
13454 Pass option as an option to the preprocessor. You can use this to
13455 supply system-specific preprocessor options that GCC does not
13456 recognize.
13457
13458 If you want to pass an option that takes an argument, you must use
13459 -Xpreprocessor twice, once for the option and once for the
13460 argument.
13461
13462 -no-integrated-cpp
13463 Perform preprocessing as a separate pass before compilation. By
13464 default, GCC performs preprocessing as an integrated part of input
13465 tokenization and parsing. If this option is provided, the
13466 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
13467 and Objective-C, respectively) is instead invoked twice, once for
13468 preprocessing only and once for actual compilation of the
13469 preprocessed input. This option may be useful in conjunction with
13470 the -B or -wrapper options to specify an alternate preprocessor or
13471 perform additional processing of the program source between normal
13472 preprocessing and compilation.
13473
13474 -flarge-source-files
13475 Adjust GCC to expect large source files, at the expense of slower
13476 compilation and higher memory usage.
13477
13478 Specifically, GCC normally tracks both column numbers and line
13479 numbers within source files and it normally prints both of these
13480 numbers in diagnostics. However, once it has processed a certain
13481 number of source lines, it stops tracking column numbers and only
13482 tracks line numbers. This means that diagnostics for later lines
13483 do not include column numbers. It also means that options like
13484 -Wmisleading-indentation cease to work at that point, although the
13485 compiler prints a note if this happens. Passing
13486 -flarge-source-files significantly increases the number of source
13487 lines that GCC can process before it stops tracking columns.
13488
13489 Passing Options to the Assembler
13490 You can pass options to the assembler.
13491
13492 -Wa,option
13493 Pass option as an option to the assembler. If option contains
13494 commas, it is split into multiple options at the commas.
13495
13496 -Xassembler option
13497 Pass option as an option to the assembler. You can use this to
13498 supply system-specific assembler options that GCC does not
13499 recognize.
13500
13501 If you want to pass an option that takes an argument, you must use
13502 -Xassembler twice, once for the option and once for the argument.
13503
13504 Options for Linking
13505 These options come into play when the compiler links object files into
13506 an executable output file. They are meaningless if the compiler is not
13507 doing a link step.
13508
13509 object-file-name
13510 A file name that does not end in a special recognized suffix is
13511 considered to name an object file or library. (Object files are
13512 distinguished from libraries by the linker according to the file
13513 contents.) If linking is done, these object files are used as
13514 input to the linker.
13515
13516 -c
13517 -S
13518 -E If any of these options is used, then the linker is not run, and
13519 object file names should not be used as arguments.
13520
13521 -flinker-output=type
13522 This option controls code generation of the link-time optimizer.
13523 By default the linker output is automatically determined by the
13524 linker plugin. For debugging the compiler and if incremental
13525 linking with a non-LTO object file is desired, it may be useful to
13526 control the type manually.
13527
13528 If type is exec, code generation produces a static binary. In this
13529 case -fpic and -fpie are both disabled.
13530
13531 If type is dyn, code generation produces a shared library. In this
13532 case -fpic or -fPIC is preserved, but not enabled automatically.
13533 This allows to build shared libraries without position-independent
13534 code on architectures where this is possible, i.e. on x86.
13535
13536 If type is pie, code generation produces an -fpie executable. This
13537 results in similar optimizations as exec except that -fpie is not
13538 disabled if specified at compilation time.
13539
13540 If type is rel, the compiler assumes that incremental linking is
13541 done. The sections containing intermediate code for link-time
13542 optimization are merged, pre-optimized, and output to the resulting
13543 object file. In addition, if -ffat-lto-objects is specified, binary
13544 code is produced for future non-LTO linking. The object file
13545 produced by incremental linking is smaller than a static library
13546 produced from the same object files. At link time the result of
13547 incremental linking also loads faster than a static library
13548 assuming that the majority of objects in the library are used.
13549
13550 Finally nolto-rel configures the compiler for incremental linking
13551 where code generation is forced, a final binary is produced, and
13552 the intermediate code for later link-time optimization is stripped.
13553 When multiple object files are linked together the resulting code
13554 is better optimized than with link-time optimizations disabled (for
13555 example, cross-module inlining happens), but most of benefits of
13556 whole program optimizations are lost.
13557
13558 During the incremental link (by -r) the linker plugin defaults to
13559 rel. With current interfaces to GNU Binutils it is however not
13560 possible to incrementally link LTO objects and non-LTO objects into
13561 a single mixed object file. If any of object files in incremental
13562 link cannot be used for link-time optimization, the linker plugin
13563 issues a warning and uses nolto-rel. To maintain whole program
13564 optimization, it is recommended to link such objects into static
13565 library instead. Alternatively it is possible to use H.J. Lu's
13566 binutils with support for mixed objects.
13567
13568 -fuse-ld=bfd
13569 Use the bfd linker instead of the default linker.
13570
13571 -fuse-ld=gold
13572 Use the gold linker instead of the default linker.
13573
13574 -fuse-ld=lld
13575 Use the LLVM lld linker instead of the default linker.
13576
13577 -llibrary
13578 -l library
13579 Search the library named library when linking. (The second
13580 alternative with the library as a separate argument is only for
13581 POSIX compliance and is not recommended.)
13582
13583 The -l option is passed directly to the linker by GCC. Refer to
13584 your linker documentation for exact details. The general
13585 description below applies to the GNU linker.
13586
13587 The linker searches a standard list of directories for the library.
13588 The directories searched include several standard system
13589 directories plus any that you specify with -L.
13590
13591 Static libraries are archives of object files, and have file names
13592 like liblibrary.a. Some targets also support shared libraries,
13593 which typically have names like liblibrary.so. If both static and
13594 shared libraries are found, the linker gives preference to linking
13595 with the shared library unless the -static option is used.
13596
13597 It makes a difference where in the command you write this option;
13598 the linker searches and processes libraries and object files in the
13599 order they are specified. Thus, foo.o -lz bar.o searches library z
13600 after file foo.o but before bar.o. If bar.o refers to functions in
13601 z, those functions may not be loaded.
13602
13603 -lobjc
13604 You need this special case of the -l option in order to link an
13605 Objective-C or Objective-C++ program.
13606
13607 -nostartfiles
13608 Do not use the standard system startup files when linking. The
13609 standard system libraries are used normally, unless -nostdlib,
13610 -nolibc, or -nodefaultlibs is used.
13611
13612 -nodefaultlibs
13613 Do not use the standard system libraries when linking. Only the
13614 libraries you specify are passed to the linker, and options
13615 specifying linkage of the system libraries, such as -static-libgcc
13616 or -shared-libgcc, are ignored. The standard startup files are
13617 used normally, unless -nostartfiles is used.
13618
13619 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13620 "memmove". These entries are usually resolved by entries in libc.
13621 These entry points should be supplied through some other mechanism
13622 when this option is specified.
13623
13624 -nolibc
13625 Do not use the C library or system libraries tightly coupled with
13626 it when linking. Still link with the startup files, libgcc or
13627 toolchain provided language support libraries such as libgnat,
13628 libgfortran or libstdc++ unless options preventing their inclusion
13629 are used as well. This typically removes -lc from the link command
13630 line, as well as system libraries that normally go with it and
13631 become meaningless when absence of a C library is assumed, for
13632 example -lpthread or -lm in some configurations. This is intended
13633 for bare-board targets when there is indeed no C library available.
13634
13635 -nostdlib
13636 Do not use the standard system startup files or libraries when
13637 linking. No startup files and only the libraries you specify are
13638 passed to the linker, and options specifying linkage of the system
13639 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
13640
13641 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13642 "memmove". These entries are usually resolved by entries in libc.
13643 These entry points should be supplied through some other mechanism
13644 when this option is specified.
13645
13646 One of the standard libraries bypassed by -nostdlib and
13647 -nodefaultlibs is libgcc.a, a library of internal subroutines which
13648 GCC uses to overcome shortcomings of particular machines, or
13649 special needs for some languages.
13650
13651 In most cases, you need libgcc.a even when you want to avoid other
13652 standard libraries. In other words, when you specify -nostdlib or
13653 -nodefaultlibs you should usually specify -lgcc as well. This
13654 ensures that you have no unresolved references to internal GCC
13655 library subroutines. (An example of such an internal subroutine is
13656 "__main", used to ensure C++ constructors are called.)
13657
13658 -e entry
13659 --entry=entry
13660 Specify that the program entry point is entry. The argument is
13661 interpreted by the linker; the GNU linker accepts either a symbol
13662 name or an address.
13663
13664 -pie
13665 Produce a dynamically linked position independent executable on
13666 targets that support it. For predictable results, you must also
13667 specify the same set of options used for compilation (-fpie, -fPIE,
13668 or model suboptions) when you specify this linker option.
13669
13670 -no-pie
13671 Don't produce a dynamically linked position independent executable.
13672
13673 -static-pie
13674 Produce a static position independent executable on targets that
13675 support it. A static position independent executable is similar to
13676 a static executable, but can be loaded at any address without a
13677 dynamic linker. For predictable results, you must also specify the
13678 same set of options used for compilation (-fpie, -fPIE, or model
13679 suboptions) when you specify this linker option.
13680
13681 -pthread
13682 Link with the POSIX threads library. This option is supported on
13683 GNU/Linux targets, most other Unix derivatives, and also on x86
13684 Cygwin and MinGW targets. On some targets this option also sets
13685 flags for the preprocessor, so it should be used consistently for
13686 both compilation and linking.
13687
13688 -r Produce a relocatable object as output. This is also known as
13689 partial linking.
13690
13691 -rdynamic
13692 Pass the flag -export-dynamic to the ELF linker, on targets that
13693 support it. This instructs the linker to add all symbols, not only
13694 used ones, to the dynamic symbol table. This option is needed for
13695 some uses of "dlopen" or to allow obtaining backtraces from within
13696 a program.
13697
13698 -s Remove all symbol table and relocation information from the
13699 executable.
13700
13701 -static
13702 On systems that support dynamic linking, this overrides -pie and
13703 prevents linking with the shared libraries. On other systems, this
13704 option has no effect.
13705
13706 -shared
13707 Produce a shared object which can then be linked with other objects
13708 to form an executable. Not all systems support this option. For
13709 predictable results, you must also specify the same set of options
13710 used for compilation (-fpic, -fPIC, or model suboptions) when you
13711 specify this linker option.[1]
13712
13713 -shared-libgcc
13714 -static-libgcc
13715 On systems that provide libgcc as a shared library, these options
13716 force the use of either the shared or static version, respectively.
13717 If no shared version of libgcc was built when the compiler was
13718 configured, these options have no effect.
13719
13720 There are several situations in which an application should use the
13721 shared libgcc instead of the static version. The most common of
13722 these is when the application wishes to throw and catch exceptions
13723 across different shared libraries. In that case, each of the
13724 libraries as well as the application itself should use the shared
13725 libgcc.
13726
13727 Therefore, the G++ driver automatically adds -shared-libgcc
13728 whenever you build a shared library or a main executable, because
13729 C++ programs typically use exceptions, so this is the right thing
13730 to do.
13731
13732 If, instead, you use the GCC driver to create shared libraries, you
13733 may find that they are not always linked with the shared libgcc.
13734 If GCC finds, at its configuration time, that you have a non-GNU
13735 linker or a GNU linker that does not support option --eh-frame-hdr,
13736 it links the shared version of libgcc into shared libraries by
13737 default. Otherwise, it takes advantage of the linker and optimizes
13738 away the linking with the shared version of libgcc, linking with
13739 the static version of libgcc by default. This allows exceptions to
13740 propagate through such shared libraries, without incurring
13741 relocation costs at library load time.
13742
13743 However, if a library or main executable is supposed to throw or
13744 catch exceptions, you must link it using the G++ driver, or using
13745 the option -shared-libgcc, such that it is linked with the shared
13746 libgcc.
13747
13748 -static-libasan
13749 When the -fsanitize=address option is used to link a program, the
13750 GCC driver automatically links against libasan. If libasan is
13751 available as a shared library, and the -static option is not used,
13752 then this links against the shared version of libasan. The
13753 -static-libasan option directs the GCC driver to link libasan
13754 statically, without necessarily linking other libraries statically.
13755
13756 -static-libtsan
13757 When the -fsanitize=thread option is used to link a program, the
13758 GCC driver automatically links against libtsan. If libtsan is
13759 available as a shared library, and the -static option is not used,
13760 then this links against the shared version of libtsan. The
13761 -static-libtsan option directs the GCC driver to link libtsan
13762 statically, without necessarily linking other libraries statically.
13763
13764 -static-liblsan
13765 When the -fsanitize=leak option is used to link a program, the GCC
13766 driver automatically links against liblsan. If liblsan is
13767 available as a shared library, and the -static option is not used,
13768 then this links against the shared version of liblsan. The
13769 -static-liblsan option directs the GCC driver to link liblsan
13770 statically, without necessarily linking other libraries statically.
13771
13772 -static-libubsan
13773 When the -fsanitize=undefined option is used to link a program, the
13774 GCC driver automatically links against libubsan. If libubsan is
13775 available as a shared library, and the -static option is not used,
13776 then this links against the shared version of libubsan. The
13777 -static-libubsan option directs the GCC driver to link libubsan
13778 statically, without necessarily linking other libraries statically.
13779
13780 -static-libstdc++
13781 When the g++ program is used to link a C++ program, it normally
13782 automatically links against libstdc++. If libstdc++ is available
13783 as a shared library, and the -static option is not used, then this
13784 links against the shared version of libstdc++. That is normally
13785 fine. However, it is sometimes useful to freeze the version of
13786 libstdc++ used by the program without going all the way to a fully
13787 static link. The -static-libstdc++ option directs the g++ driver
13788 to link libstdc++ statically, without necessarily linking other
13789 libraries statically.
13790
13791 -symbolic
13792 Bind references to global symbols when building a shared object.
13793 Warn about any unresolved references (unless overridden by the link
13794 editor option -Xlinker -z -Xlinker defs). Only a few systems
13795 support this option.
13796
13797 -T script
13798 Use script as the linker script. This option is supported by most
13799 systems using the GNU linker. On some targets, such as bare-board
13800 targets without an operating system, the -T option may be required
13801 when linking to avoid references to undefined symbols.
13802
13803 -Xlinker option
13804 Pass option as an option to the linker. You can use this to supply
13805 system-specific linker options that GCC does not recognize.
13806
13807 If you want to pass an option that takes a separate argument, you
13808 must use -Xlinker twice, once for the option and once for the
13809 argument. For example, to pass -assert definitions, you must write
13810 -Xlinker -assert -Xlinker definitions. It does not work to write
13811 -Xlinker "-assert definitions", because this passes the entire
13812 string as a single argument, which is not what the linker expects.
13813
13814 When using the GNU linker, it is usually more convenient to pass
13815 arguments to linker options using the option=value syntax than as
13816 separate arguments. For example, you can specify -Xlinker
13817 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
13818 Other linkers may not support this syntax for command-line options.
13819
13820 -Wl,option
13821 Pass option as an option to the linker. If option contains commas,
13822 it is split into multiple options at the commas. You can use this
13823 syntax to pass an argument to the option. For example,
13824 -Wl,-Map,output.map passes -Map output.map to the linker. When
13825 using the GNU linker, you can also get the same effect with
13826 -Wl,-Map=output.map.
13827
13828 -u symbol
13829 Pretend the symbol symbol is undefined, to force linking of library
13830 modules to define it. You can use -u multiple times with different
13831 symbols to force loading of additional library modules.
13832
13833 -z keyword
13834 -z is passed directly on to the linker along with the keyword
13835 keyword. See the section in the documentation of your linker for
13836 permitted values and their meanings.
13837
13838 Options for Directory Search
13839 These options specify directories to search for header files, for
13840 libraries and for parts of the compiler:
13841
13842 -I dir
13843 -iquote dir
13844 -isystem dir
13845 -idirafter dir
13846 Add the directory dir to the list of directories to be searched for
13847 header files during preprocessing. If dir begins with = or
13848 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
13849 see --sysroot and -isysroot.
13850
13851 Directories specified with -iquote apply only to the quote form of
13852 the directive, "#include "file"". Directories specified with -I,
13853 -isystem, or -idirafter apply to lookup for both the
13854 "#include "file"" and "#include <file>" directives.
13855
13856 You can specify any number or combination of these options on the
13857 command line to search for header files in several directories.
13858 The lookup order is as follows:
13859
13860 1. For the quote form of the include directive, the directory of
13861 the current file is searched first.
13862
13863 2. For the quote form of the include directive, the directories
13864 specified by -iquote options are searched in left-to-right
13865 order, as they appear on the command line.
13866
13867 3. Directories specified with -I options are scanned in left-to-
13868 right order.
13869
13870 4. Directories specified with -isystem options are scanned in
13871 left-to-right order.
13872
13873 5. Standard system directories are scanned.
13874
13875 6. Directories specified with -idirafter options are scanned in
13876 left-to-right order.
13877
13878 You can use -I to override a system header file, substituting your
13879 own version, since these directories are searched before the
13880 standard system header file directories. However, you should not
13881 use this option to add directories that contain vendor-supplied
13882 system header files; use -isystem for that.
13883
13884 The -isystem and -idirafter options also mark the directory as a
13885 system directory, so that it gets the same special treatment that
13886 is applied to the standard system directories.
13887
13888 If a standard system include directory, or a directory specified
13889 with -isystem, is also specified with -I, the -I option is ignored.
13890 The directory is still searched but as a system directory at its
13891 normal position in the system include chain. This is to ensure
13892 that GCC's procedure to fix buggy system headers and the ordering
13893 for the "#include_next" directive are not inadvertently changed.
13894 If you really need to change the search order for system
13895 directories, use the -nostdinc and/or -isystem options.
13896
13897 -I- Split the include path. This option has been deprecated. Please
13898 use -iquote instead for -I directories before the -I- and remove
13899 the -I- option.
13900
13901 Any directories specified with -I options before -I- are searched
13902 only for headers requested with "#include "file""; they are not
13903 searched for "#include <file>". If additional directories are
13904 specified with -I options after the -I-, those directories are
13905 searched for all #include directives.
13906
13907 In addition, -I- inhibits the use of the directory of the current
13908 file directory as the first search directory for "#include "file"".
13909 There is no way to override this effect of -I-.
13910
13911 -iprefix prefix
13912 Specify prefix as the prefix for subsequent -iwithprefix options.
13913 If the prefix represents a directory, you should include the final
13914 /.
13915
13916 -iwithprefix dir
13917 -iwithprefixbefore dir
13918 Append dir to the prefix specified previously with -iprefix, and
13919 add the resulting directory to the include search path.
13920 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
13921 puts it where -idirafter would.
13922
13923 -isysroot dir
13924 This option is like the --sysroot option, but applies only to
13925 header files (except for Darwin targets, where it applies to both
13926 header files and libraries). See the --sysroot option for more
13927 information.
13928
13929 -imultilib dir
13930 Use dir as a subdirectory of the directory containing target-
13931 specific C++ headers.
13932
13933 -nostdinc
13934 Do not search the standard system directories for header files.
13935 Only the directories explicitly specified with -I, -iquote,
13936 -isystem, and/or -idirafter options (and the directory of the
13937 current file, if appropriate) are searched.
13938
13939 -nostdinc++
13940 Do not search for header files in the C++-specific standard
13941 directories, but do still search the other standard directories.
13942 (This option is used when building the C++ library.)
13943
13944 -iplugindir=dir
13945 Set the directory to search for plugins that are passed by
13946 -fplugin=name instead of -fplugin=path/name.so. This option is not
13947 meant to be used by the user, but only passed by the driver.
13948
13949 -Ldir
13950 Add directory dir to the list of directories to be searched for -l.
13951
13952 -Bprefix
13953 This option specifies where to find the executables, libraries,
13954 include files, and data files of the compiler itself.
13955
13956 The compiler driver program runs one or more of the subprograms
13957 cpp, cc1, as and ld. It tries prefix as a prefix for each program
13958 it tries to run, both with and without machine/version/ for the
13959 corresponding target machine and compiler version.
13960
13961 For each subprogram to be run, the compiler driver first tries the
13962 -B prefix, if any. If that name is not found, or if -B is not
13963 specified, the driver tries two standard prefixes, /usr/lib/gcc/
13964 and /usr/local/lib/gcc/. If neither of those results in a file
13965 name that is found, the unmodified program name is searched for
13966 using the directories specified in your PATH environment variable.
13967
13968 The compiler checks to see if the path provided by -B refers to a
13969 directory, and if necessary it adds a directory separator character
13970 at the end of the path.
13971
13972 -B prefixes that effectively specify directory names also apply to
13973 libraries in the linker, because the compiler translates these
13974 options into -L options for the linker. They also apply to include
13975 files in the preprocessor, because the compiler translates these
13976 options into -isystem options for the preprocessor. In this case,
13977 the compiler appends include to the prefix.
13978
13979 The runtime support file libgcc.a can also be searched for using
13980 the -B prefix, if needed. If it is not found there, the two
13981 standard prefixes above are tried, and that is all. The file is
13982 left out of the link if it is not found by those means.
13983
13984 Another way to specify a prefix much like the -B prefix is to use
13985 the environment variable GCC_EXEC_PREFIX.
13986
13987 As a special kludge, if the path provided by -B is [dir/]stageN/,
13988 where N is a number in the range 0 to 9, then it is replaced by
13989 [dir/]include. This is to help with boot-strapping the compiler.
13990
13991 -no-canonical-prefixes
13992 Do not expand any symbolic links, resolve references to /../ or
13993 /./, or make the path absolute when generating a relative prefix.
13994
13995 --sysroot=dir
13996 Use dir as the logical root directory for headers and libraries.
13997 For example, if the compiler normally searches for headers in
13998 /usr/include and libraries in /usr/lib, it instead searches
13999 dir/usr/include and dir/usr/lib.
14000
14001 If you use both this option and the -isysroot option, then the
14002 --sysroot option applies to libraries, but the -isysroot option
14003 applies to header files.
14004
14005 The GNU linker (beginning with version 2.16) has the necessary
14006 support for this option. If your linker does not support this
14007 option, the header file aspect of --sysroot still works, but the
14008 library aspect does not.
14009
14010 --no-sysroot-suffix
14011 For some targets, a suffix is added to the root directory specified
14012 with --sysroot, depending on the other options used, so that
14013 headers may for example be found in dir/suffix/usr/include instead
14014 of dir/usr/include. This option disables the addition of such a
14015 suffix.
14016
14017 Options for Code Generation Conventions
14018 These machine-independent options control the interface conventions
14019 used in code generation.
14020
14021 Most of them have both positive and negative forms; the negative form
14022 of -ffoo is -fno-foo. In the table below, only one of the forms is
14023 listed---the one that is not the default. You can figure out the other
14024 form by either removing no- or adding it.
14025
14026 -fstack-reuse=reuse-level
14027 This option controls stack space reuse for user declared local/auto
14028 variables and compiler generated temporaries. reuse_level can be
14029 all, named_vars, or none. all enables stack reuse for all local
14030 variables and temporaries, named_vars enables the reuse only for
14031 user defined local variables with names, and none disables stack
14032 reuse completely. The default value is all. The option is needed
14033 when the program extends the lifetime of a scoped local variable or
14034 a compiler generated temporary beyond the end point defined by the
14035 language. When a lifetime of a variable ends, and if the variable
14036 lives in memory, the optimizing compiler has the freedom to reuse
14037 its stack space with other temporaries or scoped local variables
14038 whose live range does not overlap with it. Legacy code extending
14039 local lifetime is likely to break with the stack reuse
14040 optimization.
14041
14042 For example,
14043
14044 int *p;
14045 {
14046 int local1;
14047
14048 p = &local1;
14049 local1 = 10;
14050 ....
14051 }
14052 {
14053 int local2;
14054 local2 = 20;
14055 ...
14056 }
14057
14058 if (*p == 10) // out of scope use of local1
14059 {
14060
14061 }
14062
14063 Another example:
14064
14065 struct A
14066 {
14067 A(int k) : i(k), j(k) { }
14068 int i;
14069 int j;
14070 };
14071
14072 A *ap;
14073
14074 void foo(const A& ar)
14075 {
14076 ap = &ar;
14077 }
14078
14079 void bar()
14080 {
14081 foo(A(10)); // temp object's lifetime ends when foo returns
14082
14083 {
14084 A a(20);
14085 ....
14086 }
14087 ap->i+= 10; // ap references out of scope temp whose space
14088 // is reused with a. What is the value of ap->i?
14089 }
14090
14091 The lifetime of a compiler generated temporary is well defined by
14092 the C++ standard. When a lifetime of a temporary ends, and if the
14093 temporary lives in memory, the optimizing compiler has the freedom
14094 to reuse its stack space with other temporaries or scoped local
14095 variables whose live range does not overlap with it. However some
14096 of the legacy code relies on the behavior of older compilers in
14097 which temporaries' stack space is not reused, the aggressive stack
14098 reuse can lead to runtime errors. This option is used to control
14099 the temporary stack reuse optimization.
14100
14101 -ftrapv
14102 This option generates traps for signed overflow on addition,
14103 subtraction, multiplication operations. The options -ftrapv and
14104 -fwrapv override each other, so using -ftrapv -fwrapv on the
14105 command-line results in -fwrapv being effective. Note that only
14106 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14107 command-line results in -ftrapv being effective.
14108
14109 -fwrapv
14110 This option instructs the compiler to assume that signed arithmetic
14111 overflow of addition, subtraction and multiplication wraps around
14112 using twos-complement representation. This flag enables some
14113 optimizations and disables others. The options -ftrapv and -fwrapv
14114 override each other, so using -ftrapv -fwrapv on the command-line
14115 results in -fwrapv being effective. Note that only active options
14116 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14117 results in -ftrapv being effective.
14118
14119 -fwrapv-pointer
14120 This option instructs the compiler to assume that pointer
14121 arithmetic overflow on addition and subtraction wraps around using
14122 twos-complement representation. This flag disables some
14123 optimizations which assume pointer overflow is invalid.
14124
14125 -fstrict-overflow
14126 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14127 implies -fwrapv -fwrapv-pointer.
14128
14129 -fexceptions
14130 Enable exception handling. Generates extra code needed to
14131 propagate exceptions. For some targets, this implies GCC generates
14132 frame unwind information for all functions, which can produce
14133 significant data size overhead, although it does not affect
14134 execution. If you do not specify this option, GCC enables it by
14135 default for languages like C++ that normally require exception
14136 handling, and disables it for languages like C that do not normally
14137 require it. However, you may need to enable this option when
14138 compiling C code that needs to interoperate properly with exception
14139 handlers written in C++. You may also wish to disable this option
14140 if you are compiling older C++ programs that don't use exception
14141 handling.
14142
14143 -fnon-call-exceptions
14144 Generate code that allows trapping instructions to throw
14145 exceptions. Note that this requires platform-specific runtime
14146 support that does not exist everywhere. Moreover, it only allows
14147 trapping instructions to throw exceptions, i.e. memory references
14148 or floating-point instructions. It does not allow exceptions to be
14149 thrown from arbitrary signal handlers such as "SIGALRM".
14150
14151 -fdelete-dead-exceptions
14152 Consider that instructions that may throw exceptions but don't
14153 otherwise contribute to the execution of the program can be
14154 optimized away. This option is enabled by default for the Ada
14155 compiler, as permitted by the Ada language specification.
14156 Optimization passes that cause dead exceptions to be removed are
14157 enabled independently at different optimization levels.
14158
14159 -funwind-tables
14160 Similar to -fexceptions, except that it just generates any needed
14161 static data, but does not affect the generated code in any other
14162 way. You normally do not need to enable this option; instead, a
14163 language processor that needs this handling enables it on your
14164 behalf.
14165
14166 -fasynchronous-unwind-tables
14167 Generate unwind table in DWARF format, if supported by target
14168 machine. The table is exact at each instruction boundary, so it
14169 can be used for stack unwinding from asynchronous events (such as
14170 debugger or garbage collector).
14171
14172 -fno-gnu-unique
14173 On systems with recent GNU assembler and C library, the C++
14174 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
14175 definitions of template static data members and static local
14176 variables in inline functions are unique even in the presence of
14177 "RTLD_LOCAL"; this is necessary to avoid problems with a library
14178 used by two different "RTLD_LOCAL" plugins depending on a
14179 definition in one of them and therefore disagreeing with the other
14180 one about the binding of the symbol. But this causes "dlclose" to
14181 be ignored for affected DSOs; if your program relies on
14182 reinitialization of a DSO via "dlclose" and "dlopen", you can use
14183 -fno-gnu-unique.
14184
14185 -fpcc-struct-return
14186 Return "short" "struct" and "union" values in memory like longer
14187 ones, rather than in registers. This convention is less efficient,
14188 but it has the advantage of allowing intercallability between GCC-
14189 compiled files and files compiled with other compilers,
14190 particularly the Portable C Compiler (pcc).
14191
14192 The precise convention for returning structures in memory depends
14193 on the target configuration macros.
14194
14195 Short structures and unions are those whose size and alignment
14196 match that of some integer type.
14197
14198 Warning: code compiled with the -fpcc-struct-return switch is not
14199 binary compatible with code compiled with the -freg-struct-return
14200 switch. Use it to conform to a non-default application binary
14201 interface.
14202
14203 -freg-struct-return
14204 Return "struct" and "union" values in registers when possible.
14205 This is more efficient for small structures than
14206 -fpcc-struct-return.
14207
14208 If you specify neither -fpcc-struct-return nor -freg-struct-return,
14209 GCC defaults to whichever convention is standard for the target.
14210 If there is no standard convention, GCC defaults to
14211 -fpcc-struct-return, except on targets where GCC is the principal
14212 compiler. In those cases, we can choose the standard, and we chose
14213 the more efficient register return alternative.
14214
14215 Warning: code compiled with the -freg-struct-return switch is not
14216 binary compatible with code compiled with the -fpcc-struct-return
14217 switch. Use it to conform to a non-default application binary
14218 interface.
14219
14220 -fshort-enums
14221 Allocate to an "enum" type only as many bytes as it needs for the
14222 declared range of possible values. Specifically, the "enum" type
14223 is equivalent to the smallest integer type that has enough room.
14224
14225 Warning: the -fshort-enums switch causes GCC to generate code that
14226 is not binary compatible with code generated without that switch.
14227 Use it to conform to a non-default application binary interface.
14228
14229 -fshort-wchar
14230 Override the underlying type for "wchar_t" to be "short unsigned
14231 int" instead of the default for the target. This option is useful
14232 for building programs to run under WINE.
14233
14234 Warning: the -fshort-wchar switch causes GCC to generate code that
14235 is not binary compatible with code generated without that switch.
14236 Use it to conform to a non-default application binary interface.
14237
14238 -fcommon
14239 In C code, this option controls the placement of global variables
14240 defined without an initializer, known as tentative definitions in
14241 the C standard. Tentative definitions are distinct from
14242 declarations of a variable with the "extern" keyword, which do not
14243 allocate storage.
14244
14245 The default is -fno-common, which specifies that the compiler
14246 places uninitialized global variables in the BSS section of the
14247 object file. This inhibits the merging of tentative definitions by
14248 the linker so you get a multiple-definition error if the same
14249 variable is accidentally defined in more than one compilation unit.
14250
14251 The -fcommon places uninitialized global variables in a common
14252 block. This allows the linker to resolve all tentative definitions
14253 of the same variable in different compilation units to the same
14254 object, or to a non-tentative definition. This behavior is
14255 inconsistent with C++, and on many targets implies a speed and code
14256 size penalty on global variable references. It is mainly useful to
14257 enable legacy code to link without errors.
14258
14259 -fno-ident
14260 Ignore the "#ident" directive.
14261
14262 -finhibit-size-directive
14263 Don't output a ".size" assembler directive, or anything else that
14264 would cause trouble if the function is split in the middle, and the
14265 two halves are placed at locations far apart in memory. This
14266 option is used when compiling crtstuff.c; you should not need to
14267 use it for anything else.
14268
14269 -fverbose-asm
14270 Put extra commentary information in the generated assembly code to
14271 make it more readable. This option is generally only of use to
14272 those who actually need to read the generated assembly code
14273 (perhaps while debugging the compiler itself).
14274
14275 -fno-verbose-asm, the default, causes the extra information to be
14276 omitted and is useful when comparing two assembler files.
14277
14278 The added comments include:
14279
14280 * information on the compiler version and command-line options,
14281
14282 * the source code lines associated with the assembly
14283 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14284
14285 * hints on which high-level expressions correspond to the various
14286 assembly instruction operands.
14287
14288 For example, given this C source file:
14289
14290 int test (int n)
14291 {
14292 int i;
14293 int total = 0;
14294
14295 for (i = 0; i < n; i++)
14296 total += i * i;
14297
14298 return total;
14299 }
14300
14301 compiling to (x86_64) assembly via -S and emitting the result
14302 direct to stdout via -o -
14303
14304 gcc -S test.c -fverbose-asm -Os -o -
14305
14306 gives output similar to this:
14307
14308 .file "test.c"
14309 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14310 [...snip...]
14311 # options passed:
14312 [...snip...]
14313
14314 .text
14315 .globl test
14316 .type test, @function
14317 test:
14318 .LFB0:
14319 .cfi_startproc
14320 # test.c:4: int total = 0;
14321 xorl %eax, %eax # <retval>
14322 # test.c:6: for (i = 0; i < n; i++)
14323 xorl %edx, %edx # i
14324 .L2:
14325 # test.c:6: for (i = 0; i < n; i++)
14326 cmpl %edi, %edx # n, i
14327 jge .L5 #,
14328 # test.c:7: total += i * i;
14329 movl %edx, %ecx # i, tmp92
14330 imull %edx, %ecx # i, tmp92
14331 # test.c:6: for (i = 0; i < n; i++)
14332 incl %edx # i
14333 # test.c:7: total += i * i;
14334 addl %ecx, %eax # tmp92, <retval>
14335 jmp .L2 #
14336 .L5:
14337 # test.c:10: }
14338 ret
14339 .cfi_endproc
14340 .LFE0:
14341 .size test, .-test
14342 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14343 .section .note.GNU-stack,"",@progbits
14344
14345 The comments are intended for humans rather than machines and hence
14346 the precise format of the comments is subject to change.
14347
14348 -frecord-gcc-switches
14349 This switch causes the command line used to invoke the compiler to
14350 be recorded into the object file that is being created. This
14351 switch is only implemented on some targets and the exact format of
14352 the recording is target and binary file format dependent, but it
14353 usually takes the form of a section containing ASCII text. This
14354 switch is related to the -fverbose-asm switch, but that switch only
14355 records information in the assembler output file as comments, so it
14356 never reaches the object file. See also -grecord-gcc-switches for
14357 another way of storing compiler options into the object file.
14358
14359 -fpic
14360 Generate position-independent code (PIC) suitable for use in a
14361 shared library, if supported for the target machine. Such code
14362 accesses all constant addresses through a global offset table
14363 (GOT). The dynamic loader resolves the GOT entries when the
14364 program starts (the dynamic loader is not part of GCC; it is part
14365 of the operating system). If the GOT size for the linked
14366 executable exceeds a machine-specific maximum size, you get an
14367 error message from the linker indicating that -fpic does not work;
14368 in that case, recompile with -fPIC instead. (These maximums are 8k
14369 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
14370 x86 has no such limit.)
14371
14372 Position-independent code requires special support, and therefore
14373 works only on certain machines. For the x86, GCC supports PIC for
14374 System V but not for the Sun 386i. Code generated for the IBM
14375 RS/6000 is always position-independent.
14376
14377 When this flag is set, the macros "__pic__" and "__PIC__" are
14378 defined to 1.
14379
14380 -fPIC
14381 If supported for the target machine, emit position-independent
14382 code, suitable for dynamic linking and avoiding any limit on the
14383 size of the global offset table. This option makes a difference on
14384 AArch64, m68k, PowerPC and SPARC.
14385
14386 Position-independent code requires special support, and therefore
14387 works only on certain machines.
14388
14389 When this flag is set, the macros "__pic__" and "__PIC__" are
14390 defined to 2.
14391
14392 -fpie
14393 -fPIE
14394 These options are similar to -fpic and -fPIC, but the generated
14395 position-independent code can be only linked into executables.
14396 Usually these options are used to compile code that will be linked
14397 using the -pie GCC option.
14398
14399 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
14400 The macros have the value 1 for -fpie and 2 for -fPIE.
14401
14402 -fno-plt
14403 Do not use the PLT for external function calls in position-
14404 independent code. Instead, load the callee address at call sites
14405 from the GOT and branch to it. This leads to more efficient code
14406 by eliminating PLT stubs and exposing GOT loads to optimizations.
14407 On architectures such as 32-bit x86 where PLT stubs expect the GOT
14408 pointer in a specific register, this gives more register allocation
14409 freedom to the compiler. Lazy binding requires use of the PLT;
14410 with -fno-plt all external symbols are resolved at load time.
14411
14412 Alternatively, the function attribute "noplt" can be used to avoid
14413 calls through the PLT for specific external functions.
14414
14415 In position-dependent code, a few targets also convert calls to
14416 functions that are marked to not use the PLT to use the GOT
14417 instead.
14418
14419 -fno-jump-tables
14420 Do not use jump tables for switch statements even where it would be
14421 more efficient than other code generation strategies. This option
14422 is of use in conjunction with -fpic or -fPIC for building code that
14423 forms part of a dynamic linker and cannot reference the address of
14424 a jump table. On some targets, jump tables do not require a GOT
14425 and this option is not needed.
14426
14427 -fno-bit-tests
14428 Do not use bit tests for switch statements even where it would be
14429 more efficient than other code generation strategies.
14430
14431 -ffixed-reg
14432 Treat the register named reg as a fixed register; generated code
14433 should never refer to it (except perhaps as a stack pointer, frame
14434 pointer or in some other fixed role).
14435
14436 reg must be the name of a register. The register names accepted
14437 are machine-specific and are defined in the "REGISTER_NAMES" macro
14438 in the machine description macro file.
14439
14440 This flag does not have a negative form, because it specifies a
14441 three-way choice.
14442
14443 -fcall-used-reg
14444 Treat the register named reg as an allocable register that is
14445 clobbered by function calls. It may be allocated for temporaries
14446 or variables that do not live across a call. Functions compiled
14447 this way do not save and restore the register reg.
14448
14449 It is an error to use this flag with the frame pointer or stack
14450 pointer. Use of this flag for other registers that have fixed
14451 pervasive roles in the machine's execution model produces
14452 disastrous results.
14453
14454 This flag does not have a negative form, because it specifies a
14455 three-way choice.
14456
14457 -fcall-saved-reg
14458 Treat the register named reg as an allocable register saved by
14459 functions. It may be allocated even for temporaries or variables
14460 that live across a call. Functions compiled this way save and
14461 restore the register reg if they use it.
14462
14463 It is an error to use this flag with the frame pointer or stack
14464 pointer. Use of this flag for other registers that have fixed
14465 pervasive roles in the machine's execution model produces
14466 disastrous results.
14467
14468 A different sort of disaster results from the use of this flag for
14469 a register in which function values may be returned.
14470
14471 This flag does not have a negative form, because it specifies a
14472 three-way choice.
14473
14474 -fpack-struct[=n]
14475 Without a value specified, pack all structure members together
14476 without holes. When a value is specified (which must be a small
14477 power of two), pack structure members according to this value,
14478 representing the maximum alignment (that is, objects with default
14479 alignment requirements larger than this are output potentially
14480 unaligned at the next fitting location.
14481
14482 Warning: the -fpack-struct switch causes GCC to generate code that
14483 is not binary compatible with code generated without that switch.
14484 Additionally, it makes the code suboptimal. Use it to conform to a
14485 non-default application binary interface.
14486
14487 -fleading-underscore
14488 This option and its counterpart, -fno-leading-underscore, forcibly
14489 change the way C symbols are represented in the object file. One
14490 use is to help link with legacy assembly code.
14491
14492 Warning: the -fleading-underscore switch causes GCC to generate
14493 code that is not binary compatible with code generated without that
14494 switch. Use it to conform to a non-default application binary
14495 interface. Not all targets provide complete support for this
14496 switch.
14497
14498 -ftls-model=model
14499 Alter the thread-local storage model to be used. The model
14500 argument should be one of global-dynamic, local-dynamic, initial-
14501 exec or local-exec. Note that the choice is subject to
14502 optimization: the compiler may use a more efficient model for
14503 symbols not visible outside of the translation unit, or if -fpic is
14504 not given on the command line.
14505
14506 The default without -fpic is initial-exec; with -fpic the default
14507 is global-dynamic.
14508
14509 -ftrampolines
14510 For targets that normally need trampolines for nested functions,
14511 always generate them instead of using descriptors. Otherwise, for
14512 targets that do not need them, like for example HP-PA or IA-64, do
14513 nothing.
14514
14515 A trampoline is a small piece of code that is created at run time
14516 on the stack when the address of a nested function is taken, and is
14517 used to call the nested function indirectly. Therefore, it
14518 requires the stack to be made executable in order for the program
14519 to work properly.
14520
14521 -fno-trampolines is enabled by default on a language by language
14522 basis to let the compiler avoid generating them, if it computes
14523 that this is safe, and replace them with descriptors. Descriptors
14524 are made up of data only, but the generated code must be prepared
14525 to deal with them. As of this writing, -fno-trampolines is enabled
14526 by default only for Ada.
14527
14528 Moreover, code compiled with -ftrampolines and code compiled with
14529 -fno-trampolines are not binary compatible if nested functions are
14530 present. This option must therefore be used on a program-wide
14531 basis and be manipulated with extreme care.
14532
14533 -fvisibility=[default|internal|hidden|protected]
14534 Set the default ELF image symbol visibility to the specified
14535 option---all symbols are marked with this unless overridden within
14536 the code. Using this feature can very substantially improve
14537 linking and load times of shared object libraries, produce more
14538 optimized code, provide near-perfect API export and prevent symbol
14539 clashes. It is strongly recommended that you use this in any
14540 shared objects you distribute.
14541
14542 Despite the nomenclature, default always means public; i.e.,
14543 available to be linked against from outside the shared object.
14544 protected and internal are pretty useless in real-world usage so
14545 the only other commonly used option is hidden. The default if
14546 -fvisibility isn't specified is default, i.e., make every symbol
14547 public.
14548
14549 A good explanation of the benefits offered by ensuring ELF symbols
14550 have the correct visibility is given by "How To Write Shared
14551 Libraries" by Ulrich Drepper (which can be found at
14552 <https://www.akkadia.org/drepper/>)---however a superior solution
14553 made possible by this option to marking things hidden when the
14554 default is public is to make the default hidden and mark things
14555 public. This is the norm with DLLs on Windows and with
14556 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
14557 instead of "__declspec(dllexport)" you get almost identical
14558 semantics with identical syntax. This is a great boon to those
14559 working with cross-platform projects.
14560
14561 For those adding visibility support to existing code, you may find
14562 "#pragma GCC visibility" of use. This works by you enclosing the
14563 declarations you wish to set visibility for with (for example)
14564 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
14565 pop". Bear in mind that symbol visibility should be viewed as part
14566 of the API interface contract and thus all new code should always
14567 specify visibility when it is not the default; i.e., declarations
14568 only for use within the local DSO should always be marked
14569 explicitly as hidden as so to avoid PLT indirection
14570 overheads---making this abundantly clear also aids readability and
14571 self-documentation of the code. Note that due to ISO C++
14572 specification requirements, "operator new" and "operator delete"
14573 must always be of default visibility.
14574
14575 Be aware that headers from outside your project, in particular
14576 system headers and headers from any other library you use, may not
14577 be expecting to be compiled with visibility other than the default.
14578 You may need to explicitly say "#pragma GCC visibility
14579 push(default)" before including any such headers.
14580
14581 "extern" declarations are not affected by -fvisibility, so a lot of
14582 code can be recompiled with -fvisibility=hidden with no
14583 modifications. However, this means that calls to "extern"
14584 functions with no explicit visibility use the PLT, so it is more
14585 effective to use "__attribute ((visibility))" and/or "#pragma GCC
14586 visibility" to tell the compiler which "extern" declarations should
14587 be treated as hidden.
14588
14589 Note that -fvisibility does affect C++ vague linkage entities. This
14590 means that, for instance, an exception class that is be thrown
14591 between DSOs must be explicitly marked with default visibility so
14592 that the type_info nodes are unified between the DSOs.
14593
14594 An overview of these techniques, their benefits and how to use them
14595 is at <http://gcc.gnu.org/wiki/Visibility>.
14596
14597 -fstrict-volatile-bitfields
14598 This option should be used if accesses to volatile bit-fields (or
14599 other structure fields, although the compiler usually honors those
14600 types anyway) should use a single access of the width of the
14601 field's type, aligned to a natural alignment if possible. For
14602 example, targets with memory-mapped peripheral registers might
14603 require all such accesses to be 16 bits wide; with this flag you
14604 can declare all peripheral bit-fields as "unsigned short" (assuming
14605 short is 16 bits on these targets) to force GCC to use 16-bit
14606 accesses instead of, perhaps, a more efficient 32-bit access.
14607
14608 If this option is disabled, the compiler uses the most efficient
14609 instruction. In the previous example, that might be a 32-bit load
14610 instruction, even though that accesses bytes that do not contain
14611 any portion of the bit-field, or memory-mapped registers unrelated
14612 to the one being updated.
14613
14614 In some cases, such as when the "packed" attribute is applied to a
14615 structure field, it may not be possible to access the field with a
14616 single read or write that is correctly aligned for the target
14617 machine. In this case GCC falls back to generating multiple
14618 accesses rather than code that will fault or truncate the result at
14619 run time.
14620
14621 Note: Due to restrictions of the C/C++11 memory model, write
14622 accesses are not allowed to touch non bit-field members. It is
14623 therefore recommended to define all bits of the field's type as
14624 bit-field members.
14625
14626 The default value of this option is determined by the application
14627 binary interface for the target processor.
14628
14629 -fsync-libcalls
14630 This option controls whether any out-of-line instance of the
14631 "__sync" family of functions may be used to implement the C++11
14632 "__atomic" family of functions.
14633
14634 The default value of this option is enabled, thus the only useful
14635 form of the option is -fno-sync-libcalls. This option is used in
14636 the implementation of the libatomic runtime library.
14637
14638 GCC Developer Options
14639 This section describes command-line options that are primarily of
14640 interest to GCC developers, including options to support compiler
14641 testing and investigation of compiler bugs and compile-time performance
14642 problems. This includes options that produce debug dumps at various
14643 points in the compilation; that print statistics such as memory use and
14644 execution time; and that print information about GCC's configuration,
14645 such as where it searches for libraries. You should rarely need to use
14646 any of these options for ordinary compilation and linking tasks.
14647
14648 Many developer options that cause GCC to dump output to a file take an
14649 optional =filename suffix. You can specify stdout or - to dump to
14650 standard output, and stderr for standard error.
14651
14652 If =filename is omitted, a default dump file name is constructed by
14653 concatenating the base dump file name, a pass number, phase letter, and
14654 pass name. The base dump file name is the name of output file produced
14655 by the compiler if explicitly specified and not an executable;
14656 otherwise it is the source file name. The pass number is determined by
14657 the order passes are registered with the compiler's pass manager. This
14658 is generally the same as the order of execution, but passes registered
14659 by plugins, target-specific passes, or passes that are otherwise
14660 registered late are numbered higher than the pass named final, even if
14661 they are executed earlier. The phase letter is one of i (inter-
14662 procedural analysis), l (language-specific), r (RTL), or t (tree). The
14663 files are created in the directory of the output file.
14664
14665 -fcallgraph-info
14666 -fcallgraph-info=MARKERS
14667 Makes the compiler output callgraph information for the program, on
14668 a per-object-file basis. The information is generated in the
14669 common VCG format. It can be decorated with additional, per-node
14670 and/or per-edge information, if a list of comma-separated markers
14671 is additionally specified. When the "su" marker is specified, the
14672 callgraph is decorated with stack usage information; it is
14673 equivalent to -fstack-usage. When the "da" marker is specified,
14674 the callgraph is decorated with information about dynamically
14675 allocated objects.
14676
14677 When compiling with -flto, no callgraph information is output along
14678 with the object file. At LTO link time, -fcallgraph-info may
14679 generate multiple callgraph information files next to intermediate
14680 LTO output files.
14681
14682 -dletters
14683 -fdump-rtl-pass
14684 -fdump-rtl-pass=filename
14685 Says to make debugging dumps during compilation at times specified
14686 by letters. This is used for debugging the RTL-based passes of the
14687 compiler.
14688
14689 Some -dletters switches have different meaning when -E is used for
14690 preprocessing.
14691
14692 Debug dumps can be enabled with a -fdump-rtl switch or some -d
14693 option letters. Here are the possible letters for use in pass and
14694 letters, and their meanings:
14695
14696 -fdump-rtl-alignments
14697 Dump after branch alignments have been computed.
14698
14699 -fdump-rtl-asmcons
14700 Dump after fixing rtl statements that have unsatisfied in/out
14701 constraints.
14702
14703 -fdump-rtl-auto_inc_dec
14704 Dump after auto-inc-dec discovery. This pass is only run on
14705 architectures that have auto inc or auto dec instructions.
14706
14707 -fdump-rtl-barriers
14708 Dump after cleaning up the barrier instructions.
14709
14710 -fdump-rtl-bbpart
14711 Dump after partitioning hot and cold basic blocks.
14712
14713 -fdump-rtl-bbro
14714 Dump after block reordering.
14715
14716 -fdump-rtl-btl1
14717 -fdump-rtl-btl2
14718 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
14719 two branch target load optimization passes.
14720
14721 -fdump-rtl-bypass
14722 Dump after jump bypassing and control flow optimizations.
14723
14724 -fdump-rtl-combine
14725 Dump after the RTL instruction combination pass.
14726
14727 -fdump-rtl-compgotos
14728 Dump after duplicating the computed gotos.
14729
14730 -fdump-rtl-ce1
14731 -fdump-rtl-ce2
14732 -fdump-rtl-ce3
14733 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
14734 dumping after the three if conversion passes.
14735
14736 -fdump-rtl-cprop_hardreg
14737 Dump after hard register copy propagation.
14738
14739 -fdump-rtl-csa
14740 Dump after combining stack adjustments.
14741
14742 -fdump-rtl-cse1
14743 -fdump-rtl-cse2
14744 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
14745 two common subexpression elimination passes.
14746
14747 -fdump-rtl-dce
14748 Dump after the standalone dead code elimination passes.
14749
14750 -fdump-rtl-dbr
14751 Dump after delayed branch scheduling.
14752
14753 -fdump-rtl-dce1
14754 -fdump-rtl-dce2
14755 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
14756 two dead store elimination passes.
14757
14758 -fdump-rtl-eh
14759 Dump after finalization of EH handling code.
14760
14761 -fdump-rtl-eh_ranges
14762 Dump after conversion of EH handling range regions.
14763
14764 -fdump-rtl-expand
14765 Dump after RTL generation.
14766
14767 -fdump-rtl-fwprop1
14768 -fdump-rtl-fwprop2
14769 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
14770 the two forward propagation passes.
14771
14772 -fdump-rtl-gcse1
14773 -fdump-rtl-gcse2
14774 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
14775 global common subexpression elimination.
14776
14777 -fdump-rtl-init-regs
14778 Dump after the initialization of the registers.
14779
14780 -fdump-rtl-initvals
14781 Dump after the computation of the initial value sets.
14782
14783 -fdump-rtl-into_cfglayout
14784 Dump after converting to cfglayout mode.
14785
14786 -fdump-rtl-ira
14787 Dump after iterated register allocation.
14788
14789 -fdump-rtl-jump
14790 Dump after the second jump optimization.
14791
14792 -fdump-rtl-loop2
14793 -fdump-rtl-loop2 enables dumping after the rtl loop
14794 optimization passes.
14795
14796 -fdump-rtl-mach
14797 Dump after performing the machine dependent reorganization
14798 pass, if that pass exists.
14799
14800 -fdump-rtl-mode_sw
14801 Dump after removing redundant mode switches.
14802
14803 -fdump-rtl-rnreg
14804 Dump after register renumbering.
14805
14806 -fdump-rtl-outof_cfglayout
14807 Dump after converting from cfglayout mode.
14808
14809 -fdump-rtl-peephole2
14810 Dump after the peephole pass.
14811
14812 -fdump-rtl-postreload
14813 Dump after post-reload optimizations.
14814
14815 -fdump-rtl-pro_and_epilogue
14816 Dump after generating the function prologues and epilogues.
14817
14818 -fdump-rtl-sched1
14819 -fdump-rtl-sched2
14820 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
14821 the basic block scheduling passes.
14822
14823 -fdump-rtl-ree
14824 Dump after sign/zero extension elimination.
14825
14826 -fdump-rtl-seqabstr
14827 Dump after common sequence discovery.
14828
14829 -fdump-rtl-shorten
14830 Dump after shortening branches.
14831
14832 -fdump-rtl-sibling
14833 Dump after sibling call optimizations.
14834
14835 -fdump-rtl-split1
14836 -fdump-rtl-split2
14837 -fdump-rtl-split3
14838 -fdump-rtl-split4
14839 -fdump-rtl-split5
14840 These options enable dumping after five rounds of instruction
14841 splitting.
14842
14843 -fdump-rtl-sms
14844 Dump after modulo scheduling. This pass is only run on some
14845 architectures.
14846
14847 -fdump-rtl-stack
14848 Dump after conversion from GCC's "flat register file" registers
14849 to the x87's stack-like registers. This pass is only run on
14850 x86 variants.
14851
14852 -fdump-rtl-subreg1
14853 -fdump-rtl-subreg2
14854 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
14855 the two subreg expansion passes.
14856
14857 -fdump-rtl-unshare
14858 Dump after all rtl has been unshared.
14859
14860 -fdump-rtl-vartrack
14861 Dump after variable tracking.
14862
14863 -fdump-rtl-vregs
14864 Dump after converting virtual registers to hard registers.
14865
14866 -fdump-rtl-web
14867 Dump after live range splitting.
14868
14869 -fdump-rtl-regclass
14870 -fdump-rtl-subregs_of_mode_init
14871 -fdump-rtl-subregs_of_mode_finish
14872 -fdump-rtl-dfinit
14873 -fdump-rtl-dfinish
14874 These dumps are defined but always produce empty files.
14875
14876 -da
14877 -fdump-rtl-all
14878 Produce all the dumps listed above.
14879
14880 -dA Annotate the assembler output with miscellaneous debugging
14881 information.
14882
14883 -dD Dump all macro definitions, at the end of preprocessing, in
14884 addition to normal output.
14885
14886 -dH Produce a core dump whenever an error occurs.
14887
14888 -dp Annotate the assembler output with a comment indicating which
14889 pattern and alternative is used. The length and cost of each
14890 instruction are also printed.
14891
14892 -dP Dump the RTL in the assembler output as a comment before each
14893 instruction. Also turns on -dp annotation.
14894
14895 -dx Just generate RTL for a function instead of compiling it.
14896 Usually used with -fdump-rtl-expand.
14897
14898 -fdump-debug
14899 Dump debugging information generated during the debug generation
14900 phase.
14901
14902 -fdump-earlydebug
14903 Dump debugging information generated during the early debug
14904 generation phase.
14905
14906 -fdump-noaddr
14907 When doing debugging dumps, suppress address output. This makes it
14908 more feasible to use diff on debugging dumps for compiler
14909 invocations with different compiler binaries and/or different text
14910 / bss / data / heap / stack / dso start locations.
14911
14912 -freport-bug
14913 Collect and dump debug information into a temporary file if an
14914 internal compiler error (ICE) occurs.
14915
14916 -fdump-unnumbered
14917 When doing debugging dumps, suppress instruction numbers and
14918 address output. This makes it more feasible to use diff on
14919 debugging dumps for compiler invocations with different options, in
14920 particular with and without -g.
14921
14922 -fdump-unnumbered-links
14923 When doing debugging dumps (see -d option above), suppress
14924 instruction numbers for the links to the previous and next
14925 instructions in a sequence.
14926
14927 -fdump-ipa-switch
14928 -fdump-ipa-switch-options
14929 Control the dumping at various stages of inter-procedural analysis
14930 language tree to a file. The file name is generated by appending a
14931 switch specific suffix to the source file name, and the file is
14932 created in the same directory as the output file. The following
14933 dumps are possible:
14934
14935 all Enables all inter-procedural analysis dumps.
14936
14937 cgraph
14938 Dumps information about call-graph optimization, unused
14939 function removal, and inlining decisions.
14940
14941 inline
14942 Dump after function inlining.
14943
14944 Additionally, the options -optimized, -missed, -note, and -all can
14945 be provided, with the same meaning as for -fopt-info, defaulting to
14946 -optimized.
14947
14948 For example, -fdump-ipa-inline-optimized-missed will emit
14949 information on callsites that were inlined, along with callsites
14950 that were not inlined.
14951
14952 By default, the dump will contain messages about successful
14953 optimizations (equivalent to -optimized) together with low-level
14954 details about the analysis.
14955
14956 -fdump-lang
14957 Dump language-specific information. The file name is made by
14958 appending .lang to the source file name.
14959
14960 -fdump-lang-all
14961 -fdump-lang-switch
14962 -fdump-lang-switch-options
14963 -fdump-lang-switch-options=filename
14964 Control the dumping of language-specific information. The options
14965 and filename portions behave as described in the -fdump-tree
14966 option. The following switch values are accepted:
14967
14968 all Enable all language-specific dumps.
14969
14970 class
14971 Dump class hierarchy information. Virtual table information is
14972 emitted unless 'slim' is specified. This option is applicable
14973 to C++ only.
14974
14975 module
14976 Dump module information. Options lineno (locations), graph
14977 (reachability), blocks (clusters), uid (serialization), alias
14978 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
14979 provide additional information. This option is applicable to
14980 C++ only.
14981
14982 raw Dump the raw internal tree data. This option is applicable to
14983 C++ only.
14984
14985 -fdump-passes
14986 Print on stderr the list of optimization passes that are turned on
14987 and off by the current command-line options.
14988
14989 -fdump-statistics-option
14990 Enable and control dumping of pass statistics in a separate file.
14991 The file name is generated by appending a suffix ending in
14992 .statistics to the source file name, and the file is created in the
14993 same directory as the output file. If the -option form is used,
14994 -stats causes counters to be summed over the whole compilation unit
14995 while -details dumps every event as the passes generate them. The
14996 default with no option is to sum counters for each function
14997 compiled.
14998
14999 -fdump-tree-all
15000 -fdump-tree-switch
15001 -fdump-tree-switch-options
15002 -fdump-tree-switch-options=filename
15003 Control the dumping at various stages of processing the
15004 intermediate language tree to a file. If the -options form is
15005 used, options is a list of - separated options which control the
15006 details of the dump. Not all options are applicable to all dumps;
15007 those that are not meaningful are ignored. The following options
15008 are available
15009
15010 address
15011 Print the address of each node. Usually this is not meaningful
15012 as it changes according to the environment and source file.
15013 Its primary use is for tying up a dump file with a debug
15014 environment.
15015
15016 asmname
15017 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15018 that in the dump instead of "DECL_NAME". Its primary use is
15019 ease of use working backward from mangled names in the assembly
15020 file.
15021
15022 slim
15023 When dumping front-end intermediate representations, inhibit
15024 dumping of members of a scope or body of a function merely
15025 because that scope has been reached. Only dump such items when
15026 they are directly reachable by some other path.
15027
15028 When dumping pretty-printed trees, this option inhibits dumping
15029 the bodies of control structures.
15030
15031 When dumping RTL, print the RTL in slim (condensed) form
15032 instead of the default LISP-like representation.
15033
15034 raw Print a raw representation of the tree. By default, trees are
15035 pretty-printed into a C-like representation.
15036
15037 details
15038 Enable more detailed dumps (not honored by every dump option).
15039 Also include information from the optimization passes.
15040
15041 stats
15042 Enable dumping various statistics about the pass (not honored
15043 by every dump option).
15044
15045 blocks
15046 Enable showing basic block boundaries (disabled in raw dumps).
15047
15048 graph
15049 For each of the other indicated dump files (-fdump-rtl-pass),
15050 dump a representation of the control flow graph suitable for
15051 viewing with GraphViz to file.passid.pass.dot. Each function
15052 in the file is pretty-printed as a subgraph, so that GraphViz
15053 can render them all in a single plot.
15054
15055 This option currently only works for RTL dumps, and the RTL is
15056 always dumped in slim form.
15057
15058 vops
15059 Enable showing virtual operands for every statement.
15060
15061 lineno
15062 Enable showing line numbers for statements.
15063
15064 uid Enable showing the unique ID ("DECL_UID") for each variable.
15065
15066 verbose
15067 Enable showing the tree dump for each statement.
15068
15069 eh Enable showing the EH region number holding each statement.
15070
15071 scev
15072 Enable showing scalar evolution analysis details.
15073
15074 optimized
15075 Enable showing optimization information (only available in
15076 certain passes).
15077
15078 missed
15079 Enable showing missed optimization information (only available
15080 in certain passes).
15081
15082 note
15083 Enable other detailed optimization information (only available
15084 in certain passes).
15085
15086 all Turn on all options, except raw, slim, verbose and lineno.
15087
15088 optall
15089 Turn on all optimization options, i.e., optimized, missed, and
15090 note.
15091
15092 To determine what tree dumps are available or find the dump for a
15093 pass of interest follow the steps below.
15094
15095 1. Invoke GCC with -fdump-passes and in the stderr output look for
15096 a code that corresponds to the pass you are interested in. For
15097 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15098 correspond to the three Value Range Propagation passes. The
15099 number at the end distinguishes distinct invocations of the
15100 same pass.
15101
15102 2. To enable the creation of the dump file, append the pass code
15103 to the -fdump- option prefix and invoke GCC with it. For
15104 example, to enable the dump from the Early Value Range
15105 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15106 Optionally, you may specify the name of the dump file. If you
15107 don't specify one, GCC creates as described below.
15108
15109 3. Find the pass dump in a file whose name is composed of three
15110 components separated by a period: the name of the source file
15111 GCC was invoked to compile, a numeric suffix indicating the
15112 pass number followed by the letter t for tree passes (and the
15113 letter r for RTL passes), and finally the pass code. For
15114 example, the Early VRP pass dump might be in a file named
15115 myfile.c.038t.evrp in the current working directory. Note that
15116 the numeric codes are not stable and may change from one
15117 version of GCC to another.
15118
15119 -fopt-info
15120 -fopt-info-options
15121 -fopt-info-options=filename
15122 Controls optimization dumps from various optimization passes. If
15123 the -options form is used, options is a list of - separated option
15124 keywords to select the dump details and optimizations.
15125
15126 The options can be divided into three groups:
15127
15128 1. options describing what kinds of messages should be emitted,
15129
15130 2. options describing the verbosity of the dump, and
15131
15132 3. options describing which optimizations should be included.
15133
15134 The options from each group can be freely mixed as they are non-
15135 overlapping. However, in case of any conflicts, the later options
15136 override the earlier options on the command line.
15137
15138 The following options control which kinds of messages should be
15139 emitted:
15140
15141 optimized
15142 Print information when an optimization is successfully applied.
15143 It is up to a pass to decide which information is relevant. For
15144 example, the vectorizer passes print the source location of
15145 loops which are successfully vectorized.
15146
15147 missed
15148 Print information about missed optimizations. Individual passes
15149 control which information to include in the output.
15150
15151 note
15152 Print verbose information about optimizations, such as certain
15153 transformations, more detailed messages about decisions etc.
15154
15155 all Print detailed optimization information. This includes
15156 optimized, missed, and note.
15157
15158 The following option controls the dump verbosity:
15159
15160 internals
15161 By default, only "high-level" messages are emitted. This option
15162 enables additional, more detailed, messages, which are likely
15163 to only be of interest to GCC developers.
15164
15165 One or more of the following option keywords can be used to
15166 describe a group of optimizations:
15167
15168 ipa Enable dumps from all interprocedural optimizations.
15169
15170 loop
15171 Enable dumps from all loop optimizations.
15172
15173 inline
15174 Enable dumps from all inlining optimizations.
15175
15176 omp Enable dumps from all OMP (Offloading and Multi Processing)
15177 optimizations.
15178
15179 vec Enable dumps from all vectorization optimizations.
15180
15181 optall
15182 Enable dumps from all optimizations. This is a superset of the
15183 optimization groups listed above.
15184
15185 If options is omitted, it defaults to optimized-optall, which means
15186 to dump messages about successful optimizations from all the
15187 passes, omitting messages that are treated as "internals".
15188
15189 If the filename is provided, then the dumps from all the applicable
15190 optimizations are concatenated into the filename. Otherwise the
15191 dump is output onto stderr. Though multiple -fopt-info options are
15192 accepted, only one of them can include a filename. If other
15193 filenames are provided then all but the first such option are
15194 ignored.
15195
15196 Note that the output filename is overwritten in case of multiple
15197 translation units. If a combined output from multiple translation
15198 units is desired, stderr should be used instead.
15199
15200 In the following example, the optimization info is output to
15201 stderr:
15202
15203 gcc -O3 -fopt-info
15204
15205 This example:
15206
15207 gcc -O3 -fopt-info-missed=missed.all
15208
15209 outputs missed optimization report from all the passes into
15210 missed.all, and this one:
15211
15212 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15213
15214 prints information about missed optimization opportunities from
15215 vectorization passes on stderr. Note that -fopt-info-vec-missed is
15216 equivalent to -fopt-info-missed-vec. The order of the optimization
15217 group names and message types listed after -fopt-info does not
15218 matter.
15219
15220 As another example,
15221
15222 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15223
15224 outputs information about missed optimizations as well as optimized
15225 locations from all the inlining passes into inline.txt.
15226
15227 Finally, consider:
15228
15229 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15230
15231 Here the two output filenames vec.miss and loop.opt are in conflict
15232 since only one output file is allowed. In this case, only the first
15233 option takes effect and the subsequent options are ignored. Thus
15234 only vec.miss is produced which contains dumps from the vectorizer
15235 about missed opportunities.
15236
15237 -fsave-optimization-record
15238 Write a SRCFILE.opt-record.json.gz file detailing what
15239 optimizations were performed, for those optimizations that support
15240 -fopt-info.
15241
15242 This option is experimental and the format of the data within the
15243 compressed JSON file is subject to change.
15244
15245 It is roughly equivalent to a machine-readable version of
15246 -fopt-info-all, as a collection of messages with source file, line
15247 number and column number, with the following additional data for
15248 each message:
15249
15250 * the execution count of the code being optimized, along with
15251 metadata about whether this was from actual profile data, or
15252 just an estimate, allowing consumers to prioritize messages by
15253 code hotness,
15254
15255 * the function name of the code being optimized, where
15256 applicable,
15257
15258 * the "inlining chain" for the code being optimized, so that when
15259 a function is inlined into several different places (which
15260 might themselves be inlined), the reader can distinguish
15261 between the copies,
15262
15263 * objects identifying those parts of the message that refer to
15264 expressions, statements or symbol-table nodes, which of these
15265 categories they are, and, when available, their source code
15266 location,
15267
15268 * the GCC pass that emitted the message, and
15269
15270 * the location in GCC's own code from which the message was
15271 emitted
15272
15273 Additionally, some messages are logically nested within other
15274 messages, reflecting implementation details of the optimization
15275 passes.
15276
15277 -fsched-verbose=n
15278 On targets that use instruction scheduling, this option controls
15279 the amount of debugging output the scheduler prints to the dump
15280 files.
15281
15282 For n greater than zero, -fsched-verbose outputs the same
15283 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
15284 greater than one, it also output basic block probabilities,
15285 detailed ready list information and unit/insn info. For n greater
15286 than two, it includes RTL at abort point, control-flow and regions
15287 info. And for n over four, -fsched-verbose also includes
15288 dependence info.
15289
15290 -fenable-kind-pass
15291 -fdisable-kind-pass=range-list
15292 This is a set of options that are used to explicitly disable/enable
15293 optimization passes. These options are intended for use for
15294 debugging GCC. Compiler users should use regular options for
15295 enabling/disabling passes instead.
15296
15297 -fdisable-ipa-pass
15298 Disable IPA pass pass. pass is the pass name. If the same pass
15299 is statically invoked in the compiler multiple times, the pass
15300 name should be appended with a sequential number starting from
15301 1.
15302
15303 -fdisable-rtl-pass
15304 -fdisable-rtl-pass=range-list
15305 Disable RTL pass pass. pass is the pass name. If the same
15306 pass is statically invoked in the compiler multiple times, the
15307 pass name should be appended with a sequential number starting
15308 from 1. range-list is a comma-separated list of function
15309 ranges or assembler names. Each range is a number pair
15310 separated by a colon. The range is inclusive in both ends. If
15311 the range is trivial, the number pair can be simplified as a
15312 single number. If the function's call graph node's uid falls
15313 within one of the specified ranges, the pass is disabled for
15314 that function. The uid is shown in the function header of a
15315 dump file, and the pass names can be dumped by using option
15316 -fdump-passes.
15317
15318 -fdisable-tree-pass
15319 -fdisable-tree-pass=range-list
15320 Disable tree pass pass. See -fdisable-rtl for the description
15321 of option arguments.
15322
15323 -fenable-ipa-pass
15324 Enable IPA pass pass. pass is the pass name. If the same pass
15325 is statically invoked in the compiler multiple times, the pass
15326 name should be appended with a sequential number starting from
15327 1.
15328
15329 -fenable-rtl-pass
15330 -fenable-rtl-pass=range-list
15331 Enable RTL pass pass. See -fdisable-rtl for option argument
15332 description and examples.
15333
15334 -fenable-tree-pass
15335 -fenable-tree-pass=range-list
15336 Enable tree pass pass. See -fdisable-rtl for the description
15337 of option arguments.
15338
15339 Here are some examples showing uses of these options.
15340
15341 # disable ccp1 for all functions
15342 -fdisable-tree-ccp1
15343 # disable complete unroll for function whose cgraph node uid is 1
15344 -fenable-tree-cunroll=1
15345 # disable gcse2 for functions at the following ranges [1,1],
15346 # [300,400], and [400,1000]
15347 # disable gcse2 for functions foo and foo2
15348 -fdisable-rtl-gcse2=foo,foo2
15349 # disable early inlining
15350 -fdisable-tree-einline
15351 # disable ipa inlining
15352 -fdisable-ipa-inline
15353 # enable tree full unroll
15354 -fenable-tree-unroll
15355
15356 -fchecking
15357 -fchecking=n
15358 Enable internal consistency checking. The default depends on the
15359 compiler configuration. -fchecking=2 enables further internal
15360 consistency checking that might affect code generation.
15361
15362 -frandom-seed=string
15363 This option provides a seed that GCC uses in place of random
15364 numbers in generating certain symbol names that have to be
15365 different in every compiled file. It is also used to place unique
15366 stamps in coverage data files and the object files that produce
15367 them. You can use the -frandom-seed option to produce reproducibly
15368 identical object files.
15369
15370 The string can either be a number (decimal, octal or hex) or an
15371 arbitrary string (in which case it's converted to a number by
15372 computing CRC32).
15373
15374 The string should be different for every file you compile.
15375
15376 -save-temps
15377 Store the usual "temporary" intermediate files permanently; name
15378 them as auxiliary output files, as specified described under
15379 -dumpbase and -dumpdir.
15380
15381 When used in combination with the -x command-line option,
15382 -save-temps is sensible enough to avoid overwriting an input source
15383 file with the same extension as an intermediate file. The
15384 corresponding intermediate file may be obtained by renaming the
15385 source file before using -save-temps.
15386
15387 -save-temps=cwd
15388 Equivalent to -save-temps -dumpdir ./.
15389
15390 -save-temps=obj
15391 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
15392 directory of the output file specified after the -o option,
15393 including any directory separators. If the -o option is not used,
15394 the -save-temps=obj switch behaves like -save-temps=cwd.
15395
15396 -time[=file]
15397 Report the CPU time taken by each subprocess in the compilation
15398 sequence. For C source files, this is the compiler proper and
15399 assembler (plus the linker if linking is done).
15400
15401 Without the specification of an output file, the output looks like
15402 this:
15403
15404 # cc1 0.12 0.01
15405 # as 0.00 0.01
15406
15407 The first number on each line is the "user time", that is time
15408 spent executing the program itself. The second number is "system
15409 time", time spent executing operating system routines on behalf of
15410 the program. Both numbers are in seconds.
15411
15412 With the specification of an output file, the output is appended to
15413 the named file, and it looks like this:
15414
15415 0.12 0.01 cc1 <options>
15416 0.00 0.01 as <options>
15417
15418 The "user time" and the "system time" are moved before the program
15419 name, and the options passed to the program are displayed, so that
15420 one can later tell what file was being compiled, and with which
15421 options.
15422
15423 -fdump-final-insns[=file]
15424 Dump the final internal representation (RTL) to file. If the
15425 optional argument is omitted (or if file is "."), the name of the
15426 dump file is determined by appending ".gkd" to the dump base name,
15427 see -dumpbase.
15428
15429 -fcompare-debug[=opts]
15430 If no error occurs during compilation, run the compiler a second
15431 time, adding opts and -fcompare-debug-second to the arguments
15432 passed to the second compilation. Dump the final internal
15433 representation in both compilations, and print an error if they
15434 differ.
15435
15436 If the equal sign is omitted, the default -gtoggle is used.
15437
15438 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
15439 and nonzero, implicitly enables -fcompare-debug. If
15440 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
15441 it is used for opts, otherwise the default -gtoggle is used.
15442
15443 -fcompare-debug=, with the equal sign but without opts, is
15444 equivalent to -fno-compare-debug, which disables the dumping of the
15445 final representation and the second compilation, preventing even
15446 GCC_COMPARE_DEBUG from taking effect.
15447
15448 To verify full coverage during -fcompare-debug testing, set
15449 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
15450 rejects as an invalid option in any actual compilation (rather than
15451 preprocessing, assembly or linking). To get just a warning,
15452 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
15453 will do.
15454
15455 -fcompare-debug-second
15456 This option is implicitly passed to the compiler for the second
15457 compilation requested by -fcompare-debug, along with options to
15458 silence warnings, and omitting other options that would cause the
15459 compiler to produce output to files or to standard output as a side
15460 effect. Dump files and preserved temporary files are renamed so as
15461 to contain the ".gk" additional extension during the second
15462 compilation, to avoid overwriting those generated by the first.
15463
15464 When this option is passed to the compiler driver, it causes the
15465 first compilation to be skipped, which makes it useful for little
15466 other than debugging the compiler proper.
15467
15468 -gtoggle
15469 Turn off generation of debug info, if leaving out this option
15470 generates it, or turn it on at level 2 otherwise. The position of
15471 this argument in the command line does not matter; it takes effect
15472 after all other options are processed, and it does so only once, no
15473 matter how many times it is given. This is mainly intended to be
15474 used with -fcompare-debug.
15475
15476 -fvar-tracking-assignments-toggle
15477 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
15478 toggles -g.
15479
15480 -Q Makes the compiler print out each function name as it is compiled,
15481 and print some statistics about each pass when it finishes.
15482
15483 -ftime-report
15484 Makes the compiler print some statistics about the time consumed by
15485 each pass when it finishes.
15486
15487 -ftime-report-details
15488 Record the time consumed by infrastructure parts separately for
15489 each pass.
15490
15491 -fira-verbose=n
15492 Control the verbosity of the dump file for the integrated register
15493 allocator. The default value is 5. If the value n is greater or
15494 equal to 10, the dump output is sent to stderr using the same
15495 format as n minus 10.
15496
15497 -flto-report
15498 Prints a report with internal details on the workings of the link-
15499 time optimizer. The contents of this report vary from version to
15500 version. It is meant to be useful to GCC developers when
15501 processing object files in LTO mode (via -flto).
15502
15503 Disabled by default.
15504
15505 -flto-report-wpa
15506 Like -flto-report, but only print for the WPA phase of link-time
15507 optimization.
15508
15509 -fmem-report
15510 Makes the compiler print some statistics about permanent memory
15511 allocation when it finishes.
15512
15513 -fmem-report-wpa
15514 Makes the compiler print some statistics about permanent memory
15515 allocation for the WPA phase only.
15516
15517 -fpre-ipa-mem-report
15518 -fpost-ipa-mem-report
15519 Makes the compiler print some statistics about permanent memory
15520 allocation before or after interprocedural optimization.
15521
15522 -fprofile-report
15523 Makes the compiler print some statistics about consistency of the
15524 (estimated) profile and effect of individual passes.
15525
15526 -fstack-usage
15527 Makes the compiler output stack usage information for the program,
15528 on a per-function basis. The filename for the dump is made by
15529 appending .su to the auxname. auxname is generated from the name
15530 of the output file, if explicitly specified and it is not an
15531 executable, otherwise it is the basename of the source file. An
15532 entry is made up of three fields:
15533
15534 * The name of the function.
15535
15536 * A number of bytes.
15537
15538 * One or more qualifiers: "static", "dynamic", "bounded".
15539
15540 The qualifier "static" means that the function manipulates the
15541 stack statically: a fixed number of bytes are allocated for the
15542 frame on function entry and released on function exit; no stack
15543 adjustments are otherwise made in the function. The second field
15544 is this fixed number of bytes.
15545
15546 The qualifier "dynamic" means that the function manipulates the
15547 stack dynamically: in addition to the static allocation described
15548 above, stack adjustments are made in the body of the function, for
15549 example to push/pop arguments around function calls. If the
15550 qualifier "bounded" is also present, the amount of these
15551 adjustments is bounded at compile time and the second field is an
15552 upper bound of the total amount of stack used by the function. If
15553 it is not present, the amount of these adjustments is not bounded
15554 at compile time and the second field only represents the bounded
15555 part.
15556
15557 -fstats
15558 Emit statistics about front-end processing at the end of the
15559 compilation. This option is supported only by the C++ front end,
15560 and the information is generally only useful to the G++ development
15561 team.
15562
15563 -fdbg-cnt-list
15564 Print the name and the counter upper bound for all debug counters.
15565
15566 -fdbg-cnt=counter-value-list
15567 Set the internal debug counter lower and upper bound. counter-
15568 value-list is a comma-separated list of
15569 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
15570 tuples which sets the name of the counter and list of closed
15571 intervals. The lower_bound is optional and is zero initialized if
15572 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
15573 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
15574 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
15575 for first 10 invocations.
15576
15577 -print-file-name=library
15578 Print the full absolute name of the library file library that would
15579 be used when linking---and don't do anything else. With this
15580 option, GCC does not compile or link anything; it just prints the
15581 file name.
15582
15583 -print-multi-directory
15584 Print the directory name corresponding to the multilib selected by
15585 any other switches present in the command line. This directory is
15586 supposed to exist in GCC_EXEC_PREFIX.
15587
15588 -print-multi-lib
15589 Print the mapping from multilib directory names to compiler
15590 switches that enable them. The directory name is separated from
15591 the switches by ;, and each switch starts with an @ instead of the
15592 -, without spaces between multiple switches. This is supposed to
15593 ease shell processing.
15594
15595 -print-multi-os-directory
15596 Print the path to OS libraries for the selected multilib, relative
15597 to some lib subdirectory. If OS libraries are present in the lib
15598 subdirectory and no multilibs are used, this is usually just ., if
15599 OS libraries are present in libsuffix sibling directories this
15600 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
15601 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
15602 or ev6.
15603
15604 -print-multiarch
15605 Print the path to OS libraries for the selected multiarch, relative
15606 to some lib subdirectory.
15607
15608 -print-prog-name=program
15609 Like -print-file-name, but searches for a program such as cpp.
15610
15611 -print-libgcc-file-name
15612 Same as -print-file-name=libgcc.a.
15613
15614 This is useful when you use -nostdlib or -nodefaultlibs but you do
15615 want to link with libgcc.a. You can do:
15616
15617 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
15618
15619 -print-search-dirs
15620 Print the name of the configured installation directory and a list
15621 of program and library directories gcc searches---and don't do
15622 anything else.
15623
15624 This is useful when gcc prints the error message installation
15625 problem, cannot exec cpp0: No such file or directory. To resolve
15626 this you either need to put cpp0 and the other compiler components
15627 where gcc expects to find them, or you can set the environment
15628 variable GCC_EXEC_PREFIX to the directory where you installed them.
15629 Don't forget the trailing /.
15630
15631 -print-sysroot
15632 Print the target sysroot directory that is used during compilation.
15633 This is the target sysroot specified either at configure time or
15634 using the --sysroot option, possibly with an extra suffix that
15635 depends on compilation options. If no target sysroot is specified,
15636 the option prints nothing.
15637
15638 -print-sysroot-headers-suffix
15639 Print the suffix added to the target sysroot when searching for
15640 headers, or give an error if the compiler is not configured with
15641 such a suffix---and don't do anything else.
15642
15643 -dumpmachine
15644 Print the compiler's target machine (for example,
15645 i686-pc-linux-gnu)---and don't do anything else.
15646
15647 -dumpversion
15648 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
15649 don't do anything else. This is the compiler version used in
15650 filesystem paths and specs. Depending on how the compiler has been
15651 configured it can be just a single number (major version), two
15652 numbers separated by a dot (major and minor version) or three
15653 numbers separated by dots (major, minor and patchlevel version).
15654
15655 -dumpfullversion
15656 Print the full compiler version---and don't do anything else. The
15657 output is always three numbers separated by dots, major, minor and
15658 patchlevel version.
15659
15660 -dumpspecs
15661 Print the compiler's built-in specs---and don't do anything else.
15662 (This is used when GCC itself is being built.)
15663
15664 Machine-Dependent Options
15665 Each target machine supported by GCC can have its own options---for
15666 example, to allow you to compile for a particular processor variant or
15667 ABI, or to control optimizations specific to that machine. By
15668 convention, the names of machine-specific options start with -m.
15669
15670 Some configurations of the compiler also support additional target-
15671 specific options, usually for compatibility with other compilers on the
15672 same platform.
15673
15674 AArch64 Options
15675 These options are defined for AArch64 implementations:
15676
15677 -mabi=name
15678 Generate code for the specified data model. Permissible values are
15679 ilp32 for SysV-like data model where int, long int and pointers are
15680 32 bits, and lp64 for SysV-like data model where int is 32 bits,
15681 but long int and pointers are 64 bits.
15682
15683 The default depends on the specific target configuration. Note
15684 that the LP64 and ILP32 ABIs are not link-compatible; you must
15685 compile your entire program with the same ABI, and link with a
15686 compatible set of libraries.
15687
15688 -mbig-endian
15689 Generate big-endian code. This is the default when GCC is
15690 configured for an aarch64_be-*-* target.
15691
15692 -mgeneral-regs-only
15693 Generate code which uses only the general-purpose registers. This
15694 will prevent the compiler from using floating-point and Advanced
15695 SIMD registers but will not impose any restrictions on the
15696 assembler.
15697
15698 -mlittle-endian
15699 Generate little-endian code. This is the default when GCC is
15700 configured for an aarch64-*-* but not an aarch64_be-*-* target.
15701
15702 -mcmodel=tiny
15703 Generate code for the tiny code model. The program and its
15704 statically defined symbols must be within 1MB of each other.
15705 Programs can be statically or dynamically linked.
15706
15707 -mcmodel=small
15708 Generate code for the small code model. The program and its
15709 statically defined symbols must be within 4GB of each other.
15710 Programs can be statically or dynamically linked. This is the
15711 default code model.
15712
15713 -mcmodel=large
15714 Generate code for the large code model. This makes no assumptions
15715 about addresses and sizes of sections. Programs can be statically
15716 linked only. The -mcmodel=large option is incompatible with
15717 -mabi=ilp32, -fpic and -fPIC.
15718
15719 -mstrict-align
15720 -mno-strict-align
15721 Avoid or allow generating memory accesses that may not be aligned
15722 on a natural object boundary as described in the architecture
15723 specification.
15724
15725 -momit-leaf-frame-pointer
15726 -mno-omit-leaf-frame-pointer
15727 Omit or keep the frame pointer in leaf functions. The former
15728 behavior is the default.
15729
15730 -mstack-protector-guard=guard
15731 -mstack-protector-guard-reg=reg
15732 -mstack-protector-guard-offset=offset
15733 Generate stack protection code using canary at guard. Supported
15734 locations are global for a global canary or sysreg for a canary in
15735 an appropriate system register.
15736
15737 With the latter choice the options -mstack-protector-guard-reg=reg
15738 and -mstack-protector-guard-offset=offset furthermore specify which
15739 system register to use as base register for reading the canary, and
15740 from what offset from that base register. There is no default
15741 register or offset as this is entirely for use within the Linux
15742 kernel.
15743
15744 -mtls-dialect=desc
15745 Use TLS descriptors as the thread-local storage mechanism for
15746 dynamic accesses of TLS variables. This is the default.
15747
15748 -mtls-dialect=traditional
15749 Use traditional TLS as the thread-local storage mechanism for
15750 dynamic accesses of TLS variables.
15751
15752 -mtls-size=size
15753 Specify bit size of immediate TLS offsets. Valid values are 12,
15754 24, 32, 48. This option requires binutils 2.26 or newer.
15755
15756 -mfix-cortex-a53-835769
15757 -mno-fix-cortex-a53-835769
15758 Enable or disable the workaround for the ARM Cortex-A53 erratum
15759 number 835769. This involves inserting a NOP instruction between
15760 memory instructions and 64-bit integer multiply-accumulate
15761 instructions.
15762
15763 -mfix-cortex-a53-843419
15764 -mno-fix-cortex-a53-843419
15765 Enable or disable the workaround for the ARM Cortex-A53 erratum
15766 number 843419. This erratum workaround is made at link time and
15767 this will only pass the corresponding flag to the linker.
15768
15769 -mlow-precision-recip-sqrt
15770 -mno-low-precision-recip-sqrt
15771 Enable or disable the reciprocal square root approximation. This
15772 option only has an effect if -ffast-math or
15773 -funsafe-math-optimizations is used as well. Enabling this reduces
15774 precision of reciprocal square root results to about 16 bits for
15775 single precision and to 32 bits for double precision.
15776
15777 -mlow-precision-sqrt
15778 -mno-low-precision-sqrt
15779 Enable or disable the square root approximation. This option only
15780 has an effect if -ffast-math or -funsafe-math-optimizations is used
15781 as well. Enabling this reduces precision of square root results to
15782 about 16 bits for single precision and to 32 bits for double
15783 precision. If enabled, it implies -mlow-precision-recip-sqrt.
15784
15785 -mlow-precision-div
15786 -mno-low-precision-div
15787 Enable or disable the division approximation. This option only has
15788 an effect if -ffast-math or -funsafe-math-optimizations is used as
15789 well. Enabling this reduces precision of division results to about
15790 16 bits for single precision and to 32 bits for double precision.
15791
15792 -mtrack-speculation
15793 -mno-track-speculation
15794 Enable or disable generation of additional code to track
15795 speculative execution through conditional branches. The tracking
15796 state can then be used by the compiler when expanding calls to
15797 "__builtin_speculation_safe_copy" to permit a more efficient code
15798 sequence to be generated.
15799
15800 -moutline-atomics
15801 -mno-outline-atomics
15802 Enable or disable calls to out-of-line helpers to implement atomic
15803 operations. These helpers will, at runtime, determine if the LSE
15804 instructions from ARMv8.1-A can be used; if not, they will use the
15805 load/store-exclusive instructions that are present in the base
15806 ARMv8.0 ISA.
15807
15808 This option is only applicable when compiling for the base ARMv8.0
15809 instruction set. If using a later revision, e.g. -march=armv8.1-a
15810 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
15811 used directly. The same applies when using -mcpu= when the
15812 selected cpu supports the lse feature. This option is on by
15813 default.
15814
15815 -march=name
15816 Specify the name of the target architecture and, optionally, one or
15817 more feature modifiers. This option has the form
15818 -march=arch{+[no]feature}*.
15819
15820 The table below summarizes the permissible values for arch and the
15821 features that they enable by default:
15822
15823 arch value : Architecture : Includes by default
15824 armv8-a : Armv8-A : +fp, +simd
15825 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
15826 armv8.2-a : Armv8.2-A : armv8.1-a
15827 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
15828 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
15829 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
15830 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
15831 armv8-r : Armv8-R : armv8-r
15832
15833 The value native is available on native AArch64 GNU/Linux and
15834 causes the compiler to pick the architecture of the host system.
15835 This option has no effect if the compiler is unable to recognize
15836 the architecture of the host system,
15837
15838 The permissible values for feature are listed in the sub-section on
15839 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
15840 Where conflicting feature modifiers are specified, the right-most
15841 feature is used.
15842
15843 GCC uses name to determine what kind of instructions it can emit
15844 when generating assembly code. If -march is specified without
15845 either of -mtune or -mcpu also being specified, the code is tuned
15846 to perform well across a range of target processors implementing
15847 the target architecture.
15848
15849 -mtune=name
15850 Specify the name of the target processor for which GCC should tune
15851 the performance of the code. Permissible values for this option
15852 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
15853 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
15854 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
15855 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
15856 neoverse-e1, neoverse-n1, neoverse-n2, neoverse-v1, qdf24xx,
15857 saphira, phecda, xgene1, vulcan, octeontx, octeontx81, octeontx83,
15858 octeontx2, octeontx2t98, octeontx2t96 octeontx2t93, octeontx2f95,
15859 octeontx2f95n, octeontx2f95mm, a64fx, thunderx, thunderxt88,
15860 thunderxt88p1, thunderxt81, tsv110, thunderxt83, thunderx2t99,
15861 thunderx3t110, zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15862 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
15863 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
15864 cortex-x1, native.
15865
15866 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15867 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
15868 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
15869 should tune for a big.LITTLE system.
15870
15871 Additionally on native AArch64 GNU/Linux systems the value native
15872 tunes performance to the host system. This option has no effect if
15873 the compiler is unable to recognize the processor of the host
15874 system.
15875
15876 Where none of -mtune=, -mcpu= or -march= are specified, the code is
15877 tuned to perform well across a range of target processors.
15878
15879 This option cannot be suffixed by feature modifiers.
15880
15881 -mcpu=name
15882 Specify the name of the target processor, optionally suffixed by
15883 one or more feature modifiers. This option has the form
15884 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
15885 the same as those available for -mtune. The permissible values for
15886 feature are documented in the sub-section on
15887 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
15888 Where conflicting feature modifiers are specified, the right-most
15889 feature is used.
15890
15891 GCC uses name to determine what kind of instructions it can emit
15892 when generating assembly code (as if by -march) and to determine
15893 the target processor for which to tune for performance (as if by
15894 -mtune). Where this option is used in conjunction with -march or
15895 -mtune, those options take precedence over the appropriate part of
15896 this option.
15897
15898 -moverride=string
15899 Override tuning decisions made by the back-end in response to a
15900 -mtune= switch. The syntax, semantics, and accepted values for
15901 string in this option are not guaranteed to be consistent across
15902 releases.
15903
15904 This option is only intended to be useful when developing GCC.
15905
15906 -mverbose-cost-dump
15907 Enable verbose cost model dumping in the debug dump files. This
15908 option is provided for use in debugging the compiler.
15909
15910 -mpc-relative-literal-loads
15911 -mno-pc-relative-literal-loads
15912 Enable or disable PC-relative literal loads. With this option
15913 literal pools are accessed using a single instruction and emitted
15914 after each function. This limits the maximum size of functions to
15915 1MB. This is enabled by default for -mcmodel=tiny.
15916
15917 -msign-return-address=scope
15918 Select the function scope on which return address signing will be
15919 applied. Permissible values are none, which disables return
15920 address signing, non-leaf, which enables pointer signing for
15921 functions which are not leaf functions, and all, which enables
15922 pointer signing for all functions. The default value is none. This
15923 option has been deprecated by -mbranch-protection.
15924
15925 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
15926 Select the branch protection features to use. none is the default
15927 and turns off all types of branch protection. standard turns on
15928 all types of branch protection features. If a feature has
15929 additional tuning options, then standard sets it to its standard
15930 level. pac-ret[+leaf] turns on return address signing to its
15931 standard level: signing functions that save the return address to
15932 memory (non-leaf functions will practically always do this) using
15933 the a-key. The optional argument leaf can be used to extend the
15934 signing to include leaf functions. The optional argument b-key can
15935 be used to sign the functions with the B-key instead of the A-key.
15936 bti turns on branch target identification mechanism.
15937
15938 -mharden-sls=opts
15939 Enable compiler hardening against straight line speculation (SLS).
15940 opts is a comma-separated list of the following options:
15941
15942 retbr
15943 blr
15944
15945 In addition, -mharden-sls=all enables all SLS hardening while
15946 -mharden-sls=none disables all SLS hardening.
15947
15948 -msve-vector-bits=bits
15949 Specify the number of bits in an SVE vector register. This option
15950 only has an effect when SVE is enabled.
15951
15952 GCC supports two forms of SVE code generation: "vector-length
15953 agnostic" output that works with any size of vector register and
15954 "vector-length specific" output that allows GCC to make assumptions
15955 about the vector length when it is useful for optimization reasons.
15956 The possible values of bits are: scalable, 128, 256, 512, 1024 and
15957 2048. Specifying scalable selects vector-length agnostic output.
15958 At present -msve-vector-bits=128 also generates vector-length
15959 agnostic output for big-endian targets. All other values generate
15960 vector-length specific code. The behavior of these values may
15961 change in future releases and no value except scalable should be
15962 relied on for producing code that is portable across different
15963 hardware SVE vector lengths.
15964
15965 The default is -msve-vector-bits=scalable, which produces vector-
15966 length agnostic code.
15967
15968 -march and -mcpu Feature Modifiers
15969
15970 Feature modifiers used with -march and -mcpu can be any of the
15971 following and their inverses nofeature:
15972
15973 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
15974
15975 crypto
15976 Enable Crypto extension. This also enables Advanced SIMD and
15977 floating-point instructions.
15978
15979 fp Enable floating-point instructions. This is on by default for all
15980 possible values for options -march and -mcpu.
15981
15982 simd
15983 Enable Advanced SIMD instructions. This also enables floating-
15984 point instructions. This is on by default for all possible values
15985 for options -march and -mcpu.
15986
15987 sve Enable Scalable Vector Extension instructions. This also enables
15988 Advanced SIMD and floating-point instructions.
15989
15990 lse Enable Large System Extension instructions. This is on by default
15991 for -march=armv8.1-a.
15992
15993 rdma
15994 Enable Round Double Multiply Accumulate instructions. This is on
15995 by default for -march=armv8.1-a.
15996
15997 fp16
15998 Enable FP16 extension. This also enables floating-point
15999 instructions.
16000
16001 fp16fml
16002 Enable FP16 fmla extension. This also enables FP16 extensions and
16003 floating-point instructions. This option is enabled by default for
16004 -march=armv8.4-a. Use of this option with architectures prior to
16005 Armv8.2-A is not supported.
16006
16007 rcpc
16008 Enable the RcPc extension. This does not change code generation
16009 from GCC, but is passed on to the assembler, enabling inline asm
16010 statements to use instructions from the RcPc extension.
16011
16012 dotprod
16013 Enable the Dot Product extension. This also enables Advanced SIMD
16014 instructions.
16015
16016 aes Enable the Armv8-a aes and pmull crypto extension. This also
16017 enables Advanced SIMD instructions.
16018
16019 sha2
16020 Enable the Armv8-a sha2 crypto extension. This also enables
16021 Advanced SIMD instructions.
16022
16023 sha3
16024 Enable the sha512 and sha3 crypto extension. This also enables
16025 Advanced SIMD instructions. Use of this option with architectures
16026 prior to Armv8.2-A is not supported.
16027
16028 sm4 Enable the sm3 and sm4 crypto extension. This also enables
16029 Advanced SIMD instructions. Use of this option with architectures
16030 prior to Armv8.2-A is not supported.
16031
16032 profile
16033 Enable the Statistical Profiling extension. This option is only to
16034 enable the extension at the assembler level and does not affect
16035 code generation.
16036
16037 rng Enable the Armv8.5-a Random Number instructions. This option is
16038 only to enable the extension at the assembler level and does not
16039 affect code generation.
16040
16041 memtag
16042 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16043 with architectures prior to Armv8.5-A is not supported.
16044
16045 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16046 only to enable the extension at the assembler level and does not
16047 affect code generation. This option is enabled by default for
16048 -march=armv8.5-a.
16049
16050 ssbs
16051 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16052 option is only to enable the extension at the assembler level and
16053 does not affect code generation. This option is enabled by default
16054 for -march=armv8.5-a.
16055
16056 predres
16057 Enable the Armv8-a Execution and Data Prediction Restriction
16058 instructions. This option is only to enable the extension at the
16059 assembler level and does not affect code generation. This option
16060 is enabled by default for -march=armv8.5-a.
16061
16062 sve2
16063 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16064 SVE instructions.
16065
16066 sve2-bitperm
16067 Enable SVE2 bitperm instructions. This also enables SVE2
16068 instructions.
16069
16070 sve2-sm4
16071 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16072
16073 sve2-aes
16074 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16075
16076 sve2-sha3
16077 Enable SVE2 sha3 instructions. This also enables SVE2
16078 instructions.
16079
16080 tme Enable the Transactional Memory Extension.
16081
16082 i8mm
16083 Enable 8-bit Integer Matrix Multiply instructions. This also
16084 enables Advanced SIMD and floating-point instructions. This option
16085 is enabled by default for -march=armv8.6-a. Use of this option
16086 with architectures prior to Armv8.2-A is not supported.
16087
16088 f32mm
16089 Enable 32-bit Floating point Matrix Multiply instructions. This
16090 also enables SVE instructions. Use of this option with
16091 architectures prior to Armv8.2-A is not supported.
16092
16093 f64mm
16094 Enable 64-bit Floating point Matrix Multiply instructions. This
16095 also enables SVE instructions. Use of this option with
16096 architectures prior to Armv8.2-A is not supported.
16097
16098 bf16
16099 Enable brain half-precision floating-point instructions. This also
16100 enables Advanced SIMD and floating-point instructions. This option
16101 is enabled by default for -march=armv8.6-a. Use of this option
16102 with architectures prior to Armv8.2-A is not supported.
16103
16104 flagm
16105 Enable the Flag Manipulation instructions Extension.
16106
16107 pauth
16108 Enable the Pointer Authentication Extension.
16109
16110 Feature crypto implies aes, sha2, and simd, which implies fp.
16111 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16112 nosha2.
16113
16114 Adapteva Epiphany Options
16115 These -m options are defined for Adapteva Epiphany:
16116
16117 -mhalf-reg-file
16118 Don't allocate any register in the range "r32"..."r63". That
16119 allows code to run on hardware variants that lack these registers.
16120
16121 -mprefer-short-insn-regs
16122 Preferentially allocate registers that allow short instruction
16123 generation. This can result in increased instruction count, so
16124 this may either reduce or increase overall code size.
16125
16126 -mbranch-cost=num
16127 Set the cost of branches to roughly num "simple" instructions.
16128 This cost is only a heuristic and is not guaranteed to produce
16129 consistent results across releases.
16130
16131 -mcmove
16132 Enable the generation of conditional moves.
16133
16134 -mnops=num
16135 Emit num NOPs before every other generated instruction.
16136
16137 -mno-soft-cmpsf
16138 For single-precision floating-point comparisons, emit an "fsub"
16139 instruction and test the flags. This is faster than a software
16140 comparison, but can get incorrect results in the presence of NaNs,
16141 or when two different small numbers are compared such that their
16142 difference is calculated as zero. The default is -msoft-cmpsf,
16143 which uses slower, but IEEE-compliant, software comparisons.
16144
16145 -mstack-offset=num
16146 Set the offset between the top of the stack and the stack pointer.
16147 E.g., a value of 8 means that the eight bytes in the range
16148 "sp+0...sp+7" can be used by leaf functions without stack
16149 allocation. Values other than 8 or 16 are untested and unlikely to
16150 work. Note also that this option changes the ABI; compiling a
16151 program with a different stack offset than the libraries have been
16152 compiled with generally does not work. This option can be useful
16153 if you want to evaluate if a different stack offset would give you
16154 better code, but to actually use a different stack offset to build
16155 working programs, it is recommended to configure the toolchain with
16156 the appropriate --with-stack-offset=num option.
16157
16158 -mno-round-nearest
16159 Make the scheduler assume that the rounding mode has been set to
16160 truncating. The default is -mround-nearest.
16161
16162 -mlong-calls
16163 If not otherwise specified by an attribute, assume all calls might
16164 be beyond the offset range of the "b" / "bl" instructions, and
16165 therefore load the function address into a register before
16166 performing a (otherwise direct) call. This is the default.
16167
16168 -mshort-calls
16169 If not otherwise specified by an attribute, assume all direct calls
16170 are in the range of the "b" / "bl" instructions, so use these
16171 instructions for direct calls. The default is -mlong-calls.
16172
16173 -msmall16
16174 Assume addresses can be loaded as 16-bit unsigned values. This
16175 does not apply to function addresses for which -mlong-calls
16176 semantics are in effect.
16177
16178 -mfp-mode=mode
16179 Set the prevailing mode of the floating-point unit. This
16180 determines the floating-point mode that is provided and expected at
16181 function call and return time. Making this mode match the mode you
16182 predominantly need at function start can make your programs smaller
16183 and faster by avoiding unnecessary mode switches.
16184
16185 mode can be set to one the following values:
16186
16187 caller
16188 Any mode at function entry is valid, and retained or restored
16189 when the function returns, and when it calls other functions.
16190 This mode is useful for compiling libraries or other
16191 compilation units you might want to incorporate into different
16192 programs with different prevailing FPU modes, and the
16193 convenience of being able to use a single object file outweighs
16194 the size and speed overhead for any extra mode switching that
16195 might be needed, compared with what would be needed with a more
16196 specific choice of prevailing FPU mode.
16197
16198 truncate
16199 This is the mode used for floating-point calculations with
16200 truncating (i.e. round towards zero) rounding mode. That
16201 includes conversion from floating point to integer.
16202
16203 round-nearest
16204 This is the mode used for floating-point calculations with
16205 round-to-nearest-or-even rounding mode.
16206
16207 int This is the mode used to perform integer calculations in the
16208 FPU, e.g. integer multiply, or integer multiply-and-
16209 accumulate.
16210
16211 The default is -mfp-mode=caller
16212
16213 -mno-split-lohi
16214 -mno-postinc
16215 -mno-postmodify
16216 Code generation tweaks that disable, respectively, splitting of
16217 32-bit loads, generation of post-increment addresses, and
16218 generation of post-modify addresses. The defaults are msplit-lohi,
16219 -mpost-inc, and -mpost-modify.
16220
16221 -mnovect-double
16222 Change the preferred SIMD mode to SImode. The default is
16223 -mvect-double, which uses DImode as preferred SIMD mode.
16224
16225 -max-vect-align=num
16226 The maximum alignment for SIMD vector mode types. num may be 4 or
16227 8. The default is 8. Note that this is an ABI change, even though
16228 many library function interfaces are unaffected if they don't use
16229 SIMD vector modes in places that affect size and/or alignment of
16230 relevant types.
16231
16232 -msplit-vecmove-early
16233 Split vector moves into single word moves before reload. In theory
16234 this can give better register allocation, but so far the reverse
16235 seems to be generally the case.
16236
16237 -m1reg-reg
16238 Specify a register to hold the constant -1, which makes loading
16239 small negative constants and certain bitmasks faster. Allowable
16240 values for reg are r43 and r63, which specify use of that register
16241 as a fixed register, and none, which means that no register is used
16242 for this purpose. The default is -m1reg-none.
16243
16244 AMD GCN Options
16245 These options are defined specifically for the AMD GCN port.
16246
16247 -march=gpu
16248 -mtune=gpu
16249 Set architecture type or tuning for gpu. Supported values for gpu
16250 are
16251
16252 fiji
16253 Compile for GCN3 Fiji devices (gfx803).
16254
16255 gfx900
16256 Compile for GCN5 Vega 10 devices (gfx900).
16257
16258 gfx906
16259 Compile for GCN5 Vega 20 devices (gfx906).
16260
16261 -mstack-size=bytes
16262 Specify how many bytes of stack space will be requested for each
16263 GPU thread (wave-front). Beware that there may be many threads and
16264 limited memory available. The size of the stack allocation may
16265 also have an impact on run-time performance. The default is 32KB
16266 when using OpenACC or OpenMP, and 1MB otherwise.
16267
16268 ARC Options
16269 The following options control the architecture variant for which code
16270 is being compiled:
16271
16272 -mbarrel-shifter
16273 Generate instructions supported by barrel shifter. This is the
16274 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
16275
16276 -mjli-always
16277 Force to call a function using jli_s instruction. This option is
16278 valid only for ARCv2 architecture.
16279
16280 -mcpu=cpu
16281 Set architecture type, register usage, and instruction scheduling
16282 parameters for cpu. There are also shortcut alias options
16283 available for backward compatibility and convenience. Supported
16284 values for cpu are
16285
16286 arc600
16287 Compile for ARC600. Aliases: -mA6, -mARC600.
16288
16289 arc601
16290 Compile for ARC601. Alias: -mARC601.
16291
16292 arc700
16293 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
16294 default when configured with --with-cpu=arc700.
16295
16296 arcem
16297 Compile for ARC EM.
16298
16299 archs
16300 Compile for ARC HS.
16301
16302 em Compile for ARC EM CPU with no hardware extensions.
16303
16304 em4 Compile for ARC EM4 CPU.
16305
16306 em4_dmips
16307 Compile for ARC EM4 DMIPS CPU.
16308
16309 em4_fpus
16310 Compile for ARC EM4 DMIPS CPU with the single-precision
16311 floating-point extension.
16312
16313 em4_fpuda
16314 Compile for ARC EM4 DMIPS CPU with single-precision floating-
16315 point and double assist instructions.
16316
16317 hs Compile for ARC HS CPU with no hardware extensions except the
16318 atomic instructions.
16319
16320 hs34
16321 Compile for ARC HS34 CPU.
16322
16323 hs38
16324 Compile for ARC HS38 CPU.
16325
16326 hs38_linux
16327 Compile for ARC HS38 CPU with all hardware extensions on.
16328
16329 arc600_norm
16330 Compile for ARC 600 CPU with "norm" instructions enabled.
16331
16332 arc600_mul32x16
16333 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
16334 instructions enabled.
16335
16336 arc600_mul64
16337 Compile for ARC 600 CPU with "norm" and "mul64"-family
16338 instructions enabled.
16339
16340 arc601_norm
16341 Compile for ARC 601 CPU with "norm" instructions enabled.
16342
16343 arc601_mul32x16
16344 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
16345 instructions enabled.
16346
16347 arc601_mul64
16348 Compile for ARC 601 CPU with "norm" and "mul64"-family
16349 instructions enabled.
16350
16351 nps400
16352 Compile for ARC 700 on NPS400 chip.
16353
16354 em_mini
16355 Compile for ARC EM minimalist configuration featuring reduced
16356 register set.
16357
16358 -mdpfp
16359 -mdpfp-compact
16360 Generate double-precision FPX instructions, tuned for the compact
16361 implementation.
16362
16363 -mdpfp-fast
16364 Generate double-precision FPX instructions, tuned for the fast
16365 implementation.
16366
16367 -mno-dpfp-lrsr
16368 Disable "lr" and "sr" instructions from using FPX extension aux
16369 registers.
16370
16371 -mea
16372 Generate extended arithmetic instructions. Currently only "divaw",
16373 "adds", "subs", and "sat16" are supported. Only valid for
16374 -mcpu=ARC700.
16375
16376 -mno-mpy
16377 Do not generate "mpy"-family instructions for ARC700. This option
16378 is deprecated.
16379
16380 -mmul32x16
16381 Generate 32x16-bit multiply and multiply-accumulate instructions.
16382
16383 -mmul64
16384 Generate "mul64" and "mulu64" instructions. Only valid for
16385 -mcpu=ARC600.
16386
16387 -mnorm
16388 Generate "norm" instructions. This is the default if -mcpu=ARC700
16389 is in effect.
16390
16391 -mspfp
16392 -mspfp-compact
16393 Generate single-precision FPX instructions, tuned for the compact
16394 implementation.
16395
16396 -mspfp-fast
16397 Generate single-precision FPX instructions, tuned for the fast
16398 implementation.
16399
16400 -msimd
16401 Enable generation of ARC SIMD instructions via target-specific
16402 builtins. Only valid for -mcpu=ARC700.
16403
16404 -msoft-float
16405 This option ignored; it is provided for compatibility purposes
16406 only. Software floating-point code is emitted by default, and this
16407 default can overridden by FPX options; -mspfp, -mspfp-compact, or
16408 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
16409 -mdpfp-fast for double precision.
16410
16411 -mswap
16412 Generate "swap" instructions.
16413
16414 -matomic
16415 This enables use of the locked load/store conditional extension to
16416 implement atomic memory built-in functions. Not available for ARC
16417 6xx or ARC EM cores.
16418
16419 -mdiv-rem
16420 Enable "div" and "rem" instructions for ARCv2 cores.
16421
16422 -mcode-density
16423 Enable code density instructions for ARC EM. This option is on by
16424 default for ARC HS.
16425
16426 -mll64
16427 Enable double load/store operations for ARC HS cores.
16428
16429 -mtp-regno=regno
16430 Specify thread pointer register number.
16431
16432 -mmpy-option=multo
16433 Compile ARCv2 code with a multiplier design option. You can
16434 specify the option using either a string or numeric value for
16435 multo. wlh1 is the default value. The recognized values are:
16436
16437 0
16438 none
16439 No multiplier available.
16440
16441 1
16442 w 16x16 multiplier, fully pipelined. The following instructions
16443 are enabled: "mpyw" and "mpyuw".
16444
16445 2
16446 wlh1
16447 32x32 multiplier, fully pipelined (1 stage). The following
16448 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16449 "mpymu", and "mpy_s".
16450
16451 3
16452 wlh2
16453 32x32 multiplier, fully pipelined (2 stages). The following
16454 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16455 "mpymu", and "mpy_s".
16456
16457 4
16458 wlh3
16459 Two 16x16 multipliers, blocking, sequential. The following
16460 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16461 "mpymu", and "mpy_s".
16462
16463 5
16464 wlh4
16465 One 16x16 multiplier, blocking, sequential. The following
16466 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16467 "mpymu", and "mpy_s".
16468
16469 6
16470 wlh5
16471 One 32x4 multiplier, blocking, sequential. The following
16472 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16473 "mpymu", and "mpy_s".
16474
16475 7
16476 plus_dmpy
16477 ARC HS SIMD support.
16478
16479 8
16480 plus_macd
16481 ARC HS SIMD support.
16482
16483 9
16484 plus_qmacw
16485 ARC HS SIMD support.
16486
16487 This option is only available for ARCv2 cores.
16488
16489 -mfpu=fpu
16490 Enables support for specific floating-point hardware extensions for
16491 ARCv2 cores. Supported values for fpu are:
16492
16493 fpus
16494 Enables support for single-precision floating-point hardware
16495 extensions.
16496
16497 fpud
16498 Enables support for double-precision floating-point hardware
16499 extensions. The single-precision floating-point extension is
16500 also enabled. Not available for ARC EM.
16501
16502 fpuda
16503 Enables support for double-precision floating-point hardware
16504 extensions using double-precision assist instructions. The
16505 single-precision floating-point extension is also enabled.
16506 This option is only available for ARC EM.
16507
16508 fpuda_div
16509 Enables support for double-precision floating-point hardware
16510 extensions using double-precision assist instructions. The
16511 single-precision floating-point, square-root, and divide
16512 extensions are also enabled. This option is only available for
16513 ARC EM.
16514
16515 fpuda_fma
16516 Enables support for double-precision floating-point hardware
16517 extensions using double-precision assist instructions. The
16518 single-precision floating-point and fused multiply and add
16519 hardware extensions are also enabled. This option is only
16520 available for ARC EM.
16521
16522 fpuda_all
16523 Enables support for double-precision floating-point hardware
16524 extensions using double-precision assist instructions. All
16525 single-precision floating-point hardware extensions are also
16526 enabled. This option is only available for ARC EM.
16527
16528 fpus_div
16529 Enables support for single-precision floating-point, square-
16530 root and divide hardware extensions.
16531
16532 fpud_div
16533 Enables support for double-precision floating-point, square-
16534 root and divide hardware extensions. This option includes
16535 option fpus_div. Not available for ARC EM.
16536
16537 fpus_fma
16538 Enables support for single-precision floating-point and fused
16539 multiply and add hardware extensions.
16540
16541 fpud_fma
16542 Enables support for double-precision floating-point and fused
16543 multiply and add hardware extensions. This option includes
16544 option fpus_fma. Not available for ARC EM.
16545
16546 fpus_all
16547 Enables support for all single-precision floating-point
16548 hardware extensions.
16549
16550 fpud_all
16551 Enables support for all single- and double-precision floating-
16552 point hardware extensions. Not available for ARC EM.
16553
16554 -mirq-ctrl-saved=register-range, blink, lp_count
16555 Specifies general-purposes registers that the processor
16556 automatically saves/restores on interrupt entry and exit.
16557 register-range is specified as two registers separated by a dash.
16558 The register range always starts with "r0", the upper limit is "fp"
16559 register. blink and lp_count are optional. This option is only
16560 valid for ARC EM and ARC HS cores.
16561
16562 -mrgf-banked-regs=number
16563 Specifies the number of registers replicated in second register
16564 bank on entry to fast interrupt. Fast interrupts are interrupts
16565 with the highest priority level P0. These interrupts save only PC
16566 and STATUS32 registers to avoid memory transactions during
16567 interrupt entry and exit sequences. Use this option when you are
16568 using fast interrupts in an ARC V2 family processor. Permitted
16569 values are 4, 8, 16, and 32.
16570
16571 -mlpc-width=width
16572 Specify the width of the "lp_count" register. Valid values for
16573 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
16574 fixed to 32 bits. If the width is less than 32, the compiler does
16575 not attempt to transform loops in your program to use the zero-
16576 delay loop mechanism unless it is known that the "lp_count"
16577 register can hold the required loop-counter value. Depending on
16578 the width specified, the compiler and run-time library might
16579 continue to use the loop mechanism for various needs. This option
16580 defines macro "__ARC_LPC_WIDTH__" with the value of width.
16581
16582 -mrf16
16583 This option instructs the compiler to generate code for a 16-entry
16584 register file. This option defines the "__ARC_RF16__" preprocessor
16585 macro.
16586
16587 -mbranch-index
16588 Enable use of "bi" or "bih" instructions to implement jump tables.
16589
16590 The following options are passed through to the assembler, and also
16591 define preprocessor macro symbols.
16592
16593 -mdsp-packa
16594 Passed down to the assembler to enable the DSP Pack A extensions.
16595 Also sets the preprocessor symbol "__Xdsp_packa". This option is
16596 deprecated.
16597
16598 -mdvbf
16599 Passed down to the assembler to enable the dual Viterbi butterfly
16600 extension. Also sets the preprocessor symbol "__Xdvbf". This
16601 option is deprecated.
16602
16603 -mlock
16604 Passed down to the assembler to enable the locked load/store
16605 conditional extension. Also sets the preprocessor symbol
16606 "__Xlock".
16607
16608 -mmac-d16
16609 Passed down to the assembler. Also sets the preprocessor symbol
16610 "__Xxmac_d16". This option is deprecated.
16611
16612 -mmac-24
16613 Passed down to the assembler. Also sets the preprocessor symbol
16614 "__Xxmac_24". This option is deprecated.
16615
16616 -mrtsc
16617 Passed down to the assembler to enable the 64-bit time-stamp
16618 counter extension instruction. Also sets the preprocessor symbol
16619 "__Xrtsc". This option is deprecated.
16620
16621 -mswape
16622 Passed down to the assembler to enable the swap byte ordering
16623 extension instruction. Also sets the preprocessor symbol
16624 "__Xswape".
16625
16626 -mtelephony
16627 Passed down to the assembler to enable dual- and single-operand
16628 instructions for telephony. Also sets the preprocessor symbol
16629 "__Xtelephony". This option is deprecated.
16630
16631 -mxy
16632 Passed down to the assembler to enable the XY memory extension.
16633 Also sets the preprocessor symbol "__Xxy".
16634
16635 The following options control how the assembly code is annotated:
16636
16637 -misize
16638 Annotate assembler instructions with estimated addresses.
16639
16640 -mannotate-align
16641 Explain what alignment considerations lead to the decision to make
16642 an instruction short or long.
16643
16644 The following options are passed through to the linker:
16645
16646 -marclinux
16647 Passed through to the linker, to specify use of the "arclinux"
16648 emulation. This option is enabled by default in tool chains built
16649 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16650 profiling is not requested.
16651
16652 -marclinux_prof
16653 Passed through to the linker, to specify use of the "arclinux_prof"
16654 emulation. This option is enabled by default in tool chains built
16655 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16656 profiling is requested.
16657
16658 The following options control the semantics of generated code:
16659
16660 -mlong-calls
16661 Generate calls as register indirect calls, thus providing access to
16662 the full 32-bit address range.
16663
16664 -mmedium-calls
16665 Don't use less than 25-bit addressing range for calls, which is the
16666 offset available for an unconditional branch-and-link instruction.
16667 Conditional execution of function calls is suppressed, to allow use
16668 of the 25-bit range, rather than the 21-bit range with conditional
16669 branch-and-link. This is the default for tool chains built for
16670 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
16671
16672 -G num
16673 Put definitions of externally-visible data in a small data section
16674 if that data is no bigger than num bytes. The default value of num
16675 is 4 for any ARC configuration, or 8 when we have double load/store
16676 operations.
16677
16678 -mno-sdata
16679 Do not generate sdata references. This is the default for tool
16680 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
16681 targets.
16682
16683 -mvolatile-cache
16684 Use ordinarily cached memory accesses for volatile references.
16685 This is the default.
16686
16687 -mno-volatile-cache
16688 Enable cache bypass for volatile references.
16689
16690 The following options fine tune code generation:
16691
16692 -malign-call
16693 Do alignment optimizations for call instructions.
16694
16695 -mauto-modify-reg
16696 Enable the use of pre/post modify with register displacement.
16697
16698 -mbbit-peephole
16699 Enable bbit peephole2.
16700
16701 -mno-brcc
16702 This option disables a target-specific pass in arc_reorg to
16703 generate compare-and-branch ("brcc") instructions. It has no
16704 effect on generation of these instructions driven by the combiner
16705 pass.
16706
16707 -mcase-vector-pcrel
16708 Use PC-relative switch case tables to enable case table shortening.
16709 This is the default for -Os.
16710
16711 -mcompact-casesi
16712 Enable compact "casesi" pattern. This is the default for -Os, and
16713 only available for ARCv1 cores. This option is deprecated.
16714
16715 -mno-cond-exec
16716 Disable the ARCompact-specific pass to generate conditional
16717 execution instructions.
16718
16719 Due to delay slot scheduling and interactions between operand
16720 numbers, literal sizes, instruction lengths, and the support for
16721 conditional execution, the target-independent pass to generate
16722 conditional execution is often lacking, so the ARC port has kept a
16723 special pass around that tries to find more conditional execution
16724 generation opportunities after register allocation, branch
16725 shortening, and delay slot scheduling have been done. This pass
16726 generally, but not always, improves performance and code size, at
16727 the cost of extra compilation time, which is why there is an option
16728 to switch it off. If you have a problem with call instructions
16729 exceeding their allowable offset range because they are
16730 conditionalized, you should consider using -mmedium-calls instead.
16731
16732 -mearly-cbranchsi
16733 Enable pre-reload use of the "cbranchsi" pattern.
16734
16735 -mexpand-adddi
16736 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
16737 "adc" etc. This option is deprecated.
16738
16739 -mindexed-loads
16740 Enable the use of indexed loads. This can be problematic because
16741 some optimizers then assume that indexed stores exist, which is not
16742 the case.
16743
16744 -mlra
16745 Enable Local Register Allocation. This is still experimental for
16746 ARC, so by default the compiler uses standard reload (i.e.
16747 -mno-lra).
16748
16749 -mlra-priority-none
16750 Don't indicate any priority for target registers.
16751
16752 -mlra-priority-compact
16753 Indicate target register priority for r0..r3 / r12..r15.
16754
16755 -mlra-priority-noncompact
16756 Reduce target register priority for r0..r3 / r12..r15.
16757
16758 -mmillicode
16759 When optimizing for size (using -Os), prologues and epilogues that
16760 have to save or restore a large number of registers are often
16761 shortened by using call to a special function in libgcc; this is
16762 referred to as a millicode call. As these calls can pose
16763 performance issues, and/or cause linking issues when linking in a
16764 nonstandard way, this option is provided to turn on or off
16765 millicode call generation.
16766
16767 -mcode-density-frame
16768 This option enable the compiler to emit "enter" and "leave"
16769 instructions. These instructions are only valid for CPUs with
16770 code-density feature.
16771
16772 -mmixed-code
16773 Tweak register allocation to help 16-bit instruction generation.
16774 This generally has the effect of decreasing the average instruction
16775 size while increasing the instruction count.
16776
16777 -mq-class
16778 Ths option is deprecated. Enable q instruction alternatives. This
16779 is the default for -Os.
16780
16781 -mRcq
16782 Enable Rcq constraint handling. Most short code generation depends
16783 on this. This is the default.
16784
16785 -mRcw
16786 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
16787 on this. This is the default.
16788
16789 -msize-level=level
16790 Fine-tune size optimization with regards to instruction lengths and
16791 alignment. The recognized values for level are:
16792
16793 0 No size optimization. This level is deprecated and treated
16794 like 1.
16795
16796 1 Short instructions are used opportunistically.
16797
16798 2 In addition, alignment of loops and of code after barriers are
16799 dropped.
16800
16801 3 In addition, optional data alignment is dropped, and the option
16802 Os is enabled.
16803
16804 This defaults to 3 when -Os is in effect. Otherwise, the behavior
16805 when this is not set is equivalent to level 1.
16806
16807 -mtune=cpu
16808 Set instruction scheduling parameters for cpu, overriding any
16809 implied by -mcpu=.
16810
16811 Supported values for cpu are
16812
16813 ARC600
16814 Tune for ARC600 CPU.
16815
16816 ARC601
16817 Tune for ARC601 CPU.
16818
16819 ARC700
16820 Tune for ARC700 CPU with standard multiplier block.
16821
16822 ARC700-xmac
16823 Tune for ARC700 CPU with XMAC block.
16824
16825 ARC725D
16826 Tune for ARC725D CPU.
16827
16828 ARC750D
16829 Tune for ARC750D CPU.
16830
16831 -mmultcost=num
16832 Cost to assume for a multiply instruction, with 4 being equal to a
16833 normal instruction.
16834
16835 -munalign-prob-threshold=probability
16836 Set probability threshold for unaligning branches. When tuning for
16837 ARC700 and optimizing for speed, branches without filled delay slot
16838 are preferably emitted unaligned and long, unless profiling
16839 indicates that the probability for the branch to be taken is below
16840 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
16841
16842 The following options are maintained for backward compatibility, but
16843 are now deprecated and will be removed in a future release:
16844
16845 -margonaut
16846 Obsolete FPX.
16847
16848 -mbig-endian
16849 -EB Compile code for big-endian targets. Use of these options is now
16850 deprecated. Big-endian code is supported by configuring GCC to
16851 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
16852 endian is the default.
16853
16854 -mlittle-endian
16855 -EL Compile code for little-endian targets. Use of these options is
16856 now deprecated. Little-endian code is supported by configuring GCC
16857 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
16858 little endian is the default.
16859
16860 -mbarrel_shifter
16861 Replaced by -mbarrel-shifter.
16862
16863 -mdpfp_compact
16864 Replaced by -mdpfp-compact.
16865
16866 -mdpfp_fast
16867 Replaced by -mdpfp-fast.
16868
16869 -mdsp_packa
16870 Replaced by -mdsp-packa.
16871
16872 -mEA
16873 Replaced by -mea.
16874
16875 -mmac_24
16876 Replaced by -mmac-24.
16877
16878 -mmac_d16
16879 Replaced by -mmac-d16.
16880
16881 -mspfp_compact
16882 Replaced by -mspfp-compact.
16883
16884 -mspfp_fast
16885 Replaced by -mspfp-fast.
16886
16887 -mtune=cpu
16888 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
16889 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
16890
16891 -multcost=num
16892 Replaced by -mmultcost.
16893
16894 ARM Options
16895 These -m options are defined for the ARM port:
16896
16897 -mabi=name
16898 Generate code for the specified ABI. Permissible values are: apcs-
16899 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
16900
16901 -mapcs-frame
16902 Generate a stack frame that is compliant with the ARM Procedure
16903 Call Standard for all functions, even if this is not strictly
16904 necessary for correct execution of the code. Specifying
16905 -fomit-frame-pointer with this option causes the stack frames not
16906 to be generated for leaf functions. The default is
16907 -mno-apcs-frame. This option is deprecated.
16908
16909 -mapcs
16910 This is a synonym for -mapcs-frame and is deprecated.
16911
16912 -mthumb-interwork
16913 Generate code that supports calling between the ARM and Thumb
16914 instruction sets. Without this option, on pre-v5 architectures,
16915 the two instruction sets cannot be reliably used inside one
16916 program. The default is -mno-thumb-interwork, since slightly
16917 larger code is generated when -mthumb-interwork is specified. In
16918 AAPCS configurations this option is meaningless.
16919
16920 -mno-sched-prolog
16921 Prevent the reordering of instructions in the function prologue, or
16922 the merging of those instruction with the instructions in the
16923 function's body. This means that all functions start with a
16924 recognizable set of instructions (or in fact one of a choice from a
16925 small set of different function prologues), and this information
16926 can be used to locate the start of functions inside an executable
16927 piece of code. The default is -msched-prolog.
16928
16929 -mfloat-abi=name
16930 Specifies which floating-point ABI to use. Permissible values are:
16931 soft, softfp and hard.
16932
16933 Specifying soft causes GCC to generate output containing library
16934 calls for floating-point operations. softfp allows the generation
16935 of code using hardware floating-point instructions, but still uses
16936 the soft-float calling conventions. hard allows generation of
16937 floating-point instructions and uses FPU-specific calling
16938 conventions.
16939
16940 The default depends on the specific target configuration. Note
16941 that the hard-float and soft-float ABIs are not link-compatible;
16942 you must compile your entire program with the same ABI, and link
16943 with a compatible set of libraries.
16944
16945 -mgeneral-regs-only
16946 Generate code which uses only the general-purpose registers. This
16947 will prevent the compiler from using floating-point and Advanced
16948 SIMD registers but will not impose any restrictions on the
16949 assembler.
16950
16951 -mlittle-endian
16952 Generate code for a processor running in little-endian mode. This
16953 is the default for all standard configurations.
16954
16955 -mbig-endian
16956 Generate code for a processor running in big-endian mode; the
16957 default is to compile code for a little-endian processor.
16958
16959 -mbe8
16960 -mbe32
16961 When linking a big-endian image select between BE8 and BE32
16962 formats. The option has no effect for little-endian images and is
16963 ignored. The default is dependent on the selected target
16964 architecture. For ARMv6 and later architectures the default is
16965 BE8, for older architectures the default is BE32. BE32 format has
16966 been deprecated by ARM.
16967
16968 -march=name[+extension...]
16969 This specifies the name of the target ARM architecture. GCC uses
16970 this name to determine what kind of instructions it can emit when
16971 generating assembly code. This option can be used in conjunction
16972 with or instead of the -mcpu= option.
16973
16974 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
16975 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
16976 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
16977 armv8.6-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
16978 armv8-m.base, armv8-m.main, armv8.1-m.main, iwmmxt and iwmmxt2.
16979
16980 Additionally, the following architectures, which lack support for
16981 the Thumb execution state, are recognized but support is
16982 deprecated: armv4.
16983
16984 Many of the architectures support extensions. These can be added
16985 by appending +extension to the architecture name. Extension
16986 options are processed in order and capabilities accumulate. An
16987 extension will also enable any necessary base extensions upon which
16988 it depends. For example, the +crypto extension will always enable
16989 the +simd extension. The exception to the additive construction is
16990 for extensions that are prefixed with +no...: these extensions
16991 disable the specified option and any other extensions that may
16992 depend on the presence of that extension.
16993
16994 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
16995 writing -march=armv7-a+vfpv4 since the +simd option is entirely
16996 disabled by the +nofp option that follows it.
16997
16998 Most extension names are generically named, but have an effect that
16999 is dependent upon the architecture to which it is applied. For
17000 example, the +simd option can be applied to both armv7-a and
17001 armv8-a architectures, but will enable the original ARMv7-A
17002 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17003 for armv8-a.
17004
17005 The table below lists the supported extensions for each
17006 architecture. Architectures not mentioned do not support any
17007 extensions.
17008
17009 armv5te
17010 armv6
17011 armv6j
17012 armv6k
17013 armv6kz
17014 armv6t2
17015 armv6z
17016 armv6zk
17017 +fp The VFPv2 floating-point instructions. The extension
17018 +vfpv2 can be used as an alias for this extension.
17019
17020 +nofp
17021 Disable the floating-point instructions.
17022
17023 armv7
17024 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17025 architectures.
17026
17027 +fp The VFPv3 floating-point instructions, with 16 double-
17028 precision registers. The extension +vfpv3-d16 can be used
17029 as an alias for this extension. Note that floating-point
17030 is not supported by the base ARMv7-M architecture, but is
17031 compatible with both the ARMv7-A and ARMv7-R architectures.
17032
17033 +nofp
17034 Disable the floating-point instructions.
17035
17036 armv7-a
17037 +mp The multiprocessing extension.
17038
17039 +sec
17040 The security extension.
17041
17042 +fp The VFPv3 floating-point instructions, with 16 double-
17043 precision registers. The extension +vfpv3-d16 can be used
17044 as an alias for this extension.
17045
17046 +simd
17047 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17048 instructions. The extensions +neon and +neon-vfpv3 can be
17049 used as aliases for this extension.
17050
17051 +vfpv3
17052 The VFPv3 floating-point instructions, with 32 double-
17053 precision registers.
17054
17055 +vfpv3-d16-fp16
17056 The VFPv3 floating-point instructions, with 16 double-
17057 precision registers and the half-precision floating-point
17058 conversion operations.
17059
17060 +vfpv3-fp16
17061 The VFPv3 floating-point instructions, with 32 double-
17062 precision registers and the half-precision floating-point
17063 conversion operations.
17064
17065 +vfpv4-d16
17066 The VFPv4 floating-point instructions, with 16 double-
17067 precision registers.
17068
17069 +vfpv4
17070 The VFPv4 floating-point instructions, with 32 double-
17071 precision registers.
17072
17073 +neon-fp16
17074 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17075 instructions, with the half-precision floating-point
17076 conversion operations.
17077
17078 +neon-vfpv4
17079 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17080 instructions.
17081
17082 +nosimd
17083 Disable the Advanced SIMD instructions (does not disable
17084 floating point).
17085
17086 +nofp
17087 Disable the floating-point and Advanced SIMD instructions.
17088
17089 armv7ve
17090 The extended version of the ARMv7-A architecture with support
17091 for virtualization.
17092
17093 +fp The VFPv4 floating-point instructions, with 16 double-
17094 precision registers. The extension +vfpv4-d16 can be used
17095 as an alias for this extension.
17096
17097 +simd
17098 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17099 instructions. The extension +neon-vfpv4 can be used as an
17100 alias for this extension.
17101
17102 +vfpv3-d16
17103 The VFPv3 floating-point instructions, with 16 double-
17104 precision registers.
17105
17106 +vfpv3
17107 The VFPv3 floating-point instructions, with 32 double-
17108 precision registers.
17109
17110 +vfpv3-d16-fp16
17111 The VFPv3 floating-point instructions, with 16 double-
17112 precision registers and the half-precision floating-point
17113 conversion operations.
17114
17115 +vfpv3-fp16
17116 The VFPv3 floating-point instructions, with 32 double-
17117 precision registers and the half-precision floating-point
17118 conversion operations.
17119
17120 +vfpv4-d16
17121 The VFPv4 floating-point instructions, with 16 double-
17122 precision registers.
17123
17124 +vfpv4
17125 The VFPv4 floating-point instructions, with 32 double-
17126 precision registers.
17127
17128 +neon
17129 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17130 instructions. The extension +neon-vfpv3 can be used as an
17131 alias for this extension.
17132
17133 +neon-fp16
17134 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17135 instructions, with the half-precision floating-point
17136 conversion operations.
17137
17138 +nosimd
17139 Disable the Advanced SIMD instructions (does not disable
17140 floating point).
17141
17142 +nofp
17143 Disable the floating-point and Advanced SIMD instructions.
17144
17145 armv8-a
17146 +crc
17147 The Cyclic Redundancy Check (CRC) instructions.
17148
17149 +simd
17150 The ARMv8-A Advanced SIMD and floating-point instructions.
17151
17152 +crypto
17153 The cryptographic instructions.
17154
17155 +nocrypto
17156 Disable the cryptographic instructions.
17157
17158 +nofp
17159 Disable the floating-point, Advanced SIMD and cryptographic
17160 instructions.
17161
17162 +sb Speculation Barrier Instruction.
17163
17164 +predres
17165 Execution and Data Prediction Restriction Instructions.
17166
17167 armv8.1-a
17168 +simd
17169 The ARMv8.1-A Advanced SIMD and floating-point
17170 instructions.
17171
17172 +crypto
17173 The cryptographic instructions. This also enables the
17174 Advanced SIMD and floating-point instructions.
17175
17176 +nocrypto
17177 Disable the cryptographic instructions.
17178
17179 +nofp
17180 Disable the floating-point, Advanced SIMD and cryptographic
17181 instructions.
17182
17183 +sb Speculation Barrier Instruction.
17184
17185 +predres
17186 Execution and Data Prediction Restriction Instructions.
17187
17188 armv8.2-a
17189 armv8.3-a
17190 +fp16
17191 The half-precision floating-point data processing
17192 instructions. This also enables the Advanced SIMD and
17193 floating-point instructions.
17194
17195 +fp16fml
17196 The half-precision floating-point fmla extension. This
17197 also enables the half-precision floating-point extension
17198 and Advanced SIMD and floating-point instructions.
17199
17200 +simd
17201 The ARMv8.1-A Advanced SIMD and floating-point
17202 instructions.
17203
17204 +crypto
17205 The cryptographic instructions. This also enables the
17206 Advanced SIMD and floating-point instructions.
17207
17208 +dotprod
17209 Enable the Dot Product extension. This also enables
17210 Advanced SIMD instructions.
17211
17212 +nocrypto
17213 Disable the cryptographic extension.
17214
17215 +nofp
17216 Disable the floating-point, Advanced SIMD and cryptographic
17217 instructions.
17218
17219 +sb Speculation Barrier Instruction.
17220
17221 +predres
17222 Execution and Data Prediction Restriction Instructions.
17223
17224 +i8mm
17225 8-bit Integer Matrix Multiply instructions. This also
17226 enables Advanced SIMD and floating-point instructions.
17227
17228 +bf16
17229 Brain half-precision floating-point instructions. This
17230 also enables Advanced SIMD and floating-point instructions.
17231
17232 armv8.4-a
17233 +fp16
17234 The half-precision floating-point data processing
17235 instructions. This also enables the Advanced SIMD and
17236 floating-point instructions as well as the Dot Product
17237 extension and the half-precision floating-point fmla
17238 extension.
17239
17240 +simd
17241 The ARMv8.3-A Advanced SIMD and floating-point instructions
17242 as well as the Dot Product extension.
17243
17244 +crypto
17245 The cryptographic instructions. This also enables the
17246 Advanced SIMD and floating-point instructions as well as
17247 the Dot Product extension.
17248
17249 +nocrypto
17250 Disable the cryptographic extension.
17251
17252 +nofp
17253 Disable the floating-point, Advanced SIMD and cryptographic
17254 instructions.
17255
17256 +sb Speculation Barrier Instruction.
17257
17258 +predres
17259 Execution and Data Prediction Restriction Instructions.
17260
17261 +i8mm
17262 8-bit Integer Matrix Multiply instructions. This also
17263 enables Advanced SIMD and floating-point instructions.
17264
17265 +bf16
17266 Brain half-precision floating-point instructions. This
17267 also enables Advanced SIMD and floating-point instructions.
17268
17269 armv8.5-a
17270 +fp16
17271 The half-precision floating-point data processing
17272 instructions. This also enables the Advanced SIMD and
17273 floating-point instructions as well as the Dot Product
17274 extension and the half-precision floating-point fmla
17275 extension.
17276
17277 +simd
17278 The ARMv8.3-A Advanced SIMD and floating-point instructions
17279 as well as the Dot Product extension.
17280
17281 +crypto
17282 The cryptographic instructions. This also enables the
17283 Advanced SIMD and floating-point instructions as well as
17284 the Dot Product extension.
17285
17286 +nocrypto
17287 Disable the cryptographic extension.
17288
17289 +nofp
17290 Disable the floating-point, Advanced SIMD and cryptographic
17291 instructions.
17292
17293 +i8mm
17294 8-bit Integer Matrix Multiply instructions. This also
17295 enables Advanced SIMD and floating-point instructions.
17296
17297 +bf16
17298 Brain half-precision floating-point instructions. This
17299 also enables Advanced SIMD and floating-point instructions.
17300
17301 armv8.6-a
17302 +fp16
17303 The half-precision floating-point data processing
17304 instructions. This also enables the Advanced SIMD and
17305 floating-point instructions as well as the Dot Product
17306 extension and the half-precision floating-point fmla
17307 extension.
17308
17309 +simd
17310 The ARMv8.3-A Advanced SIMD and floating-point instructions
17311 as well as the Dot Product extension.
17312
17313 +crypto
17314 The cryptographic instructions. This also enables the
17315 Advanced SIMD and floating-point instructions as well as
17316 the Dot Product extension.
17317
17318 +nocrypto
17319 Disable the cryptographic extension.
17320
17321 +nofp
17322 Disable the floating-point, Advanced SIMD and cryptographic
17323 instructions.
17324
17325 +i8mm
17326 8-bit Integer Matrix Multiply instructions. This also
17327 enables Advanced SIMD and floating-point instructions.
17328
17329 +bf16
17330 Brain half-precision floating-point instructions. This
17331 also enables Advanced SIMD and floating-point instructions.
17332
17333 armv7-r
17334 +fp.sp
17335 The single-precision VFPv3 floating-point instructions.
17336 The extension +vfpv3xd can be used as an alias for this
17337 extension.
17338
17339 +fp The VFPv3 floating-point instructions with 16 double-
17340 precision registers. The extension +vfpv3-d16 can be used
17341 as an alias for this extension.
17342
17343 +vfpv3xd-d16-fp16
17344 The single-precision VFPv3 floating-point instructions with
17345 16 double-precision registers and the half-precision
17346 floating-point conversion operations.
17347
17348 +vfpv3-d16-fp16
17349 The VFPv3 floating-point instructions with 16 double-
17350 precision registers and the half-precision floating-point
17351 conversion operations.
17352
17353 +nofp
17354 Disable the floating-point extension.
17355
17356 +idiv
17357 The ARM-state integer division instructions.
17358
17359 +noidiv
17360 Disable the ARM-state integer division extension.
17361
17362 armv7e-m
17363 +fp The single-precision VFPv4 floating-point instructions.
17364
17365 +fpv5
17366 The single-precision FPv5 floating-point instructions.
17367
17368 +fp.dp
17369 The single- and double-precision FPv5 floating-point
17370 instructions.
17371
17372 +nofp
17373 Disable the floating-point extensions.
17374
17375 armv8.1-m.main
17376 +dsp
17377 The DSP instructions.
17378
17379 +mve
17380 The M-Profile Vector Extension (MVE) integer instructions.
17381
17382 +mve.fp
17383 The M-Profile Vector Extension (MVE) integer and single
17384 precision floating-point instructions.
17385
17386 +fp The single-precision floating-point instructions.
17387
17388 +fp.dp
17389 The single- and double-precision floating-point
17390 instructions.
17391
17392 +nofp
17393 Disable the floating-point extension.
17394
17395 +cdecp0, +cdecp1, ... , +cdecp7
17396 Enable the Custom Datapath Extension (CDE) on selected
17397 coprocessors according to the numbers given in the options
17398 in the range 0 to 7.
17399
17400 armv8-m.main
17401 +dsp
17402 The DSP instructions.
17403
17404 +nodsp
17405 Disable the DSP extension.
17406
17407 +fp The single-precision floating-point instructions.
17408
17409 +fp.dp
17410 The single- and double-precision floating-point
17411 instructions.
17412
17413 +nofp
17414 Disable the floating-point extension.
17415
17416 +cdecp0, +cdecp1, ... , +cdecp7
17417 Enable the Custom Datapath Extension (CDE) on selected
17418 coprocessors according to the numbers given in the options
17419 in the range 0 to 7.
17420
17421 armv8-r
17422 +crc
17423 The Cyclic Redundancy Check (CRC) instructions.
17424
17425 +fp.sp
17426 The single-precision FPv5 floating-point instructions.
17427
17428 +simd
17429 The ARMv8-A Advanced SIMD and floating-point instructions.
17430
17431 +crypto
17432 The cryptographic instructions.
17433
17434 +nocrypto
17435 Disable the cryptographic instructions.
17436
17437 +nofp
17438 Disable the floating-point, Advanced SIMD and cryptographic
17439 instructions.
17440
17441 -march=native causes the compiler to auto-detect the architecture
17442 of the build computer. At present, this feature is only supported
17443 on GNU/Linux, and not all architectures are recognized. If the
17444 auto-detect is unsuccessful the option has no effect.
17445
17446 -mtune=name
17447 This option specifies the name of the target ARM processor for
17448 which GCC should tune the performance of the code. For some ARM
17449 implementations better performance can be obtained by using this
17450 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
17451 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
17452 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
17453 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
17454 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
17455 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
17456 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
17457 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
17458 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
17459 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
17460 cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78,
17461 cortex-a78ae, cortex-a78c, ares, cortex-r4, cortex-r4f, cortex-r5,
17462 cortex-r7, cortex-r8, cortex-r52, cortex-m0, cortex-m0plus,
17463 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
17464 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
17465 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
17466 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
17467 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
17468 xgene1.
17469
17470 Additionally, this option can specify that GCC should tune the
17471 performance of the code for a big.LITTLE system. Permissible names
17472 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17473 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17474 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
17475 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
17476
17477 -mtune=generic-arch specifies that GCC should tune the performance
17478 for a blend of processors within architecture arch. The aim is to
17479 generate code that run well on the current most popular processors,
17480 balancing between optimizations that benefit some CPUs in the
17481 range, and avoiding performance pitfalls of other CPUs. The
17482 effects of this option may change in future GCC versions as CPU
17483 models come and go.
17484
17485 -mtune permits the same extension options as -mcpu, but the
17486 extension options do not affect the tuning of the generated code.
17487
17488 -mtune=native causes the compiler to auto-detect the CPU of the
17489 build computer. At present, this feature is only supported on
17490 GNU/Linux, and not all architectures are recognized. If the auto-
17491 detect is unsuccessful the option has no effect.
17492
17493 -mcpu=name[+extension...]
17494 This specifies the name of the target ARM processor. GCC uses this
17495 name to derive the name of the target ARM architecture (as if
17496 specified by -march) and the ARM processor type for which to tune
17497 for performance (as if specified by -mtune). Where this option is
17498 used in conjunction with -march or -mtune, those options take
17499 precedence over the appropriate part of this option.
17500
17501 Many of the supported CPUs implement optional architectural
17502 extensions. Where this is so the architectural extensions are
17503 normally enabled by default. If implementations that lack the
17504 extension exist, then the extension syntax can be used to disable
17505 those extensions that have been omitted. For floating-point and
17506 Advanced SIMD (Neon) instructions, the settings of the options
17507 -mfloat-abi and -mfpu must also be considered: floating-point and
17508 Advanced SIMD instructions will only be used if -mfloat-abi is not
17509 set to soft; and any setting of -mfpu other than auto will override
17510 the available floating-point and SIMD extension instructions.
17511
17512 For example, cortex-a9 can be found in three major configurations:
17513 integer only, with just a floating-point unit or with floating-
17514 point and Advanced SIMD. The default is to enable all the
17515 instructions, but the extensions +nosimd and +nofp can be used to
17516 disable just the SIMD or both the SIMD and floating-point
17517 instructions respectively.
17518
17519 Permissible names for this option are the same as those for -mtune.
17520
17521 The following extension options are common to the listed CPUs:
17522
17523 +nodsp
17524 Disable the DSP instructions on cortex-m33, cortex-m35p.
17525
17526 +nofp
17527 Disables the floating-point instructions on arm9e, arm946e-s,
17528 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
17529 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
17530 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
17531 point and SIMD instructions on generic-armv7-a, cortex-a5,
17532 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
17533 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17534 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
17535
17536 +nofp.dp
17537 Disables the double-precision component of the floating-point
17538 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
17539 cortex-m7.
17540
17541 +nosimd
17542 Disables the SIMD (but not floating-point) instructions on
17543 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
17544
17545 +crypto
17546 Enables the cryptographic instructions on cortex-a32,
17547 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
17548 cortex-a73, cortex-a75, exynos-m1, xgene1,
17549 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17550 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
17551 cortex-a75.cortex-a55.
17552
17553 Additionally the generic-armv7-a pseudo target defaults to VFPv3
17554 with 16 double-precision registers. It supports the following
17555 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
17556 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
17557 neon-vfpv4. The meanings are the same as for the extensions to
17558 -march=armv7-a.
17559
17560 -mcpu=generic-arch is also permissible, and is equivalent to
17561 -march=arch -mtune=generic-arch. See -mtune for more information.
17562
17563 -mcpu=native causes the compiler to auto-detect the CPU of the
17564 build computer. At present, this feature is only supported on
17565 GNU/Linux, and not all architectures are recognized. If the auto-
17566 detect is unsuccessful the option has no effect.
17567
17568 -mfpu=name
17569 This specifies what floating-point hardware (or hardware emulation)
17570 is available on the target. Permissible names are: auto, vfpv2,
17571 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
17572 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
17573 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
17574 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
17575 and vfp is an alias for vfpv2.
17576
17577 The setting auto is the default and is special. It causes the
17578 compiler to select the floating-point and Advanced SIMD
17579 instructions based on the settings of -mcpu and -march.
17580
17581 If the selected floating-point hardware includes the NEON extension
17582 (e.g. -mfpu=neon), note that floating-point operations are not
17583 generated by GCC's auto-vectorization pass unless
17584 -funsafe-math-optimizations is also specified. This is because
17585 NEON hardware does not fully implement the IEEE 754 standard for
17586 floating-point arithmetic (in particular denormal values are
17587 treated as zero), so the use of NEON instructions may lead to a
17588 loss of precision.
17589
17590 You can also set the fpu name at function level by using the
17591 "target("fpu=")" function attributes or pragmas.
17592
17593 -mfp16-format=name
17594 Specify the format of the "__fp16" half-precision floating-point
17595 type. Permissible names are none, ieee, and alternative; the
17596 default is none, in which case the "__fp16" type is not defined.
17597
17598 -mstructure-size-boundary=n
17599 The sizes of all structures and unions are rounded up to a multiple
17600 of the number of bits set by this option. Permissible values are
17601 8, 32 and 64. The default value varies for different toolchains.
17602 For the COFF targeted toolchain the default value is 8. A value of
17603 64 is only allowed if the underlying ABI supports it.
17604
17605 Specifying a larger number can produce faster, more efficient code,
17606 but can also increase the size of the program. Different values
17607 are potentially incompatible. Code compiled with one value cannot
17608 necessarily expect to work with code or libraries compiled with
17609 another value, if they exchange information using structures or
17610 unions.
17611
17612 This option is deprecated.
17613
17614 -mabort-on-noreturn
17615 Generate a call to the function "abort" at the end of a "noreturn"
17616 function. It is executed if the function tries to return.
17617
17618 -mlong-calls
17619 -mno-long-calls
17620 Tells the compiler to perform function calls by first loading the
17621 address of the function into a register and then performing a
17622 subroutine call on this register. This switch is needed if the
17623 target function lies outside of the 64-megabyte addressing range of
17624 the offset-based version of subroutine call instruction.
17625
17626 Even if this switch is enabled, not all function calls are turned
17627 into long calls. The heuristic is that static functions, functions
17628 that have the "short_call" attribute, functions that are inside the
17629 scope of a "#pragma no_long_calls" directive, and functions whose
17630 definitions have already been compiled within the current
17631 compilation unit are not turned into long calls. The exceptions to
17632 this rule are that weak function definitions, functions with the
17633 "long_call" attribute or the "section" attribute, and functions
17634 that are within the scope of a "#pragma long_calls" directive are
17635 always turned into long calls.
17636
17637 This feature is not enabled by default. Specifying -mno-long-calls
17638 restores the default behavior, as does placing the function calls
17639 within the scope of a "#pragma long_calls_off" directive. Note
17640 these switches have no effect on how the compiler generates code to
17641 handle function calls via function pointers.
17642
17643 -msingle-pic-base
17644 Treat the register used for PIC addressing as read-only, rather
17645 than loading it in the prologue for each function. The runtime
17646 system is responsible for initializing this register with an
17647 appropriate value before execution begins.
17648
17649 -mpic-register=reg
17650 Specify the register to be used for PIC addressing. For standard
17651 PIC base case, the default is any suitable register determined by
17652 compiler. For single PIC base case, the default is R9 if target is
17653 EABI based or stack-checking is enabled, otherwise the default is
17654 R10.
17655
17656 -mpic-data-is-text-relative
17657 Assume that the displacement between the text and data segments is
17658 fixed at static link time. This permits using PC-relative
17659 addressing operations to access data known to be in the data
17660 segment. For non-VxWorks RTP targets, this option is enabled by
17661 default. When disabled on such targets, it will enable
17662 -msingle-pic-base by default.
17663
17664 -mpoke-function-name
17665 Write the name of each function into the text section, directly
17666 preceding the function prologue. The generated code is similar to
17667 this:
17668
17669 t0
17670 .ascii "arm_poke_function_name", 0
17671 .align
17672 t1
17673 .word 0xff000000 + (t1 - t0)
17674 arm_poke_function_name
17675 mov ip, sp
17676 stmfd sp!, {fp, ip, lr, pc}
17677 sub fp, ip, #4
17678
17679 When performing a stack backtrace, code can inspect the value of
17680 "pc" stored at "fp + 0". If the trace function then looks at
17681 location "pc - 12" and the top 8 bits are set, then we know that
17682 there is a function name embedded immediately preceding this
17683 location and has length "((pc[-3]) & 0xff000000)".
17684
17685 -mthumb
17686 -marm
17687 Select between generating code that executes in ARM and Thumb
17688 states. The default for most configurations is to generate code
17689 that executes in ARM state, but the default can be changed by
17690 configuring GCC with the --with-mode=state configure option.
17691
17692 You can also override the ARM and Thumb mode for each function by
17693 using the "target("thumb")" and "target("arm")" function attributes
17694 or pragmas.
17695
17696 -mflip-thumb
17697 Switch ARM/Thumb modes on alternating functions. This option is
17698 provided for regression testing of mixed Thumb/ARM code generation,
17699 and is not intended for ordinary use in compiling code.
17700
17701 -mtpcs-frame
17702 Generate a stack frame that is compliant with the Thumb Procedure
17703 Call Standard for all non-leaf functions. (A leaf function is one
17704 that does not call any other functions.) The default is
17705 -mno-tpcs-frame.
17706
17707 -mtpcs-leaf-frame
17708 Generate a stack frame that is compliant with the Thumb Procedure
17709 Call Standard for all leaf functions. (A leaf function is one that
17710 does not call any other functions.) The default is
17711 -mno-apcs-leaf-frame.
17712
17713 -mcallee-super-interworking
17714 Gives all externally visible functions in the file being compiled
17715 an ARM instruction set header which switches to Thumb mode before
17716 executing the rest of the function. This allows these functions to
17717 be called from non-interworking code. This option is not valid in
17718 AAPCS configurations because interworking is enabled by default.
17719
17720 -mcaller-super-interworking
17721 Allows calls via function pointers (including virtual functions) to
17722 execute correctly regardless of whether the target code has been
17723 compiled for interworking or not. There is a small overhead in the
17724 cost of executing a function pointer if this option is enabled.
17725 This option is not valid in AAPCS configurations because
17726 interworking is enabled by default.
17727
17728 -mtp=name
17729 Specify the access model for the thread local storage pointer. The
17730 valid models are soft, which generates calls to "__aeabi_read_tp",
17731 cp15, which fetches the thread pointer from "cp15" directly
17732 (supported in the arm6k architecture), and auto, which uses the
17733 best available method for the selected processor. The default
17734 setting is auto.
17735
17736 -mtls-dialect=dialect
17737 Specify the dialect to use for accessing thread local storage. Two
17738 dialects are supported---gnu and gnu2. The gnu dialect selects the
17739 original GNU scheme for supporting local and global dynamic TLS
17740 models. The gnu2 dialect selects the GNU descriptor scheme, which
17741 provides better performance for shared libraries. The GNU
17742 descriptor scheme is compatible with the original scheme, but does
17743 require new assembler, linker and library support. Initial and
17744 local exec TLS models are unaffected by this option and always use
17745 the original scheme.
17746
17747 -mword-relocations
17748 Only generate absolute relocations on word-sized values (i.e.
17749 R_ARM_ABS32). This is enabled by default on targets (uClinux,
17750 SymbianOS) where the runtime loader imposes this restriction, and
17751 when -fpic or -fPIC is specified. This option conflicts with
17752 -mslow-flash-data.
17753
17754 -mfix-cortex-m3-ldrd
17755 Some Cortex-M3 cores can cause data corruption when "ldrd"
17756 instructions with overlapping destination and base registers are
17757 used. This option avoids generating these instructions. This
17758 option is enabled by default when -mcpu=cortex-m3 is specified.
17759
17760 -munaligned-access
17761 -mno-unaligned-access
17762 Enables (or disables) reading and writing of 16- and 32- bit values
17763 from addresses that are not 16- or 32- bit aligned. By default
17764 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17765 ARMv8-M Baseline architectures, and enabled for all other
17766 architectures. If unaligned access is not enabled then words in
17767 packed data structures are accessed a byte at a time.
17768
17769 The ARM attribute "Tag_CPU_unaligned_access" is set in the
17770 generated object file to either true or false, depending upon the
17771 setting of this option. If unaligned access is enabled then the
17772 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
17773
17774 -mneon-for-64bits
17775 This option is deprecated and has no effect.
17776
17777 -mslow-flash-data
17778 Assume loading data from flash is slower than fetching instruction.
17779 Therefore literal load is minimized for better performance. This
17780 option is only supported when compiling for ARMv7 M-profile and off
17781 by default. It conflicts with -mword-relocations.
17782
17783 -masm-syntax-unified
17784 Assume inline assembler is using unified asm syntax. The default
17785 is currently off which implies divided syntax. This option has no
17786 impact on Thumb2. However, this may change in future releases of
17787 GCC. Divided syntax should be considered deprecated.
17788
17789 -mrestrict-it
17790 Restricts generation of IT blocks to conform to the rules of
17791 ARMv8-A. IT blocks can only contain a single 16-bit instruction
17792 from a select set of instructions. This option is on by default for
17793 ARMv8-A Thumb mode.
17794
17795 -mprint-tune-info
17796 Print CPU tuning information as comment in assembler file. This is
17797 an option used only for regression testing of the compiler and not
17798 intended for ordinary use in compiling code. This option is
17799 disabled by default.
17800
17801 -mverbose-cost-dump
17802 Enable verbose cost model dumping in the debug dump files. This
17803 option is provided for use in debugging the compiler.
17804
17805 -mpure-code
17806 Do not allow constant data to be placed in code sections.
17807 Additionally, when compiling for ELF object format give all text
17808 sections the ELF processor-specific section attribute
17809 "SHF_ARM_PURECODE". This option is only available when generating
17810 non-pic code for M-profile targets.
17811
17812 -mcmse
17813 Generate secure code as per the "ARMv8-M Security Extensions:
17814 Requirements on Development Tools Engineering Specification", which
17815 can be found on
17816 <https://developer.arm.com/documentation/ecm0359818/latest/>.
17817
17818 -mfdpic
17819 -mno-fdpic
17820 Select the FDPIC ABI, which uses 64-bit function descriptors to
17821 represent pointers to functions. When the compiler is configured
17822 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
17823 and implies -fPIE if none of the PIC/PIE-related options is
17824 provided. On other targets, it only enables the FDPIC-specific
17825 code generation features, and the user should explicitly provide
17826 the PIC/PIE-related options as needed.
17827
17828 Note that static linking is not supported because it would still
17829 involve the dynamic linker when the program self-relocates. If
17830 such behavior is acceptable, use -static and -Wl,-dynamic-linker
17831 options.
17832
17833 The opposite -mno-fdpic option is useful (and required) to build
17834 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
17835 toolchain as the one used to build the userland programs.
17836
17837 AVR Options
17838 These options are defined for AVR implementations:
17839
17840 -mmcu=mcu
17841 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17842
17843 The default for this option is avr2.
17844
17845 GCC supports the following AVR devices and ISAs:
17846
17847 "avr2"
17848 "Classic" devices with up to 8 KiB of program memory. mcu =
17849 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
17850 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
17851 "at90c8534", "at90s8515", "at90s8535".
17852
17853 "avr25"
17854 "Classic" devices with up to 8 KiB of program memory and with
17855 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
17856 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
17857 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
17858 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
17859 "attiny461a", "attiny4313", "attiny84", "attiny84a",
17860 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
17861 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
17862
17863 "avr3"
17864 "Classic" devices with 16 KiB up to 64 KiB of program memory.
17865 mcu = "at76c711", "at43usb355".
17866
17867 "avr31"
17868 "Classic" devices with 128 KiB of program memory. mcu =
17869 "atmega103", "at43usb320".
17870
17871 "avr35"
17872 "Classic" devices with 16 KiB up to 64 KiB of program memory
17873 and with the "MOVW" instruction. mcu = "attiny167",
17874 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
17875 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
17876
17877 "avr4"
17878 "Enhanced" devices with up to 8 KiB of program memory. mcu =
17879 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
17880 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
17881 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
17882 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
17883 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
17884 "at90pwm3b", "at90pwm81".
17885
17886 "avr5"
17887 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
17888 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
17889 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
17890 "atmega161", "atmega162", "atmega163", "atmega164a",
17891 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
17892 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
17893 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
17894 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
17895 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
17896 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
17897 "atmega324a", "atmega324p", "atmega324pa", "atmega325",
17898 "atmega325a", "atmega325p", "atmega325pa", "atmega328",
17899 "atmega328p", "atmega328pb", "atmega329", "atmega329a",
17900 "atmega329p", "atmega329pa", "atmega3250", "atmega3250a",
17901 "atmega3250p", "atmega3250pa", "atmega3290", "atmega3290a",
17902 "atmega3290p", "atmega3290pa", "atmega406", "atmega64",
17903 "atmega64a", "atmega64c1", "atmega64hve", "atmega64hve2",
17904 "atmega64m1", "atmega64rfr2", "atmega640", "atmega644",
17905 "atmega644a", "atmega644p", "atmega644pa", "atmega644rfr2",
17906 "atmega645", "atmega645a", "atmega645p", "atmega649",
17907 "atmega649a", "atmega649p", "atmega6450", "atmega6450a",
17908 "atmega6450p", "atmega6490", "atmega6490a", "atmega6490p",
17909 "ata5795", "ata5790", "ata5790n", "ata5791", "ata6613c",
17910 "ata6614q", "ata5782", "ata5831", "ata8210", "ata8510",
17911 "ata5702m322", "at90pwm161", "at90pwm216", "at90pwm316",
17912 "at90can32", "at90can64", "at90scr100", "at90usb646",
17913 "at90usb647", "at94k", "m3000".
17914
17915 "avr51"
17916 "Enhanced" devices with 128 KiB of program memory. mcu =
17917 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
17918 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
17919 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
17920
17921 "avr6"
17922 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
17923 of program memory. mcu = "atmega256rfr2", "atmega2560",
17924 "atmega2561", "atmega2564rfr2".
17925
17926 "avrxmega2"
17927 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
17928 program memory. mcu = "atxmega8e5", "atxmega16a4",
17929 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
17930 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
17931 "atxmega32d3", "atxmega32d4", "atxmega32e5".
17932
17933 "avrxmega3"
17934 "XMEGA" devices with up to 64 KiB of combined program memory
17935 and RAM, and with program memory visible in the RAM address
17936 space. mcu = "attiny202", "attiny204", "attiny212",
17937 "attiny214", "attiny402", "attiny404", "attiny406",
17938 "attiny412", "attiny414", "attiny416", "attiny417",
17939 "attiny804", "attiny806", "attiny807", "attiny814",
17940 "attiny816", "attiny817", "attiny1604", "attiny1606",
17941 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
17942 "attiny3214", "attiny3216", "attiny3217", "atmega808",
17943 "atmega809", "atmega1608", "atmega1609", "atmega3208",
17944 "atmega3209", "atmega4808", "atmega4809".
17945
17946 "avrxmega4"
17947 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
17948 program memory. mcu = "atxmega64a3", "atxmega64a3u",
17949 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
17950 "atxmega64d3", "atxmega64d4".
17951
17952 "avrxmega5"
17953 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
17954 program memory and more than 64 KiB of RAM. mcu =
17955 "atxmega64a1", "atxmega64a1u".
17956
17957 "avrxmega6"
17958 "XMEGA" devices with more than 128 KiB of program memory. mcu
17959 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
17960 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
17961 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
17962 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
17963 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
17964 "atxmega256d3", "atxmega384c3", "atxmega384d3".
17965
17966 "avrxmega7"
17967 "XMEGA" devices with more than 128 KiB of program memory and
17968 more than 64 KiB of RAM. mcu = "atxmega128a1",
17969 "atxmega128a1u", "atxmega128a4u".
17970
17971 "avrtiny"
17972 "TINY" Tiny core devices with 512 B up to 4 KiB of program
17973 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
17974 "attiny20", "attiny40".
17975
17976 "avr1"
17977 This ISA is implemented by the minimal AVR core and supported
17978 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
17979 "attiny28", "at90s1200".
17980
17981 -mabsdata
17982 Assume that all data in static storage can be accessed by LDS / STS
17983 instructions. This option has only an effect on reduced Tiny
17984 devices like ATtiny40. See also the "absdata" AVR Variable
17985 Attributes,variable attribute.
17986
17987 -maccumulate-args
17988 Accumulate outgoing function arguments and acquire/release the
17989 needed stack space for outgoing function arguments once in function
17990 prologue/epilogue. Without this option, outgoing arguments are
17991 pushed before calling a function and popped afterwards.
17992
17993 Popping the arguments after the function call can be expensive on
17994 AVR so that accumulating the stack space might lead to smaller
17995 executables because arguments need not be removed from the stack
17996 after such a function call.
17997
17998 This option can lead to reduced code size for functions that
17999 perform several calls to functions that get their arguments on the
18000 stack like calls to printf-like functions.
18001
18002 -mbranch-cost=cost
18003 Set the branch costs for conditional branch instructions to cost.
18004 Reasonable values for cost are small, non-negative integers. The
18005 default branch cost is 0.
18006
18007 -mcall-prologues
18008 Functions prologues/epilogues are expanded as calls to appropriate
18009 subroutines. Code size is smaller.
18010
18011 -mdouble=bits
18012 -mlong-double=bits
18013 Set the size (in bits) of the "double" or "long double" type,
18014 respectively. Possible values for bits are 32 and 64. Whether or
18015 not a specific value for bits is allowed depends on the
18016 "--with-double=" and "--with-long-double=" configure options
18017 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18018 applies for the default values of the options.
18019
18020 -mgas-isr-prologues
18021 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18022 instruction supported by GNU Binutils. If this option is on, the
18023 feature can still be disabled for individual ISRs by means of the
18024 AVR Function Attributes,,"no_gccisr" function attribute. This
18025 feature is activated per default if optimization is on (but not
18026 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18027 PR21683 ("https://sourceware.org/PR21683").
18028
18029 -mint8
18030 Assume "int" to be 8-bit integer. This affects the sizes of all
18031 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18032 and "long long" is 4 bytes. Please note that this option does not
18033 conform to the C standards, but it results in smaller code size.
18034
18035 -mmain-is-OS_task
18036 Do not save registers in "main". The effect is the same like
18037 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18038 It is activated per default if optimization is on.
18039
18040 -mn-flash=num
18041 Assume that the flash memory has a size of num times 64 KiB.
18042
18043 -mno-interrupts
18044 Generated code is not compatible with hardware interrupts. Code
18045 size is smaller.
18046
18047 -mrelax
18048 Try to replace "CALL" resp. "JMP" instruction by the shorter
18049 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18050 just adds the --mlink-relax option to the assembler's command line
18051 and the --relax option to the linker's command line.
18052
18053 Jump relaxing is performed by the linker because jump offsets are
18054 not known before code is located. Therefore, the assembler code
18055 generated by the compiler is the same, but the instructions in the
18056 executable may differ from instructions in the assembler code.
18057
18058 Relaxing must be turned on if linker stubs are needed, see the
18059 section on "EIND" and linker stubs below.
18060
18061 -mrmw
18062 Assume that the device supports the Read-Modify-Write instructions
18063 "XCH", "LAC", "LAS" and "LAT".
18064
18065 -mshort-calls
18066 Assume that "RJMP" and "RCALL" can target the whole program memory.
18067
18068 This option is used internally for multilib selection. It is not
18069 an optimization option, and you don't need to set it by hand.
18070
18071 -msp8
18072 Treat the stack pointer register as an 8-bit register, i.e. assume
18073 the high byte of the stack pointer is zero. In general, you don't
18074 need to set this option by hand.
18075
18076 This option is used internally by the compiler to select and build
18077 multilibs for architectures "avr2" and "avr25". These
18078 architectures mix devices with and without "SPH". For any setting
18079 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
18080 removes this option from the compiler proper's command line,
18081 because the compiler then knows if the device or architecture has
18082 an 8-bit stack pointer and thus no "SPH" register or not.
18083
18084 -mstrict-X
18085 Use address register "X" in a way proposed by the hardware. This
18086 means that "X" is only used in indirect, post-increment or pre-
18087 decrement addressing.
18088
18089 Without this option, the "X" register may be used in the same way
18090 as "Y" or "Z" which then is emulated by additional instructions.
18091 For example, loading a value with "X+const" addressing with a small
18092 non-negative "const < 64" to a register Rn is performed as
18093
18094 adiw r26, const ; X += const
18095 ld <Rn>, X ; <Rn> = *X
18096 sbiw r26, const ; X -= const
18097
18098 -mtiny-stack
18099 Only change the lower 8 bits of the stack pointer.
18100
18101 -mfract-convert-truncate
18102 Allow to use truncation instead of rounding towards zero for
18103 fractional fixed-point types.
18104
18105 -nodevicelib
18106 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
18107
18108 -nodevicespecs
18109 Don't add -specs=device-specs/specs-mcu to the compiler driver's
18110 command line. The user takes responsibility for supplying the sub-
18111 processes like compiler proper, assembler and linker with
18112 appropriate command line options. This means that the user has to
18113 supply her private device specs file by means of -specs=path-to-
18114 specs-file. There is no more need for option -mmcu=mcu.
18115
18116 This option can also serve as a replacement for the older way of
18117 specifying custom device-specs files that needed -B some-path to
18118 point to a directory which contains a folder named "device-specs"
18119 which contains a specs file named "specs-mcu", where mcu was
18120 specified by -mmcu=mcu.
18121
18122 -Waddr-space-convert
18123 Warn about conversions between address spaces in the case where the
18124 resulting address space is not contained in the incoming address
18125 space.
18126
18127 -Wmisspelled-isr
18128 Warn if the ISR is misspelled, i.e. without __vector prefix.
18129 Enabled by default.
18130
18131 "EIND" and Devices with More Than 128 Ki Bytes of Flash
18132
18133 Pointers in the implementation are 16 bits wide. The address of a
18134 function or label is represented as word address so that indirect jumps
18135 and calls can target any code address in the range of 64 Ki words.
18136
18137 In order to facilitate indirect jump on devices with more than 128 Ki
18138 bytes of program memory space, there is a special function register
18139 called "EIND" that serves as most significant part of the target
18140 address when "EICALL" or "EIJMP" instructions are used.
18141
18142 Indirect jumps and calls on these devices are handled as follows by the
18143 compiler and are subject to some limitations:
18144
18145 * The compiler never sets "EIND".
18146
18147 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
18148 instructions or might read "EIND" directly in order to emulate an
18149 indirect call/jump by means of a "RET" instruction.
18150
18151 * The compiler assumes that "EIND" never changes during the startup
18152 code or during the application. In particular, "EIND" is not
18153 saved/restored in function or interrupt service routine
18154 prologue/epilogue.
18155
18156 * For indirect calls to functions and computed goto, the linker
18157 generates stubs. Stubs are jump pads sometimes also called
18158 trampolines. Thus, the indirect call/jump jumps to such a stub.
18159 The stub contains a direct jump to the desired address.
18160
18161 * Linker relaxation must be turned on so that the linker generates
18162 the stubs correctly in all situations. See the compiler option
18163 -mrelax and the linker option --relax. There are corner cases
18164 where the linker is supposed to generate stubs but aborts without
18165 relaxation and without a helpful error message.
18166
18167 * The default linker script is arranged for code with "EIND = 0". If
18168 code is supposed to work for a setup with "EIND != 0", a custom
18169 linker script has to be used in order to place the sections whose
18170 name start with ".trampolines" into the segment where "EIND" points
18171 to.
18172
18173 * The startup code from libgcc never sets "EIND". Notice that
18174 startup code is a blend of code from libgcc and AVR-LibC. For the
18175 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
18176 ("http://nongnu.org/avr-libc/user-manual/").
18177
18178 * It is legitimate for user-specific startup code to set up "EIND"
18179 early, for example by means of initialization code located in
18180 section ".init3". Such code runs prior to general startup code that
18181 initializes RAM and calls constructors, but after the bit of
18182 startup code from AVR-LibC that sets "EIND" to the segment where
18183 the vector table is located.
18184
18185 #include <avr/io.h>
18186
18187 static void
18188 __attribute__((section(".init3"),naked,used,no_instrument_function))
18189 init3_set_eind (void)
18190 {
18191 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18192 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18193 }
18194
18195 The "__trampolines_start" symbol is defined in the linker script.
18196
18197 * Stubs are generated automatically by the linker if the following
18198 two conditions are met:
18199
18200 -<The address of a label is taken by means of the "gs" modifier>
18201 (short for generate stubs) like so:
18202
18203 LDI r24, lo8(gs(<func>))
18204 LDI r25, hi8(gs(<func>))
18205
18206 -<The final location of that label is in a code segment>
18207 outside the segment where the stubs are located.
18208
18209 * The compiler emits such "gs" modifiers for code labels in the
18210 following situations:
18211
18212 -<Taking address of a function or code label.>
18213 -<Computed goto.>
18214 -<If prologue-save function is used, see -mcall-prologues>
18215 command-line option.
18216
18217 -<Switch/case dispatch tables. If you do not want such dispatch>
18218 tables you can specify the -fno-jump-tables command-line
18219 option.
18220
18221 -<C and C++ constructors/destructors called during
18222 startup/shutdown.>
18223 -<If the tools hit a "gs()" modifier explained above.>
18224 * Jumping to non-symbolic addresses like so is not supported:
18225
18226 int main (void)
18227 {
18228 /* Call function at word address 0x2 */
18229 return ((int(*)(void)) 0x2)();
18230 }
18231
18232 Instead, a stub has to be set up, i.e. the function has to be
18233 called through a symbol ("func_4" in the example):
18234
18235 int main (void)
18236 {
18237 extern int func_4 (void);
18238
18239 /* Call function at byte address 0x4 */
18240 return func_4();
18241 }
18242
18243 and the application be linked with -Wl,--defsym,func_4=0x4.
18244 Alternatively, "func_4" can be defined in the linker script.
18245
18246 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
18247 Registers
18248
18249 Some AVR devices support memories larger than the 64 KiB range that can
18250 be accessed with 16-bit pointers. To access memory locations outside
18251 this 64 KiB range, the content of a "RAMP" register is used as high
18252 part of the address: The "X", "Y", "Z" address register is concatenated
18253 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
18254 respectively, to get a wide address. Similarly, "RAMPD" is used
18255 together with direct addressing.
18256
18257 * The startup code initializes the "RAMP" special function registers
18258 with zero.
18259
18260 * If a AVR Named Address Spaces,named address space other than
18261 generic or "__flash" is used, then "RAMPZ" is set as needed before
18262 the operation.
18263
18264 * If the device supports RAM larger than 64 KiB and the compiler
18265 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
18266 reset to zero after the operation.
18267
18268 * If the device comes with a specific "RAMP" register, the ISR
18269 prologue/epilogue saves/restores that SFR and initializes it with
18270 zero in case the ISR code might (implicitly) use it.
18271
18272 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
18273 you use inline assembler to read from locations outside the 16-bit
18274 address range and change one of the "RAMP" registers, you must
18275 reset it to zero after the access.
18276
18277 AVR Built-in Macros
18278
18279 GCC defines several built-in macros so that the user code can test for
18280 the presence or absence of features. Almost any of the following
18281 built-in macros are deduced from device capabilities and thus triggered
18282 by the -mmcu= command-line option.
18283
18284 For even more AVR-specific built-in macros see AVR Named Address Spaces
18285 and AVR Built-in Functions.
18286
18287 "__AVR_ARCH__"
18288 Build-in macro that resolves to a decimal number that identifies
18289 the architecture and depends on the -mmcu=mcu option. Possible
18290 values are:
18291
18292 2, 25, 3, 31, 35, 4, 5, 51, 6
18293
18294 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
18295 "avr51", "avr6",
18296
18297 respectively and
18298
18299 100, 102, 103, 104, 105, 106, 107
18300
18301 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
18302 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
18303 specifies a device, this built-in macro is set accordingly. For
18304 example, with -mmcu=atmega8 the macro is defined to 4.
18305
18306 "__AVR_Device__"
18307 Setting -mmcu=device defines this built-in macro which reflects the
18308 device's name. For example, -mmcu=atmega8 defines the built-in
18309 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
18310 "__AVR_ATtiny261A__", etc.
18311
18312 The built-in macros' names follow the scheme "__AVR_Device__" where
18313 Device is the device name as from the AVR user manual. The
18314 difference between Device in the built-in macro and device in
18315 -mmcu=device is that the latter is always lowercase.
18316
18317 If device is not a device but only a core architecture like avr51,
18318 this macro is not defined.
18319
18320 "__AVR_DEVICE_NAME__"
18321 Setting -mmcu=device defines this built-in macro to the device's
18322 name. For example, with -mmcu=atmega8 the macro is defined to
18323 "atmega8".
18324
18325 If device is not a device but only a core architecture like avr51,
18326 this macro is not defined.
18327
18328 "__AVR_XMEGA__"
18329 The device / architecture belongs to the XMEGA family of devices.
18330
18331 "__AVR_HAVE_ELPM__"
18332 The device has the "ELPM" instruction.
18333
18334 "__AVR_HAVE_ELPMX__"
18335 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
18336
18337 "__AVR_HAVE_MOVW__"
18338 The device has the "MOVW" instruction to perform 16-bit register-
18339 register moves.
18340
18341 "__AVR_HAVE_LPMX__"
18342 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
18343
18344 "__AVR_HAVE_MUL__"
18345 The device has a hardware multiplier.
18346
18347 "__AVR_HAVE_JMP_CALL__"
18348 The device has the "JMP" and "CALL" instructions. This is the case
18349 for devices with more than 8 KiB of program memory.
18350
18351 "__AVR_HAVE_EIJMP_EICALL__"
18352 "__AVR_3_BYTE_PC__"
18353 The device has the "EIJMP" and "EICALL" instructions. This is the
18354 case for devices with more than 128 KiB of program memory. This
18355 also means that the program counter (PC) is 3 bytes wide.
18356
18357 "__AVR_2_BYTE_PC__"
18358 The program counter (PC) is 2 bytes wide. This is the case for
18359 devices with up to 128 KiB of program memory.
18360
18361 "__AVR_HAVE_8BIT_SP__"
18362 "__AVR_HAVE_16BIT_SP__"
18363 The stack pointer (SP) register is treated as 8-bit respectively
18364 16-bit register by the compiler. The definition of these macros is
18365 affected by -mtiny-stack.
18366
18367 "__AVR_HAVE_SPH__"
18368 "__AVR_SP8__"
18369 The device has the SPH (high part of stack pointer) special
18370 function register or has an 8-bit stack pointer, respectively. The
18371 definition of these macros is affected by -mmcu= and in the cases
18372 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
18373
18374 "__AVR_HAVE_RAMPD__"
18375 "__AVR_HAVE_RAMPX__"
18376 "__AVR_HAVE_RAMPY__"
18377 "__AVR_HAVE_RAMPZ__"
18378 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
18379 function register, respectively.
18380
18381 "__NO_INTERRUPTS__"
18382 This macro reflects the -mno-interrupts command-line option.
18383
18384 "__AVR_ERRATA_SKIP__"
18385 "__AVR_ERRATA_SKIP_JMP_CALL__"
18386 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18387 instructions because of a hardware erratum. Skip instructions are
18388 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
18389 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
18390
18391 "__AVR_ISA_RMW__"
18392 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
18393 LAT).
18394
18395 "__AVR_SFR_OFFSET__=offset"
18396 Instructions that can address I/O special function registers
18397 directly like "IN", "OUT", "SBI", etc. may use a different address
18398 as if addressed by an instruction to access RAM like "LD" or "STS".
18399 This offset depends on the device architecture and has to be
18400 subtracted from the RAM address in order to get the respective I/O
18401 address.
18402
18403 "__AVR_SHORT_CALLS__"
18404 The -mshort-calls command line option is set.
18405
18406 "__AVR_PM_BASE_ADDRESS__=addr"
18407 Some devices support reading from flash memory by means of "LD*"
18408 instructions. The flash memory is seen in the data address space
18409 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
18410 defined, this feature is not available. If defined, the address
18411 space is linear and there is no need to put ".rodata" into RAM.
18412 This is handled by the default linker description file, and is
18413 currently available for "avrtiny" and "avrxmega3". Even more
18414 convenient, there is no need to use address spaces like "__flash"
18415 or features like attribute "progmem" and "pgm_read_*".
18416
18417 "__WITH_AVRLIBC__"
18418 The compiler is configured to be used together with AVR-Libc. See
18419 the --with-avrlibc configure option.
18420
18421 "__HAVE_DOUBLE_MULTILIB__"
18422 Defined if -mdouble= acts as a multilib option.
18423
18424 "__HAVE_DOUBLE32__"
18425 "__HAVE_DOUBLE64__"
18426 Defined if the compiler supports 32-bit double resp. 64-bit double.
18427 The actual layout is specified by option -mdouble=.
18428
18429 "__DEFAULT_DOUBLE__"
18430 The size in bits of "double" if -mdouble= is not set. To test the
18431 layout of "double" in a program, use the built-in macro
18432 "__SIZEOF_DOUBLE__".
18433
18434 "__HAVE_LONG_DOUBLE32__"
18435 "__HAVE_LONG_DOUBLE64__"
18436 "__HAVE_LONG_DOUBLE_MULTILIB__"
18437 "__DEFAULT_LONG_DOUBLE__"
18438 Same as above, but for "long double" instead of "double".
18439
18440 "__WITH_DOUBLE_COMPARISON__"
18441 Reflects the "--with-double-comparison={tristate|bool|libf7}"
18442 configure option ("https://gcc.gnu.org/install/configure.html#avr")
18443 and is defined to 2 or 3.
18444
18445 "__WITH_LIBF7_LIBGCC__"
18446 "__WITH_LIBF7_MATH__"
18447 "__WITH_LIBF7_MATH_SYMBOLS__"
18448 Reflects the "--with-libf7={libgcc|math|math-symbols}"
18449 configure option
18450 ("https://gcc.gnu.org/install/configure.html#avr").
18451
18452 Blackfin Options
18453 -mcpu=cpu[-sirevision]
18454 Specifies the name of the target Blackfin processor. Currently,
18455 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
18456 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
18457 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
18458 bf547m, bf548m, bf549m, bf561, bf592.
18459
18460 The optional sirevision specifies the silicon revision of the
18461 target Blackfin processor. Any workarounds available for the
18462 targeted silicon revision are enabled. If sirevision is none, no
18463 workarounds are enabled. If sirevision is any, all workarounds for
18464 the targeted processor are enabled. The "__SILICON_REVISION__"
18465 macro is defined to two hexadecimal digits representing the major
18466 and minor numbers in the silicon revision. If sirevision is none,
18467 the "__SILICON_REVISION__" is not defined. If sirevision is any,
18468 the "__SILICON_REVISION__" is defined to be 0xffff. If this
18469 optional sirevision is not used, GCC assumes the latest known
18470 silicon revision of the targeted Blackfin processor.
18471
18472 GCC defines a preprocessor macro for the specified cpu. For the
18473 bfin-elf toolchain, this option causes the hardware BSP provided by
18474 libgloss to be linked in if -msim is not given.
18475
18476 Without this option, bf532 is used as the processor by default.
18477
18478 Note that support for bf561 is incomplete. For bf561, only the
18479 preprocessor macro is defined.
18480
18481 -msim
18482 Specifies that the program will be run on the simulator. This
18483 causes the simulator BSP provided by libgloss to be linked in.
18484 This option has effect only for bfin-elf toolchain. Certain other
18485 options, such as -mid-shared-library and -mfdpic, imply -msim.
18486
18487 -momit-leaf-frame-pointer
18488 Don't keep the frame pointer in a register for leaf functions.
18489 This avoids the instructions to save, set up and restore frame
18490 pointers and makes an extra register available in leaf functions.
18491
18492 -mspecld-anomaly
18493 When enabled, the compiler ensures that the generated code does not
18494 contain speculative loads after jump instructions. If this option
18495 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
18496
18497 -mno-specld-anomaly
18498 Don't generate extra code to prevent speculative loads from
18499 occurring.
18500
18501 -mcsync-anomaly
18502 When enabled, the compiler ensures that the generated code does not
18503 contain CSYNC or SSYNC instructions too soon after conditional
18504 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
18505 is defined.
18506
18507 -mno-csync-anomaly
18508 Don't generate extra code to prevent CSYNC or SSYNC instructions
18509 from occurring too soon after a conditional branch.
18510
18511 -mlow64k
18512 When enabled, the compiler is free to take advantage of the
18513 knowledge that the entire program fits into the low 64k of memory.
18514
18515 -mno-low64k
18516 Assume that the program is arbitrarily large. This is the default.
18517
18518 -mstack-check-l1
18519 Do stack checking using information placed into L1 scratchpad
18520 memory by the uClinux kernel.
18521
18522 -mid-shared-library
18523 Generate code that supports shared libraries via the library ID
18524 method. This allows for execute in place and shared libraries in
18525 an environment without virtual memory management. This option
18526 implies -fPIC. With a bfin-elf target, this option implies -msim.
18527
18528 -mno-id-shared-library
18529 Generate code that doesn't assume ID-based shared libraries are
18530 being used. This is the default.
18531
18532 -mleaf-id-shared-library
18533 Generate code that supports shared libraries via the library ID
18534 method, but assumes that this library or executable won't link
18535 against any other ID shared libraries. That allows the compiler to
18536 use faster code for jumps and calls.
18537
18538 -mno-leaf-id-shared-library
18539 Do not assume that the code being compiled won't link against any
18540 ID shared libraries. Slower code is generated for jump and call
18541 insns.
18542
18543 -mshared-library-id=n
18544 Specifies the identification number of the ID-based shared library
18545 being compiled. Specifying a value of 0 generates more compact
18546 code; specifying other values forces the allocation of that number
18547 to the current library but is no more space- or time-efficient than
18548 omitting this option.
18549
18550 -msep-data
18551 Generate code that allows the data segment to be located in a
18552 different area of memory from the text segment. This allows for
18553 execute in place in an environment without virtual memory
18554 management by eliminating relocations against the text section.
18555
18556 -mno-sep-data
18557 Generate code that assumes that the data segment follows the text
18558 segment. This is the default.
18559
18560 -mlong-calls
18561 -mno-long-calls
18562 Tells the compiler to perform function calls by first loading the
18563 address of the function into a register and then performing a
18564 subroutine call on this register. This switch is needed if the
18565 target function lies outside of the 24-bit addressing range of the
18566 offset-based version of subroutine call instruction.
18567
18568 This feature is not enabled by default. Specifying -mno-long-calls
18569 restores the default behavior. Note these switches have no effect
18570 on how the compiler generates code to handle function calls via
18571 function pointers.
18572
18573 -mfast-fp
18574 Link with the fast floating-point library. This library relaxes
18575 some of the IEEE floating-point standard's rules for checking
18576 inputs against Not-a-Number (NAN), in the interest of performance.
18577
18578 -minline-plt
18579 Enable inlining of PLT entries in function calls to functions that
18580 are not known to bind locally. It has no effect without -mfdpic.
18581
18582 -mmulticore
18583 Build a standalone application for multicore Blackfin processors.
18584 This option causes proper start files and link scripts supporting
18585 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
18586 can only be used with -mcpu=bf561[-sirevision].
18587
18588 This option can be used with -mcorea or -mcoreb, which selects the
18589 one-application-per-core programming model. Without -mcorea or
18590 -mcoreb, the single-application/dual-core programming model is
18591 used. In this model, the main function of Core B should be named as
18592 "coreb_main".
18593
18594 If this option is not used, the single-core application programming
18595 model is used.
18596
18597 -mcorea
18598 Build a standalone application for Core A of BF561 when using the
18599 one-application-per-core programming model. Proper start files and
18600 link scripts are used to support Core A, and the macro
18601 "__BFIN_COREA" is defined. This option can only be used in
18602 conjunction with -mmulticore.
18603
18604 -mcoreb
18605 Build a standalone application for Core B of BF561 when using the
18606 one-application-per-core programming model. Proper start files and
18607 link scripts are used to support Core B, and the macro
18608 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
18609 should be used instead of "main". This option can only be used in
18610 conjunction with -mmulticore.
18611
18612 -msdram
18613 Build a standalone application for SDRAM. Proper start files and
18614 link scripts are used to put the application into SDRAM, and the
18615 macro "__BFIN_SDRAM" is defined. The loader should initialize
18616 SDRAM before loading the application.
18617
18618 -micplb
18619 Assume that ICPLBs are enabled at run time. This has an effect on
18620 certain anomaly workarounds. For Linux targets, the default is to
18621 assume ICPLBs are enabled; for standalone applications the default
18622 is off.
18623
18624 C6X Options
18625 -march=name
18626 This specifies the name of the target architecture. GCC uses this
18627 name to determine what kind of instructions it can emit when
18628 generating assembly code. Permissible names are: c62x, c64x,
18629 c64x+, c67x, c67x+, c674x.
18630
18631 -mbig-endian
18632 Generate code for a big-endian target.
18633
18634 -mlittle-endian
18635 Generate code for a little-endian target. This is the default.
18636
18637 -msim
18638 Choose startup files and linker script suitable for the simulator.
18639
18640 -msdata=default
18641 Put small global and static data in the ".neardata" section, which
18642 is pointed to by register "B14". Put small uninitialized global
18643 and static data in the ".bss" section, which is adjacent to the
18644 ".neardata" section. Put small read-only data into the ".rodata"
18645 section. The corresponding sections used for large pieces of data
18646 are ".fardata", ".far" and ".const".
18647
18648 -msdata=all
18649 Put all data, not just small objects, into the sections reserved
18650 for small data, and use addressing relative to the "B14" register
18651 to access them.
18652
18653 -msdata=none
18654 Make no use of the sections reserved for small data, and use
18655 absolute addresses to access all data. Put all initialized global
18656 and static data in the ".fardata" section, and all uninitialized
18657 data in the ".far" section. Put all constant data into the
18658 ".const" section.
18659
18660 CRIS Options
18661 These options are defined specifically for the CRIS ports.
18662
18663 -march=architecture-type
18664 -mcpu=architecture-type
18665 Generate code for the specified architecture. The choices for
18666 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
18667 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
18668 linux-gnu, where the default is v10.
18669
18670 -mtune=architecture-type
18671 Tune to architecture-type everything applicable about the generated
18672 code, except for the ABI and the set of available instructions.
18673 The choices for architecture-type are the same as for
18674 -march=architecture-type.
18675
18676 -mmax-stack-frame=n
18677 Warn when the stack frame of a function exceeds n bytes.
18678
18679 -metrax4
18680 -metrax100
18681 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
18682 -march=v8 respectively.
18683
18684 -mmul-bug-workaround
18685 -mno-mul-bug-workaround
18686 Work around a bug in the "muls" and "mulu" instructions for CPU
18687 models where it applies. This option is active by default.
18688
18689 -mpdebug
18690 Enable CRIS-specific verbose debug-related information in the
18691 assembly code. This option also has the effect of turning off the
18692 #NO_APP formatted-code indicator to the assembler at the beginning
18693 of the assembly file.
18694
18695 -mcc-init
18696 Do not use condition-code results from previous instruction; always
18697 emit compare and test instructions before use of condition codes.
18698
18699 -mno-side-effects
18700 Do not emit instructions with side effects in addressing modes
18701 other than post-increment.
18702
18703 -mstack-align
18704 -mno-stack-align
18705 -mdata-align
18706 -mno-data-align
18707 -mconst-align
18708 -mno-const-align
18709 These options (no- options) arrange (eliminate arrangements) for
18710 the stack frame, individual data and constants to be aligned for
18711 the maximum single data access size for the chosen CPU model. The
18712 default is to arrange for 32-bit alignment. ABI details such as
18713 structure layout are not affected by these options.
18714
18715 -m32-bit
18716 -m16-bit
18717 -m8-bit
18718 Similar to the stack- data- and const-align options above, these
18719 options arrange for stack frame, writable data and constants to all
18720 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
18721 alignment.
18722
18723 -mno-prologue-epilogue
18724 -mprologue-epilogue
18725 With -mno-prologue-epilogue, the normal function prologue and
18726 epilogue which set up the stack frame are omitted and no return
18727 instructions or return sequences are generated in the code. Use
18728 this option only together with visual inspection of the compiled
18729 code: no warnings or errors are generated when call-saved registers
18730 must be saved, or storage for local variables needs to be
18731 allocated.
18732
18733 -mno-gotplt
18734 -mgotplt
18735 With -fpic and -fPIC, don't generate (do generate) instruction
18736 sequences that load addresses for functions from the PLT part of
18737 the GOT rather than (traditional on other architectures) calls to
18738 the PLT. The default is -mgotplt.
18739
18740 -melf
18741 Legacy no-op option only recognized with the cris-axis-elf and
18742 cris-axis-linux-gnu targets.
18743
18744 -mlinux
18745 Legacy no-op option only recognized with the cris-axis-linux-gnu
18746 target.
18747
18748 -sim
18749 This option, recognized for the cris-axis-elf, arranges to link
18750 with input-output functions from a simulator library. Code,
18751 initialized data and zero-initialized data are allocated
18752 consecutively.
18753
18754 -sim2
18755 Like -sim, but pass linker options to locate initialized data at
18756 0x40000000 and zero-initialized data at 0x80000000.
18757
18758 CR16 Options
18759 These options are defined specifically for the CR16 ports.
18760
18761 -mmac
18762 Enable the use of multiply-accumulate instructions. Disabled by
18763 default.
18764
18765 -mcr16cplus
18766 -mcr16c
18767 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18768 is default.
18769
18770 -msim
18771 Links the library libsim.a which is in compatible with simulator.
18772 Applicable to ELF compiler only.
18773
18774 -mint32
18775 Choose integer type as 32-bit wide.
18776
18777 -mbit-ops
18778 Generates "sbit"/"cbit" instructions for bit manipulations.
18779
18780 -mdata-model=model
18781 Choose a data model. The choices for model are near, far or medium.
18782 medium is default. However, far is not valid with -mcr16c, as the
18783 CR16C architecture does not support the far data model.
18784
18785 C-SKY Options
18786 GCC supports these options when compiling for C-SKY V2 processors.
18787
18788 -march=arch
18789 Specify the C-SKY target architecture. Valid values for arch are:
18790 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
18791
18792 -mcpu=cpu
18793 Specify the C-SKY target processor. Valid values for cpu are:
18794 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
18795 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
18796 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
18797 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
18798 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
18799 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
18800 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
18801 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
18802 ck810tv, ck810ft, and ck810ftv.
18803
18804 -mbig-endian
18805 -EB
18806 -mlittle-endian
18807 -EL Select big- or little-endian code. The default is little-endian.
18808
18809 -mfloat-abi=name
18810 Specifies which floating-point ABI to use. Permissible values are:
18811 soft, softfp and hard.
18812
18813 Specifying soft causes GCC to generate output containing library
18814 calls for floating-point operations. softfp allows the generation
18815 of code using hardware floating-point instructions, but still uses
18816 the soft-float calling conventions. hard allows generation of
18817 floating-point instructions and uses FPU-specific calling
18818 conventions.
18819
18820 The default depends on the specific target configuration. Note
18821 that the hard-float and soft-float ABIs are not link-compatible;
18822 you must compile your entire program with the same ABI, and link
18823 with a compatible set of libraries.
18824
18825 -mhard-float
18826 -msoft-float
18827 Select hardware or software floating-point implementations. The
18828 default is soft float.
18829
18830 -mdouble-float
18831 -mno-double-float
18832 When -mhard-float is in effect, enable generation of double-
18833 precision float instructions. This is the default except when
18834 compiling for CK803.
18835
18836 -mfdivdu
18837 -mno-fdivdu
18838 When -mhard-float is in effect, enable generation of "frecipd",
18839 "fsqrtd", and "fdivd" instructions. This is the default except
18840 when compiling for CK803.
18841
18842 -mfpu=fpu
18843 Select the floating-point processor. This option can only be used
18844 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
18845 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
18846 and fpv2_divd (-mdouble-float -mdivdu).
18847
18848 -melrw
18849 -mno-elrw
18850 Enable the extended "lrw" instruction. This option defaults to on
18851 for CK801 and off otherwise.
18852
18853 -mistack
18854 -mno-istack
18855 Enable interrupt stack instructions; the default is off.
18856
18857 The -mistack option is required to handle the "interrupt" and "isr"
18858 function attributes.
18859
18860 -mmp
18861 Enable multiprocessor instructions; the default is off.
18862
18863 -mcp
18864 Enable coprocessor instructions; the default is off.
18865
18866 -mcache
18867 Enable coprocessor instructions; the default is off.
18868
18869 -msecurity
18870 Enable C-SKY security instructions; the default is off.
18871
18872 -mtrust
18873 Enable C-SKY trust instructions; the default is off.
18874
18875 -mdsp
18876 -medsp
18877 -mvdsp
18878 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
18879 respectively. All of these options default to off.
18880
18881 -mdiv
18882 -mno-div
18883 Generate divide instructions. Default is off.
18884
18885 -msmart
18886 -mno-smart
18887 Generate code for Smart Mode, using only registers numbered 0-7 to
18888 allow use of 16-bit instructions. This option is ignored for CK801
18889 where this is the required behavior, and it defaults to on for
18890 CK802. For other targets, the default is off.
18891
18892 -mhigh-registers
18893 -mno-high-registers
18894 Generate code using the high registers numbered 16-31. This option
18895 is not supported on CK801, CK802, or CK803, and is enabled by
18896 default for other processors.
18897
18898 -manchor
18899 -mno-anchor
18900 Generate code using global anchor symbol addresses.
18901
18902 -mpushpop
18903 -mno-pushpop
18904 Generate code using "push" and "pop" instructions. This option
18905 defaults to on.
18906
18907 -mmultiple-stld
18908 -mstm
18909 -mno-multiple-stld
18910 -mno-stm
18911 Generate code using "stm" and "ldm" instructions. This option
18912 isn't supported on CK801 but is enabled by default on other
18913 processors.
18914
18915 -mconstpool
18916 -mno-constpool
18917 Create constant pools in the compiler instead of deferring it to
18918 the assembler. This option is the default and required for correct
18919 code generation on CK801 and CK802, and is optional on other
18920 processors.
18921
18922 -mstack-size
18923 -mno-stack-size
18924 Emit ".stack_size" directives for each function in the assembly
18925 output. This option defaults to off.
18926
18927 -mccrt
18928 -mno-ccrt
18929 Generate code for the C-SKY compiler runtime instead of libgcc.
18930 This option defaults to off.
18931
18932 -mbranch-cost=n
18933 Set the branch costs to roughly "n" instructions. The default is
18934 1.
18935
18936 -msched-prolog
18937 -mno-sched-prolog
18938 Permit scheduling of function prologue and epilogue sequences.
18939 Using this option can result in code that is not compliant with the
18940 C-SKY V2 ABI prologue requirements and that cannot be debugged or
18941 backtraced. It is disabled by default.
18942
18943 -msim
18944 Links the library libsemi.a which is in compatible with simulator.
18945 Applicable to ELF compiler only.
18946
18947 Darwin Options
18948 These options are defined for all architectures running the Darwin
18949 operating system.
18950
18951 FSF GCC on Darwin does not create "fat" object files; it creates an
18952 object file for the single architecture that GCC was built to target.
18953 Apple's GCC on Darwin does create "fat" files if multiple -arch options
18954 are used; it does so by running the compiler or linker multiple times
18955 and joining the results together with lipo.
18956
18957 The subtype of the file created (like ppc7400 or ppc970 or i686) is
18958 determined by the flags that specify the ISA that GCC is targeting,
18959 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
18960 override this.
18961
18962 The Darwin tools vary in their behavior when presented with an ISA
18963 mismatch. The assembler, as, only permits instructions to be used that
18964 are valid for the subtype of the file it is generating, so you cannot
18965 put 64-bit instructions in a ppc750 object file. The linker for shared
18966 libraries, /usr/bin/libtool, fails and prints an error if asked to
18967 create a shared library with a less restrictive subtype than its input
18968 files (for instance, trying to put a ppc970 object file in a ppc7400
18969 library). The linker for executables, ld, quietly gives the executable
18970 the most restrictive subtype of any of its input files.
18971
18972 -Fdir
18973 Add the framework directory dir to the head of the list of
18974 directories to be searched for header files. These directories are
18975 interleaved with those specified by -I options and are scanned in a
18976 left-to-right order.
18977
18978 A framework directory is a directory with frameworks in it. A
18979 framework is a directory with a Headers and/or PrivateHeaders
18980 directory contained directly in it that ends in .framework. The
18981 name of a framework is the name of this directory excluding the
18982 .framework. Headers associated with the framework are found in one
18983 of those two directories, with Headers being searched first. A
18984 subframework is a framework directory that is in a framework's
18985 Frameworks directory. Includes of subframework headers can only
18986 appear in a header of a framework that contains the subframework,
18987 or in a sibling subframework header. Two subframeworks are
18988 siblings if they occur in the same framework. A subframework
18989 should not have the same name as a framework; a warning is issued
18990 if this is violated. Currently a subframework cannot have
18991 subframeworks; in the future, the mechanism may be extended to
18992 support this. The standard frameworks can be found in
18993 /System/Library/Frameworks and /Library/Frameworks. An example
18994 include looks like "#include <Framework/header.h>", where Framework
18995 denotes the name of the framework and header.h is found in the
18996 PrivateHeaders or Headers directory.
18997
18998 -iframeworkdir
18999 Like -F except the directory is a treated as a system directory.
19000 The main difference between this -iframework and -F is that with
19001 -iframework the compiler does not warn about constructs contained
19002 within header files found via dir. This option is valid only for
19003 the C family of languages.
19004
19005 -gused
19006 Emit debugging information for symbols that are used. For stabs
19007 debugging format, this enables -feliminate-unused-debug-symbols.
19008 This is by default ON.
19009
19010 -gfull
19011 Emit debugging information for all symbols and types.
19012
19013 -mmacosx-version-min=version
19014 The earliest version of MacOS X that this executable will run on is
19015 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19016
19017 If the compiler was built to use the system's headers by default,
19018 then the default for this option is the system version on which the
19019 compiler is running, otherwise the default is to make choices that
19020 are compatible with as many systems and code bases as possible.
19021
19022 -mkernel
19023 Enable kernel development mode. The -mkernel option sets -static,
19024 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19025 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19026 where applicable. This mode also sets -mno-altivec, -msoft-float,
19027 -fno-builtin and -mlong-branch for PowerPC targets.
19028
19029 -mone-byte-bool
19030 Override the defaults for "bool" so that "sizeof(bool)==1". By
19031 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19032 when compiling for Darwin/x86, so this option has no effect on x86.
19033
19034 Warning: The -mone-byte-bool switch causes GCC to generate code
19035 that is not binary compatible with code generated without that
19036 switch. Using this switch may require recompiling all other
19037 modules in a program, including system libraries. Use this switch
19038 to conform to a non-default data model.
19039
19040 -mfix-and-continue
19041 -ffix-and-continue
19042 -findirect-data
19043 Generate code suitable for fast turnaround development, such as to
19044 allow GDB to dynamically load .o files into already-running
19045 programs. -findirect-data and -ffix-and-continue are provided for
19046 backwards compatibility.
19047
19048 -all_load
19049 Loads all members of static archive libraries. See man ld(1) for
19050 more information.
19051
19052 -arch_errors_fatal
19053 Cause the errors having to do with files that have the wrong
19054 architecture to be fatal.
19055
19056 -bind_at_load
19057 Causes the output file to be marked such that the dynamic linker
19058 will bind all undefined references when the file is loaded or
19059 launched.
19060
19061 -bundle
19062 Produce a Mach-o bundle format file. See man ld(1) for more
19063 information.
19064
19065 -bundle_loader executable
19066 This option specifies the executable that will load the build
19067 output file being linked. See man ld(1) for more information.
19068
19069 -dynamiclib
19070 When passed this option, GCC produces a dynamic library instead of
19071 an executable when linking, using the Darwin libtool command.
19072
19073 -force_cpusubtype_ALL
19074 This causes GCC's output file to have the ALL subtype, instead of
19075 one controlled by the -mcpu or -march option.
19076
19077 -allowable_client client_name
19078 -client_name
19079 -compatibility_version
19080 -current_version
19081 -dead_strip
19082 -dependency-file
19083 -dylib_file
19084 -dylinker_install_name
19085 -dynamic
19086 -exported_symbols_list
19087 -filelist
19088 -flat_namespace
19089 -force_flat_namespace
19090 -headerpad_max_install_names
19091 -image_base
19092 -init
19093 -install_name
19094 -keep_private_externs
19095 -multi_module
19096 -multiply_defined
19097 -multiply_defined_unused
19098 -noall_load
19099 -no_dead_strip_inits_and_terms
19100 -nofixprebinding
19101 -nomultidefs
19102 -noprebind
19103 -noseglinkedit
19104 -pagezero_size
19105 -prebind
19106 -prebind_all_twolevel_modules
19107 -private_bundle
19108 -read_only_relocs
19109 -sectalign
19110 -sectobjectsymbols
19111 -whyload
19112 -seg1addr
19113 -sectcreate
19114 -sectobjectsymbols
19115 -sectorder
19116 -segaddr
19117 -segs_read_only_addr
19118 -segs_read_write_addr
19119 -seg_addr_table
19120 -seg_addr_table_filename
19121 -seglinkedit
19122 -segprot
19123 -segs_read_only_addr
19124 -segs_read_write_addr
19125 -single_module
19126 -static
19127 -sub_library
19128 -sub_umbrella
19129 -twolevel_namespace
19130 -umbrella
19131 -undefined
19132 -unexported_symbols_list
19133 -weak_reference_mismatches
19134 -whatsloaded
19135 These options are passed to the Darwin linker. The Darwin linker
19136 man page describes them in detail.
19137
19138 DEC Alpha Options
19139 These -m options are defined for the DEC Alpha implementations:
19140
19141 -mno-soft-float
19142 -msoft-float
19143 Use (do not use) the hardware floating-point instructions for
19144 floating-point operations. When -msoft-float is specified,
19145 functions in libgcc.a are used to perform floating-point
19146 operations. Unless they are replaced by routines that emulate the
19147 floating-point operations, or compiled in such a way as to call
19148 such emulations routines, these routines issue floating-point
19149 operations. If you are compiling for an Alpha without floating-
19150 point operations, you must ensure that the library is built so as
19151 not to call them.
19152
19153 Note that Alpha implementations without floating-point operations
19154 are required to have floating-point registers.
19155
19156 -mfp-reg
19157 -mno-fp-regs
19158 Generate code that uses (does not use) the floating-point register
19159 set. -mno-fp-regs implies -msoft-float. If the floating-point
19160 register set is not used, floating-point operands are passed in
19161 integer registers as if they were integers and floating-point
19162 results are passed in $0 instead of $f0. This is a non-standard
19163 calling sequence, so any function with a floating-point argument or
19164 return value called by code compiled with -mno-fp-regs must also be
19165 compiled with that option.
19166
19167 A typical use of this option is building a kernel that does not
19168 use, and hence need not save and restore, any floating-point
19169 registers.
19170
19171 -mieee
19172 The Alpha architecture implements floating-point hardware optimized
19173 for maximum performance. It is mostly compliant with the IEEE
19174 floating-point standard. However, for full compliance, software
19175 assistance is required. This option generates code fully IEEE-
19176 compliant code except that the inexact-flag is not maintained (see
19177 below). If this option is turned on, the preprocessor macro
19178 "_IEEE_FP" is defined during compilation. The resulting code is
19179 less efficient but is able to correctly support denormalized
19180 numbers and exceptional IEEE values such as not-a-number and
19181 plus/minus infinity. Other Alpha compilers call this option
19182 -ieee_with_no_inexact.
19183
19184 -mieee-with-inexact
19185 This is like -mieee except the generated code also maintains the
19186 IEEE inexact-flag. Turning on this option causes the generated
19187 code to implement fully-compliant IEEE math. In addition to
19188 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
19189 On some Alpha implementations the resulting code may execute
19190 significantly slower than the code generated by default. Since
19191 there is very little code that depends on the inexact-flag, you
19192 should normally not specify this option. Other Alpha compilers
19193 call this option -ieee_with_inexact.
19194
19195 -mfp-trap-mode=trap-mode
19196 This option controls what floating-point related traps are enabled.
19197 Other Alpha compilers call this option -fptm trap-mode. The trap
19198 mode can be set to one of four values:
19199
19200 n This is the default (normal) setting. The only traps that are
19201 enabled are the ones that cannot be disabled in software (e.g.,
19202 division by zero trap).
19203
19204 u In addition to the traps enabled by n, underflow traps are
19205 enabled as well.
19206
19207 su Like u, but the instructions are marked to be safe for software
19208 completion (see Alpha architecture manual for details).
19209
19210 sui Like su, but inexact traps are enabled as well.
19211
19212 -mfp-rounding-mode=rounding-mode
19213 Selects the IEEE rounding mode. Other Alpha compilers call this
19214 option -fprm rounding-mode. The rounding-mode can be one of:
19215
19216 n Normal IEEE rounding mode. Floating-point numbers are rounded
19217 towards the nearest machine number or towards the even machine
19218 number in case of a tie.
19219
19220 m Round towards minus infinity.
19221
19222 c Chopped rounding mode. Floating-point numbers are rounded
19223 towards zero.
19224
19225 d Dynamic rounding mode. A field in the floating-point control
19226 register (fpcr, see Alpha architecture reference manual)
19227 controls the rounding mode in effect. The C library
19228 initializes this register for rounding towards plus infinity.
19229 Thus, unless your program modifies the fpcr, d corresponds to
19230 round towards plus infinity.
19231
19232 -mtrap-precision=trap-precision
19233 In the Alpha architecture, floating-point traps are imprecise.
19234 This means without software assistance it is impossible to recover
19235 from a floating trap and program execution normally needs to be
19236 terminated. GCC can generate code that can assist operating system
19237 trap handlers in determining the exact location that caused a
19238 floating-point trap. Depending on the requirements of an
19239 application, different levels of precisions can be selected:
19240
19241 p Program precision. This option is the default and means a trap
19242 handler can only identify which program caused a floating-point
19243 exception.
19244
19245 f Function precision. The trap handler can determine the
19246 function that caused a floating-point exception.
19247
19248 i Instruction precision. The trap handler can determine the
19249 exact instruction that caused a floating-point exception.
19250
19251 Other Alpha compilers provide the equivalent options called
19252 -scope_safe and -resumption_safe.
19253
19254 -mieee-conformant
19255 This option marks the generated code as IEEE conformant. You must
19256 not use this option unless you also specify -mtrap-precision=i and
19257 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
19258 to emit the line .eflag 48 in the function prologue of the
19259 generated assembly file.
19260
19261 -mbuild-constants
19262 Normally GCC examines a 32- or 64-bit integer constant to see if it
19263 can construct it from smaller constants in two or three
19264 instructions. If it cannot, it outputs the constant as a literal
19265 and generates code to load it from the data segment at run time.
19266
19267 Use this option to require GCC to construct all integer constants
19268 using code, even if it takes more instructions (the maximum is
19269 six).
19270
19271 You typically use this option to build a shared library dynamic
19272 loader. Itself a shared library, it must relocate itself in memory
19273 before it can find the variables and constants in its own data
19274 segment.
19275
19276 -mbwx
19277 -mno-bwx
19278 -mcix
19279 -mno-cix
19280 -mfix
19281 -mno-fix
19282 -mmax
19283 -mno-max
19284 Indicate whether GCC should generate code to use the optional BWX,
19285 CIX, FIX and MAX instruction sets. The default is to use the
19286 instruction sets supported by the CPU type specified via -mcpu=
19287 option or that of the CPU on which GCC was built if none is
19288 specified.
19289
19290 -mfloat-vax
19291 -mfloat-ieee
19292 Generate code that uses (does not use) VAX F and G floating-point
19293 arithmetic instead of IEEE single and double precision.
19294
19295 -mexplicit-relocs
19296 -mno-explicit-relocs
19297 Older Alpha assemblers provided no way to generate symbol
19298 relocations except via assembler macros. Use of these macros does
19299 not allow optimal instruction scheduling. GNU binutils as of
19300 version 2.12 supports a new syntax that allows the compiler to
19301 explicitly mark which relocations should apply to which
19302 instructions. This option is mostly useful for debugging, as GCC
19303 detects the capabilities of the assembler when it is built and sets
19304 the default accordingly.
19305
19306 -msmall-data
19307 -mlarge-data
19308 When -mexplicit-relocs is in effect, static data is accessed via
19309 gp-relative relocations. When -msmall-data is used, objects 8
19310 bytes long or smaller are placed in a small data area (the ".sdata"
19311 and ".sbss" sections) and are accessed via 16-bit relocations off
19312 of the $gp register. This limits the size of the small data area
19313 to 64KB, but allows the variables to be directly accessed via a
19314 single instruction.
19315
19316 The default is -mlarge-data. With this option the data area is
19317 limited to just below 2GB. Programs that require more than 2GB of
19318 data must use "malloc" or "mmap" to allocate the data in the heap
19319 instead of in the program's data segment.
19320
19321 When generating code for shared libraries, -fpic implies
19322 -msmall-data and -fPIC implies -mlarge-data.
19323
19324 -msmall-text
19325 -mlarge-text
19326 When -msmall-text is used, the compiler assumes that the code of
19327 the entire program (or shared library) fits in 4MB, and is thus
19328 reachable with a branch instruction. When -msmall-data is used,
19329 the compiler can assume that all local symbols share the same $gp
19330 value, and thus reduce the number of instructions required for a
19331 function call from 4 to 1.
19332
19333 The default is -mlarge-text.
19334
19335 -mcpu=cpu_type
19336 Set the instruction set and instruction scheduling parameters for
19337 machine type cpu_type. You can specify either the EV style name or
19338 the corresponding chip number. GCC supports scheduling parameters
19339 for the EV4, EV5 and EV6 family of processors and chooses the
19340 default values for the instruction set from the processor you
19341 specify. If you do not specify a processor type, GCC defaults to
19342 the processor on which the compiler was built.
19343
19344 Supported values for cpu_type are
19345
19346 ev4
19347 ev45
19348 21064
19349 Schedules as an EV4 and has no instruction set extensions.
19350
19351 ev5
19352 21164
19353 Schedules as an EV5 and has no instruction set extensions.
19354
19355 ev56
19356 21164a
19357 Schedules as an EV5 and supports the BWX extension.
19358
19359 pca56
19360 21164pc
19361 21164PC
19362 Schedules as an EV5 and supports the BWX and MAX extensions.
19363
19364 ev6
19365 21264
19366 Schedules as an EV6 and supports the BWX, FIX, and MAX
19367 extensions.
19368
19369 ev67
19370 21264a
19371 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
19372 extensions.
19373
19374 Native toolchains also support the value native, which selects the
19375 best architecture option for the host processor. -mcpu=native has
19376 no effect if GCC does not recognize the processor.
19377
19378 -mtune=cpu_type
19379 Set only the instruction scheduling parameters for machine type
19380 cpu_type. The instruction set is not changed.
19381
19382 Native toolchains also support the value native, which selects the
19383 best architecture option for the host processor. -mtune=native has
19384 no effect if GCC does not recognize the processor.
19385
19386 -mmemory-latency=time
19387 Sets the latency the scheduler should assume for typical memory
19388 references as seen by the application. This number is highly
19389 dependent on the memory access patterns used by the application and
19390 the size of the external cache on the machine.
19391
19392 Valid options for time are
19393
19394 number
19395 A decimal number representing clock cycles.
19396
19397 L1
19398 L2
19399 L3
19400 main
19401 The compiler contains estimates of the number of clock cycles
19402 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19403 (also called Dcache, Scache, and Bcache), as well as to main
19404 memory. Note that L3 is only valid for EV5.
19405
19406 eBPF Options
19407 -mframe-limit=bytes
19408 This specifies the hard limit for frame sizes, in bytes.
19409 Currently, the value that can be specified should be less than or
19410 equal to 32767. Defaults to whatever limit is imposed by the
19411 version of the Linux kernel targeted.
19412
19413 -mkernel=version
19414 This specifies the minimum version of the kernel that will run the
19415 compiled program. GCC uses this version to determine which
19416 instructions to use, what kernel helpers to allow, etc. Currently,
19417 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
19418 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
19419 4.20, 5.0, 5.1, 5.2, latest and native.
19420
19421 -mbig-endian
19422 Generate code for a big-endian target.
19423
19424 -mlittle-endian
19425 Generate code for a little-endian target. This is the default.
19426
19427 -mxbpf
19428 Generate code for an expanded version of BPF, which relaxes some of
19429 the restrictions imposed by the BPF architecture:
19430
19431 -<Save and restore callee-saved registers at function entry and>
19432 exit, respectively.
19433
19434 FR30 Options
19435 These options are defined specifically for the FR30 port.
19436
19437 -msmall-model
19438 Use the small address space model. This can produce smaller code,
19439 but it does assume that all symbolic values and addresses fit into
19440 a 20-bit range.
19441
19442 -mno-lsim
19443 Assume that runtime support has been provided and so there is no
19444 need to include the simulator library (libsim.a) on the linker
19445 command line.
19446
19447 FT32 Options
19448 These options are defined specifically for the FT32 port.
19449
19450 -msim
19451 Specifies that the program will be run on the simulator. This
19452 causes an alternate runtime startup and library to be linked. You
19453 must not use this option when generating programs that will run on
19454 real hardware; you must provide your own runtime library for
19455 whatever I/O functions are needed.
19456
19457 -mlra
19458 Enable Local Register Allocation. This is still experimental for
19459 FT32, so by default the compiler uses standard reload.
19460
19461 -mnodiv
19462 Do not use div and mod instructions.
19463
19464 -mft32b
19465 Enable use of the extended instructions of the FT32B processor.
19466
19467 -mcompress
19468 Compress all code using the Ft32B code compression scheme.
19469
19470 -mnopm
19471 Do not generate code that reads program memory.
19472
19473 FRV Options
19474 -mgpr-32
19475 Only use the first 32 general-purpose registers.
19476
19477 -mgpr-64
19478 Use all 64 general-purpose registers.
19479
19480 -mfpr-32
19481 Use only the first 32 floating-point registers.
19482
19483 -mfpr-64
19484 Use all 64 floating-point registers.
19485
19486 -mhard-float
19487 Use hardware instructions for floating-point operations.
19488
19489 -msoft-float
19490 Use library routines for floating-point operations.
19491
19492 -malloc-cc
19493 Dynamically allocate condition code registers.
19494
19495 -mfixed-cc
19496 Do not try to dynamically allocate condition code registers, only
19497 use "icc0" and "fcc0".
19498
19499 -mdword
19500 Change ABI to use double word insns.
19501
19502 -mno-dword
19503 Do not use double word instructions.
19504
19505 -mdouble
19506 Use floating-point double instructions.
19507
19508 -mno-double
19509 Do not use floating-point double instructions.
19510
19511 -mmedia
19512 Use media instructions.
19513
19514 -mno-media
19515 Do not use media instructions.
19516
19517 -mmuladd
19518 Use multiply and add/subtract instructions.
19519
19520 -mno-muladd
19521 Do not use multiply and add/subtract instructions.
19522
19523 -mfdpic
19524 Select the FDPIC ABI, which uses function descriptors to represent
19525 pointers to functions. Without any PIC/PIE-related options, it
19526 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
19527 small data are within a 12-bit range from the GOT base address;
19528 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
19529 bfin-elf target, this option implies -msim.
19530
19531 -minline-plt
19532 Enable inlining of PLT entries in function calls to functions that
19533 are not known to bind locally. It has no effect without -mfdpic.
19534 It's enabled by default if optimizing for speed and compiling for
19535 shared libraries (i.e., -fPIC or -fpic), or when an optimization
19536 option such as -O3 or above is present in the command line.
19537
19538 -mTLS
19539 Assume a large TLS segment when generating thread-local code.
19540
19541 -mtls
19542 Do not assume a large TLS segment when generating thread-local
19543 code.
19544
19545 -mgprel-ro
19546 Enable the use of "GPREL" relocations in the FDPIC ABI for data
19547 that is known to be in read-only sections. It's enabled by
19548 default, except for -fpic or -fpie: even though it may help make
19549 the global offset table smaller, it trades 1 instruction for 4.
19550 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
19551 may be shared by multiple symbols, and it avoids the need for a GOT
19552 entry for the referenced symbol, so it's more likely to be a win.
19553 If it is not, -mno-gprel-ro can be used to disable it.
19554
19555 -multilib-library-pic
19556 Link with the (library, not FD) pic libraries. It's implied by
19557 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
19558 should never have to use it explicitly.
19559
19560 -mlinked-fp
19561 Follow the EABI requirement of always creating a frame pointer
19562 whenever a stack frame is allocated. This option is enabled by
19563 default and can be disabled with -mno-linked-fp.
19564
19565 -mlong-calls
19566 Use indirect addressing to call functions outside the current
19567 compilation unit. This allows the functions to be placed anywhere
19568 within the 32-bit address space.
19569
19570 -malign-labels
19571 Try to align labels to an 8-byte boundary by inserting NOPs into
19572 the previous packet. This option only has an effect when VLIW
19573 packing is enabled. It doesn't create new packets; it merely adds
19574 NOPs to existing ones.
19575
19576 -mlibrary-pic
19577 Generate position-independent EABI code.
19578
19579 -macc-4
19580 Use only the first four media accumulator registers.
19581
19582 -macc-8
19583 Use all eight media accumulator registers.
19584
19585 -mpack
19586 Pack VLIW instructions.
19587
19588 -mno-pack
19589 Do not pack VLIW instructions.
19590
19591 -mno-eflags
19592 Do not mark ABI switches in e_flags.
19593
19594 -mcond-move
19595 Enable the use of conditional-move instructions (default).
19596
19597 This switch is mainly for debugging the compiler and will likely be
19598 removed in a future version.
19599
19600 -mno-cond-move
19601 Disable the use of conditional-move instructions.
19602
19603 This switch is mainly for debugging the compiler and will likely be
19604 removed in a future version.
19605
19606 -mscc
19607 Enable the use of conditional set instructions (default).
19608
19609 This switch is mainly for debugging the compiler and will likely be
19610 removed in a future version.
19611
19612 -mno-scc
19613 Disable the use of conditional set instructions.
19614
19615 This switch is mainly for debugging the compiler and will likely be
19616 removed in a future version.
19617
19618 -mcond-exec
19619 Enable the use of conditional execution (default).
19620
19621 This switch is mainly for debugging the compiler and will likely be
19622 removed in a future version.
19623
19624 -mno-cond-exec
19625 Disable the use of conditional execution.
19626
19627 This switch is mainly for debugging the compiler and will likely be
19628 removed in a future version.
19629
19630 -mvliw-branch
19631 Run a pass to pack branches into VLIW instructions (default).
19632
19633 This switch is mainly for debugging the compiler and will likely be
19634 removed in a future version.
19635
19636 -mno-vliw-branch
19637 Do not run a pass to pack branches into VLIW instructions.
19638
19639 This switch is mainly for debugging the compiler and will likely be
19640 removed in a future version.
19641
19642 -mmulti-cond-exec
19643 Enable optimization of "&&" and "||" in conditional execution
19644 (default).
19645
19646 This switch is mainly for debugging the compiler and will likely be
19647 removed in a future version.
19648
19649 -mno-multi-cond-exec
19650 Disable optimization of "&&" and "||" in conditional execution.
19651
19652 This switch is mainly for debugging the compiler and will likely be
19653 removed in a future version.
19654
19655 -mnested-cond-exec
19656 Enable nested conditional execution optimizations (default).
19657
19658 This switch is mainly for debugging the compiler and will likely be
19659 removed in a future version.
19660
19661 -mno-nested-cond-exec
19662 Disable nested conditional execution optimizations.
19663
19664 This switch is mainly for debugging the compiler and will likely be
19665 removed in a future version.
19666
19667 -moptimize-membar
19668 This switch removes redundant "membar" instructions from the
19669 compiler-generated code. It is enabled by default.
19670
19671 -mno-optimize-membar
19672 This switch disables the automatic removal of redundant "membar"
19673 instructions from the generated code.
19674
19675 -mtomcat-stats
19676 Cause gas to print out tomcat statistics.
19677
19678 -mcpu=cpu
19679 Select the processor type for which to generate code. Possible
19680 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
19681 and simple.
19682
19683 GNU/Linux Options
19684 These -m options are defined for GNU/Linux targets:
19685
19686 -mglibc
19687 Use the GNU C library. This is the default except on
19688 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
19689 targets.
19690
19691 -muclibc
19692 Use uClibc C library. This is the default on *-*-linux-*uclibc*
19693 targets.
19694
19695 -mmusl
19696 Use the musl C library. This is the default on *-*-linux-*musl*
19697 targets.
19698
19699 -mbionic
19700 Use Bionic C library. This is the default on *-*-linux-*android*
19701 targets.
19702
19703 -mandroid
19704 Compile code compatible with Android platform. This is the default
19705 on *-*-linux-*android* targets.
19706
19707 When compiling, this option enables -mbionic, -fPIC,
19708 -fno-exceptions and -fno-rtti by default. When linking, this
19709 option makes the GCC driver pass Android-specific options to the
19710 linker. Finally, this option causes the preprocessor macro
19711 "__ANDROID__" to be defined.
19712
19713 -tno-android-cc
19714 Disable compilation effects of -mandroid, i.e., do not enable
19715 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
19716
19717 -tno-android-ld
19718 Disable linking effects of -mandroid, i.e., pass standard Linux
19719 linking options to the linker.
19720
19721 H8/300 Options
19722 These -m options are defined for the H8/300 implementations:
19723
19724 -mrelax
19725 Shorten some address references at link time, when possible; uses
19726 the linker option -relax.
19727
19728 -mh Generate code for the H8/300H.
19729
19730 -ms Generate code for the H8S.
19731
19732 -mn Generate code for the H8S and H8/300H in the normal mode. This
19733 switch must be used either with -mh or -ms.
19734
19735 -ms2600
19736 Generate code for the H8S/2600. This switch must be used with -ms.
19737
19738 -mexr
19739 Extended registers are stored on stack before execution of function
19740 with monitor attribute. Default option is -mexr. This option is
19741 valid only for H8S targets.
19742
19743 -mno-exr
19744 Extended registers are not stored on stack before execution of
19745 function with monitor attribute. Default option is -mno-exr. This
19746 option is valid only for H8S targets.
19747
19748 -mint32
19749 Make "int" data 32 bits by default.
19750
19751 -malign-300
19752 On the H8/300H and H8S, use the same alignment rules as for the
19753 H8/300. The default for the H8/300H and H8S is to align longs and
19754 floats on 4-byte boundaries. -malign-300 causes them to be aligned
19755 on 2-byte boundaries. This option has no effect on the H8/300.
19756
19757 HPPA Options
19758 These -m options are defined for the HPPA family of computers:
19759
19760 -march=architecture-type
19761 Generate code for the specified architecture. The choices for
19762 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
19763 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
19764 system to determine the proper architecture option for your
19765 machine. Code compiled for lower numbered architectures runs on
19766 higher numbered architectures, but not the other way around.
19767
19768 -mpa-risc-1-0
19769 -mpa-risc-1-1
19770 -mpa-risc-2-0
19771 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
19772
19773 -mcaller-copies
19774 The caller copies function arguments passed by hidden reference.
19775 This option should be used with care as it is not compatible with
19776 the default 32-bit runtime. However, only aggregates larger than
19777 eight bytes are passed by hidden reference and the option provides
19778 better compatibility with OpenMP.
19779
19780 -mjump-in-delay
19781 This option is ignored and provided for compatibility purposes
19782 only.
19783
19784 -mdisable-fpregs
19785 Prevent floating-point registers from being used in any manner.
19786 This is necessary for compiling kernels that perform lazy context
19787 switching of floating-point registers. If you use this option and
19788 attempt to perform floating-point operations, the compiler aborts.
19789
19790 -mdisable-indexing
19791 Prevent the compiler from using indexing address modes. This
19792 avoids some rather obscure problems when compiling MIG generated
19793 code under MACH.
19794
19795 -mno-space-regs
19796 Generate code that assumes the target has no space registers. This
19797 allows GCC to generate faster indirect calls and use unscaled index
19798 address modes.
19799
19800 Such code is suitable for level 0 PA systems and kernels.
19801
19802 -mfast-indirect-calls
19803 Generate code that assumes calls never cross space boundaries.
19804 This allows GCC to emit code that performs faster indirect calls.
19805
19806 This option does not work in the presence of shared libraries or
19807 nested functions.
19808
19809 -mfixed-range=register-range
19810 Generate code treating the given register range as fixed registers.
19811 A fixed register is one that the register allocator cannot use.
19812 This is useful when compiling kernel code. A register range is
19813 specified as two registers separated by a dash. Multiple register
19814 ranges can be specified separated by a comma.
19815
19816 -mlong-load-store
19817 Generate 3-instruction load and store sequences as sometimes
19818 required by the HP-UX 10 linker. This is equivalent to the +k
19819 option to the HP compilers.
19820
19821 -mportable-runtime
19822 Use the portable calling conventions proposed by HP for ELF
19823 systems.
19824
19825 -mgas
19826 Enable the use of assembler directives only GAS understands.
19827
19828 -mschedule=cpu-type
19829 Schedule code according to the constraints for the machine type
19830 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
19831 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
19832 to determine the proper scheduling option for your machine. The
19833 default scheduling is 8000.
19834
19835 -mlinker-opt
19836 Enable the optimization pass in the HP-UX linker. Note this makes
19837 symbolic debugging impossible. It also triggers a bug in the HP-UX
19838 8 and HP-UX 9 linkers in which they give bogus error messages when
19839 linking some programs.
19840
19841 -msoft-float
19842 Generate output containing library calls for floating point.
19843 Warning: the requisite libraries are not available for all HPPA
19844 targets. Normally the facilities of the machine's usual C compiler
19845 are used, but this cannot be done directly in cross-compilation.
19846 You must make your own arrangements to provide suitable library
19847 functions for cross-compilation.
19848
19849 -msoft-float changes the calling convention in the output file;
19850 therefore, it is only useful if you compile all of a program with
19851 this option. In particular, you need to compile libgcc.a, the
19852 library that comes with GCC, with -msoft-float in order for this to
19853 work.
19854
19855 -msio
19856 Generate the predefine, "_SIO", for server IO. The default is
19857 -mwsio. This generates the predefines, "__hp9000s700",
19858 "__hp9000s700__" and "_WSIO", for workstation IO. These options
19859 are available under HP-UX and HI-UX.
19860
19861 -mgnu-ld
19862 Use options specific to GNU ld. This passes -shared to ld when
19863 building a shared library. It is the default when GCC is
19864 configured, explicitly or implicitly, with the GNU linker. This
19865 option does not affect which ld is called; it only changes what
19866 parameters are passed to that ld. The ld that is called is
19867 determined by the --with-ld configure option, GCC's program search
19868 path, and finally by the user's PATH. The linker used by GCC can
19869 be printed using which `gcc -print-prog-name=ld`. This option is
19870 only available on the 64-bit HP-UX GCC, i.e. configured with
19871 hppa*64*-*-hpux*.
19872
19873 -mhp-ld
19874 Use options specific to HP ld. This passes -b to ld when building
19875 a shared library and passes +Accept TypeMismatch to ld on all
19876 links. It is the default when GCC is configured, explicitly or
19877 implicitly, with the HP linker. This option does not affect which
19878 ld is called; it only changes what parameters are passed to that
19879 ld. The ld that is called is determined by the --with-ld configure
19880 option, GCC's program search path, and finally by the user's PATH.
19881 The linker used by GCC can be printed using which `gcc
19882 -print-prog-name=ld`. This option is only available on the 64-bit
19883 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
19884
19885 -mlong-calls
19886 Generate code that uses long call sequences. This ensures that a
19887 call is always able to reach linker generated stubs. The default
19888 is to generate long calls only when the distance from the call site
19889 to the beginning of the function or translation unit, as the case
19890 may be, exceeds a predefined limit set by the branch type being
19891 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
19892 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
19893 always limited at 240,000 bytes.
19894
19895 Distances are measured from the beginning of functions when using
19896 the -ffunction-sections option, or when using the -mgas and
19897 -mno-portable-runtime options together under HP-UX with the SOM
19898 linker.
19899
19900 It is normally not desirable to use this option as it degrades
19901 performance. However, it may be useful in large applications,
19902 particularly when partial linking is used to build the application.
19903
19904 The types of long calls used depends on the capabilities of the
19905 assembler and linker, and the type of code being generated. The
19906 impact on systems that support long absolute calls, and long pic
19907 symbol-difference or pc-relative calls should be relatively small.
19908 However, an indirect call is used on 32-bit ELF systems in pic code
19909 and it is quite long.
19910
19911 -munix=unix-std
19912 Generate compiler predefines and select a startfile for the
19913 specified UNIX standard. The choices for unix-std are 93, 95 and
19914 98. 93 is supported on all HP-UX versions. 95 is available on HP-
19915 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
19916 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
19917 11.00, and 98 for HP-UX 11.11 and later.
19918
19919 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
19920 -munix=95 provides additional predefines for "XOPEN_UNIX" and
19921 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
19922 provides additional predefines for "_XOPEN_UNIX",
19923 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
19924 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
19925
19926 It is important to note that this option changes the interfaces for
19927 various library routines. It also affects the operational behavior
19928 of the C library. Thus, extreme care is needed in using this
19929 option.
19930
19931 Library code that is intended to operate with more than one UNIX
19932 standard must test, set and restore the variable
19933 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
19934 provide this capability.
19935
19936 -nolibdld
19937 Suppress the generation of link options to search libdld.sl when
19938 the -static option is specified on HP-UX 10 and later.
19939
19940 -static
19941 The HP-UX implementation of setlocale in libc has a dependency on
19942 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19943 when the -static option is specified, special link options are
19944 needed to resolve this dependency.
19945
19946 On HP-UX 10 and later, the GCC driver adds the necessary options to
19947 link with libdld.sl when the -static option is specified. This
19948 causes the resulting binary to be dynamic. On the 64-bit port, the
19949 linkers generate dynamic binaries by default in any case. The
19950 -nolibdld option can be used to prevent the GCC driver from adding
19951 these link options.
19952
19953 -threads
19954 Add support for multithreading with the dce thread library under
19955 HP-UX. This option sets flags for both the preprocessor and
19956 linker.
19957
19958 IA-64 Options
19959 These are the -m options defined for the Intel IA-64 architecture.
19960
19961 -mbig-endian
19962 Generate code for a big-endian target. This is the default for HP-
19963 UX.
19964
19965 -mlittle-endian
19966 Generate code for a little-endian target. This is the default for
19967 AIX5 and GNU/Linux.
19968
19969 -mgnu-as
19970 -mno-gnu-as
19971 Generate (or don't) code for the GNU assembler. This is the
19972 default.
19973
19974 -mgnu-ld
19975 -mno-gnu-ld
19976 Generate (or don't) code for the GNU linker. This is the default.
19977
19978 -mno-pic
19979 Generate code that does not use a global pointer register. The
19980 result is not position independent code, and violates the IA-64
19981 ABI.
19982
19983 -mvolatile-asm-stop
19984 -mno-volatile-asm-stop
19985 Generate (or don't) a stop bit immediately before and after
19986 volatile asm statements.
19987
19988 -mregister-names
19989 -mno-register-names
19990 Generate (or don't) in, loc, and out register names for the stacked
19991 registers. This may make assembler output more readable.
19992
19993 -mno-sdata
19994 -msdata
19995 Disable (or enable) optimizations that use the small data section.
19996 This may be useful for working around optimizer bugs.
19997
19998 -mconstant-gp
19999 Generate code that uses a single constant global pointer value.
20000 This is useful when compiling kernel code.
20001
20002 -mauto-pic
20003 Generate code that is self-relocatable. This implies
20004 -mconstant-gp. This is useful when compiling firmware code.
20005
20006 -minline-float-divide-min-latency
20007 Generate code for inline divides of floating-point values using the
20008 minimum latency algorithm.
20009
20010 -minline-float-divide-max-throughput
20011 Generate code for inline divides of floating-point values using the
20012 maximum throughput algorithm.
20013
20014 -mno-inline-float-divide
20015 Do not generate inline code for divides of floating-point values.
20016
20017 -minline-int-divide-min-latency
20018 Generate code for inline divides of integer values using the
20019 minimum latency algorithm.
20020
20021 -minline-int-divide-max-throughput
20022 Generate code for inline divides of integer values using the
20023 maximum throughput algorithm.
20024
20025 -mno-inline-int-divide
20026 Do not generate inline code for divides of integer values.
20027
20028 -minline-sqrt-min-latency
20029 Generate code for inline square roots using the minimum latency
20030 algorithm.
20031
20032 -minline-sqrt-max-throughput
20033 Generate code for inline square roots using the maximum throughput
20034 algorithm.
20035
20036 -mno-inline-sqrt
20037 Do not generate inline code for "sqrt".
20038
20039 -mfused-madd
20040 -mno-fused-madd
20041 Do (don't) generate code that uses the fused multiply/add or
20042 multiply/subtract instructions. The default is to use these
20043 instructions.
20044
20045 -mno-dwarf2-asm
20046 -mdwarf2-asm
20047 Don't (or do) generate assembler code for the DWARF line number
20048 debugging info. This may be useful when not using the GNU
20049 assembler.
20050
20051 -mearly-stop-bits
20052 -mno-early-stop-bits
20053 Allow stop bits to be placed earlier than immediately preceding the
20054 instruction that triggered the stop bit. This can improve
20055 instruction scheduling, but does not always do so.
20056
20057 -mfixed-range=register-range
20058 Generate code treating the given register range as fixed registers.
20059 A fixed register is one that the register allocator cannot use.
20060 This is useful when compiling kernel code. A register range is
20061 specified as two registers separated by a dash. Multiple register
20062 ranges can be specified separated by a comma.
20063
20064 -mtls-size=tls-size
20065 Specify bit size of immediate TLS offsets. Valid values are 14,
20066 22, and 64.
20067
20068 -mtune=cpu-type
20069 Tune the instruction scheduling for a particular CPU, Valid values
20070 are itanium, itanium1, merced, itanium2, and mckinley.
20071
20072 -milp32
20073 -mlp64
20074 Generate code for a 32-bit or 64-bit environment. The 32-bit
20075 environment sets int, long and pointer to 32 bits. The 64-bit
20076 environment sets int to 32 bits and long and pointer to 64 bits.
20077 These are HP-UX specific flags.
20078
20079 -mno-sched-br-data-spec
20080 -msched-br-data-spec
20081 (Dis/En)able data speculative scheduling before reload. This
20082 results in generation of "ld.a" instructions and the corresponding
20083 check instructions ("ld.c" / "chk.a"). The default setting is
20084 disabled.
20085
20086 -msched-ar-data-spec
20087 -mno-sched-ar-data-spec
20088 (En/Dis)able data speculative scheduling after reload. This
20089 results in generation of "ld.a" instructions and the corresponding
20090 check instructions ("ld.c" / "chk.a"). The default setting is
20091 enabled.
20092
20093 -mno-sched-control-spec
20094 -msched-control-spec
20095 (Dis/En)able control speculative scheduling. This feature is
20096 available only during region scheduling (i.e. before reload). This
20097 results in generation of the "ld.s" instructions and the
20098 corresponding check instructions "chk.s". The default setting is
20099 disabled.
20100
20101 -msched-br-in-data-spec
20102 -mno-sched-br-in-data-spec
20103 (En/Dis)able speculative scheduling of the instructions that are
20104 dependent on the data speculative loads before reload. This is
20105 effective only with -msched-br-data-spec enabled. The default
20106 setting is enabled.
20107
20108 -msched-ar-in-data-spec
20109 -mno-sched-ar-in-data-spec
20110 (En/Dis)able speculative scheduling of the instructions that are
20111 dependent on the data speculative loads after reload. This is
20112 effective only with -msched-ar-data-spec enabled. The default
20113 setting is enabled.
20114
20115 -msched-in-control-spec
20116 -mno-sched-in-control-spec
20117 (En/Dis)able speculative scheduling of the instructions that are
20118 dependent on the control speculative loads. This is effective only
20119 with -msched-control-spec enabled. The default setting is enabled.
20120
20121 -mno-sched-prefer-non-data-spec-insns
20122 -msched-prefer-non-data-spec-insns
20123 If enabled, data-speculative instructions are chosen for schedule
20124 only if there are no other choices at the moment. This makes the
20125 use of the data speculation much more conservative. The default
20126 setting is disabled.
20127
20128 -mno-sched-prefer-non-control-spec-insns
20129 -msched-prefer-non-control-spec-insns
20130 If enabled, control-speculative instructions are chosen for
20131 schedule only if there are no other choices at the moment. This
20132 makes the use of the control speculation much more conservative.
20133 The default setting is disabled.
20134
20135 -mno-sched-count-spec-in-critical-path
20136 -msched-count-spec-in-critical-path
20137 If enabled, speculative dependencies are considered during
20138 computation of the instructions priorities. This makes the use of
20139 the speculation a bit more conservative. The default setting is
20140 disabled.
20141
20142 -msched-spec-ldc
20143 Use a simple data speculation check. This option is on by default.
20144
20145 -msched-control-spec-ldc
20146 Use a simple check for control speculation. This option is on by
20147 default.
20148
20149 -msched-stop-bits-after-every-cycle
20150 Place a stop bit after every cycle when scheduling. This option is
20151 on by default.
20152
20153 -msched-fp-mem-deps-zero-cost
20154 Assume that floating-point stores and loads are not likely to cause
20155 a conflict when placed into the same instruction group. This
20156 option is disabled by default.
20157
20158 -msel-sched-dont-check-control-spec
20159 Generate checks for control speculation in selective scheduling.
20160 This flag is disabled by default.
20161
20162 -msched-max-memory-insns=max-insns
20163 Limit on the number of memory insns per instruction group, giving
20164 lower priority to subsequent memory insns attempting to schedule in
20165 the same instruction group. Frequently useful to prevent cache bank
20166 conflicts. The default value is 1.
20167
20168 -msched-max-memory-insns-hard-limit
20169 Makes the limit specified by msched-max-memory-insns a hard limit,
20170 disallowing more than that number in an instruction group.
20171 Otherwise, the limit is "soft", meaning that non-memory operations
20172 are preferred when the limit is reached, but memory operations may
20173 still be scheduled.
20174
20175 LM32 Options
20176 These -m options are defined for the LatticeMico32 architecture:
20177
20178 -mbarrel-shift-enabled
20179 Enable barrel-shift instructions.
20180
20181 -mdivide-enabled
20182 Enable divide and modulus instructions.
20183
20184 -mmultiply-enabled
20185 Enable multiply instructions.
20186
20187 -msign-extend-enabled
20188 Enable sign extend instructions.
20189
20190 -muser-enabled
20191 Enable user-defined instructions.
20192
20193 M32C Options
20194 -mcpu=name
20195 Select the CPU for which code is generated. name may be one of r8c
20196 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
20197 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
20198
20199 -msim
20200 Specifies that the program will be run on the simulator. This
20201 causes an alternate runtime library to be linked in which supports,
20202 for example, file I/O. You must not use this option when
20203 generating programs that will run on real hardware; you must
20204 provide your own runtime library for whatever I/O functions are
20205 needed.
20206
20207 -memregs=number
20208 Specifies the number of memory-based pseudo-registers GCC uses
20209 during code generation. These pseudo-registers are used like real
20210 registers, so there is a tradeoff between GCC's ability to fit the
20211 code into available registers, and the performance penalty of using
20212 memory instead of registers. Note that all modules in a program
20213 must be compiled with the same value for this option. Because of
20214 that, you must not use this option with GCC's default runtime
20215 libraries.
20216
20217 M32R/D Options
20218 These -m options are defined for Renesas M32R/D architectures:
20219
20220 -m32r2
20221 Generate code for the M32R/2.
20222
20223 -m32rx
20224 Generate code for the M32R/X.
20225
20226 -m32r
20227 Generate code for the M32R. This is the default.
20228
20229 -mmodel=small
20230 Assume all objects live in the lower 16MB of memory (so that their
20231 addresses can be loaded with the "ld24" instruction), and assume
20232 all subroutines are reachable with the "bl" instruction. This is
20233 the default.
20234
20235 The addressability of a particular object can be set with the
20236 "model" attribute.
20237
20238 -mmodel=medium
20239 Assume objects may be anywhere in the 32-bit address space (the
20240 compiler generates "seth/add3" instructions to load their
20241 addresses), and assume all subroutines are reachable with the "bl"
20242 instruction.
20243
20244 -mmodel=large
20245 Assume objects may be anywhere in the 32-bit address space (the
20246 compiler generates "seth/add3" instructions to load their
20247 addresses), and assume subroutines may not be reachable with the
20248 "bl" instruction (the compiler generates the much slower
20249 "seth/add3/jl" instruction sequence).
20250
20251 -msdata=none
20252 Disable use of the small data area. Variables are put into one of
20253 ".data", ".bss", or ".rodata" (unless the "section" attribute has
20254 been specified). This is the default.
20255
20256 The small data area consists of sections ".sdata" and ".sbss".
20257 Objects may be explicitly put in the small data area with the
20258 "section" attribute using one of these sections.
20259
20260 -msdata=sdata
20261 Put small global and static data in the small data area, but do not
20262 generate special code to reference them.
20263
20264 -msdata=use
20265 Put small global and static data in the small data area, and
20266 generate special instructions to reference them.
20267
20268 -G num
20269 Put global and static objects less than or equal to num bytes into
20270 the small data or BSS sections instead of the normal data or BSS
20271 sections. The default value of num is 8. The -msdata option must
20272 be set to one of sdata or use for this option to have any effect.
20273
20274 All modules should be compiled with the same -G num value.
20275 Compiling with different values of num may or may not work; if it
20276 doesn't the linker gives an error message---incorrect code is not
20277 generated.
20278
20279 -mdebug
20280 Makes the M32R-specific code in the compiler display some
20281 statistics that might help in debugging programs.
20282
20283 -malign-loops
20284 Align all loops to a 32-byte boundary.
20285
20286 -mno-align-loops
20287 Do not enforce a 32-byte alignment for loops. This is the default.
20288
20289 -missue-rate=number
20290 Issue number instructions per cycle. number can only be 1 or 2.
20291
20292 -mbranch-cost=number
20293 number can only be 1 or 2. If it is 1 then branches are preferred
20294 over conditional code, if it is 2, then the opposite applies.
20295
20296 -mflush-trap=number
20297 Specifies the trap number to use to flush the cache. The default
20298 is 12. Valid numbers are between 0 and 15 inclusive.
20299
20300 -mno-flush-trap
20301 Specifies that the cache cannot be flushed by using a trap.
20302
20303 -mflush-func=name
20304 Specifies the name of the operating system function to call to
20305 flush the cache. The default is _flush_cache, but a function call
20306 is only used if a trap is not available.
20307
20308 -mno-flush-func
20309 Indicates that there is no OS function for flushing the cache.
20310
20311 M680x0 Options
20312 These are the -m options defined for M680x0 and ColdFire processors.
20313 The default settings depend on which architecture was selected when the
20314 compiler was configured; the defaults for the most common choices are
20315 given below.
20316
20317 -march=arch
20318 Generate code for a specific M680x0 or ColdFire instruction set
20319 architecture. Permissible values of arch for M680x0 architectures
20320 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
20321 architectures are selected according to Freescale's ISA
20322 classification and the permissible values are: isaa, isaaplus, isab
20323 and isac.
20324
20325 GCC defines a macro "__mcfarch__" whenever it is generating code
20326 for a ColdFire target. The arch in this macro is one of the -march
20327 arguments given above.
20328
20329 When used together, -march and -mtune select code that runs on a
20330 family of similar processors but that is optimized for a particular
20331 microarchitecture.
20332
20333 -mcpu=cpu
20334 Generate code for a specific M680x0 or ColdFire processor. The
20335 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
20336 68332 and cpu32. The ColdFire cpus are given by the table below,
20337 which also classifies the CPUs into families:
20338
20339 Family : -mcpu arguments
20340 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
20341 5206 : 5202 5204 5206
20342 5206e : 5206e
20343 5208 : 5207 5208
20344 5211a : 5210a 5211a
20345 5213 : 5211 5212 5213
20346 5216 : 5214 5216
20347 52235 : 52230 52231 52232 52233 52234 52235
20348 5225 : 5224 5225
20349 52259 : 52252 52254 52255 52256 52258 52259
20350 5235 : 5232 5233 5234 5235 523x
20351 5249 : 5249
20352 5250 : 5250
20353 5271 : 5270 5271
20354 5272 : 5272
20355 5275 : 5274 5275
20356 5282 : 5280 5281 5282 528x
20357 53017 : 53011 53012 53013 53014 53015 53016 53017
20358 5307 : 5307
20359 5329 : 5327 5328 5329 532x
20360 5373 : 5372 5373 537x
20361 5407 : 5407
20362 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
20363 5485
20364
20365 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
20366 Other combinations of -mcpu and -march are rejected.
20367
20368 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
20369 selected. It also defines "__mcf_family_family", where the value
20370 of family is given by the table above.
20371
20372 -mtune=tune
20373 Tune the code for a particular microarchitecture within the
20374 constraints set by -march and -mcpu. The M680x0 microarchitectures
20375 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
20376 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
20377
20378 You can also use -mtune=68020-40 for code that needs to run
20379 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
20380 is similar but includes 68060 targets as well. These two options
20381 select the same tuning decisions as -m68020-40 and -m68020-60
20382 respectively.
20383
20384 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
20385 680x0 architecture arch. It also defines "mcarch" unless either
20386 -ansi or a non-GNU -std option is used. If GCC is tuning for a
20387 range of architectures, as selected by -mtune=68020-40 or
20388 -mtune=68020-60, it defines the macros for every architecture in
20389 the range.
20390
20391 GCC also defines the macro "__muarch__" when tuning for ColdFire
20392 microarchitecture uarch, where uarch is one of the arguments given
20393 above.
20394
20395 -m68000
20396 -mc68000
20397 Generate output for a 68000. This is the default when the compiler
20398 is configured for 68000-based systems. It is equivalent to
20399 -march=68000.
20400
20401 Use this option for microcontrollers with a 68000 or EC000 core,
20402 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20403
20404 -m68010
20405 Generate output for a 68010. This is the default when the compiler
20406 is configured for 68010-based systems. It is equivalent to
20407 -march=68010.
20408
20409 -m68020
20410 -mc68020
20411 Generate output for a 68020. This is the default when the compiler
20412 is configured for 68020-based systems. It is equivalent to
20413 -march=68020.
20414
20415 -m68030
20416 Generate output for a 68030. This is the default when the compiler
20417 is configured for 68030-based systems. It is equivalent to
20418 -march=68030.
20419
20420 -m68040
20421 Generate output for a 68040. This is the default when the compiler
20422 is configured for 68040-based systems. It is equivalent to
20423 -march=68040.
20424
20425 This option inhibits the use of 68881/68882 instructions that have
20426 to be emulated by software on the 68040. Use this option if your
20427 68040 does not have code to emulate those instructions.
20428
20429 -m68060
20430 Generate output for a 68060. This is the default when the compiler
20431 is configured for 68060-based systems. It is equivalent to
20432 -march=68060.
20433
20434 This option inhibits the use of 68020 and 68881/68882 instructions
20435 that have to be emulated by software on the 68060. Use this option
20436 if your 68060 does not have code to emulate those instructions.
20437
20438 -mcpu32
20439 Generate output for a CPU32. This is the default when the compiler
20440 is configured for CPU32-based systems. It is equivalent to
20441 -march=cpu32.
20442
20443 Use this option for microcontrollers with a CPU32 or CPU32+ core,
20444 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
20445 68341, 68349 and 68360.
20446
20447 -m5200
20448 Generate output for a 520X ColdFire CPU. This is the default when
20449 the compiler is configured for 520X-based systems. It is
20450 equivalent to -mcpu=5206, and is now deprecated in favor of that
20451 option.
20452
20453 Use this option for microcontroller with a 5200 core, including the
20454 MCF5202, MCF5203, MCF5204 and MCF5206.
20455
20456 -m5206e
20457 Generate output for a 5206e ColdFire CPU. The option is now
20458 deprecated in favor of the equivalent -mcpu=5206e.
20459
20460 -m528x
20461 Generate output for a member of the ColdFire 528X family. The
20462 option is now deprecated in favor of the equivalent -mcpu=528x.
20463
20464 -m5307
20465 Generate output for a ColdFire 5307 CPU. The option is now
20466 deprecated in favor of the equivalent -mcpu=5307.
20467
20468 -m5407
20469 Generate output for a ColdFire 5407 CPU. The option is now
20470 deprecated in favor of the equivalent -mcpu=5407.
20471
20472 -mcfv4e
20473 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
20474 This includes use of hardware floating-point instructions. The
20475 option is equivalent to -mcpu=547x, and is now deprecated in favor
20476 of that option.
20477
20478 -m68020-40
20479 Generate output for a 68040, without using any of the new
20480 instructions. This results in code that can run relatively
20481 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20482 generated code does use the 68881 instructions that are emulated on
20483 the 68040.
20484
20485 The option is equivalent to -march=68020 -mtune=68020-40.
20486
20487 -m68020-60
20488 Generate output for a 68060, without using any of the new
20489 instructions. This results in code that can run relatively
20490 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20491 generated code does use the 68881 instructions that are emulated on
20492 the 68060.
20493
20494 The option is equivalent to -march=68020 -mtune=68020-60.
20495
20496 -mhard-float
20497 -m68881
20498 Generate floating-point instructions. This is the default for
20499 68020 and above, and for ColdFire devices that have an FPU. It
20500 defines the macro "__HAVE_68881__" on M680x0 targets and
20501 "__mcffpu__" on ColdFire targets.
20502
20503 -msoft-float
20504 Do not generate floating-point instructions; use library calls
20505 instead. This is the default for 68000, 68010, and 68832 targets.
20506 It is also the default for ColdFire devices that have no FPU.
20507
20508 -mdiv
20509 -mno-div
20510 Generate (do not generate) ColdFire hardware divide and remainder
20511 instructions. If -march is used without -mcpu, the default is "on"
20512 for ColdFire architectures and "off" for M680x0 architectures.
20513 Otherwise, the default is taken from the target CPU (either the
20514 default CPU, or the one specified by -mcpu). For example, the
20515 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
20516
20517 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
20518
20519 -mshort
20520 Consider type "int" to be 16 bits wide, like "short int".
20521 Additionally, parameters passed on the stack are also aligned to a
20522 16-bit boundary even on targets whose API mandates promotion to
20523 32-bit.
20524
20525 -mno-short
20526 Do not consider type "int" to be 16 bits wide. This is the
20527 default.
20528
20529 -mnobitfield
20530 -mno-bitfield
20531 Do not use the bit-field instructions. The -m68000, -mcpu32 and
20532 -m5200 options imply -mnobitfield.
20533
20534 -mbitfield
20535 Do use the bit-field instructions. The -m68020 option implies
20536 -mbitfield. This is the default if you use a configuration
20537 designed for a 68020.
20538
20539 -mrtd
20540 Use a different function-calling convention, in which functions
20541 that take a fixed number of arguments return with the "rtd"
20542 instruction, which pops their arguments while returning. This
20543 saves one instruction in the caller since there is no need to pop
20544 the arguments there.
20545
20546 This calling convention is incompatible with the one normally used
20547 on Unix, so you cannot use it if you need to call libraries
20548 compiled with the Unix compiler.
20549
20550 Also, you must provide function prototypes for all functions that
20551 take variable numbers of arguments (including "printf"); otherwise
20552 incorrect code is generated for calls to those functions.
20553
20554 In addition, seriously incorrect code results if you call a
20555 function with too many arguments. (Normally, extra arguments are
20556 harmlessly ignored.)
20557
20558 The "rtd" instruction is supported by the 68010, 68020, 68030,
20559 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20560
20561 The default is -mno-rtd.
20562
20563 -malign-int
20564 -mno-align-int
20565 Control whether GCC aligns "int", "long", "long long", "float",
20566 "double", and "long double" variables on a 32-bit boundary
20567 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
20568 variables on 32-bit boundaries produces code that runs somewhat
20569 faster on processors with 32-bit busses at the expense of more
20570 memory.
20571
20572 Warning: if you use the -malign-int switch, GCC aligns structures
20573 containing the above types differently than most published
20574 application binary interface specifications for the m68k.
20575
20576 Use the pc-relative addressing mode of the 68000 directly, instead
20577 of using a global offset table. At present, this option implies
20578 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
20579 -fPIC is not presently supported with -mpcrel, though this could be
20580 supported for 68020 and higher processors.
20581
20582 -mno-strict-align
20583 -mstrict-align
20584 Do not (do) assume that unaligned memory references are handled by
20585 the system.
20586
20587 -msep-data
20588 Generate code that allows the data segment to be located in a
20589 different area of memory from the text segment. This allows for
20590 execute-in-place in an environment without virtual memory
20591 management. This option implies -fPIC.
20592
20593 -mno-sep-data
20594 Generate code that assumes that the data segment follows the text
20595 segment. This is the default.
20596
20597 -mid-shared-library
20598 Generate code that supports shared libraries via the library ID
20599 method. This allows for execute-in-place and shared libraries in
20600 an environment without virtual memory management. This option
20601 implies -fPIC.
20602
20603 -mno-id-shared-library
20604 Generate code that doesn't assume ID-based shared libraries are
20605 being used. This is the default.
20606
20607 -mshared-library-id=n
20608 Specifies the identification number of the ID-based shared library
20609 being compiled. Specifying a value of 0 generates more compact
20610 code; specifying other values forces the allocation of that number
20611 to the current library, but is no more space- or time-efficient
20612 than omitting this option.
20613
20614 -mxgot
20615 -mno-xgot
20616 When generating position-independent code for ColdFire, generate
20617 code that works if the GOT has more than 8192 entries. This code
20618 is larger and slower than code generated without this option. On
20619 M680x0 processors, this option is not needed; -fPIC suffices.
20620
20621 GCC normally uses a single instruction to load values from the GOT.
20622 While this is relatively efficient, it only works if the GOT is
20623 smaller than about 64k. Anything larger causes the linker to
20624 report an error such as:
20625
20626 relocation truncated to fit: R_68K_GOT16O foobar
20627
20628 If this happens, you should recompile your code with -mxgot. It
20629 should then work with very large GOTs. However, code generated
20630 with -mxgot is less efficient, since it takes 4 instructions to
20631 fetch the value of a global symbol.
20632
20633 Note that some linkers, including newer versions of the GNU linker,
20634 can create multiple GOTs and sort GOT entries. If you have such a
20635 linker, you should only need to use -mxgot when compiling a single
20636 object file that accesses more than 8192 GOT entries. Very few do.
20637
20638 These options have no effect unless GCC is generating position-
20639 independent code.
20640
20641 -mlong-jump-table-offsets
20642 Use 32-bit offsets in "switch" tables. The default is to use
20643 16-bit offsets.
20644
20645 MCore Options
20646 These are the -m options defined for the Motorola M*Core processors.
20647
20648 -mhardlit
20649 -mno-hardlit
20650 Inline constants into the code stream if it can be done in two
20651 instructions or less.
20652
20653 -mdiv
20654 -mno-div
20655 Use the divide instruction. (Enabled by default).
20656
20657 -mrelax-immediate
20658 -mno-relax-immediate
20659 Allow arbitrary-sized immediates in bit operations.
20660
20661 -mwide-bitfields
20662 -mno-wide-bitfields
20663 Always treat bit-fields as "int"-sized.
20664
20665 -m4byte-functions
20666 -mno-4byte-functions
20667 Force all functions to be aligned to a 4-byte boundary.
20668
20669 -mcallgraph-data
20670 -mno-callgraph-data
20671 Emit callgraph information.
20672
20673 -mslow-bytes
20674 -mno-slow-bytes
20675 Prefer word access when reading byte quantities.
20676
20677 -mlittle-endian
20678 -mbig-endian
20679 Generate code for a little-endian target.
20680
20681 -m210
20682 -m340
20683 Generate code for the 210 processor.
20684
20685 -mno-lsim
20686 Assume that runtime support has been provided and so omit the
20687 simulator library (libsim.a) from the linker command line.
20688
20689 -mstack-increment=size
20690 Set the maximum amount for a single stack increment operation.
20691 Large values can increase the speed of programs that contain
20692 functions that need a large amount of stack space, but they can
20693 also trigger a segmentation fault if the stack is extended too
20694 much. The default value is 0x1000.
20695
20696 MeP Options
20697 -mabsdiff
20698 Enables the "abs" instruction, which is the absolute difference
20699 between two registers.
20700
20701 -mall-opts
20702 Enables all the optional instructions---average, multiply, divide,
20703 bit operations, leading zero, absolute difference, min/max, clip,
20704 and saturation.
20705
20706 -maverage
20707 Enables the "ave" instruction, which computes the average of two
20708 registers.
20709
20710 -mbased=n
20711 Variables of size n bytes or smaller are placed in the ".based"
20712 section by default. Based variables use the $tp register as a base
20713 register, and there is a 128-byte limit to the ".based" section.
20714
20715 -mbitops
20716 Enables the bit operation instructions---bit test ("btstm"), set
20717 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
20718 ("tas").
20719
20720 -mc=name
20721 Selects which section constant data is placed in. name may be
20722 tiny, near, or far.
20723
20724 -mclip
20725 Enables the "clip" instruction. Note that -mclip is not useful
20726 unless you also provide -mminmax.
20727
20728 -mconfig=name
20729 Selects one of the built-in core configurations. Each MeP chip has
20730 one or more modules in it; each module has a core CPU and a variety
20731 of coprocessors, optional instructions, and peripherals. The
20732 "MeP-Integrator" tool, not part of GCC, provides these
20733 configurations through this option; using this option is the same
20734 as using all the corresponding command-line options. The default
20735 configuration is default.
20736
20737 -mcop
20738 Enables the coprocessor instructions. By default, this is a 32-bit
20739 coprocessor. Note that the coprocessor is normally enabled via the
20740 -mconfig= option.
20741
20742 -mcop32
20743 Enables the 32-bit coprocessor's instructions.
20744
20745 -mcop64
20746 Enables the 64-bit coprocessor's instructions.
20747
20748 -mivc2
20749 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20750
20751 -mdc
20752 Causes constant variables to be placed in the ".near" section.
20753
20754 -mdiv
20755 Enables the "div" and "divu" instructions.
20756
20757 -meb
20758 Generate big-endian code.
20759
20760 -mel
20761 Generate little-endian code.
20762
20763 -mio-volatile
20764 Tells the compiler that any variable marked with the "io" attribute
20765 is to be considered volatile.
20766
20767 -ml Causes variables to be assigned to the ".far" section by default.
20768
20769 -mleadz
20770 Enables the "leadz" (leading zero) instruction.
20771
20772 -mm Causes variables to be assigned to the ".near" section by default.
20773
20774 -mminmax
20775 Enables the "min" and "max" instructions.
20776
20777 -mmult
20778 Enables the multiplication and multiply-accumulate instructions.
20779
20780 -mno-opts
20781 Disables all the optional instructions enabled by -mall-opts.
20782
20783 -mrepeat
20784 Enables the "repeat" and "erepeat" instructions, used for low-
20785 overhead looping.
20786
20787 -ms Causes all variables to default to the ".tiny" section. Note that
20788 there is a 65536-byte limit to this section. Accesses to these
20789 variables use the %gp base register.
20790
20791 -msatur
20792 Enables the saturation instructions. Note that the compiler does
20793 not currently generate these itself, but this option is included
20794 for compatibility with other tools, like "as".
20795
20796 -msdram
20797 Link the SDRAM-based runtime instead of the default ROM-based
20798 runtime.
20799
20800 -msim
20801 Link the simulator run-time libraries.
20802
20803 -msimnovec
20804 Link the simulator runtime libraries, excluding built-in support
20805 for reset and exception vectors and tables.
20806
20807 -mtf
20808 Causes all functions to default to the ".far" section. Without
20809 this option, functions default to the ".near" section.
20810
20811 -mtiny=n
20812 Variables that are n bytes or smaller are allocated to the ".tiny"
20813 section. These variables use the $gp base register. The default
20814 for this option is 4, but note that there's a 65536-byte limit to
20815 the ".tiny" section.
20816
20817 MicroBlaze Options
20818 -msoft-float
20819 Use software emulation for floating point (default).
20820
20821 -mhard-float
20822 Use hardware floating-point instructions.
20823
20824 -mmemcpy
20825 Do not optimize block moves, use "memcpy".
20826
20827 -mno-clearbss
20828 This option is deprecated. Use -fno-zero-initialized-in-bss
20829 instead.
20830
20831 -mcpu=cpu-type
20832 Use features of, and schedule code for, the given CPU. Supported
20833 values are in the format vX.YY.Z, where X is a major version, YY is
20834 the minor version, and Z is compatibility code. Example values are
20835 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
20836
20837 -mxl-soft-mul
20838 Use software multiply emulation (default).
20839
20840 -mxl-soft-div
20841 Use software emulation for divides (default).
20842
20843 -mxl-barrel-shift
20844 Use the hardware barrel shifter.
20845
20846 -mxl-pattern-compare
20847 Use pattern compare instructions.
20848
20849 -msmall-divides
20850 Use table lookup optimization for small signed integer divisions.
20851
20852 -mxl-stack-check
20853 This option is deprecated. Use -fstack-check instead.
20854
20855 -mxl-gp-opt
20856 Use GP-relative ".sdata"/".sbss" sections.
20857
20858 -mxl-multiply-high
20859 Use multiply high instructions for high part of 32x32 multiply.
20860
20861 -mxl-float-convert
20862 Use hardware floating-point conversion instructions.
20863
20864 -mxl-float-sqrt
20865 Use hardware floating-point square root instruction.
20866
20867 -mbig-endian
20868 Generate code for a big-endian target.
20869
20870 -mlittle-endian
20871 Generate code for a little-endian target.
20872
20873 -mxl-reorder
20874 Use reorder instructions (swap and byte reversed load/store).
20875
20876 -mxl-mode-app-model
20877 Select application model app-model. Valid models are
20878
20879 executable
20880 normal executable (default), uses startup code crt0.o.
20881
20882 -mpic-data-is-text-relative
20883 Assume that the displacement between the text and data segments
20884 is fixed at static link time. This allows data to be
20885 referenced by offset from start of text address instead of GOT
20886 since PC-relative addressing is not supported.
20887
20888 xmdstub
20889 for use with Xilinx Microprocessor Debugger (XMD) based
20890 software intrusive debug agent called xmdstub. This uses
20891 startup file crt1.o and sets the start address of the program
20892 to 0x800.
20893
20894 bootstrap
20895 for applications that are loaded using a bootloader. This
20896 model uses startup file crt2.o which does not contain a
20897 processor reset vector handler. This is suitable for
20898 transferring control on a processor reset to the bootloader
20899 rather than the application.
20900
20901 novectors
20902 for applications that do not require any of the MicroBlaze
20903 vectors. This option may be useful for applications running
20904 within a monitoring application. This model uses crt3.o as a
20905 startup file.
20906
20907 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
20908 model.
20909
20910 MIPS Options
20911 -EB Generate big-endian code.
20912
20913 -EL Generate little-endian code. This is the default for mips*el-*-*
20914 configurations.
20915
20916 -march=arch
20917 Generate code that runs on arch, which can be the name of a generic
20918 MIPS ISA, or the name of a particular processor. The ISA names
20919 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
20920 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
20921 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
20922 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
20923 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
20924 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
20925 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
20926 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
20927 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
20928 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
20929 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
20930 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
20931 and xlp. The special value from-abi selects the most compatible
20932 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
20933 and mips3 for 64-bit ABIs).
20934
20935 The native Linux/GNU toolchain also supports the value native,
20936 which selects the best architecture option for the host processor.
20937 -march=native has no effect if GCC does not recognize the
20938 processor.
20939
20940 In processor names, a final 000 can be abbreviated as k (for
20941 example, -march=r2k). Prefixes are optional, and vr may be written
20942 r.
20943
20944 Names of the form nf2_1 refer to processors with FPUs clocked at
20945 half the rate of the core, names of the form nf1_1 refer to
20946 processors with FPUs clocked at the same rate as the core, and
20947 names of the form nf3_2 refer to processors with FPUs clocked a
20948 ratio of 3:2 with respect to the core. For compatibility reasons,
20949 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
20950 as synonyms for nf1_1.
20951
20952 GCC defines two macros based on the value of this option. The
20953 first is "_MIPS_ARCH", which gives the name of target architecture,
20954 as a string. The second has the form "_MIPS_ARCH_foo", where foo
20955 is the capitalized value of "_MIPS_ARCH". For example,
20956 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
20957 "_MIPS_ARCH_R2000".
20958
20959 Note that the "_MIPS_ARCH" macro uses the processor names given
20960 above. In other words, it has the full prefix and does not
20961 abbreviate 000 as k. In the case of from-abi, the macro names the
20962 resolved architecture (either "mips1" or "mips3"). It names the
20963 default architecture when no -march option is given.
20964
20965 -mtune=arch
20966 Optimize for arch. Among other things, this option controls the
20967 way instructions are scheduled, and the perceived cost of
20968 arithmetic operations. The list of arch values is the same as for
20969 -march.
20970
20971 When this option is not used, GCC optimizes for the processor
20972 specified by -march. By using -march and -mtune together, it is
20973 possible to generate code that runs on a family of processors, but
20974 optimize the code for one particular member of that family.
20975
20976 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
20977 work in the same way as the -march ones described above.
20978
20979 -mips1
20980 Equivalent to -march=mips1.
20981
20982 -mips2
20983 Equivalent to -march=mips2.
20984
20985 -mips3
20986 Equivalent to -march=mips3.
20987
20988 -mips4
20989 Equivalent to -march=mips4.
20990
20991 -mips32
20992 Equivalent to -march=mips32.
20993
20994 -mips32r3
20995 Equivalent to -march=mips32r3.
20996
20997 -mips32r5
20998 Equivalent to -march=mips32r5.
20999
21000 -mips32r6
21001 Equivalent to -march=mips32r6.
21002
21003 -mips64
21004 Equivalent to -march=mips64.
21005
21006 -mips64r2
21007 Equivalent to -march=mips64r2.
21008
21009 -mips64r3
21010 Equivalent to -march=mips64r3.
21011
21012 -mips64r5
21013 Equivalent to -march=mips64r5.
21014
21015 -mips64r6
21016 Equivalent to -march=mips64r6.
21017
21018 -mips16
21019 -mno-mips16
21020 Generate (do not generate) MIPS16 code. If GCC is targeting a
21021 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
21022
21023 MIPS16 code generation can also be controlled on a per-function
21024 basis by means of "mips16" and "nomips16" attributes.
21025
21026 -mflip-mips16
21027 Generate MIPS16 code on alternating functions. This option is
21028 provided for regression testing of mixed MIPS16/non-MIPS16 code
21029 generation, and is not intended for ordinary use in compiling user
21030 code.
21031
21032 -minterlink-compressed
21033 -mno-interlink-compressed
21034 Require (do not require) that code using the standard
21035 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
21036 microMIPS code, and vice versa.
21037
21038 For example, code using the standard ISA encoding cannot jump
21039 directly to MIPS16 or microMIPS code; it must either use a call or
21040 an indirect jump. -minterlink-compressed therefore disables direct
21041 jumps unless GCC knows that the target of the jump is not
21042 compressed.
21043
21044 -minterlink-mips16
21045 -mno-interlink-mips16
21046 Aliases of -minterlink-compressed and -mno-interlink-compressed.
21047 These options predate the microMIPS ASE and are retained for
21048 backwards compatibility.
21049
21050 -mabi=32
21051 -mabi=o64
21052 -mabi=n32
21053 -mabi=64
21054 -mabi=eabi
21055 Generate code for the given ABI.
21056
21057 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21058 generates 64-bit code when you select a 64-bit architecture, but
21059 you can use -mgp32 to get 32-bit code instead.
21060
21061 For information about the O64 ABI, see
21062 <http://gcc.gnu.org/projects/mipso64-abi.html>.
21063
21064 GCC supports a variant of the o32 ABI in which floating-point
21065 registers are 64 rather than 32 bits wide. You can select this
21066 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
21067 and "mfhc1" instructions and is therefore only supported for
21068 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21069
21070 The register assignments for arguments and return values remain the
21071 same, but each scalar value is passed in a single 64-bit register
21072 rather than a pair of 32-bit registers. For example, scalar
21073 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
21074 The set of call-saved registers also remains the same in that the
21075 even-numbered double-precision registers are saved.
21076
21077 Two additional variants of the o32 ABI are supported to enable a
21078 transition from 32-bit to 64-bit registers. These are FPXX
21079 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
21080 mandates that all code must execute correctly when run using 32-bit
21081 or 64-bit registers. The code can be interlinked with either FP32
21082 or FP64, but not both. The FP64A extension is similar to the FP64
21083 extension but forbids the use of odd-numbered single-precision
21084 registers. This can be used in conjunction with the "FRE" mode of
21085 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
21086 interlink and run in the same process without changing FPU modes.
21087
21088 -mabicalls
21089 -mno-abicalls
21090 Generate (do not generate) code that is suitable for SVR4-style
21091 dynamic objects. -mabicalls is the default for SVR4-based systems.
21092
21093 -mshared
21094 -mno-shared
21095 Generate (do not generate) code that is fully position-independent,
21096 and that can therefore be linked into shared libraries. This
21097 option only affects -mabicalls.
21098
21099 All -mabicalls code has traditionally been position-independent,
21100 regardless of options like -fPIC and -fpic. However, as an
21101 extension, the GNU toolchain allows executables to use absolute
21102 accesses for locally-binding symbols. It can also use shorter GP
21103 initialization sequences and generate direct calls to locally-
21104 defined functions. This mode is selected by -mno-shared.
21105
21106 -mno-shared depends on binutils 2.16 or higher and generates
21107 objects that can only be linked by the GNU linker. However, the
21108 option does not affect the ABI of the final executable; it only
21109 affects the ABI of relocatable objects. Using -mno-shared
21110 generally makes executables both smaller and quicker.
21111
21112 -mshared is the default.
21113
21114 -mplt
21115 -mno-plt
21116 Assume (do not assume) that the static and dynamic linkers support
21117 PLTs and copy relocations. This option only affects -mno-shared
21118 -mabicalls. For the n64 ABI, this option has no effect without
21119 -msym32.
21120
21121 You can make -mplt the default by configuring GCC with
21122 --with-mips-plt. The default is -mno-plt otherwise.
21123
21124 -mxgot
21125 -mno-xgot
21126 Lift (do not lift) the usual restrictions on the size of the global
21127 offset table.
21128
21129 GCC normally uses a single instruction to load values from the GOT.
21130 While this is relatively efficient, it only works if the GOT is
21131 smaller than about 64k. Anything larger causes the linker to
21132 report an error such as:
21133
21134 relocation truncated to fit: R_MIPS_GOT16 foobar
21135
21136 If this happens, you should recompile your code with -mxgot. This
21137 works with very large GOTs, although the code is also less
21138 efficient, since it takes three instructions to fetch the value of
21139 a global symbol.
21140
21141 Note that some linkers can create multiple GOTs. If you have such
21142 a linker, you should only need to use -mxgot when a single object
21143 file accesses more than 64k's worth of GOT entries. Very few do.
21144
21145 These options have no effect unless GCC is generating position
21146 independent code.
21147
21148 -mgp32
21149 Assume that general-purpose registers are 32 bits wide.
21150
21151 -mgp64
21152 Assume that general-purpose registers are 64 bits wide.
21153
21154 -mfp32
21155 Assume that floating-point registers are 32 bits wide.
21156
21157 -mfp64
21158 Assume that floating-point registers are 64 bits wide.
21159
21160 -mfpxx
21161 Do not assume the width of floating-point registers.
21162
21163 -mhard-float
21164 Use floating-point coprocessor instructions.
21165
21166 -msoft-float
21167 Do not use floating-point coprocessor instructions. Implement
21168 floating-point calculations using library calls instead.
21169
21170 -mno-float
21171 Equivalent to -msoft-float, but additionally asserts that the
21172 program being compiled does not perform any floating-point
21173 operations. This option is presently supported only by some bare-
21174 metal MIPS configurations, where it may select a special set of
21175 libraries that lack all floating-point support (including, for
21176 example, the floating-point "printf" formats). If code compiled
21177 with -mno-float accidentally contains floating-point operations, it
21178 is likely to suffer a link-time or run-time failure.
21179
21180 -msingle-float
21181 Assume that the floating-point coprocessor only supports single-
21182 precision operations.
21183
21184 -mdouble-float
21185 Assume that the floating-point coprocessor supports double-
21186 precision operations. This is the default.
21187
21188 -modd-spreg
21189 -mno-odd-spreg
21190 Enable the use of odd-numbered single-precision floating-point
21191 registers for the o32 ABI. This is the default for processors that
21192 are known to support these registers. When using the o32 FPXX ABI,
21193 -mno-odd-spreg is set by default.
21194
21195 -mabs=2008
21196 -mabs=legacy
21197 These options control the treatment of the special not-a-number
21198 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
21199 machine instructions.
21200
21201 By default or when -mabs=legacy is used the legacy treatment is
21202 selected. In this case these instructions are considered
21203 arithmetic and avoided where correct operation is required and the
21204 input operand might be a NaN. A longer sequence of instructions
21205 that manipulate the sign bit of floating-point datum manually is
21206 used instead unless the -ffinite-math-only option has also been
21207 specified.
21208
21209 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
21210 case these instructions are considered non-arithmetic and therefore
21211 operating correctly in all cases, including in particular where the
21212 input operand is a NaN. These instructions are therefore always
21213 used for the respective operations.
21214
21215 -mnan=2008
21216 -mnan=legacy
21217 These options control the encoding of the special not-a-number
21218 (NaN) IEEE 754 floating-point data.
21219
21220 The -mnan=legacy option selects the legacy encoding. In this case
21221 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21222 significand field being 0, whereas signaling NaNs (sNaNs) are
21223 denoted by the first bit of their trailing significand field being
21224 1.
21225
21226 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
21227 case qNaNs are denoted by the first bit of their trailing
21228 significand field being 1, whereas sNaNs are denoted by the first
21229 bit of their trailing significand field being 0.
21230
21231 The default is -mnan=legacy unless GCC has been configured with
21232 --with-nan=2008.
21233
21234 -mllsc
21235 -mno-llsc
21236 Use (do not use) ll, sc, and sync instructions to implement atomic
21237 memory built-in functions. When neither option is specified, GCC
21238 uses the instructions if the target architecture supports them.
21239
21240 -mllsc is useful if the runtime environment can emulate the
21241 instructions and -mno-llsc can be useful when compiling for
21242 nonstandard ISAs. You can make either option the default by
21243 configuring GCC with --with-llsc and --without-llsc respectively.
21244 --with-llsc is the default for some configurations; see the
21245 installation documentation for details.
21246
21247 -mdsp
21248 -mno-dsp
21249 Use (do not use) revision 1 of the MIPS DSP ASE.
21250 This option defines the preprocessor macro "__mips_dsp". It also
21251 defines "__mips_dsp_rev" to 1.
21252
21253 -mdspr2
21254 -mno-dspr2
21255 Use (do not use) revision 2 of the MIPS DSP ASE.
21256 This option defines the preprocessor macros "__mips_dsp" and
21257 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
21258
21259 -msmartmips
21260 -mno-smartmips
21261 Use (do not use) the MIPS SmartMIPS ASE.
21262
21263 -mpaired-single
21264 -mno-paired-single
21265 Use (do not use) paired-single floating-point instructions.
21266 This option requires hardware floating-point support to be
21267 enabled.
21268
21269 -mdmx
21270 -mno-mdmx
21271 Use (do not use) MIPS Digital Media Extension instructions. This
21272 option can only be used when generating 64-bit code and requires
21273 hardware floating-point support to be enabled.
21274
21275 -mips3d
21276 -mno-mips3d
21277 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
21278 -mpaired-single.
21279
21280 -mmicromips
21281 -mno-micromips
21282 Generate (do not generate) microMIPS code.
21283
21284 MicroMIPS code generation can also be controlled on a per-function
21285 basis by means of "micromips" and "nomicromips" attributes.
21286
21287 -mmt
21288 -mno-mt
21289 Use (do not use) MT Multithreading instructions.
21290
21291 -mmcu
21292 -mno-mcu
21293 Use (do not use) the MIPS MCU ASE instructions.
21294
21295 -meva
21296 -mno-eva
21297 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21298
21299 -mvirt
21300 -mno-virt
21301 Use (do not use) the MIPS Virtualization (VZ) instructions.
21302
21303 -mxpa
21304 -mno-xpa
21305 Use (do not use) the MIPS eXtended Physical Address (XPA)
21306 instructions.
21307
21308 -mcrc
21309 -mno-crc
21310 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
21311 instructions.
21312
21313 -mginv
21314 -mno-ginv
21315 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21316
21317 -mloongson-mmi
21318 -mno-loongson-mmi
21319 Use (do not use) the MIPS Loongson MultiMedia extensions
21320 Instructions (MMI).
21321
21322 -mloongson-ext
21323 -mno-loongson-ext
21324 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21325
21326 -mloongson-ext2
21327 -mno-loongson-ext2
21328 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
21329 instructions.
21330
21331 -mlong64
21332 Force "long" types to be 64 bits wide. See -mlong32 for an
21333 explanation of the default and the way that the pointer size is
21334 determined.
21335
21336 -mlong32
21337 Force "long", "int", and pointer types to be 32 bits wide.
21338
21339 The default size of "int"s, "long"s and pointers depends on the
21340 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
21341 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
21342 "long"s. Pointers are the same size as "long"s, or the same size
21343 as integer registers, whichever is smaller.
21344
21345 -msym32
21346 -mno-sym32
21347 Assume (do not assume) that all symbols have 32-bit values,
21348 regardless of the selected ABI. This option is useful in
21349 combination with -mabi=64 and -mno-abicalls because it allows GCC
21350 to generate shorter and faster references to symbolic addresses.
21351
21352 -G num
21353 Put definitions of externally-visible data in a small data section
21354 if that data is no bigger than num bytes. GCC can then generate
21355 more efficient accesses to the data; see -mgpopt for details.
21356
21357 The default -G option depends on the configuration.
21358
21359 -mlocal-sdata
21360 -mno-local-sdata
21361 Extend (do not extend) the -G behavior to local data too, such as
21362 to static variables in C. -mlocal-sdata is the default for all
21363 configurations.
21364
21365 If the linker complains that an application is using too much small
21366 data, you might want to try rebuilding the less performance-
21367 critical parts with -mno-local-sdata. You might also want to build
21368 large libraries with -mno-local-sdata, so that the libraries leave
21369 more room for the main program.
21370
21371 -mextern-sdata
21372 -mno-extern-sdata
21373 Assume (do not assume) that externally-defined data is in a small
21374 data section if the size of that data is within the -G limit.
21375 -mextern-sdata is the default for all configurations.
21376
21377 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
21378 Mod references a variable Var that is no bigger than num bytes, you
21379 must make sure that Var is placed in a small data section. If Var
21380 is defined by another module, you must either compile that module
21381 with a high-enough -G setting or attach a "section" attribute to
21382 Var's definition. If Var is common, you must link the application
21383 with a high-enough -G setting.
21384
21385 The easiest way of satisfying these restrictions is to compile and
21386 link every module with the same -G option. However, you may wish
21387 to build a library that supports several different small data
21388 limits. You can do this by compiling the library with the highest
21389 supported -G setting and additionally using -mno-extern-sdata to
21390 stop the library from making assumptions about externally-defined
21391 data.
21392
21393 -mgpopt
21394 -mno-gpopt
21395 Use (do not use) GP-relative accesses for symbols that are known to
21396 be in a small data section; see -G, -mlocal-sdata and
21397 -mextern-sdata. -mgpopt is the default for all configurations.
21398
21399 -mno-gpopt is useful for cases where the $gp register might not
21400 hold the value of "_gp". For example, if the code is part of a
21401 library that might be used in a boot monitor, programs that call
21402 boot monitor routines pass an unknown value in $gp. (In such
21403 situations, the boot monitor itself is usually compiled with -G0.)
21404
21405 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
21406
21407 -membedded-data
21408 -mno-embedded-data
21409 Allocate variables to the read-only data section first if possible,
21410 then next in the small data section if possible, otherwise in data.
21411 This gives slightly slower code than the default, but reduces the
21412 amount of RAM required when executing, and thus may be preferred
21413 for some embedded systems.
21414
21415 -muninit-const-in-rodata
21416 -mno-uninit-const-in-rodata
21417 Put uninitialized "const" variables in the read-only data section.
21418 This option is only meaningful in conjunction with -membedded-data.
21419
21420 -mcode-readable=setting
21421 Specify whether GCC may generate code that reads from executable
21422 sections. There are three possible settings:
21423
21424 -mcode-readable=yes
21425 Instructions may freely access executable sections. This is
21426 the default setting.
21427
21428 -mcode-readable=pcrel
21429 MIPS16 PC-relative load instructions can access executable
21430 sections, but other instructions must not do so. This option
21431 is useful on 4KSc and 4KSd processors when the code TLBs have
21432 the Read Inhibit bit set. It is also useful on processors that
21433 can be configured to have a dual instruction/data SRAM
21434 interface and that, like the M4K, automatically redirect PC-
21435 relative loads to the instruction RAM.
21436
21437 -mcode-readable=no
21438 Instructions must not access executable sections. This option
21439 can be useful on targets that are configured to have a dual
21440 instruction/data SRAM interface but that (unlike the M4K) do
21441 not automatically redirect PC-relative loads to the instruction
21442 RAM.
21443
21444 -msplit-addresses
21445 -mno-split-addresses
21446 Enable (disable) use of the "%hi()" and "%lo()" assembler
21447 relocation operators. This option has been superseded by
21448 -mexplicit-relocs but is retained for backwards compatibility.
21449
21450 -mexplicit-relocs
21451 -mno-explicit-relocs
21452 Use (do not use) assembler relocation operators when dealing with
21453 symbolic addresses. The alternative, selected by
21454 -mno-explicit-relocs, is to use assembler macros instead.
21455
21456 -mexplicit-relocs is the default if GCC was configured to use an
21457 assembler that supports relocation operators.
21458
21459 -mcheck-zero-division
21460 -mno-check-zero-division
21461 Trap (do not trap) on integer division by zero.
21462
21463 The default is -mcheck-zero-division.
21464
21465 -mdivide-traps
21466 -mdivide-breaks
21467 MIPS systems check for division by zero by generating either a
21468 conditional trap or a break instruction. Using traps results in
21469 smaller code, but is only supported on MIPS II and later. Also,
21470 some versions of the Linux kernel have a bug that prevents trap
21471 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
21472 to allow conditional traps on architectures that support them and
21473 -mdivide-breaks to force the use of breaks.
21474
21475 The default is usually -mdivide-traps, but this can be overridden
21476 at configure time using --with-divide=breaks. Divide-by-zero
21477 checks can be completely disabled using -mno-check-zero-division.
21478
21479 -mload-store-pairs
21480 -mno-load-store-pairs
21481 Enable (disable) an optimization that pairs consecutive load or
21482 store instructions to enable load/store bonding. This option is
21483 enabled by default but only takes effect when the selected
21484 architecture is known to support bonding.
21485
21486 -mmemcpy
21487 -mno-memcpy
21488 Force (do not force) the use of "memcpy" for non-trivial block
21489 moves. The default is -mno-memcpy, which allows GCC to inline most
21490 constant-sized copies.
21491
21492 -mlong-calls
21493 -mno-long-calls
21494 Disable (do not disable) use of the "jal" instruction. Calling
21495 functions using "jal" is more efficient but requires the caller and
21496 callee to be in the same 256 megabyte segment.
21497
21498 This option has no effect on abicalls code. The default is
21499 -mno-long-calls.
21500
21501 -mmad
21502 -mno-mad
21503 Enable (disable) use of the "mad", "madu" and "mul" instructions,
21504 as provided by the R4650 ISA.
21505
21506 -mimadd
21507 -mno-imadd
21508 Enable (disable) use of the "madd" and "msub" integer instructions.
21509 The default is -mimadd on architectures that support "madd" and
21510 "msub" except for the 74k architecture where it was found to
21511 generate slower code.
21512
21513 -mfused-madd
21514 -mno-fused-madd
21515 Enable (disable) use of the floating-point multiply-accumulate
21516 instructions, when they are available. The default is
21517 -mfused-madd.
21518
21519 On the R8000 CPU when multiply-accumulate instructions are used,
21520 the intermediate product is calculated to infinite precision and is
21521 not subject to the FCSR Flush to Zero bit. This may be undesirable
21522 in some circumstances. On other processors the result is
21523 numerically identical to the equivalent computation using separate
21524 multiply, add, subtract and negate instructions.
21525
21526 -nocpp
21527 Tell the MIPS assembler to not run its preprocessor over user
21528 assembler files (with a .s suffix) when assembling them.
21529
21530 -mfix-24k
21531 -mno-fix-24k
21532 Work around the 24K E48 (lost data on stores during refill) errata.
21533 The workarounds are implemented by the assembler rather than by
21534 GCC.
21535
21536 -mfix-r4000
21537 -mno-fix-r4000
21538 Work around certain R4000 CPU errata:
21539
21540 - A double-word or a variable shift may give an incorrect result
21541 if executed immediately after starting an integer division.
21542
21543 - A double-word or a variable shift may give an incorrect result
21544 if executed while an integer multiplication is in progress.
21545
21546 - An integer division may give an incorrect result if started in
21547 a delay slot of a taken branch or a jump.
21548
21549 -mfix-r4400
21550 -mno-fix-r4400
21551 Work around certain R4400 CPU errata:
21552
21553 - A double-word or a variable shift may give an incorrect result
21554 if executed immediately after starting an integer division.
21555
21556 -mfix-r10000
21557 -mno-fix-r10000
21558 Work around certain R10000 errata:
21559
21560 - "ll"/"sc" sequences may not behave atomically on revisions
21561 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21562
21563 This option can only be used if the target architecture supports
21564 branch-likely instructions. -mfix-r10000 is the default when
21565 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
21566
21567 -mfix-r5900
21568 -mno-fix-r5900
21569 Do not attempt to schedule the preceding instruction into the delay
21570 slot of a branch instruction placed at the end of a short loop of
21571 six instructions or fewer and always schedule a "nop" instruction
21572 there instead. The short loop bug under certain conditions causes
21573 loops to execute only once or twice, due to a hardware bug in the
21574 R5900 chip. The workaround is implemented by the assembler rather
21575 than by GCC.
21576
21577 -mfix-rm7000
21578 -mno-fix-rm7000
21579 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
21580 are implemented by the assembler rather than by GCC.
21581
21582 -mfix-vr4120
21583 -mno-fix-vr4120
21584 Work around certain VR4120 errata:
21585
21586 - "dmultu" does not always produce the correct result.
21587
21588 - "div" and "ddiv" do not always produce the correct result if
21589 one of the operands is negative.
21590
21591 The workarounds for the division errata rely on special functions
21592 in libgcc.a. At present, these functions are only provided by the
21593 "mips64vr*-elf" configurations.
21594
21595 Other VR4120 errata require a NOP to be inserted between certain
21596 pairs of instructions. These errata are handled by the assembler,
21597 not by GCC itself.
21598
21599 -mfix-vr4130
21600 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
21601 implemented by the assembler rather than by GCC, although GCC
21602 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
21603 "dmacc" and "dmacchi" instructions are available instead.
21604
21605 -mfix-sb1
21606 -mno-fix-sb1
21607 Work around certain SB-1 CPU core errata. (This flag currently
21608 works around the SB-1 revision 2 "F1" and "F2" floating-point
21609 errata.)
21610
21611 -mr10k-cache-barrier=setting
21612 Specify whether GCC should insert cache barriers to avoid the side
21613 effects of speculation on R10K processors.
21614
21615 In common with many processors, the R10K tries to predict the
21616 outcome of a conditional branch and speculatively executes
21617 instructions from the "taken" branch. It later aborts these
21618 instructions if the predicted outcome is wrong. However, on the
21619 R10K, even aborted instructions can have side effects.
21620
21621 This problem only affects kernel stores and, depending on the
21622 system, kernel loads. As an example, a speculatively-executed
21623 store may load the target memory into cache and mark the cache line
21624 as dirty, even if the store itself is later aborted. If a DMA
21625 operation writes to the same area of memory before the "dirty" line
21626 is flushed, the cached data overwrites the DMA-ed data. See the
21627 R10K processor manual for a full description, including other
21628 potential problems.
21629
21630 One workaround is to insert cache barrier instructions before every
21631 memory access that might be speculatively executed and that might
21632 have side effects even if aborted. -mr10k-cache-barrier=setting
21633 controls GCC's implementation of this workaround. It assumes that
21634 aborted accesses to any byte in the following regions does not have
21635 side effects:
21636
21637 1. the memory occupied by the current function's stack frame;
21638
21639 2. the memory occupied by an incoming stack argument;
21640
21641 3. the memory occupied by an object with a link-time-constant
21642 address.
21643
21644 It is the kernel's responsibility to ensure that speculative
21645 accesses to these regions are indeed safe.
21646
21647 If the input program contains a function declaration such as:
21648
21649 void foo (void);
21650
21651 then the implementation of "foo" must allow "j foo" and "jal foo"
21652 to be executed speculatively. GCC honors this restriction for
21653 functions it compiles itself. It expects non-GCC functions (such
21654 as hand-written assembly code) to do the same.
21655
21656 The option has three forms:
21657
21658 -mr10k-cache-barrier=load-store
21659 Insert a cache barrier before a load or store that might be
21660 speculatively executed and that might have side effects even if
21661 aborted.
21662
21663 -mr10k-cache-barrier=store
21664 Insert a cache barrier before a store that might be
21665 speculatively executed and that might have side effects even if
21666 aborted.
21667
21668 -mr10k-cache-barrier=none
21669 Disable the insertion of cache barriers. This is the default
21670 setting.
21671
21672 -mflush-func=func
21673 -mno-flush-func
21674 Specifies the function to call to flush the I and D caches, or to
21675 not call any such function. If called, the function must take the
21676 same arguments as the common "_flush_func", that is, the address of
21677 the memory range for which the cache is being flushed, the size of
21678 the memory range, and the number 3 (to flush both caches). The
21679 default depends on the target GCC was configured for, but commonly
21680 is either "_flush_func" or "__cpu_flush".
21681
21682 mbranch-cost=num
21683 Set the cost of branches to roughly num "simple" instructions.
21684 This cost is only a heuristic and is not guaranteed to produce
21685 consistent results across releases. A zero cost redundantly
21686 selects the default, which is based on the -mtune setting.
21687
21688 -mbranch-likely
21689 -mno-branch-likely
21690 Enable or disable use of Branch Likely instructions, regardless of
21691 the default for the selected architecture. By default, Branch
21692 Likely instructions may be generated if they are supported by the
21693 selected architecture. An exception is for the MIPS32 and MIPS64
21694 architectures and processors that implement those architectures;
21695 for those, Branch Likely instructions are not be generated by
21696 default because the MIPS32 and MIPS64 architectures specifically
21697 deprecate their use.
21698
21699 -mcompact-branches=never
21700 -mcompact-branches=optimal
21701 -mcompact-branches=always
21702 These options control which form of branches will be generated.
21703 The default is -mcompact-branches=optimal.
21704
21705 The -mcompact-branches=never option ensures that compact branch
21706 instructions will never be generated.
21707
21708 The -mcompact-branches=always option ensures that a compact branch
21709 instruction will be generated if available. If a compact branch
21710 instruction is not available, a delay slot form of the branch will
21711 be used instead.
21712
21713 This option is supported from MIPS Release 6 onwards.
21714
21715 The -mcompact-branches=optimal option will cause a delay slot
21716 branch to be used if one is available in the current ISA and the
21717 delay slot is successfully filled. If the delay slot is not
21718 filled, a compact branch will be chosen if one is available.
21719
21720 -mfp-exceptions
21721 -mno-fp-exceptions
21722 Specifies whether FP exceptions are enabled. This affects how FP
21723 instructions are scheduled for some processors. The default is
21724 that FP exceptions are enabled.
21725
21726 For instance, on the SB-1, if FP exceptions are disabled, and we
21727 are emitting 64-bit code, then we can use both FP pipes.
21728 Otherwise, we can only use one FP pipe.
21729
21730 -mvr4130-align
21731 -mno-vr4130-align
21732 The VR4130 pipeline is two-way superscalar, but can only issue two
21733 instructions together if the first one is 8-byte aligned. When
21734 this option is enabled, GCC aligns pairs of instructions that it
21735 thinks should execute in parallel.
21736
21737 This option only has an effect when optimizing for the VR4130. It
21738 normally makes code faster, but at the expense of making it bigger.
21739 It is enabled by default at optimization level -O3.
21740
21741 -msynci
21742 -mno-synci
21743 Enable (disable) generation of "synci" instructions on
21744 architectures that support it. The "synci" instructions (if
21745 enabled) are generated when "__builtin___clear_cache" is compiled.
21746
21747 This option defaults to -mno-synci, but the default can be
21748 overridden by configuring GCC with --with-synci.
21749
21750 When compiling code for single processor systems, it is generally
21751 safe to use "synci". However, on many multi-core (SMP) systems, it
21752 does not invalidate the instruction caches on all cores and may
21753 lead to undefined behavior.
21754
21755 -mrelax-pic-calls
21756 -mno-relax-pic-calls
21757 Try to turn PIC calls that are normally dispatched via register $25
21758 into direct calls. This is only possible if the linker can resolve
21759 the destination at link time and if the destination is within range
21760 for a direct call.
21761
21762 -mrelax-pic-calls is the default if GCC was configured to use an
21763 assembler and a linker that support the ".reloc" assembly directive
21764 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
21765 this optimization can be performed by the assembler and the linker
21766 alone without help from the compiler.
21767
21768 -mmcount-ra-address
21769 -mno-mcount-ra-address
21770 Emit (do not emit) code that allows "_mcount" to modify the calling
21771 function's return address. When enabled, this option extends the
21772 usual "_mcount" interface with a new ra-address parameter, which
21773 has type "intptr_t *" and is passed in register $12. "_mcount" can
21774 then modify the return address by doing both of the following:
21775
21776 * Returning the new address in register $31.
21777
21778 * Storing the new address in "*ra-address", if ra-address is
21779 nonnull.
21780
21781 The default is -mno-mcount-ra-address.
21782
21783 -mframe-header-opt
21784 -mno-frame-header-opt
21785 Enable (disable) frame header optimization in the o32 ABI. When
21786 using the o32 ABI, calling functions will allocate 16 bytes on the
21787 stack for the called function to write out register arguments.
21788 When enabled, this optimization will suppress the allocation of the
21789 frame header if it can be determined that it is unused.
21790
21791 This optimization is off by default at all optimization levels.
21792
21793 -mlxc1-sxc1
21794 -mno-lxc1-sxc1
21795 When applicable, enable (disable) the generation of "lwxc1",
21796 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
21797
21798 -mmadd4
21799 -mno-madd4
21800 When applicable, enable (disable) the generation of 4-operand
21801 "madd.s", "madd.d" and related instructions. Enabled by default.
21802
21803 MMIX Options
21804 These options are defined for the MMIX:
21805
21806 -mlibfuncs
21807 -mno-libfuncs
21808 Specify that intrinsic library functions are being compiled,
21809 passing all values in registers, no matter the size.
21810
21811 -mepsilon
21812 -mno-epsilon
21813 Generate floating-point comparison instructions that compare with
21814 respect to the "rE" epsilon register.
21815
21816 -mabi=mmixware
21817 -mabi=gnu
21818 Generate code that passes function parameters and return values
21819 that (in the called function) are seen as registers $0 and up, as
21820 opposed to the GNU ABI which uses global registers $231 and up.
21821
21822 -mzero-extend
21823 -mno-zero-extend
21824 When reading data from memory in sizes shorter than 64 bits, use
21825 (do not use) zero-extending load instructions by default, rather
21826 than sign-extending ones.
21827
21828 -mknuthdiv
21829 -mno-knuthdiv
21830 Make the result of a division yielding a remainder have the same
21831 sign as the divisor. With the default, -mno-knuthdiv, the sign of
21832 the remainder follows the sign of the dividend. Both methods are
21833 arithmetically valid, the latter being almost exclusively used.
21834
21835 -mtoplevel-symbols
21836 -mno-toplevel-symbols
21837 Prepend (do not prepend) a : to all global symbols, so the assembly
21838 code can be used with the "PREFIX" assembly directive.
21839
21840 -melf
21841 Generate an executable in the ELF format, rather than the default
21842 mmo format used by the mmix simulator.
21843
21844 -mbranch-predict
21845 -mno-branch-predict
21846 Use (do not use) the probable-branch instructions, when static
21847 branch prediction indicates a probable branch.
21848
21849 -mbase-addresses
21850 -mno-base-addresses
21851 Generate (do not generate) code that uses base addresses. Using a
21852 base address automatically generates a request (handled by the
21853 assembler and the linker) for a constant to be set up in a global
21854 register. The register is used for one or more base address
21855 requests within the range 0 to 255 from the value held in the
21856 register. The generally leads to short and fast code, but the
21857 number of different data items that can be addressed is limited.
21858 This means that a program that uses lots of static data may require
21859 -mno-base-addresses.
21860
21861 -msingle-exit
21862 -mno-single-exit
21863 Force (do not force) generated code to have a single exit point in
21864 each function.
21865
21866 MN10300 Options
21867 These -m options are defined for Matsushita MN10300 architectures:
21868
21869 -mmult-bug
21870 Generate code to avoid bugs in the multiply instructions for the
21871 MN10300 processors. This is the default.
21872
21873 -mno-mult-bug
21874 Do not generate code to avoid bugs in the multiply instructions for
21875 the MN10300 processors.
21876
21877 -mam33
21878 Generate code using features specific to the AM33 processor.
21879
21880 -mno-am33
21881 Do not generate code using features specific to the AM33 processor.
21882 This is the default.
21883
21884 -mam33-2
21885 Generate code using features specific to the AM33/2.0 processor.
21886
21887 -mam34
21888 Generate code using features specific to the AM34 processor.
21889
21890 -mtune=cpu-type
21891 Use the timing characteristics of the indicated CPU type when
21892 scheduling instructions. This does not change the targeted
21893 processor type. The CPU type must be one of mn10300, am33, am33-2
21894 or am34.
21895
21896 -mreturn-pointer-on-d0
21897 When generating a function that returns a pointer, return the
21898 pointer in both "a0" and "d0". Otherwise, the pointer is returned
21899 only in "a0", and attempts to call such functions without a
21900 prototype result in errors. Note that this option is on by
21901 default; use -mno-return-pointer-on-d0 to disable it.
21902
21903 -mno-crt0
21904 Do not link in the C run-time initialization object file.
21905
21906 -mrelax
21907 Indicate to the linker that it should perform a relaxation
21908 optimization pass to shorten branches, calls and absolute memory
21909 addresses. This option only has an effect when used on the command
21910 line for the final link step.
21911
21912 This option makes symbolic debugging impossible.
21913
21914 -mliw
21915 Allow the compiler to generate Long Instruction Word instructions
21916 if the target is the AM33 or later. This is the default. This
21917 option defines the preprocessor macro "__LIW__".
21918
21919 -mno-liw
21920 Do not allow the compiler to generate Long Instruction Word
21921 instructions. This option defines the preprocessor macro
21922 "__NO_LIW__".
21923
21924 -msetlb
21925 Allow the compiler to generate the SETLB and Lcc instructions if
21926 the target is the AM33 or later. This is the default. This option
21927 defines the preprocessor macro "__SETLB__".
21928
21929 -mno-setlb
21930 Do not allow the compiler to generate SETLB or Lcc instructions.
21931 This option defines the preprocessor macro "__NO_SETLB__".
21932
21933 Moxie Options
21934 -meb
21935 Generate big-endian code. This is the default for moxie-*-*
21936 configurations.
21937
21938 -mel
21939 Generate little-endian code.
21940
21941 -mmul.x
21942 Generate mul.x and umul.x instructions. This is the default for
21943 moxiebox-*-* configurations.
21944
21945 -mno-crt0
21946 Do not link in the C run-time initialization object file.
21947
21948 MSP430 Options
21949 These options are defined for the MSP430:
21950
21951 -masm-hex
21952 Force assembly output to always use hex constants. Normally such
21953 constants are signed decimals, but this option is available for
21954 testsuite and/or aesthetic purposes.
21955
21956 -mmcu=
21957 Select the MCU to target. This is used to create a C preprocessor
21958 symbol based upon the MCU name, converted to upper case and pre-
21959 and post-fixed with __. This in turn is used by the msp430.h
21960 header file to select an MCU-specific supplementary header file.
21961
21962 The option also sets the ISA to use. If the MCU name is one that
21963 is known to only support the 430 ISA then that is selected,
21964 otherwise the 430X ISA is selected. A generic MCU name of msp430
21965 can also be used to select the 430 ISA. Similarly the generic
21966 msp430x MCU name selects the 430X ISA.
21967
21968 In addition an MCU-specific linker script is added to the linker
21969 command line. The script's name is the name of the MCU with .ld
21970 appended. Thus specifying -mmcu=xxx on the gcc command line
21971 defines the C preprocessor symbol "__XXX__" and cause the linker to
21972 search for a script called xxx.ld.
21973
21974 The ISA and hardware multiply supported for the different MCUs is
21975 hard-coded into GCC. However, an external devices.csv file can be
21976 used to extend device support beyond those that have been hard-
21977 coded.
21978
21979 GCC searches for the devices.csv file using the following methods
21980 in the given precedence order, where the first method takes
21981 precendence over the second which takes precedence over the third.
21982
21983 Include path specified with "-I" and "-L"
21984 devices.csv will be searched for in each of the directories
21985 specified by include paths and linker library search paths.
21986
21987 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
21988 Define the value of the global environment variable
21989 MSP430_GCC_INCLUDE_DIR to the full path to the directory
21990 containing devices.csv, and GCC will search this directory for
21991 devices.csv. If devices.csv is found, this directory will also
21992 be registered as an include path, and linker library path.
21993 Header files and linker scripts in this directory can therefore
21994 be used without manually specifying "-I" and "-L" on the
21995 command line.
21996
21997 The msp430-elf{,bare}/include/devices directory
21998 Finally, GCC will examine msp430-elf{,bare}/include/devices
21999 from the toolchain root directory. This directory does not
22000 exist in a default installation, but if the user has created it
22001 and copied devices.csv there, then the MCU data will be read.
22002 As above, this directory will also be registered as an include
22003 path, and linker library path.
22004
22005 If none of the above search methods find devices.csv, then the
22006 hard-coded MCU data is used.
22007
22008 -mwarn-mcu
22009 -mno-warn-mcu
22010 This option enables or disables warnings about conflicts between
22011 the MCU name specified by the -mmcu option and the ISA set by the
22012 -mcpu option and/or the hardware multiply support set by the
22013 -mhwmult option. It also toggles warnings about unrecognized MCU
22014 names. This option is on by default.
22015
22016 -mcpu=
22017 Specifies the ISA to use. Accepted values are msp430, msp430x and
22018 msp430xv2. This option is deprecated. The -mmcu= option should be
22019 used to select the ISA.
22020
22021 -msim
22022 Link to the simulator runtime libraries and linker script.
22023 Overrides any scripts that would be selected by the -mmcu= option.
22024
22025 -mlarge
22026 Use large-model addressing (20-bit pointers, 20-bit "size_t").
22027
22028 -msmall
22029 Use small-model addressing (16-bit pointers, 16-bit "size_t").
22030
22031 -mrelax
22032 This option is passed to the assembler and linker, and allows the
22033 linker to perform certain optimizations that cannot be done until
22034 the final link.
22035
22036 mhwmult=
22037 Describes the type of hardware multiply supported by the target.
22038 Accepted values are none for no hardware multiply, 16bit for the
22039 original 16-bit-only multiply supported by early MCUs. 32bit for
22040 the 16/32-bit multiply supported by later MCUs and f5series for the
22041 16/32-bit multiply supported by F5-series MCUs. A value of auto
22042 can also be given. This tells GCC to deduce the hardware multiply
22043 support based upon the MCU name provided by the -mmcu option. If
22044 no -mmcu option is specified or if the MCU name is not recognized
22045 then no hardware multiply support is assumed. "auto" is the
22046 default setting.
22047
22048 Hardware multiplies are normally performed by calling a library
22049 routine. This saves space in the generated code. When compiling
22050 at -O3 or higher however the hardware multiplier is invoked inline.
22051 This makes for bigger, but faster code.
22052
22053 The hardware multiply routines disable interrupts whilst running
22054 and restore the previous interrupt state when they finish. This
22055 makes them safe to use inside interrupt handlers as well as in
22056 normal code.
22057
22058 -minrt
22059 Enable the use of a minimum runtime environment - no static
22060 initializers or constructors. This is intended for memory-
22061 constrained devices. The compiler includes special symbols in some
22062 objects that tell the linker and runtime which code fragments are
22063 required.
22064
22065 -mtiny-printf
22066 Enable reduced code size "printf" and "puts" library functions.
22067 The tiny implementations of these functions are not reentrant, so
22068 must be used with caution in multi-threaded applications.
22069
22070 Support for streams has been removed and the string to be printed
22071 will always be sent to stdout via the "write" syscall. The string
22072 is not buffered before it is sent to write.
22073
22074 This option requires Newlib Nano IO, so GCC must be configured with
22075 --enable-newlib-nano-formatted-io.
22076
22077 -mmax-inline-shift=
22078 This option takes an integer between 0 and 64 inclusive, and sets
22079 the maximum number of inline shift instructions which should be
22080 emitted to perform a shift operation by a constant amount. When
22081 this value needs to be exceeded, an mspabi helper function is used
22082 instead. The default value is 4.
22083
22084 This only affects cases where a shift by multiple positions cannot
22085 be completed with a single instruction (e.g. all shifts >1 on the
22086 430 ISA).
22087
22088 Shifts of a 32-bit value are at least twice as costly, so the value
22089 passed for this option is divided by 2 and the resulting value used
22090 instead.
22091
22092 -mcode-region=
22093 -mdata-region=
22094 These options tell the compiler where to place functions and data
22095 that do not have one of the "lower", "upper", "either" or "section"
22096 attributes. Possible values are "lower", "upper", "either" or
22097 "any". The first three behave like the corresponding attribute.
22098 The fourth possible value - "any" - is the default. It leaves
22099 placement entirely up to the linker script and how it assigns the
22100 standard sections (".text", ".data", etc) to the memory regions.
22101
22102 -msilicon-errata=
22103 This option passes on a request to assembler to enable the fixes
22104 for the named silicon errata.
22105
22106 -msilicon-errata-warn=
22107 This option passes on a request to the assembler to enable warning
22108 messages when a silicon errata might need to be applied.
22109
22110 -mwarn-devices-csv
22111 -mno-warn-devices-csv
22112 Warn if devices.csv is not found or there are problem parsing it
22113 (default: on).
22114
22115 NDS32 Options
22116 These options are defined for NDS32 implementations:
22117
22118 -mbig-endian
22119 Generate code in big-endian mode.
22120
22121 -mlittle-endian
22122 Generate code in little-endian mode.
22123
22124 -mreduced-regs
22125 Use reduced-set registers for register allocation.
22126
22127 -mfull-regs
22128 Use full-set registers for register allocation.
22129
22130 -mcmov
22131 Generate conditional move instructions.
22132
22133 -mno-cmov
22134 Do not generate conditional move instructions.
22135
22136 -mext-perf
22137 Generate performance extension instructions.
22138
22139 -mno-ext-perf
22140 Do not generate performance extension instructions.
22141
22142 -mext-perf2
22143 Generate performance extension 2 instructions.
22144
22145 -mno-ext-perf2
22146 Do not generate performance extension 2 instructions.
22147
22148 -mext-string
22149 Generate string extension instructions.
22150
22151 -mno-ext-string
22152 Do not generate string extension instructions.
22153
22154 -mv3push
22155 Generate v3 push25/pop25 instructions.
22156
22157 -mno-v3push
22158 Do not generate v3 push25/pop25 instructions.
22159
22160 -m16-bit
22161 Generate 16-bit instructions.
22162
22163 -mno-16-bit
22164 Do not generate 16-bit instructions.
22165
22166 -misr-vector-size=num
22167 Specify the size of each interrupt vector, which must be 4 or 16.
22168
22169 -mcache-block-size=num
22170 Specify the size of each cache block, which must be a power of 2
22171 between 4 and 512.
22172
22173 -march=arch
22174 Specify the name of the target architecture.
22175
22176 -mcmodel=code-model
22177 Set the code model to one of
22178
22179 small
22180 All the data and read-only data segments must be within 512KB
22181 addressing space. The text segment must be within 16MB
22182 addressing space.
22183
22184 medium
22185 The data segment must be within 512KB while the read-only data
22186 segment can be within 4GB addressing space. The text segment
22187 should be still within 16MB addressing space.
22188
22189 large
22190 All the text and data segments can be within 4GB addressing
22191 space.
22192
22193 -mctor-dtor
22194 Enable constructor/destructor feature.
22195
22196 -mrelax
22197 Guide linker to relax instructions.
22198
22199 Nios II Options
22200 These are the options defined for the Altera Nios II processor.
22201
22202 -G num
22203 Put global and static objects less than or equal to num bytes into
22204 the small data or BSS sections instead of the normal data or BSS
22205 sections. The default value of num is 8.
22206
22207 -mgpopt=option
22208 -mgpopt
22209 -mno-gpopt
22210 Generate (do not generate) GP-relative accesses. The following
22211 option names are recognized:
22212
22213 none
22214 Do not generate GP-relative accesses.
22215
22216 local
22217 Generate GP-relative accesses for small data objects that are
22218 not external, weak, or uninitialized common symbols. Also use
22219 GP-relative addressing for objects that have been explicitly
22220 placed in a small data section via a "section" attribute.
22221
22222 global
22223 As for local, but also generate GP-relative accesses for small
22224 data objects that are external, weak, or common. If you use
22225 this option, you must ensure that all parts of your program
22226 (including libraries) are compiled with the same -G setting.
22227
22228 data
22229 Generate GP-relative accesses for all data objects in the
22230 program. If you use this option, the entire data and BSS
22231 segments of your program must fit in 64K of memory and you must
22232 use an appropriate linker script to allocate them within the
22233 addressable range of the global pointer.
22234
22235 all Generate GP-relative addresses for function pointers as well as
22236 data pointers. If you use this option, the entire text, data,
22237 and BSS segments of your program must fit in 64K of memory and
22238 you must use an appropriate linker script to allocate them
22239 within the addressable range of the global pointer.
22240
22241 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
22242 equivalent to -mgpopt=none.
22243
22244 The default is -mgpopt except when -fpic or -fPIC is specified to
22245 generate position-independent code. Note that the Nios II ABI does
22246 not permit GP-relative accesses from shared libraries.
22247
22248 You may need to specify -mno-gpopt explicitly when building
22249 programs that include large amounts of small data, including large
22250 GOT data sections. In this case, the 16-bit offset for GP-relative
22251 addressing may not be large enough to allow access to the entire
22252 small data section.
22253
22254 -mgprel-sec=regexp
22255 This option specifies additional section names that can be accessed
22256 via GP-relative addressing. It is most useful in conjunction with
22257 "section" attributes on variable declarations and a custom linker
22258 script. The regexp is a POSIX Extended Regular Expression.
22259
22260 This option does not affect the behavior of the -G option, and the
22261 specified sections are in addition to the standard ".sdata" and
22262 ".sbss" small-data sections that are recognized by -mgpopt.
22263
22264 -mr0rel-sec=regexp
22265 This option specifies names of sections that can be accessed via a
22266 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
22267 32-bit address space. It is most useful in conjunction with
22268 "section" attributes on variable declarations and a custom linker
22269 script. The regexp is a POSIX Extended Regular Expression.
22270
22271 In contrast to the use of GP-relative addressing for small data,
22272 zero-based addressing is never generated by default and there are
22273 no conventional section names used in standard linker scripts for
22274 sections in the low or high areas of memory.
22275
22276 -mel
22277 -meb
22278 Generate little-endian (default) or big-endian (experimental) code,
22279 respectively.
22280
22281 -march=arch
22282 This specifies the name of the target Nios II architecture. GCC
22283 uses this name to determine what kind of instructions it can emit
22284 when generating assembly code. Permissible names are: r1, r2.
22285
22286 The preprocessor macro "__nios2_arch__" is available to programs,
22287 with value 1 or 2, indicating the targeted ISA level.
22288
22289 -mbypass-cache
22290 -mno-bypass-cache
22291 Force all load and store instructions to always bypass cache by
22292 using I/O variants of the instructions. The default is not to
22293 bypass the cache.
22294
22295 -mno-cache-volatile
22296 -mcache-volatile
22297 Volatile memory access bypass the cache using the I/O variants of
22298 the load and store instructions. The default is not to bypass the
22299 cache.
22300
22301 -mno-fast-sw-div
22302 -mfast-sw-div
22303 Do not use table-based fast divide for small numbers. The default
22304 is to use the fast divide at -O3 and above.
22305
22306 -mno-hw-mul
22307 -mhw-mul
22308 -mno-hw-mulx
22309 -mhw-mulx
22310 -mno-hw-div
22311 -mhw-div
22312 Enable or disable emitting "mul", "mulx" and "div" family of
22313 instructions by the compiler. The default is to emit "mul" and not
22314 emit "div" and "mulx".
22315
22316 -mbmx
22317 -mno-bmx
22318 -mcdx
22319 -mno-cdx
22320 Enable or disable generation of Nios II R2 BMX (bit manipulation)
22321 and CDX (code density) instructions. Enabling these instructions
22322 also requires -march=r2. Since these instructions are optional
22323 extensions to the R2 architecture, the default is not to emit them.
22324
22325 -mcustom-insn=N
22326 -mno-custom-insn
22327 Each -mcustom-insn=N option enables use of a custom instruction
22328 with encoding N when generating code that uses insn. For example,
22329 -mcustom-fadds=253 generates custom instruction 253 for single-
22330 precision floating-point add operations instead of the default
22331 behavior of using a library call.
22332
22333 The following values of insn are supported. Except as otherwise
22334 noted, floating-point operations are expected to be implemented
22335 with normal IEEE 754 semantics and correspond directly to the C
22336 operators or the equivalent GCC built-in functions.
22337
22338 Single-precision floating point:
22339
22340 fadds, fsubs, fdivs, fmuls
22341 Binary arithmetic operations.
22342
22343 fnegs
22344 Unary negation.
22345
22346 fabss
22347 Unary absolute value.
22348
22349 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
22350 Comparison operations.
22351
22352 fmins, fmaxs
22353 Floating-point minimum and maximum. These instructions are
22354 only generated if -ffinite-math-only is specified.
22355
22356 fsqrts
22357 Unary square root operation.
22358
22359 fcoss, fsins, ftans, fatans, fexps, flogs
22360 Floating-point trigonometric and exponential functions. These
22361 instructions are only generated if -funsafe-math-optimizations
22362 is also specified.
22363
22364 Double-precision floating point:
22365
22366 faddd, fsubd, fdivd, fmuld
22367 Binary arithmetic operations.
22368
22369 fnegd
22370 Unary negation.
22371
22372 fabsd
22373 Unary absolute value.
22374
22375 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
22376 Comparison operations.
22377
22378 fmind, fmaxd
22379 Double-precision minimum and maximum. These instructions are
22380 only generated if -ffinite-math-only is specified.
22381
22382 fsqrtd
22383 Unary square root operation.
22384
22385 fcosd, fsind, ftand, fatand, fexpd, flogd
22386 Double-precision trigonometric and exponential functions.
22387 These instructions are only generated if
22388 -funsafe-math-optimizations is also specified.
22389
22390 Conversions:
22391
22392 fextsd
22393 Conversion from single precision to double precision.
22394
22395 ftruncds
22396 Conversion from double precision to single precision.
22397
22398 fixsi, fixsu, fixdi, fixdu
22399 Conversion from floating point to signed or unsigned integer
22400 types, with truncation towards zero.
22401
22402 round
22403 Conversion from single-precision floating point to signed
22404 integer, rounding to the nearest integer and ties away from
22405 zero. This corresponds to the "__builtin_lroundf" function
22406 when -fno-math-errno is used.
22407
22408 floatis, floatus, floatid, floatud
22409 Conversion from signed or unsigned integer types to floating-
22410 point types.
22411
22412 In addition, all of the following transfer instructions for
22413 internal registers X and Y must be provided to use any of the
22414 double-precision floating-point instructions. Custom instructions
22415 taking two double-precision source operands expect the first
22416 operand in the 64-bit register X. The other operand (or only
22417 operand of a unary operation) is given to the custom arithmetic
22418 instruction with the least significant half in source register src1
22419 and the most significant half in src2. A custom instruction that
22420 returns a double-precision result returns the most significant 32
22421 bits in the destination register and the other half in 32-bit
22422 register Y. GCC automatically generates the necessary code
22423 sequences to write register X and/or read register Y when double-
22424 precision floating-point instructions are used.
22425
22426 fwrx
22427 Write src1 into the least significant half of X and src2 into
22428 the most significant half of X.
22429
22430 fwry
22431 Write src1 into Y.
22432
22433 frdxhi, frdxlo
22434 Read the most or least (respectively) significant half of X and
22435 store it in dest.
22436
22437 frdy
22438 Read the value of Y and store it into dest.
22439
22440 Note that you can gain more local control over generation of Nios
22441 II custom instructions by using the "target("custom-insn=N")" and
22442 "target("no-custom-insn")" function attributes or pragmas.
22443
22444 -mcustom-fpu-cfg=name
22445 This option enables a predefined, named set of custom instruction
22446 encodings (see -mcustom-insn above). Currently, the following sets
22447 are defined:
22448
22449 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
22450 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
22451
22452 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
22453 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
22454 -fsingle-precision-constant
22455
22456 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
22457 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
22458 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
22459 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
22460 -mcustom-fdivs=255 -fsingle-precision-constant
22461
22462 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
22463 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
22464 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
22465 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
22466 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
22467 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
22468 -mcustom-fsubs=254 -mcustom-fdivs=255
22469
22470 Custom instruction assignments given by individual -mcustom-insn=
22471 options override those given by -mcustom-fpu-cfg=, regardless of
22472 the order of the options on the command line.
22473
22474 Note that you can gain more local control over selection of a FPU
22475 configuration by using the "target("custom-fpu-cfg=name")" function
22476 attribute or pragma.
22477
22478 The name fph2 is an abbreviation for Nios II Floating Point
22479 Hardware 2 Component. Please note that the custom instructions
22480 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
22481 generated if -ffinite-math-only is specified. The custom
22482 instruction enabled by -mcustom-round=248 is only generated if
22483 -fno-math-errno is specified. In contrast to the other
22484 configurations, -fsingle-precision-constant is not set.
22485
22486 These additional -m options are available for the Altera Nios II ELF
22487 (bare-metal) target:
22488
22489 -mhal
22490 Link with HAL BSP. This suppresses linking with the GCC-provided C
22491 runtime startup and termination code, and is typically used in
22492 conjunction with -msys-crt0= to specify the location of the
22493 alternate startup code provided by the HAL BSP.
22494
22495 -msmallc
22496 Link with a limited version of the C library, -lsmallc, rather than
22497 Newlib.
22498
22499 -msys-crt0=startfile
22500 startfile is the file name of the startfile (crt0) to use when
22501 linking. This option is only useful in conjunction with -mhal.
22502
22503 -msys-lib=systemlib
22504 systemlib is the library name of the library that provides low-
22505 level system calls required by the C library, e.g. "read" and
22506 "write". This option is typically used to link with a library
22507 provided by a HAL BSP.
22508
22509 Nvidia PTX Options
22510 These options are defined for Nvidia PTX:
22511
22512 -m64
22513 Ignored, but preserved for backward compatibility. Only 64-bit ABI
22514 is supported.
22515
22516 -misa=ISA-string
22517 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
22518 strings must be lower-case. Valid ISA strings include sm_30 and
22519 sm_35. The default ISA is sm_35.
22520
22521 -mmainkernel
22522 Link in code for a __main kernel. This is for stand-alone instead
22523 of offloading execution.
22524
22525 -moptimize
22526 Apply partitioned execution optimizations. This is the default
22527 when any level of optimization is selected.
22528
22529 -msoft-stack
22530 Generate code that does not use ".local" memory directly for stack
22531 storage. Instead, a per-warp stack pointer is maintained
22532 explicitly. This enables variable-length stack allocation (with
22533 variable-length arrays or "alloca"), and when global memory is used
22534 for underlying storage, makes it possible to access automatic
22535 variables from other threads, or with atomic instructions. This
22536 code generation variant is used for OpenMP offloading, but the
22537 option is exposed on its own for the purpose of testing the
22538 compiler; to generate code suitable for linking into programs using
22539 OpenMP offloading, use option -mgomp.
22540
22541 -muniform-simt
22542 Switch to code generation variant that allows to execute all
22543 threads in each warp, while maintaining memory state and side
22544 effects as if only one thread in each warp was active outside of
22545 OpenMP SIMD regions. All atomic operations and calls to runtime
22546 (malloc, free, vprintf) are conditionally executed (iff current
22547 lane index equals the master lane index), and the register being
22548 assigned is copied via a shuffle instruction from the master lane.
22549 Outside of SIMD regions lane 0 is the master; inside, each thread
22550 sees itself as the master. Shared memory array "int __nvptx_uni[]"
22551 stores all-zeros or all-ones bitmasks for each warp, indicating
22552 current mode (0 outside of SIMD regions). Each thread can bitwise-
22553 and the bitmask at position "tid.y" with current lane index to
22554 compute the master lane index.
22555
22556 -mgomp
22557 Generate code for use in OpenMP offloading: enables -msoft-stack
22558 and -muniform-simt options, and selects corresponding multilib
22559 variant.
22560
22561 OpenRISC Options
22562 These options are defined for OpenRISC:
22563
22564 -mboard=name
22565 Configure a board specific runtime. This will be passed to the
22566 linker for newlib board library linking. The default is "or1ksim".
22567
22568 -mnewlib
22569 This option is ignored; it is for compatibility purposes only.
22570 This used to select linker and preprocessor options for use with
22571 newlib.
22572
22573 -msoft-div
22574 -mhard-div
22575 Select software or hardware divide ("l.div", "l.divu")
22576 instructions. This default is hardware divide.
22577
22578 -msoft-mul
22579 -mhard-mul
22580 Select software or hardware multiply ("l.mul", "l.muli")
22581 instructions. This default is hardware multiply.
22582
22583 -msoft-float
22584 -mhard-float
22585 Select software or hardware for floating point operations. The
22586 default is software.
22587
22588 -mdouble-float
22589 When -mhard-float is selected, enables generation of double-
22590 precision floating point instructions. By default functions from
22591 libgcc are used to perform double-precision floating point
22592 operations.
22593
22594 -munordered-float
22595 When -mhard-float is selected, enables generation of unordered
22596 floating point compare and set flag ("lf.sfun*") instructions. By
22597 default functions from libgcc are used to perform unordered
22598 floating point compare and set flag operations.
22599
22600 -mcmov
22601 Enable generation of conditional move ("l.cmov") instructions. By
22602 default the equivalent will be generated using set and branch.
22603
22604 -mror
22605 Enable generation of rotate right ("l.ror") instructions. By
22606 default functions from libgcc are used to perform rotate right
22607 operations.
22608
22609 -mrori
22610 Enable generation of rotate right with immediate ("l.rori")
22611 instructions. By default functions from libgcc are used to perform
22612 rotate right with immediate operations.
22613
22614 -msext
22615 Enable generation of sign extension ("l.ext*") instructions. By
22616 default memory loads are used to perform sign extension.
22617
22618 -msfimm
22619 Enable generation of compare and set flag with immediate ("l.sf*i")
22620 instructions. By default extra instructions will be generated to
22621 store the immediate to a register first.
22622
22623 -mshftimm
22624 Enable generation of shift with immediate ("l.srai", "l.srli",
22625 "l.slli") instructions. By default extra instructions will be
22626 generated to store the immediate to a register first.
22627
22628 PDP-11 Options
22629 These options are defined for the PDP-11:
22630
22631 -mfpu
22632 Use hardware FPP floating point. This is the default. (FIS
22633 floating point on the PDP-11/40 is not supported.) Implies -m45.
22634
22635 -msoft-float
22636 Do not use hardware floating point.
22637
22638 -mac0
22639 Return floating-point results in ac0 (fr0 in Unix assembler
22640 syntax).
22641
22642 -mno-ac0
22643 Return floating-point results in memory. This is the default.
22644
22645 -m40
22646 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22647
22648 -m45
22649 Generate code for a PDP-11/45. This is the default.
22650
22651 -m10
22652 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22653
22654 -mint16
22655 -mno-int32
22656 Use 16-bit "int". This is the default.
22657
22658 -mint32
22659 -mno-int16
22660 Use 32-bit "int".
22661
22662 -msplit
22663 Target has split instruction and data space. Implies -m45.
22664
22665 -munix-asm
22666 Use Unix assembler syntax.
22667
22668 -mdec-asm
22669 Use DEC assembler syntax.
22670
22671 -mgnu-asm
22672 Use GNU assembler syntax. This is the default.
22673
22674 -mlra
22675 Use the new LRA register allocator. By default, the old "reload"
22676 allocator is used.
22677
22678 picoChip Options
22679 These -m options are defined for picoChip implementations:
22680
22681 -mae=ae_type
22682 Set the instruction set, register set, and instruction scheduling
22683 parameters for array element type ae_type. Supported values for
22684 ae_type are ANY, MUL, and MAC.
22685
22686 -mae=ANY selects a completely generic AE type. Code generated with
22687 this option runs on any of the other AE types. The code is not as
22688 efficient as it would be if compiled for a specific AE type, and
22689 some types of operation (e.g., multiplication) do not work properly
22690 on all types of AE.
22691
22692 -mae=MUL selects a MUL AE type. This is the most useful AE type
22693 for compiled code, and is the default.
22694
22695 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
22696 option may suffer from poor performance of byte (char)
22697 manipulation, since the DSP AE does not provide hardware support
22698 for byte load/stores.
22699
22700 -msymbol-as-address
22701 Enable the compiler to directly use a symbol name as an address in
22702 a load/store instruction, without first loading it into a register.
22703 Typically, the use of this option generates larger programs, which
22704 run faster than when the option isn't used. However, the results
22705 vary from program to program, so it is left as a user option,
22706 rather than being permanently enabled.
22707
22708 -mno-inefficient-warnings
22709 Disables warnings about the generation of inefficient code. These
22710 warnings can be generated, for example, when compiling code that
22711 performs byte-level memory operations on the MAC AE type. The MAC
22712 AE has no hardware support for byte-level memory operations, so all
22713 byte load/stores must be synthesized from word load/store
22714 operations. This is inefficient and a warning is generated to
22715 indicate that you should rewrite the code to avoid byte operations,
22716 or to target an AE type that has the necessary hardware support.
22717 This option disables these warnings.
22718
22719 PowerPC Options
22720 These are listed under
22721
22722 PRU Options
22723 These command-line options are defined for PRU target:
22724
22725 -minrt
22726 Link with a minimum runtime environment, with no support for static
22727 initializers and constructors. Using this option can significantly
22728 reduce the size of the final ELF binary. Beware that the compiler
22729 could still generate code with static initializers and
22730 constructors. It is up to the programmer to ensure that the source
22731 program will not use those features.
22732
22733 -mmcu=mcu
22734 Specify the PRU MCU variant to use. Check Newlib for the exact
22735 list of supported MCUs.
22736
22737 -mno-relax
22738 Make GCC pass the --no-relax command-line option to the linker
22739 instead of the --relax option.
22740
22741 -mloop
22742 Allow (or do not allow) GCC to use the LOOP instruction.
22743
22744 -mabi=variant
22745 Specify the ABI variant to output code for. -mabi=ti selects the
22746 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
22747 more naturally with certain GCC assumptions. These are the
22748 differences:
22749
22750 Function Pointer Size
22751 TI ABI specifies that function (code) pointers are 16-bit,
22752 whereas GNU supports only 32-bit data and code pointers.
22753
22754 Optional Return Value Pointer
22755 Function return values larger than 64 bits are passed by using
22756 a hidden pointer as the first argument of the function. TI
22757 ABI, though, mandates that the pointer can be NULL in case the
22758 caller is not using the returned value. GNU always passes and
22759 expects a valid return value pointer.
22760
22761 The current -mabi=ti implementation simply raises a compile error
22762 when any of the above code constructs is detected. As a
22763 consequence the standard C library cannot be built and it is
22764 omitted when linking with -mabi=ti.
22765
22766 Relaxation is a GNU feature and for safety reasons is disabled when
22767 using -mabi=ti. The TI toolchain does not emit relocations for
22768 QBBx instructions, so the GNU linker cannot adjust them when
22769 shortening adjacent LDI32 pseudo instructions.
22770
22771 RISC-V Options
22772 These command-line options are defined for RISC-V targets:
22773
22774 -mbranch-cost=n
22775 Set the cost of branches to roughly n instructions.
22776
22777 -mplt
22778 -mno-plt
22779 When generating PIC code, do or don't allow the use of PLTs.
22780 Ignored for non-PIC. The default is -mplt.
22781
22782 -mabi=ABI-string
22783 Specify integer and floating-point calling convention. ABI-string
22784 contains two parts: the size of integer types and the registers
22785 used for floating-point types. For example -march=rv64ifd
22786 -mabi=lp64d means that long and pointers are 64-bit (implicitly
22787 defining int to be 32-bit), and that floating-point values up to 64
22788 bits wide are passed in F registers. Contrast this with
22789 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
22790 generate code that uses the F and D extensions but only allows
22791 floating-point values up to 32 bits long to be passed in registers;
22792 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
22793 will be passed in registers.
22794
22795 The default for this argument is system dependent, users who want a
22796 specific calling convention should specify one explicitly. The
22797 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
22798 and lp64d. Some calling conventions are impossible to implement on
22799 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
22800 because the ABI requires 64-bit values be passed in F registers,
22801 but F registers are only 32 bits wide. There is also the ilp32e
22802 ABI that can only be used with the rv32e architecture. This ABI is
22803 not well specified at present, and is subject to change.
22804
22805 -mfdiv
22806 -mno-fdiv
22807 Do or don't use hardware floating-point divide and square root
22808 instructions. This requires the F or D extensions for floating-
22809 point registers. The default is to use them if the specified
22810 architecture has these instructions.
22811
22812 -mdiv
22813 -mno-div
22814 Do or don't use hardware instructions for integer division. This
22815 requires the M extension. The default is to use them if the
22816 specified architecture has these instructions.
22817
22818 -march=ISA-string
22819 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
22820 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
22821
22822 When -march= is not specified, use the setting from -mcpu.
22823
22824 If both -march and -mcpu= are not specified, the default for this
22825 argument is system dependent, users who want a specific
22826 architecture extensions should specify one explicitly.
22827
22828 -mcpu=processor-string
22829 Use architecture of and optimize the output for the given
22830 processor, specified by particular CPU name. Permissible values
22831 for this option are: sifive-e20, sifive-e21, sifive-e24,
22832 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
22833 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
22834
22835 -mtune=processor-string
22836 Optimize the output for the given processor, specified by
22837 microarchitecture or particular CPU name. Permissible values for
22838 this option are: rocket, sifive-3-series, sifive-5-series,
22839 sifive-7-series, size, and all valid options for -mcpu=.
22840
22841 When -mtune= is not specified, use the setting from -mcpu, the
22842 default is rocket if both are not specified.
22843
22844 The size choice is not intended for use by end-users. This is used
22845 when -Os is specified. It overrides the instruction cost info
22846 provided by -mtune=, but does not override the pipeline info. This
22847 helps reduce code size while still giving good performance.
22848
22849 -mpreferred-stack-boundary=num
22850 Attempt to keep the stack boundary aligned to a 2 raised to num
22851 byte boundary. If -mpreferred-stack-boundary is not specified, the
22852 default is 4 (16 bytes or 128-bits).
22853
22854 Warning: If you use this switch, then you must build all modules
22855 with the same value, including any libraries. This includes the
22856 system libraries and startup modules.
22857
22858 -msmall-data-limit=n
22859 Put global and static data smaller than n bytes into a special
22860 section (on some targets).
22861
22862 -msave-restore
22863 -mno-save-restore
22864 Do or don't use smaller but slower prologue and epilogue code that
22865 uses library function calls. The default is to use fast inline
22866 prologues and epilogues.
22867
22868 -mshorten-memrefs
22869 -mno-shorten-memrefs
22870 Do or do not attempt to make more use of compressed load/store
22871 instructions by replacing a load/store of 'base register + large
22872 offset' with a new load/store of 'new base + small offset'. If the
22873 new base gets stored in a compressed register, then the new
22874 load/store can be compressed. Currently targets 32-bit integer
22875 load/stores only.
22876
22877 -mstrict-align
22878 -mno-strict-align
22879 Do not or do generate unaligned memory accesses. The default is
22880 set depending on whether the processor we are optimizing for
22881 supports fast unaligned access or not.
22882
22883 -mcmodel=medlow
22884 Generate code for the medium-low code model. The program and its
22885 statically defined symbols must lie within a single 2 GiB address
22886 range and must lie between absolute addresses -2 GiB and +2 GiB.
22887 Programs can be statically or dynamically linked. This is the
22888 default code model.
22889
22890 -mcmodel=medany
22891 Generate code for the medium-any code model. The program and its
22892 statically defined symbols must be within any single 2 GiB address
22893 range. Programs can be statically or dynamically linked.
22894
22895 -mexplicit-relocs
22896 -mno-exlicit-relocs
22897 Use or do not use assembler relocation operators when dealing with
22898 symbolic addresses. The alternative is to use assembler macros
22899 instead, which may limit optimization.
22900
22901 -mrelax
22902 -mno-relax
22903 Take advantage of linker relaxations to reduce the number of
22904 instructions required to materialize symbol addresses. The default
22905 is to take advantage of linker relaxations.
22906
22907 -memit-attribute
22908 -mno-emit-attribute
22909 Emit (do not emit) RISC-V attribute to record extra information
22910 into ELF objects. This feature requires at least binutils 2.32.
22911
22912 -malign-data=type
22913 Control how GCC aligns variables and constants of array, structure,
22914 or union types. Supported values for type are xlen which uses x
22915 register width as the alignment value, and natural which uses
22916 natural alignment. xlen is the default.
22917
22918 -mbig-endian
22919 Generate big-endian code. This is the default when GCC is
22920 configured for a riscv64be-*-* or riscv32be-*-* target.
22921
22922 -mlittle-endian
22923 Generate little-endian code. This is the default when GCC is
22924 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
22925 or riscv32be-*-* target.
22926
22927 -mstack-protector-guard=guard
22928 -mstack-protector-guard-reg=reg
22929 -mstack-protector-guard-offset=offset
22930 Generate stack protection code using canary at guard. Supported
22931 locations are global for a global canary or tls for per-thread
22932 canary in the TLS block.
22933
22934 With the latter choice the options -mstack-protector-guard-reg=reg
22935 and -mstack-protector-guard-offset=offset furthermore specify which
22936 register to use as base register for reading the canary, and from
22937 what offset from that base register. There is no default register
22938 or offset as this is entirely for use within the Linux kernel.
22939
22940 RL78 Options
22941 -msim
22942 Links in additional target libraries to support operation within a
22943 simulator.
22944
22945 -mmul=none
22946 -mmul=g10
22947 -mmul=g13
22948 -mmul=g14
22949 -mmul=rl78
22950 Specifies the type of hardware multiplication and division support
22951 to be used. The simplest is "none", which uses software for both
22952 multiplication and division. This is the default. The "g13" value
22953 is for the hardware multiply/divide peripheral found on the
22954 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
22955 multiplication and division instructions supported by the RL78/G14
22956 (S3 core) parts. The value "rl78" is an alias for "g14" and the
22957 value "mg10" is an alias for "none".
22958
22959 In addition a C preprocessor macro is defined, based upon the
22960 setting of this option. Possible values are: "__RL78_MUL_NONE__",
22961 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
22962
22963 -mcpu=g10
22964 -mcpu=g13
22965 -mcpu=g14
22966 -mcpu=rl78
22967 Specifies the RL78 core to target. The default is the G14 core,
22968 also known as an S3 core or just RL78. The G13 or S2 core does not
22969 have multiply or divide instructions, instead it uses a hardware
22970 peripheral for these operations. The G10 or S1 core does not have
22971 register banks, so it uses a different calling convention.
22972
22973 If this option is set it also selects the type of hardware multiply
22974 support to use, unless this is overridden by an explicit -mmul=none
22975 option on the command line. Thus specifying -mcpu=g13 enables the
22976 use of the G13 hardware multiply peripheral and specifying
22977 -mcpu=g10 disables the use of hardware multiplications altogether.
22978
22979 Note, although the RL78/G14 core is the default target, specifying
22980 -mcpu=g14 or -mcpu=rl78 on the command line does change the
22981 behavior of the toolchain since it also enables G14 hardware
22982 multiply support. If these options are not specified on the
22983 command line then software multiplication routines will be used
22984 even though the code targets the RL78 core. This is for backwards
22985 compatibility with older toolchains which did not have hardware
22986 multiply and divide support.
22987
22988 In addition a C preprocessor macro is defined, based upon the
22989 setting of this option. Possible values are: "__RL78_G10__",
22990 "__RL78_G13__" or "__RL78_G14__".
22991
22992 -mg10
22993 -mg13
22994 -mg14
22995 -mrl78
22996 These are aliases for the corresponding -mcpu= option. They are
22997 provided for backwards compatibility.
22998
22999 -mallregs
23000 Allow the compiler to use all of the available registers. By
23001 default registers "r24..r31" are reserved for use in interrupt
23002 handlers. With this option enabled these registers can be used in
23003 ordinary functions as well.
23004
23005 -m64bit-doubles
23006 -m32bit-doubles
23007 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
23008 (-m32bit-doubles) in size. The default is -m32bit-doubles.
23009
23010 -msave-mduc-in-interrupts
23011 -mno-save-mduc-in-interrupts
23012 Specifies that interrupt handler functions should preserve the MDUC
23013 registers. This is only necessary if normal code might use the
23014 MDUC registers, for example because it performs multiplication and
23015 division operations. The default is to ignore the MDUC registers
23016 as this makes the interrupt handlers faster. The target option
23017 -mg13 needs to be passed for this to work as this feature is only
23018 available on the G13 target (S2 core). The MDUC registers will
23019 only be saved if the interrupt handler performs a multiplication or
23020 division operation or it calls another function.
23021
23022 IBM RS/6000 and PowerPC Options
23023 These -m options are defined for the IBM RS/6000 and PowerPC:
23024
23025 -mpowerpc-gpopt
23026 -mno-powerpc-gpopt
23027 -mpowerpc-gfxopt
23028 -mno-powerpc-gfxopt
23029 -mpowerpc64
23030 -mno-powerpc64
23031 -mmfcrf
23032 -mno-mfcrf
23033 -mpopcntb
23034 -mno-popcntb
23035 -mpopcntd
23036 -mno-popcntd
23037 -mfprnd
23038 -mno-fprnd
23039 -mcmpb
23040 -mno-cmpb
23041 -mhard-dfp
23042 -mno-hard-dfp
23043 You use these options to specify which instructions are available
23044 on the processor you are using. The default value of these options
23045 is determined when configuring GCC. Specifying the -mcpu=cpu_type
23046 overrides the specification of these options. We recommend you use
23047 the -mcpu=cpu_type option rather than the options listed above.
23048
23049 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
23050 architecture instructions in the General Purpose group, including
23051 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
23052 to use the optional PowerPC architecture instructions in the
23053 Graphics group, including floating-point select.
23054
23055 The -mmfcrf option allows GCC to generate the move from condition
23056 register field instruction implemented on the POWER4 processor and
23057 other processors that support the PowerPC V2.01 architecture. The
23058 -mpopcntb option allows GCC to generate the popcount and double-
23059 precision FP reciprocal estimate instruction implemented on the
23060 POWER5 processor and other processors that support the PowerPC
23061 V2.02 architecture. The -mpopcntd option allows GCC to generate
23062 the popcount instruction implemented on the POWER7 processor and
23063 other processors that support the PowerPC V2.06 architecture. The
23064 -mfprnd option allows GCC to generate the FP round to integer
23065 instructions implemented on the POWER5+ processor and other
23066 processors that support the PowerPC V2.03 architecture. The -mcmpb
23067 option allows GCC to generate the compare bytes instruction
23068 implemented on the POWER6 processor and other processors that
23069 support the PowerPC V2.05 architecture. The -mhard-dfp option
23070 allows GCC to generate the decimal floating-point instructions
23071 implemented on some POWER processors.
23072
23073 The -mpowerpc64 option allows GCC to generate the additional 64-bit
23074 instructions that are found in the full PowerPC64 architecture and
23075 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23076 -mno-powerpc64.
23077
23078 -mcpu=cpu_type
23079 Set architecture type, register usage, and instruction scheduling
23080 parameters for machine type cpu_type. Supported values for
23081 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
23082 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
23083 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
23084 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
23085 power4, power5, power5+, power6, power6x, power7, power8, power9,
23086 future, powerpc, powerpc64, powerpc64le, rs64, and native.
23087
23088 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
23089 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
23090 64-bit little endian PowerPC architecture machine types, with an
23091 appropriate, generic processor model assumed for scheduling
23092 purposes.
23093
23094 Specifying native as cpu type detects and selects the architecture
23095 option that corresponds to the host processor of the system
23096 performing the compilation. -mcpu=native has no effect if GCC does
23097 not recognize the processor.
23098
23099 The other options specify a specific processor. Code generated
23100 under those options runs best on that processor, and may not run at
23101 all on others.
23102
23103 The -mcpu options automatically enable or disable the following
23104 options:
23105
23106 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
23107 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
23108 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
23109 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
23110 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
23111
23112 The particular options set for any particular CPU varies between
23113 compiler versions, depending on what setting seems to produce
23114 optimal code for that CPU; it doesn't necessarily reflect the
23115 actual hardware's capabilities. If you wish to set an individual
23116 option to a particular value, you may specify it after the -mcpu
23117 option, like -mcpu=970 -mno-altivec.
23118
23119 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
23120 disabled by the -mcpu option at present because AIX does not have
23121 full support for these options. You may still enable or disable
23122 them individually if you're sure it'll work in your environment.
23123
23124 -mtune=cpu_type
23125 Set the instruction scheduling parameters for machine type
23126 cpu_type, but do not set the architecture type or register usage,
23127 as -mcpu=cpu_type does. The same values for cpu_type are used for
23128 -mtune as for -mcpu. If both are specified, the code generated
23129 uses the architecture and registers set by -mcpu, but the
23130 scheduling parameters set by -mtune.
23131
23132 -mcmodel=small
23133 Generate PowerPC64 code for the small model: The TOC is limited to
23134 64k.
23135
23136 -mcmodel=medium
23137 Generate PowerPC64 code for the medium model: The TOC and other
23138 static data may be up to a total of 4G in size. This is the
23139 default for 64-bit Linux.
23140
23141 -mcmodel=large
23142 Generate PowerPC64 code for the large model: The TOC may be up to
23143 4G in size. Other data and code is only limited by the 64-bit
23144 address space.
23145
23146 -maltivec
23147 -mno-altivec
23148 Generate code that uses (does not use) AltiVec instructions, and
23149 also enable the use of built-in functions that allow more direct
23150 access to the AltiVec instruction set. You may also need to set
23151 -mabi=altivec to adjust the current ABI with AltiVec ABI
23152 enhancements.
23153
23154 When -maltivec is used, the element order for AltiVec intrinsics
23155 such as "vec_splat", "vec_extract", and "vec_insert" match array
23156 element order corresponding to the endianness of the target. That
23157 is, element zero identifies the leftmost element in a vector
23158 register when targeting a big-endian platform, and identifies the
23159 rightmost element in a vector register when targeting a little-
23160 endian platform.
23161
23162 -mvrsave
23163 -mno-vrsave
23164 Generate VRSAVE instructions when generating AltiVec code.
23165
23166 -msecure-plt
23167 Generate code that allows ld and ld.so to build executables and
23168 shared libraries with non-executable ".plt" and ".got" sections.
23169 This is a PowerPC 32-bit SYSV ABI option.
23170
23171 -mbss-plt
23172 Generate code that uses a BSS ".plt" section that ld.so fills in,
23173 and requires ".plt" and ".got" sections that are both writable and
23174 executable. This is a PowerPC 32-bit SYSV ABI option.
23175
23176 -misel
23177 -mno-isel
23178 This switch enables or disables the generation of ISEL
23179 instructions.
23180
23181 -mvsx
23182 -mno-vsx
23183 Generate code that uses (does not use) vector/scalar (VSX)
23184 instructions, and also enable the use of built-in functions that
23185 allow more direct access to the VSX instruction set.
23186
23187 -mcrypto
23188 -mno-crypto
23189 Enable the use (disable) of the built-in functions that allow
23190 direct access to the cryptographic instructions that were added in
23191 version 2.07 of the PowerPC ISA.
23192
23193 -mhtm
23194 -mno-htm
23195 Enable (disable) the use of the built-in functions that allow
23196 direct access to the Hardware Transactional Memory (HTM)
23197 instructions that were added in version 2.07 of the PowerPC ISA.
23198
23199 -mpower8-fusion
23200 -mno-power8-fusion
23201 Generate code that keeps (does not keeps) some integer operations
23202 adjacent so that the instructions can be fused together on power8
23203 and later processors.
23204
23205 -mpower8-vector
23206 -mno-power8-vector
23207 Generate code that uses (does not use) the vector and scalar
23208 instructions that were added in version 2.07 of the PowerPC ISA.
23209 Also enable the use of built-in functions that allow more direct
23210 access to the vector instructions.
23211
23212 -mquad-memory
23213 -mno-quad-memory
23214 Generate code that uses (does not use) the non-atomic quad word
23215 memory instructions. The -mquad-memory option requires use of
23216 64-bit mode.
23217
23218 -mquad-memory-atomic
23219 -mno-quad-memory-atomic
23220 Generate code that uses (does not use) the atomic quad word memory
23221 instructions. The -mquad-memory-atomic option requires use of
23222 64-bit mode.
23223
23224 -mfloat128
23225 -mno-float128
23226 Enable/disable the __float128 keyword for IEEE 128-bit floating
23227 point and use either software emulation for IEEE 128-bit floating
23228 point or hardware instructions.
23229
23230 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
23231 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
23232 support. The IEEE 128-bit floating point support only works on
23233 PowerPC Linux systems.
23234
23235 The default for -mfloat128 is enabled on PowerPC Linux systems
23236 using the VSX instruction set, and disabled on other systems.
23237
23238 If you use the ISA 3.0 instruction set (-mpower9-vector or
23239 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
23240 support will also enable the generation of ISA 3.0 IEEE 128-bit
23241 floating point instructions. Otherwise, if you do not specify to
23242 generate ISA 3.0 instructions or you are targeting a 32-bit big
23243 endian system, IEEE 128-bit floating point will be done with
23244 software emulation.
23245
23246 -mfloat128-hardware
23247 -mno-float128-hardware
23248 Enable/disable using ISA 3.0 hardware instructions to support the
23249 __float128 data type.
23250
23251 The default for -mfloat128-hardware is enabled on PowerPC Linux
23252 systems using the ISA 3.0 instruction set, and disabled on other
23253 systems.
23254
23255 -m32
23256 -m64
23257 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23258 targets (including GNU/Linux). The 32-bit environment sets int,
23259 long and pointer to 32 bits and generates code that runs on any
23260 PowerPC variant. The 64-bit environment sets int to 32 bits and
23261 long and pointer to 64 bits, and generates code for PowerPC64, as
23262 for -mpowerpc64.
23263
23264 -mfull-toc
23265 -mno-fp-in-toc
23266 -mno-sum-in-toc
23267 -mminimal-toc
23268 Modify generation of the TOC (Table Of Contents), which is created
23269 for every executable file. The -mfull-toc option is selected by
23270 default. In that case, GCC allocates at least one TOC entry for
23271 each unique non-automatic variable reference in your program. GCC
23272 also places floating-point constants in the TOC. However, only
23273 16,384 entries are available in the TOC.
23274
23275 If you receive a linker error message that saying you have
23276 overflowed the available TOC space, you can reduce the amount of
23277 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
23278 -mno-fp-in-toc prevents GCC from putting floating-point constants
23279 in the TOC and -mno-sum-in-toc forces GCC to generate code to
23280 calculate the sum of an address and a constant at run time instead
23281 of putting that sum into the TOC. You may specify one or both of
23282 these options. Each causes GCC to produce very slightly slower and
23283 larger code at the expense of conserving TOC space.
23284
23285 If you still run out of space in the TOC even when you specify both
23286 of these options, specify -mminimal-toc instead. This option
23287 causes GCC to make only one TOC entry for every file. When you
23288 specify this option, GCC produces code that is slower and larger
23289 but which uses extremely little TOC space. You may wish to use
23290 this option only on files that contain less frequently-executed
23291 code.
23292
23293 -maix64
23294 -maix32
23295 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
23296 64-bit "long" type, and the infrastructure needed to support them.
23297 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
23298 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
23299
23300 -mxl-compat
23301 -mno-xl-compat
23302 Produce code that conforms more closely to IBM XL compiler
23303 semantics when using AIX-compatible ABI. Pass floating-point
23304 arguments to prototyped functions beyond the register save area
23305 (RSA) on the stack in addition to argument FPRs. Do not assume
23306 that most significant double in 128-bit long double value is
23307 properly rounded when comparing values and converting to double.
23308 Use XL symbol names for long double support routines.
23309
23310 The AIX calling convention was extended but not initially
23311 documented to handle an obscure K&R C case of calling a function
23312 that takes the address of its arguments with fewer arguments than
23313 declared. IBM XL compilers access floating-point arguments that do
23314 not fit in the RSA from the stack when a subroutine is compiled
23315 without optimization. Because always storing floating-point
23316 arguments on the stack is inefficient and rarely needed, this
23317 option is not enabled by default and only is necessary when calling
23318 subroutines compiled by IBM XL compilers without optimization.
23319
23320 -mpe
23321 Support IBM RS/6000 SP Parallel Environment (PE). Link an
23322 application written to use message passing with special startup
23323 code to enable the application to run. The system must have PE
23324 installed in the standard location (/usr/lpp/ppe.poe/), or the
23325 specs file must be overridden with the -specs= option to specify
23326 the appropriate directory location. The Parallel Environment does
23327 not support threads, so the -mpe option and the -pthread option are
23328 incompatible.
23329
23330 -malign-natural
23331 -malign-power
23332 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23333 -malign-natural overrides the ABI-defined alignment of larger
23334 types, such as floating-point doubles, on their natural size-based
23335 boundary. The option -malign-power instructs GCC to follow the
23336 ABI-specified alignment rules. GCC defaults to the standard
23337 alignment defined in the ABI.
23338
23339 On 64-bit Darwin, natural alignment is the default, and
23340 -malign-power is not supported.
23341
23342 -msoft-float
23343 -mhard-float
23344 Generate code that does not use (uses) the floating-point register
23345 set. Software floating-point emulation is provided if you use the
23346 -msoft-float option, and pass the option to GCC when linking.
23347
23348 -mmultiple
23349 -mno-multiple
23350 Generate code that uses (does not use) the load multiple word
23351 instructions and the store multiple word instructions. These
23352 instructions are generated by default on POWER systems, and not
23353 generated on PowerPC systems. Do not use -mmultiple on little-
23354 endian PowerPC systems, since those instructions do not work when
23355 the processor is in little-endian mode. The exceptions are PPC740
23356 and PPC750 which permit these instructions in little-endian mode.
23357
23358 -mupdate
23359 -mno-update
23360 Generate code that uses (does not use) the load or store
23361 instructions that update the base register to the address of the
23362 calculated memory location. These instructions are generated by
23363 default. If you use -mno-update, there is a small window between
23364 the time that the stack pointer is updated and the address of the
23365 previous frame is stored, which means code that walks the stack
23366 frame across interrupts or signals may get corrupted data.
23367
23368 -mavoid-indexed-addresses
23369 -mno-avoid-indexed-addresses
23370 Generate code that tries to avoid (not avoid) the use of indexed
23371 load or store instructions. These instructions can incur a
23372 performance penalty on Power6 processors in certain situations,
23373 such as when stepping through large arrays that cross a 16M
23374 boundary. This option is enabled by default when targeting Power6
23375 and disabled otherwise.
23376
23377 -mfused-madd
23378 -mno-fused-madd
23379 Generate code that uses (does not use) the floating-point multiply
23380 and accumulate instructions. These instructions are generated by
23381 default if hardware floating point is used. The machine-dependent
23382 -mfused-madd option is now mapped to the machine-independent
23383 -ffp-contract=fast option, and -mno-fused-madd is mapped to
23384 -ffp-contract=off.
23385
23386 -mmulhw
23387 -mno-mulhw
23388 Generate code that uses (does not use) the half-word multiply and
23389 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
23390 processors. These instructions are generated by default when
23391 targeting those processors.
23392
23393 -mdlmzb
23394 -mno-dlmzb
23395 Generate code that uses (does not use) the string-search dlmzb
23396 instruction on the IBM 405, 440, 464 and 476 processors. This
23397 instruction is generated by default when targeting those
23398 processors.
23399
23400 -mno-bit-align
23401 -mbit-align
23402 On System V.4 and embedded PowerPC systems do not (do) force
23403 structures and unions that contain bit-fields to be aligned to the
23404 base type of the bit-field.
23405
23406 For example, by default a structure containing nothing but 8
23407 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
23408 and has a size of 4 bytes. By using -mno-bit-align, the structure
23409 is aligned to a 1-byte boundary and is 1 byte in size.
23410
23411 -mno-strict-align
23412 -mstrict-align
23413 On System V.4 and embedded PowerPC systems do not (do) assume that
23414 unaligned memory references are handled by the system.
23415
23416 -mrelocatable
23417 -mno-relocatable
23418 Generate code that allows (does not allow) a static executable to
23419 be relocated to a different address at run time. A simple embedded
23420 PowerPC system loader should relocate the entire contents of
23421 ".got2" and 4-byte locations listed in the ".fixup" section, a
23422 table of 32-bit addresses generated by this option. For this to
23423 work, all objects linked together must be compiled with
23424 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
23425 stack to an 8-byte boundary.
23426
23427 -mrelocatable-lib
23428 -mno-relocatable-lib
23429 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
23430 to allow static executables to be relocated at run time, but
23431 -mrelocatable-lib does not use the smaller stack alignment of
23432 -mrelocatable. Objects compiled with -mrelocatable-lib may be
23433 linked with objects compiled with any combination of the
23434 -mrelocatable options.
23435
23436 -mno-toc
23437 -mtoc
23438 On System V.4 and embedded PowerPC systems do not (do) assume that
23439 register 2 contains a pointer to a global area pointing to the
23440 addresses used in the program.
23441
23442 -mlittle
23443 -mlittle-endian
23444 On System V.4 and embedded PowerPC systems compile code for the
23445 processor in little-endian mode. The -mlittle-endian option is the
23446 same as -mlittle.
23447
23448 -mbig
23449 -mbig-endian
23450 On System V.4 and embedded PowerPC systems compile code for the
23451 processor in big-endian mode. The -mbig-endian option is the same
23452 as -mbig.
23453
23454 -mdynamic-no-pic
23455 On Darwin and Mac OS X systems, compile code so that it is not
23456 relocatable, but that its external references are relocatable. The
23457 resulting code is suitable for applications, but not shared
23458 libraries.
23459
23460 -msingle-pic-base
23461 Treat the register used for PIC addressing as read-only, rather
23462 than loading it in the prologue for each function. The runtime
23463 system is responsible for initializing this register with an
23464 appropriate value before execution begins.
23465
23466 -mprioritize-restricted-insns=priority
23467 This option controls the priority that is assigned to dispatch-slot
23468 restricted instructions during the second scheduling pass. The
23469 argument priority takes the value 0, 1, or 2 to assign no, highest,
23470 or second-highest (respectively) priority to dispatch-slot
23471 restricted instructions.
23472
23473 -msched-costly-dep=dependence_type
23474 This option controls which dependences are considered costly by the
23475 target during instruction scheduling. The argument dependence_type
23476 takes one of the following values:
23477
23478 no No dependence is costly.
23479
23480 all All dependences are costly.
23481
23482 true_store_to_load
23483 A true dependence from store to load is costly.
23484
23485 store_to_load
23486 Any dependence from store to load is costly.
23487
23488 number
23489 Any dependence for which the latency is greater than or equal
23490 to number is costly.
23491
23492 -minsert-sched-nops=scheme
23493 This option controls which NOP insertion scheme is used during the
23494 second scheduling pass. The argument scheme takes one of the
23495 following values:
23496
23497 no Don't insert NOPs.
23498
23499 pad Pad with NOPs any dispatch group that has vacant issue slots,
23500 according to the scheduler's grouping.
23501
23502 regroup_exact
23503 Insert NOPs to force costly dependent insns into separate
23504 groups. Insert exactly as many NOPs as needed to force an insn
23505 to a new group, according to the estimated processor grouping.
23506
23507 number
23508 Insert NOPs to force costly dependent insns into separate
23509 groups. Insert number NOPs to force an insn to a new group.
23510
23511 -mcall-sysv
23512 On System V.4 and embedded PowerPC systems compile code using
23513 calling conventions that adhere to the March 1995 draft of the
23514 System V Application Binary Interface, PowerPC processor
23515 supplement. This is the default unless you configured GCC using
23516 powerpc-*-eabiaix.
23517
23518 -mcall-sysv-eabi
23519 -mcall-eabi
23520 Specify both -mcall-sysv and -meabi options.
23521
23522 -mcall-sysv-noeabi
23523 Specify both -mcall-sysv and -mno-eabi options.
23524
23525 -mcall-aixdesc
23526 On System V.4 and embedded PowerPC systems compile code for the AIX
23527 operating system.
23528
23529 -mcall-linux
23530 On System V.4 and embedded PowerPC systems compile code for the
23531 Linux-based GNU system.
23532
23533 -mcall-freebsd
23534 On System V.4 and embedded PowerPC systems compile code for the
23535 FreeBSD operating system.
23536
23537 -mcall-netbsd
23538 On System V.4 and embedded PowerPC systems compile code for the
23539 NetBSD operating system.
23540
23541 -mcall-openbsd
23542 On System V.4 and embedded PowerPC systems compile code for the
23543 OpenBSD operating system.
23544
23545 -mtraceback=traceback_type
23546 Select the type of traceback table. Valid values for traceback_type
23547 are full, part, and no.
23548
23549 -maix-struct-return
23550 Return all structures in memory (as specified by the AIX ABI).
23551
23552 -msvr4-struct-return
23553 Return structures smaller than 8 bytes in registers (as specified
23554 by the SVR4 ABI).
23555
23556 -mabi=abi-type
23557 Extend the current ABI with a particular extension, or remove such
23558 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
23559 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
23560
23561 -mabi=ibmlongdouble
23562 Change the current ABI to use IBM extended-precision long double.
23563 This is not likely to work if your system defaults to using IEEE
23564 extended-precision long double. If you change the long double type
23565 from IEEE extended-precision, the compiler will issue a warning
23566 unless you use the -Wno-psabi option. Requires -mlong-double-128
23567 to be enabled.
23568
23569 -mabi=ieeelongdouble
23570 Change the current ABI to use IEEE extended-precision long double.
23571 This is not likely to work if your system defaults to using IBM
23572 extended-precision long double. If you change the long double type
23573 from IBM extended-precision, the compiler will issue a warning
23574 unless you use the -Wno-psabi option. Requires -mlong-double-128
23575 to be enabled.
23576
23577 -mabi=elfv1
23578 Change the current ABI to use the ELFv1 ABI. This is the default
23579 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
23580 ABI requires special system support and is likely to fail in
23581 spectacular ways.
23582
23583 -mabi=elfv2
23584 Change the current ABI to use the ELFv2 ABI. This is the default
23585 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
23586 ABI requires special system support and is likely to fail in
23587 spectacular ways.
23588
23589 -mgnu-attribute
23590 -mno-gnu-attribute
23591 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23592 .gnu.attributes section that specify ABI variations in function
23593 parameters or return values.
23594
23595 -mprototype
23596 -mno-prototype
23597 On System V.4 and embedded PowerPC systems assume that all calls to
23598 variable argument functions are properly prototyped. Otherwise,
23599 the compiler must insert an instruction before every non-prototyped
23600 call to set or clear bit 6 of the condition code register ("CR") to
23601 indicate whether floating-point values are passed in the floating-
23602 point registers in case the function takes variable arguments.
23603 With -mprototype, only calls to prototyped variable argument
23604 functions set or clear the bit.
23605
23606 -msim
23607 On embedded PowerPC systems, assume that the startup module is
23608 called sim-crt0.o and that the standard C libraries are libsim.a
23609 and libc.a. This is the default for powerpc-*-eabisim
23610 configurations.
23611
23612 -mmvme
23613 On embedded PowerPC systems, assume that the startup module is
23614 called crt0.o and the standard C libraries are libmvme.a and
23615 libc.a.
23616
23617 -mads
23618 On embedded PowerPC systems, assume that the startup module is
23619 called crt0.o and the standard C libraries are libads.a and libc.a.
23620
23621 -myellowknife
23622 On embedded PowerPC systems, assume that the startup module is
23623 called crt0.o and the standard C libraries are libyk.a and libc.a.
23624
23625 -mvxworks
23626 On System V.4 and embedded PowerPC systems, specify that you are
23627 compiling for a VxWorks system.
23628
23629 -memb
23630 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
23631 header to indicate that eabi extended relocations are used.
23632
23633 -meabi
23634 -mno-eabi
23635 On System V.4 and embedded PowerPC systems do (do not) adhere to
23636 the Embedded Applications Binary Interface (EABI), which is a set
23637 of modifications to the System V.4 specifications. Selecting
23638 -meabi means that the stack is aligned to an 8-byte boundary, a
23639 function "__eabi" is called from "main" to set up the EABI
23640 environment, and the -msdata option can use both "r2" and "r13" to
23641 point to two separate small data areas. Selecting -mno-eabi means
23642 that the stack is aligned to a 16-byte boundary, no EABI
23643 initialization function is called from "main", and the -msdata
23644 option only uses "r13" to point to a single small data area. The
23645 -meabi option is on by default if you configured GCC using one of
23646 the powerpc*-*-eabi* options.
23647
23648 -msdata=eabi
23649 On System V.4 and embedded PowerPC systems, put small initialized
23650 "const" global and static data in the ".sdata2" section, which is
23651 pointed to by register "r2". Put small initialized non-"const"
23652 global and static data in the ".sdata" section, which is pointed to
23653 by register "r13". Put small uninitialized global and static data
23654 in the ".sbss" section, which is adjacent to the ".sdata" section.
23655 The -msdata=eabi option is incompatible with the -mrelocatable
23656 option. The -msdata=eabi option also sets the -memb option.
23657
23658 -msdata=sysv
23659 On System V.4 and embedded PowerPC systems, put small global and
23660 static data in the ".sdata" section, which is pointed to by
23661 register "r13". Put small uninitialized global and static data in
23662 the ".sbss" section, which is adjacent to the ".sdata" section.
23663 The -msdata=sysv option is incompatible with the -mrelocatable
23664 option.
23665
23666 -msdata=default
23667 -msdata
23668 On System V.4 and embedded PowerPC systems, if -meabi is used,
23669 compile code the same as -msdata=eabi, otherwise compile code the
23670 same as -msdata=sysv.
23671
23672 -msdata=data
23673 On System V.4 and embedded PowerPC systems, put small global data
23674 in the ".sdata" section. Put small uninitialized global data in
23675 the ".sbss" section. Do not use register "r13" to address small
23676 data however. This is the default behavior unless other -msdata
23677 options are used.
23678
23679 -msdata=none
23680 -mno-sdata
23681 On embedded PowerPC systems, put all initialized global and static
23682 data in the ".data" section, and all uninitialized data in the
23683 ".bss" section.
23684
23685 -mreadonly-in-sdata
23686 Put read-only objects in the ".sdata" section as well. This is the
23687 default.
23688
23689 -mblock-move-inline-limit=num
23690 Inline all block moves (such as calls to "memcpy" or structure
23691 copies) less than or equal to num bytes. The minimum value for num
23692 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
23693 default value is target-specific.
23694
23695 -mblock-compare-inline-limit=num
23696 Generate non-looping inline code for all block compares (such as
23697 calls to "memcmp" or structure compares) less than or equal to num
23698 bytes. If num is 0, all inline expansion (non-loop and loop) of
23699 block compare is disabled. The default value is target-specific.
23700
23701 -mblock-compare-inline-loop-limit=num
23702 Generate an inline expansion using loop code for all block compares
23703 that are less than or equal to num bytes, but greater than the
23704 limit for non-loop inline block compare expansion. If the block
23705 length is not constant, at most num bytes will be compared before
23706 "memcmp" is called to compare the remainder of the block. The
23707 default value is target-specific.
23708
23709 -mstring-compare-inline-limit=num
23710 Compare at most num string bytes with inline code. If the
23711 difference or end of string is not found at the end of the inline
23712 compare a call to "strcmp" or "strncmp" will take care of the rest
23713 of the comparison. The default is 64 bytes.
23714
23715 -G num
23716 On embedded PowerPC systems, put global and static items less than
23717 or equal to num bytes into the small data or BSS sections instead
23718 of the normal data or BSS section. By default, num is 8. The -G
23719 num switch is also passed to the linker. All modules should be
23720 compiled with the same -G num value.
23721
23722 -mregnames
23723 -mno-regnames
23724 On System V.4 and embedded PowerPC systems do (do not) emit
23725 register names in the assembly language output using symbolic
23726 forms.
23727
23728 -mlongcall
23729 -mno-longcall
23730 By default assume that all calls are far away so that a longer and
23731 more expensive calling sequence is required. This is required for
23732 calls farther than 32 megabytes (33,554,432 bytes) from the current
23733 location. A short call is generated if the compiler knows the call
23734 cannot be that far away. This setting can be overridden by the
23735 "shortcall" function attribute, or by "#pragma longcall(0)".
23736
23737 Some linkers are capable of detecting out-of-range calls and
23738 generating glue code on the fly. On these systems, long calls are
23739 unnecessary and generate slower code. As of this writing, the AIX
23740 linker can do this, as can the GNU linker for PowerPC/64. It is
23741 planned to add this feature to the GNU linker for 32-bit PowerPC
23742 systems as well.
23743
23744 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
23745 linkers, GCC can generate long calls using an inline PLT call
23746 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
23747 ELFv1 (big-endian) do not support inline PLT calls.
23748
23749 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
23750 L42", plus a branch island (glue code). The two target addresses
23751 represent the callee and the branch island. The Darwin/PPC linker
23752 prefers the first address and generates a "bl callee" if the PPC
23753 "bl" instruction reaches the callee directly; otherwise, the linker
23754 generates "bl L42" to call the branch island. The branch island is
23755 appended to the body of the calling function; it computes the full
23756 32-bit address of the callee and jumps to it.
23757
23758 On Mach-O (Darwin) systems, this option directs the compiler emit
23759 to the glue for every direct call, and the Darwin linker decides
23760 whether to use or discard it.
23761
23762 In the future, GCC may ignore all longcall specifications when the
23763 linker is known to generate glue.
23764
23765 -mpltseq
23766 -mno-pltseq
23767 Implement (do not implement) -fno-plt and long calls using an
23768 inline PLT call sequence that supports lazy linking and long calls
23769 to functions in dlopen'd shared libraries. Inline PLT calls are
23770 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
23771 newer GNU linkers, and are enabled by default if the support is
23772 detected when configuring GCC, and, in the case of 32-bit PowerPC,
23773 if GCC is configured with --enable-secureplt. -mpltseq code and
23774 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
23775 together.
23776
23777 -mtls-markers
23778 -mno-tls-markers
23779 Mark (do not mark) calls to "__tls_get_addr" with a relocation
23780 specifying the function argument. The relocation allows the linker
23781 to reliably associate function call with argument setup
23782 instructions for TLS optimization, which in turn allows GCC to
23783 better schedule the sequence.
23784
23785 -mrecip
23786 -mno-recip
23787 This option enables use of the reciprocal estimate and reciprocal
23788 square root estimate instructions with additional Newton-Raphson
23789 steps to increase precision instead of doing a divide or square
23790 root and divide for floating-point arguments. You should use the
23791 -ffast-math option when using -mrecip (or at least
23792 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
23793 and -fno-trapping-math). Note that while the throughput of the
23794 sequence is generally higher than the throughput of the non-
23795 reciprocal instruction, the precision of the sequence can be
23796 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
23797 0.99999994) for reciprocal square roots.
23798
23799 -mrecip=opt
23800 This option controls which reciprocal estimate instructions may be
23801 used. opt is a comma-separated list of options, which may be
23802 preceded by a "!" to invert the option:
23803
23804 all Enable all estimate instructions.
23805
23806 default
23807 Enable the default instructions, equivalent to -mrecip.
23808
23809 none
23810 Disable all estimate instructions, equivalent to -mno-recip.
23811
23812 div Enable the reciprocal approximation instructions for both
23813 single and double precision.
23814
23815 divf
23816 Enable the single-precision reciprocal approximation
23817 instructions.
23818
23819 divd
23820 Enable the double-precision reciprocal approximation
23821 instructions.
23822
23823 rsqrt
23824 Enable the reciprocal square root approximation instructions
23825 for both single and double precision.
23826
23827 rsqrtf
23828 Enable the single-precision reciprocal square root
23829 approximation instructions.
23830
23831 rsqrtd
23832 Enable the double-precision reciprocal square root
23833 approximation instructions.
23834
23835 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
23836 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
23837 "XVRSQRTEDP" instructions which handle the double-precision
23838 reciprocal square root calculations.
23839
23840 -mrecip-precision
23841 -mno-recip-precision
23842 Assume (do not assume) that the reciprocal estimate instructions
23843 provide higher-precision estimates than is mandated by the PowerPC
23844 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
23845 automatically selects -mrecip-precision. The double-precision
23846 square root estimate instructions are not generated by default on
23847 low-precision machines, since they do not provide an estimate that
23848 converges after three steps.
23849
23850 -mveclibabi=type
23851 Specifies the ABI type to use for vectorizing intrinsics using an
23852 external library. The only type supported at present is mass,
23853 which specifies to use IBM's Mathematical Acceleration Subsystem
23854 (MASS) libraries for vectorizing intrinsics using external
23855 libraries. GCC currently emits calls to "acosd2", "acosf4",
23856 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
23857 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
23858 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
23859 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
23860 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
23861 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
23862 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
23863 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
23864 "tanhf4" when generating code for power7. Both -ftree-vectorize
23865 and -funsafe-math-optimizations must also be enabled. The MASS
23866 libraries must be specified at link time.
23867
23868 -mfriz
23869 -mno-friz
23870 Generate (do not generate) the "friz" instruction when the
23871 -funsafe-math-optimizations option is used to optimize rounding of
23872 floating-point values to 64-bit integer and back to floating point.
23873 The "friz" instruction does not return the same value if the
23874 floating-point number is too large to fit in an integer.
23875
23876 -mpointers-to-nested-functions
23877 -mno-pointers-to-nested-functions
23878 Generate (do not generate) code to load up the static chain
23879 register ("r11") when calling through a pointer on AIX and 64-bit
23880 Linux systems where a function pointer points to a 3-word
23881 descriptor giving the function address, TOC value to be loaded in
23882 register "r2", and static chain value to be loaded in register
23883 "r11". The -mpointers-to-nested-functions is on by default. You
23884 cannot call through pointers to nested functions or pointers to
23885 functions compiled in other languages that use the static chain if
23886 you use -mno-pointers-to-nested-functions.
23887
23888 -msave-toc-indirect
23889 -mno-save-toc-indirect
23890 Generate (do not generate) code to save the TOC value in the
23891 reserved stack location in the function prologue if the function
23892 calls through a pointer on AIX and 64-bit Linux systems. If the
23893 TOC value is not saved in the prologue, it is saved just before the
23894 call through the pointer. The -mno-save-toc-indirect option is the
23895 default.
23896
23897 -mcompat-align-parm
23898 -mno-compat-align-parm
23899 Generate (do not generate) code to pass structure parameters with a
23900 maximum alignment of 64 bits, for compatibility with older versions
23901 of GCC.
23902
23903 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23904 structure parameter on a 128-bit boundary when that structure
23905 contained a member requiring 128-bit alignment. This is corrected
23906 in more recent versions of GCC. This option may be used to
23907 generate code that is compatible with functions compiled with older
23908 versions of GCC.
23909
23910 The -mno-compat-align-parm option is the default.
23911
23912 -mstack-protector-guard=guard
23913 -mstack-protector-guard-reg=reg
23914 -mstack-protector-guard-offset=offset
23915 -mstack-protector-guard-symbol=symbol
23916 Generate stack protection code using canary at guard. Supported
23917 locations are global for global canary or tls for per-thread canary
23918 in the TLS block (the default with GNU libc version 2.4 or later).
23919
23920 With the latter choice the options -mstack-protector-guard-reg=reg
23921 and -mstack-protector-guard-offset=offset furthermore specify which
23922 register to use as base register for reading the canary, and from
23923 what offset from that base register. The default for those is as
23924 specified in the relevant ABI.
23925 -mstack-protector-guard-symbol=symbol overrides the offset with a
23926 symbol reference to a canary in the TLS block.
23927
23928 -mpcrel
23929 -mno-pcrel
23930 Generate (do not generate) pc-relative addressing when the option
23931 -mcpu=future is used. The -mpcrel option requires that the medium
23932 code model (-mcmodel=medium) and prefixed addressing (-mprefixed)
23933 options are enabled.
23934
23935 -mprefixed
23936 -mno-prefixed
23937 Generate (do not generate) addressing modes using prefixed load and
23938 store instructions when the option -mcpu=future is used.
23939
23940 -mmma
23941 -mno-mma
23942 Generate (do not generate) the MMA instructions when the option
23943 -mcpu=future is used.
23944
23945 -mrop-protect
23946 -mno-rop-protect
23947 Generate (do not generate) ROP protection instructions when the
23948 target processor supports them. Currently this option disables the
23949 shrink-wrap optimization (-fshrink-wrap).
23950
23951 -mprivileged
23952 -mno-privileged
23953 Generate (do not generate) code that will run in privileged state.
23954
23955 -mblock-ops-unaligned-vsx
23956 -mno-block-ops-unaligned-vsx
23957 Generate (do not generate) unaligned vsx loads and stores for
23958 inline expansion of "memcpy" and "memmove".
23959
23960 RX Options
23961 These command-line options are defined for RX targets:
23962
23963 -m64bit-doubles
23964 -m32bit-doubles
23965 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
23966 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
23967 RX floating-point hardware only works on 32-bit values, which is
23968 why the default is -m32bit-doubles.
23969
23970 -fpu
23971 -nofpu
23972 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
23973 hardware. The default is enabled for the RX600 series and disabled
23974 for the RX200 series.
23975
23976 Floating-point instructions are only generated for 32-bit floating-
23977 point values, however, so the FPU hardware is not used for doubles
23978 if the -m64bit-doubles option is used.
23979
23980 Note If the -fpu option is enabled then -funsafe-math-optimizations
23981 is also enabled automatically. This is because the RX FPU
23982 instructions are themselves unsafe.
23983
23984 -mcpu=name
23985 Selects the type of RX CPU to be targeted. Currently three types
23986 are supported, the generic RX600 and RX200 series hardware and the
23987 specific RX610 CPU. The default is RX600.
23988
23989 The only difference between RX600 and RX610 is that the RX610 does
23990 not support the "MVTIPL" instruction.
23991
23992 The RX200 series does not have a hardware floating-point unit and
23993 so -nofpu is enabled by default when this type is selected.
23994
23995 -mbig-endian-data
23996 -mlittle-endian-data
23997 Store data (but not code) in the big-endian format. The default is
23998 -mlittle-endian-data, i.e. to store data in the little-endian
23999 format.
24000
24001 -msmall-data-limit=N
24002 Specifies the maximum size in bytes of global and static variables
24003 which can be placed into the small data area. Using the small data
24004 area can lead to smaller and faster code, but the size of area is
24005 limited and it is up to the programmer to ensure that the area does
24006 not overflow. Also when the small data area is used one of the
24007 RX's registers (usually "r13") is reserved for use pointing to this
24008 area, so it is no longer available for use by the compiler. This
24009 could result in slower and/or larger code if variables are pushed
24010 onto the stack instead of being held in this register.
24011
24012 Note, common variables (variables that have not been initialized)
24013 and constants are not placed into the small data area as they are
24014 assigned to other sections in the output executable.
24015
24016 The default value is zero, which disables this feature. Note, this
24017 feature is not enabled by default with higher optimization levels
24018 (-O2 etc) because of the potentially detrimental effects of
24019 reserving a register. It is up to the programmer to experiment and
24020 discover whether this feature is of benefit to their program. See
24021 the description of the -mpid option for a description of how the
24022 actual register to hold the small data area pointer is chosen.
24023
24024 -msim
24025 -mno-sim
24026 Use the simulator runtime. The default is to use the libgloss
24027 board-specific runtime.
24028
24029 -mas100-syntax
24030 -mno-as100-syntax
24031 When generating assembler output use a syntax that is compatible
24032 with Renesas's AS100 assembler. This syntax can also be handled by
24033 the GAS assembler, but it has some restrictions so it is not
24034 generated by default.
24035
24036 -mmax-constant-size=N
24037 Specifies the maximum size, in bytes, of a constant that can be
24038 used as an operand in a RX instruction. Although the RX
24039 instruction set does allow constants of up to 4 bytes in length to
24040 be used in instructions, a longer value equates to a longer
24041 instruction. Thus in some circumstances it can be beneficial to
24042 restrict the size of constants that are used in instructions.
24043 Constants that are too big are instead placed into a constant pool
24044 and referenced via register indirection.
24045
24046 The value N can be between 0 and 4. A value of 0 (the default) or
24047 4 means that constants of any size are allowed.
24048
24049 -mrelax
24050 Enable linker relaxation. Linker relaxation is a process whereby
24051 the linker attempts to reduce the size of a program by finding
24052 shorter versions of various instructions. Disabled by default.
24053
24054 -mint-register=N
24055 Specify the number of registers to reserve for fast interrupt
24056 handler functions. The value N can be between 0 and 4. A value of
24057 1 means that register "r13" is reserved for the exclusive use of
24058 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
24059 value of 3 reserves "r13", "r12" and "r11", and a value of 4
24060 reserves "r13" through "r10". A value of 0, the default, does not
24061 reserve any registers.
24062
24063 -msave-acc-in-interrupts
24064 Specifies that interrupt handler functions should preserve the
24065 accumulator register. This is only necessary if normal code might
24066 use the accumulator register, for example because it performs
24067 64-bit multiplications. The default is to ignore the accumulator
24068 as this makes the interrupt handlers faster.
24069
24070 -mpid
24071 -mno-pid
24072 Enables the generation of position independent data. When enabled
24073 any access to constant data is done via an offset from a base
24074 address held in a register. This allows the location of constant
24075 data to be determined at run time without requiring the executable
24076 to be relocated, which is a benefit to embedded applications with
24077 tight memory constraints. Data that can be modified is not
24078 affected by this option.
24079
24080 Note, using this feature reserves a register, usually "r13", for
24081 the constant data base address. This can result in slower and/or
24082 larger code, especially in complicated functions.
24083
24084 The actual register chosen to hold the constant data base address
24085 depends upon whether the -msmall-data-limit and/or the
24086 -mint-register command-line options are enabled. Starting with
24087 register "r13" and proceeding downwards, registers are allocated
24088 first to satisfy the requirements of -mint-register, then -mpid and
24089 finally -msmall-data-limit. Thus it is possible for the small data
24090 area register to be "r8" if both -mint-register=4 and -mpid are
24091 specified on the command line.
24092
24093 By default this feature is not enabled. The default can be
24094 restored via the -mno-pid command-line option.
24095
24096 -mno-warn-multiple-fast-interrupts
24097 -mwarn-multiple-fast-interrupts
24098 Prevents GCC from issuing a warning message if it finds more than
24099 one fast interrupt handler when it is compiling a file. The
24100 default is to issue a warning for each extra fast interrupt handler
24101 found, as the RX only supports one such interrupt.
24102
24103 -mallow-string-insns
24104 -mno-allow-string-insns
24105 Enables or disables the use of the string manipulation instructions
24106 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
24107 "RMPA" instruction. These instructions may prefetch data, which is
24108 not safe to do if accessing an I/O register. (See section 12.2.7
24109 of the RX62N Group User's Manual for more information).
24110
24111 The default is to allow these instructions, but it is not possible
24112 for GCC to reliably detect all circumstances where a string
24113 instruction might be used to access an I/O register, so their use
24114 cannot be disabled automatically. Instead it is reliant upon the
24115 programmer to use the -mno-allow-string-insns option if their
24116 program accesses I/O space.
24117
24118 When the instructions are enabled GCC defines the C preprocessor
24119 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
24120 "__RX_DISALLOW_STRING_INSNS__".
24121
24122 -mjsr
24123 -mno-jsr
24124 Use only (or not only) "JSR" instructions to access functions.
24125 This option can be used when code size exceeds the range of "BSR"
24126 instructions. Note that -mno-jsr does not mean to not use "JSR"
24127 but instead means that any type of branch may be used.
24128
24129 Note: The generic GCC command-line option -ffixed-reg has special
24130 significance to the RX port when used with the "interrupt" function
24131 attribute. This attribute indicates a function intended to process
24132 fast interrupts. GCC ensures that it only uses the registers "r10",
24133 "r11", "r12" and/or "r13" and only provided that the normal use of the
24134 corresponding registers have been restricted via the -ffixed-reg or
24135 -mint-register command-line options.
24136
24137 S/390 and zSeries Options
24138 These are the -m options defined for the S/390 and zSeries
24139 architecture.
24140
24141 -mhard-float
24142 -msoft-float
24143 Use (do not use) the hardware floating-point instructions and
24144 registers for floating-point operations. When -msoft-float is
24145 specified, functions in libgcc.a are used to perform floating-point
24146 operations. When -mhard-float is specified, the compiler generates
24147 IEEE floating-point instructions. This is the default.
24148
24149 -mhard-dfp
24150 -mno-hard-dfp
24151 Use (do not use) the hardware decimal-floating-point instructions
24152 for decimal-floating-point operations. When -mno-hard-dfp is
24153 specified, functions in libgcc.a are used to perform decimal-
24154 floating-point operations. When -mhard-dfp is specified, the
24155 compiler generates decimal-floating-point hardware instructions.
24156 This is the default for -march=z9-ec or higher.
24157
24158 -mlong-double-64
24159 -mlong-double-128
24160 These switches control the size of "long double" type. A size of 64
24161 bits makes the "long double" type equivalent to the "double" type.
24162 This is the default.
24163
24164 -mbackchain
24165 -mno-backchain
24166 Store (do not store) the address of the caller's frame as backchain
24167 pointer into the callee's stack frame. A backchain may be needed
24168 to allow debugging using tools that do not understand DWARF call
24169 frame information. When -mno-packed-stack is in effect, the
24170 backchain pointer is stored at the bottom of the stack frame; when
24171 -mpacked-stack is in effect, the backchain is placed into the
24172 topmost word of the 96/160 byte register save area.
24173
24174 In general, code compiled with -mbackchain is call-compatible with
24175 code compiled with -mno-backchain; however, use of the backchain
24176 for debugging purposes usually requires that the whole binary is
24177 built with -mbackchain. Note that the combination of -mbackchain,
24178 -mpacked-stack and -mhard-float is not supported. In order to
24179 build a linux kernel use -msoft-float.
24180
24181 The default is to not maintain the backchain.
24182
24183 -mpacked-stack
24184 -mno-packed-stack
24185 Use (do not use) the packed stack layout. When -mno-packed-stack
24186 is specified, the compiler uses the all fields of the 96/160 byte
24187 register save area only for their default purpose; unused fields
24188 still take up stack space. When -mpacked-stack is specified,
24189 register save slots are densely packed at the top of the register
24190 save area; unused space is reused for other purposes, allowing for
24191 more efficient use of the available stack space. However, when
24192 -mbackchain is also in effect, the topmost word of the save area is
24193 always used to store the backchain, and the return address register
24194 is always saved two words below the backchain.
24195
24196 As long as the stack frame backchain is not used, code generated
24197 with -mpacked-stack is call-compatible with code generated with
24198 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
24199 S/390 or zSeries generated code that uses the stack frame backchain
24200 at run time, not just for debugging purposes. Such code is not
24201 call-compatible with code compiled with -mpacked-stack. Also, note
24202 that the combination of -mbackchain, -mpacked-stack and
24203 -mhard-float is not supported. In order to build a linux kernel
24204 use -msoft-float.
24205
24206 The default is to not use the packed stack layout.
24207
24208 -msmall-exec
24209 -mno-small-exec
24210 Generate (or do not generate) code using the "bras" instruction to
24211 do subroutine calls. This only works reliably if the total
24212 executable size does not exceed 64k. The default is to use the
24213 "basr" instruction instead, which does not have this limitation.
24214
24215 -m64
24216 -m31
24217 When -m31 is specified, generate code compliant to the GNU/Linux
24218 for S/390 ABI. When -m64 is specified, generate code compliant to
24219 the GNU/Linux for zSeries ABI. This allows GCC in particular to
24220 generate 64-bit instructions. For the s390 targets, the default is
24221 -m31, while the s390x targets default to -m64.
24222
24223 -mzarch
24224 -mesa
24225 When -mzarch is specified, generate code using the instructions
24226 available on z/Architecture. When -mesa is specified, generate
24227 code using the instructions available on ESA/390. Note that -mesa
24228 is not possible with -m64. When generating code compliant to the
24229 GNU/Linux for S/390 ABI, the default is -mesa. When generating
24230 code compliant to the GNU/Linux for zSeries ABI, the default is
24231 -mzarch.
24232
24233 -mhtm
24234 -mno-htm
24235 The -mhtm option enables a set of builtins making use of
24236 instructions available with the transactional execution facility
24237 introduced with the IBM zEnterprise EC12 machine generation S/390
24238 System z Built-in Functions. -mhtm is enabled by default when
24239 using -march=zEC12.
24240
24241 -mvx
24242 -mno-vx
24243 When -mvx is specified, generate code using the instructions
24244 available with the vector extension facility introduced with the
24245 IBM z13 machine generation. This option changes the ABI for some
24246 vector type values with regard to alignment and calling
24247 conventions. In case vector type values are being used in an ABI-
24248 relevant context a GAS .gnu_attribute command will be added to mark
24249 the resulting binary with the ABI used. -mvx is enabled by default
24250 when using -march=z13.
24251
24252 -mzvector
24253 -mno-zvector
24254 The -mzvector option enables vector language extensions and
24255 builtins using instructions available with the vector extension
24256 facility introduced with the IBM z13 machine generation. This
24257 option adds support for vector to be used as a keyword to define
24258 vector type variables and arguments. vector is only available when
24259 GNU extensions are enabled. It will not be expanded when
24260 requesting strict standard compliance e.g. with -std=c99. In
24261 addition to the GCC low-level builtins -mzvector enables a set of
24262 builtins added for compatibility with AltiVec-style implementations
24263 like Power and Cell. In order to make use of these builtins the
24264 header file vecintrin.h needs to be included. -mzvector is
24265 disabled by default.
24266
24267 -mmvcle
24268 -mno-mvcle
24269 Generate (or do not generate) code using the "mvcle" instruction to
24270 perform block moves. When -mno-mvcle is specified, use a "mvc"
24271 loop instead. This is the default unless optimizing for size.
24272
24273 -mdebug
24274 -mno-debug
24275 Print (or do not print) additional debug information when
24276 compiling. The default is to not print debug information.
24277
24278 -march=cpu-type
24279 Generate code that runs on cpu-type, which is the name of a system
24280 representing a certain processor type. Possible values for cpu-
24281 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
24282 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, and native.
24283
24284 The default is -march=z900.
24285
24286 Specifying native as cpu type can be used to select the best
24287 architecture option for the host processor. -march=native has no
24288 effect if GCC does not recognize the processor.
24289
24290 -mtune=cpu-type
24291 Tune to cpu-type everything applicable about the generated code,
24292 except for the ABI and the set of available instructions. The list
24293 of cpu-type values is the same as for -march. The default is the
24294 value used for -march.
24295
24296 -mtpf-trace
24297 -mno-tpf-trace
24298 Generate code that adds (does not add) in TPF OS specific branches
24299 to trace routines in the operating system. This option is off by
24300 default, even when compiling for the TPF OS.
24301
24302 -mtpf-trace-skip
24303 -mno-tpf-trace-skip
24304 Generate code that changes (does not change) the default branch
24305 targets enabled by -mtpf-trace to point to specialized trace
24306 routines providing the ability of selectively skipping function
24307 trace entries for the TPF OS. This option is off by default, even
24308 when compiling for the TPF OS and specifying -mtpf-trace.
24309
24310 -mfused-madd
24311 -mno-fused-madd
24312 Generate code that uses (does not use) the floating-point multiply
24313 and accumulate instructions. These instructions are generated by
24314 default if hardware floating point is used.
24315
24316 -mwarn-framesize=framesize
24317 Emit a warning if the current function exceeds the given frame
24318 size. Because this is a compile-time check it doesn't need to be a
24319 real problem when the program runs. It is intended to identify
24320 functions that most probably cause a stack overflow. It is useful
24321 to be used in an environment with limited stack size e.g. the linux
24322 kernel.
24323
24324 -mwarn-dynamicstack
24325 Emit a warning if the function calls "alloca" or uses dynamically-
24326 sized arrays. This is generally a bad idea with a limited stack
24327 size.
24328
24329 -mstack-guard=stack-guard
24330 -mstack-size=stack-size
24331 If these options are provided the S/390 back end emits additional
24332 instructions in the function prologue that trigger a trap if the
24333 stack size is stack-guard bytes above the stack-size (remember that
24334 the stack on S/390 grows downward). If the stack-guard option is
24335 omitted the smallest power of 2 larger than the frame size of the
24336 compiled function is chosen. These options are intended to be used
24337 to help debugging stack overflow problems. The additionally
24338 emitted code causes only little overhead and hence can also be used
24339 in production-like systems without greater performance degradation.
24340 The given values have to be exact powers of 2 and stack-size has to
24341 be greater than stack-guard without exceeding 64k. In order to be
24342 efficient the extra code makes the assumption that the stack starts
24343 at an address aligned to the value given by stack-size. The stack-
24344 guard option can only be used in conjunction with stack-size.
24345
24346 -mhotpatch=pre-halfwords,post-halfwords
24347 If the hotpatch option is enabled, a "hot-patching" function
24348 prologue is generated for all functions in the compilation unit.
24349 The funtion label is prepended with the given number of two-byte
24350 NOP instructions (pre-halfwords, maximum 1000000). After the
24351 label, 2 * post-halfwords bytes are appended, using the largest NOP
24352 like instructions the architecture allows (maximum 1000000).
24353
24354 If both arguments are zero, hotpatching is disabled.
24355
24356 This option can be overridden for individual functions with the
24357 "hotpatch" attribute.
24358
24359 Score Options
24360 These options are defined for Score implementations:
24361
24362 -meb
24363 Compile code for big-endian mode. This is the default.
24364
24365 -mel
24366 Compile code for little-endian mode.
24367
24368 -mnhwloop
24369 Disable generation of "bcnz" instructions.
24370
24371 -muls
24372 Enable generation of unaligned load and store instructions.
24373
24374 -mmac
24375 Enable the use of multiply-accumulate instructions. Disabled by
24376 default.
24377
24378 -mscore5
24379 Specify the SCORE5 as the target architecture.
24380
24381 -mscore5u
24382 Specify the SCORE5U of the target architecture.
24383
24384 -mscore7
24385 Specify the SCORE7 as the target architecture. This is the default.
24386
24387 -mscore7d
24388 Specify the SCORE7D as the target architecture.
24389
24390 SH Options
24391 These -m options are defined for the SH implementations:
24392
24393 -m1 Generate code for the SH1.
24394
24395 -m2 Generate code for the SH2.
24396
24397 -m2e
24398 Generate code for the SH2e.
24399
24400 -m2a-nofpu
24401 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
24402 way that the floating-point unit is not used.
24403
24404 -m2a-single-only
24405 Generate code for the SH2a-FPU, in such a way that no double-
24406 precision floating-point operations are used.
24407
24408 -m2a-single
24409 Generate code for the SH2a-FPU assuming the floating-point unit is
24410 in single-precision mode by default.
24411
24412 -m2a
24413 Generate code for the SH2a-FPU assuming the floating-point unit is
24414 in double-precision mode by default.
24415
24416 -m3 Generate code for the SH3.
24417
24418 -m3e
24419 Generate code for the SH3e.
24420
24421 -m4-nofpu
24422 Generate code for the SH4 without a floating-point unit.
24423
24424 -m4-single-only
24425 Generate code for the SH4 with a floating-point unit that only
24426 supports single-precision arithmetic.
24427
24428 -m4-single
24429 Generate code for the SH4 assuming the floating-point unit is in
24430 single-precision mode by default.
24431
24432 -m4 Generate code for the SH4.
24433
24434 -m4-100
24435 Generate code for SH4-100.
24436
24437 -m4-100-nofpu
24438 Generate code for SH4-100 in such a way that the floating-point
24439 unit is not used.
24440
24441 -m4-100-single
24442 Generate code for SH4-100 assuming the floating-point unit is in
24443 single-precision mode by default.
24444
24445 -m4-100-single-only
24446 Generate code for SH4-100 in such a way that no double-precision
24447 floating-point operations are used.
24448
24449 -m4-200
24450 Generate code for SH4-200.
24451
24452 -m4-200-nofpu
24453 Generate code for SH4-200 without in such a way that the floating-
24454 point unit is not used.
24455
24456 -m4-200-single
24457 Generate code for SH4-200 assuming the floating-point unit is in
24458 single-precision mode by default.
24459
24460 -m4-200-single-only
24461 Generate code for SH4-200 in such a way that no double-precision
24462 floating-point operations are used.
24463
24464 -m4-300
24465 Generate code for SH4-300.
24466
24467 -m4-300-nofpu
24468 Generate code for SH4-300 without in such a way that the floating-
24469 point unit is not used.
24470
24471 -m4-300-single
24472 Generate code for SH4-300 in such a way that no double-precision
24473 floating-point operations are used.
24474
24475 -m4-300-single-only
24476 Generate code for SH4-300 in such a way that no double-precision
24477 floating-point operations are used.
24478
24479 -m4-340
24480 Generate code for SH4-340 (no MMU, no FPU).
24481
24482 -m4-500
24483 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
24484 assembler.
24485
24486 -m4a-nofpu
24487 Generate code for the SH4al-dsp, or for a SH4a in such a way that
24488 the floating-point unit is not used.
24489
24490 -m4a-single-only
24491 Generate code for the SH4a, in such a way that no double-precision
24492 floating-point operations are used.
24493
24494 -m4a-single
24495 Generate code for the SH4a assuming the floating-point unit is in
24496 single-precision mode by default.
24497
24498 -m4a
24499 Generate code for the SH4a.
24500
24501 -m4al
24502 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
24503 assembler. GCC doesn't generate any DSP instructions at the
24504 moment.
24505
24506 -mb Compile code for the processor in big-endian mode.
24507
24508 -ml Compile code for the processor in little-endian mode.
24509
24510 -mdalign
24511 Align doubles at 64-bit boundaries. Note that this changes the
24512 calling conventions, and thus some functions from the standard C
24513 library do not work unless you recompile it first with -mdalign.
24514
24515 -mrelax
24516 Shorten some address references at link time, when possible; uses
24517 the linker option -relax.
24518
24519 -mbigtable
24520 Use 32-bit offsets in "switch" tables. The default is to use
24521 16-bit offsets.
24522
24523 -mbitops
24524 Enable the use of bit manipulation instructions on SH2A.
24525
24526 -mfmovd
24527 Enable the use of the instruction "fmovd". Check -mdalign for
24528 alignment constraints.
24529
24530 -mrenesas
24531 Comply with the calling conventions defined by Renesas.
24532
24533 -mno-renesas
24534 Comply with the calling conventions defined for GCC before the
24535 Renesas conventions were available. This option is the default for
24536 all targets of the SH toolchain.
24537
24538 -mnomacsave
24539 Mark the "MAC" register as call-clobbered, even if -mrenesas is
24540 given.
24541
24542 -mieee
24543 -mno-ieee
24544 Control the IEEE compliance of floating-point comparisons, which
24545 affects the handling of cases where the result of a comparison is
24546 unordered. By default -mieee is implicitly enabled. If
24547 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
24548 results in faster floating-point greater-equal and less-equal
24549 comparisons. The implicit settings can be overridden by specifying
24550 either -mieee or -mno-ieee.
24551
24552 -minline-ic_invalidate
24553 Inline code to invalidate instruction cache entries after setting
24554 up nested function trampolines. This option has no effect if
24555 -musermode is in effect and the selected code generation option
24556 (e.g. -m4) does not allow the use of the "icbi" instruction. If
24557 the selected code generation option does not allow the use of the
24558 "icbi" instruction, and -musermode is not in effect, the inlined
24559 code manipulates the instruction cache address array directly with
24560 an associative write. This not only requires privileged mode at
24561 run time, but it also fails if the cache line had been mapped via
24562 the TLB and has become unmapped.
24563
24564 -misize
24565 Dump instruction size and location in the assembly code.
24566
24567 -mpadstruct
24568 This option is deprecated. It pads structures to multiple of 4
24569 bytes, which is incompatible with the SH ABI.
24570
24571 -matomic-model=model
24572 Sets the model of atomic operations and additional parameters as a
24573 comma separated list. For details on the atomic built-in functions
24574 see __atomic Builtins. The following models and parameters are
24575 supported:
24576
24577 none
24578 Disable compiler generated atomic sequences and emit library
24579 calls for atomic operations. This is the default if the target
24580 is not "sh*-*-linux*".
24581
24582 soft-gusa
24583 Generate GNU/Linux compatible gUSA software atomic sequences
24584 for the atomic built-in functions. The generated atomic
24585 sequences require additional support from the
24586 interrupt/exception handling code of the system and are only
24587 suitable for SH3* and SH4* single-core systems. This option is
24588 enabled by default when the target is "sh*-*-linux*" and SH3*
24589 or SH4*. When the target is SH4A, this option also partially
24590 utilizes the hardware atomic instructions "movli.l" and
24591 "movco.l" to create more efficient code, unless strict is
24592 specified.
24593
24594 soft-tcb
24595 Generate software atomic sequences that use a variable in the
24596 thread control block. This is a variation of the gUSA
24597 sequences which can also be used on SH1* and SH2* targets. The
24598 generated atomic sequences require additional support from the
24599 interrupt/exception handling code of the system and are only
24600 suitable for single-core systems. When using this model, the
24601 gbr-offset= parameter has to be specified as well.
24602
24603 soft-imask
24604 Generate software atomic sequences that temporarily disable
24605 interrupts by setting "SR.IMASK = 1111". This model works only
24606 when the program runs in privileged mode and is only suitable
24607 for single-core systems. Additional support from the
24608 interrupt/exception handling code of the system is not
24609 required. This model is enabled by default when the target is
24610 "sh*-*-linux*" and SH1* or SH2*.
24611
24612 hard-llcs
24613 Generate hardware atomic sequences using the "movli.l" and
24614 "movco.l" instructions only. This is only available on SH4A
24615 and is suitable for multi-core systems. Since the hardware
24616 instructions support only 32 bit atomic variables access to 8
24617 or 16 bit variables is emulated with 32 bit accesses. Code
24618 compiled with this option is also compatible with other
24619 software atomic model interrupt/exception handling systems if
24620 executed on an SH4A system. Additional support from the
24621 interrupt/exception handling code of the system is not required
24622 for this model.
24623
24624 gbr-offset=
24625 This parameter specifies the offset in bytes of the variable in
24626 the thread control block structure that should be used by the
24627 generated atomic sequences when the soft-tcb model has been
24628 selected. For other models this parameter is ignored. The
24629 specified value must be an integer multiple of four and in the
24630 range 0-1020.
24631
24632 strict
24633 This parameter prevents mixed usage of multiple atomic models,
24634 even if they are compatible, and makes the compiler generate
24635 atomic sequences of the specified model only.
24636
24637 -mtas
24638 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
24639 that depending on the particular hardware and software
24640 configuration this can degrade overall performance due to the
24641 operand cache line flushes that are implied by the "tas.b"
24642 instruction. On multi-core SH4A processors the "tas.b" instruction
24643 must be used with caution since it can result in data corruption
24644 for certain cache configurations.
24645
24646 -mprefergot
24647 When generating position-independent code, emit function calls
24648 using the Global Offset Table instead of the Procedure Linkage
24649 Table.
24650
24651 -musermode
24652 -mno-usermode
24653 Don't allow (allow) the compiler generating privileged mode code.
24654 Specifying -musermode also implies -mno-inline-ic_invalidate if the
24655 inlined code would not work in user mode. -musermode is the
24656 default when the target is "sh*-*-linux*". If the target is SH1*
24657 or SH2* -musermode has no effect, since there is no user mode.
24658
24659 -multcost=number
24660 Set the cost to assume for a multiply insn.
24661
24662 -mdiv=strategy
24663 Set the division strategy to be used for integer division
24664 operations. strategy can be one of:
24665
24666 call-div1
24667 Calls a library function that uses the single-step division
24668 instruction "div1" to perform the operation. Division by zero
24669 calculates an unspecified result and does not trap. This is
24670 the default except for SH4, SH2A and SHcompact.
24671
24672 call-fp
24673 Calls a library function that performs the operation in double
24674 precision floating point. Division by zero causes a floating-
24675 point exception. This is the default for SHcompact with FPU.
24676 Specifying this for targets that do not have a double precision
24677 FPU defaults to "call-div1".
24678
24679 call-table
24680 Calls a library function that uses a lookup table for small
24681 divisors and the "div1" instruction with case distinction for
24682 larger divisors. Division by zero calculates an unspecified
24683 result and does not trap. This is the default for SH4.
24684 Specifying this for targets that do not have dynamic shift
24685 instructions defaults to "call-div1".
24686
24687 When a division strategy has not been specified the default
24688 strategy is selected based on the current target. For SH2A the
24689 default strategy is to use the "divs" and "divu" instructions
24690 instead of library function calls.
24691
24692 -maccumulate-outgoing-args
24693 Reserve space once for outgoing arguments in the function prologue
24694 rather than around each call. Generally beneficial for performance
24695 and size. Also needed for unwinding to avoid changing the stack
24696 frame around conditional code.
24697
24698 -mdivsi3_libfunc=name
24699 Set the name of the library function used for 32-bit signed
24700 division to name. This only affects the name used in the call
24701 division strategies, and the compiler still expects the same sets
24702 of input/output/clobbered registers as if this option were not
24703 present.
24704
24705 -mfixed-range=register-range
24706 Generate code treating the given register range as fixed registers.
24707 A fixed register is one that the register allocator cannot use.
24708 This is useful when compiling kernel code. A register range is
24709 specified as two registers separated by a dash. Multiple register
24710 ranges can be specified separated by a comma.
24711
24712 -mbranch-cost=num
24713 Assume num to be the cost for a branch instruction. Higher numbers
24714 make the compiler try to generate more branch-free code if
24715 possible. If not specified the value is selected depending on the
24716 processor type that is being compiled for.
24717
24718 -mzdcbranch
24719 -mno-zdcbranch
24720 Assume (do not assume) that zero displacement conditional branch
24721 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
24722 the compiler prefers zero displacement branch code sequences. This
24723 is enabled by default when generating code for SH4 and SH4A. It
24724 can be explicitly disabled by specifying -mno-zdcbranch.
24725
24726 -mcbranch-force-delay-slot
24727 Force the usage of delay slots for conditional branches, which
24728 stuffs the delay slot with a "nop" if a suitable instruction cannot
24729 be found. By default this option is disabled. It can be enabled
24730 to work around hardware bugs as found in the original SH7055.
24731
24732 -mfused-madd
24733 -mno-fused-madd
24734 Generate code that uses (does not use) the floating-point multiply
24735 and accumulate instructions. These instructions are generated by
24736 default if hardware floating point is used. The machine-dependent
24737 -mfused-madd option is now mapped to the machine-independent
24738 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24739 -ffp-contract=off.
24740
24741 -mfsca
24742 -mno-fsca
24743 Allow or disallow the compiler to emit the "fsca" instruction for
24744 sine and cosine approximations. The option -mfsca must be used in
24745 combination with -funsafe-math-optimizations. It is enabled by
24746 default when generating code for SH4A. Using -mno-fsca disables
24747 sine and cosine approximations even if -funsafe-math-optimizations
24748 is in effect.
24749
24750 -mfsrra
24751 -mno-fsrra
24752 Allow or disallow the compiler to emit the "fsrra" instruction for
24753 reciprocal square root approximations. The option -mfsrra must be
24754 used in combination with -funsafe-math-optimizations and
24755 -ffinite-math-only. It is enabled by default when generating code
24756 for SH4A. Using -mno-fsrra disables reciprocal square root
24757 approximations even if -funsafe-math-optimizations and
24758 -ffinite-math-only are in effect.
24759
24760 -mpretend-cmove
24761 Prefer zero-displacement conditional branches for conditional move
24762 instruction patterns. This can result in faster code on the SH4
24763 processor.
24764
24765 -mfdpic
24766 Generate code using the FDPIC ABI.
24767
24768 Solaris 2 Options
24769 These -m options are supported on Solaris 2:
24770
24771 -mclear-hwcap
24772 -mclear-hwcap tells the compiler to remove the hardware
24773 capabilities generated by the Solaris assembler. This is only
24774 necessary when object files use ISA extensions not supported by the
24775 current machine, but check at runtime whether or not to use them.
24776
24777 -mimpure-text
24778 -mimpure-text, used in addition to -shared, tells the compiler to
24779 not pass -z text to the linker when linking a shared object. Using
24780 this option, you can link position-dependent code into a shared
24781 object.
24782
24783 -mimpure-text suppresses the "relocations remain against
24784 allocatable but non-writable sections" linker error message.
24785 However, the necessary relocations trigger copy-on-write, and the
24786 shared object is not actually shared across processes. Instead of
24787 using -mimpure-text, you should compile all source code with -fpic
24788 or -fPIC.
24789
24790 These switches are supported in addition to the above on Solaris 2:
24791
24792 -pthreads
24793 This is a synonym for -pthread.
24794
24795 SPARC Options
24796 These -m options are supported on the SPARC:
24797
24798 -mno-app-regs
24799 -mapp-regs
24800 Specify -mapp-regs to generate output using the global registers 2
24801 through 4, which the SPARC SVR4 ABI reserves for applications.
24802 Like the global register 1, each global register 2 through 4 is
24803 then treated as an allocable register that is clobbered by function
24804 calls. This is the default.
24805
24806 To be fully SVR4 ABI-compliant at the cost of some performance
24807 loss, specify -mno-app-regs. You should compile libraries and
24808 system software with this option.
24809
24810 -mflat
24811 -mno-flat
24812 With -mflat, the compiler does not generate save/restore
24813 instructions and uses a "flat" or single register window model.
24814 This model is compatible with the regular register window model.
24815 The local registers and the input registers (0--5) are still
24816 treated as "call-saved" registers and are saved on the stack as
24817 needed.
24818
24819 With -mno-flat (the default), the compiler generates save/restore
24820 instructions (except for leaf functions). This is the normal
24821 operating mode.
24822
24823 -mfpu
24824 -mhard-float
24825 Generate output containing floating-point instructions. This is
24826 the default.
24827
24828 -mno-fpu
24829 -msoft-float
24830 Generate output containing library calls for floating point.
24831 Warning: the requisite libraries are not available for all SPARC
24832 targets. Normally the facilities of the machine's usual C compiler
24833 are used, but this cannot be done directly in cross-compilation.
24834 You must make your own arrangements to provide suitable library
24835 functions for cross-compilation. The embedded targets sparc-*-aout
24836 and sparclite-*-* do provide software floating-point support.
24837
24838 -msoft-float changes the calling convention in the output file;
24839 therefore, it is only useful if you compile all of a program with
24840 this option. In particular, you need to compile libgcc.a, the
24841 library that comes with GCC, with -msoft-float in order for this to
24842 work.
24843
24844 -mhard-quad-float
24845 Generate output containing quad-word (long double) floating-point
24846 instructions.
24847
24848 -msoft-quad-float
24849 Generate output containing library calls for quad-word (long
24850 double) floating-point instructions. The functions called are
24851 those specified in the SPARC ABI. This is the default.
24852
24853 As of this writing, there are no SPARC implementations that have
24854 hardware support for the quad-word floating-point instructions.
24855 They all invoke a trap handler for one of these instructions, and
24856 then the trap handler emulates the effect of the instruction.
24857 Because of the trap handler overhead, this is much slower than
24858 calling the ABI library routines. Thus the -msoft-quad-float
24859 option is the default.
24860
24861 -mno-unaligned-doubles
24862 -munaligned-doubles
24863 Assume that doubles have 8-byte alignment. This is the default.
24864
24865 With -munaligned-doubles, GCC assumes that doubles have 8-byte
24866 alignment only if they are contained in another type, or if they
24867 have an absolute address. Otherwise, it assumes they have 4-byte
24868 alignment. Specifying this option avoids some rare compatibility
24869 problems with code generated by other compilers. It is not the
24870 default because it results in a performance loss, especially for
24871 floating-point code.
24872
24873 -muser-mode
24874 -mno-user-mode
24875 Do not generate code that can only run in supervisor mode. This is
24876 relevant only for the "casa" instruction emitted for the LEON3
24877 processor. This is the default.
24878
24879 -mfaster-structs
24880 -mno-faster-structs
24881 With -mfaster-structs, the compiler assumes that structures should
24882 have 8-byte alignment. This enables the use of pairs of "ldd" and
24883 "std" instructions for copies in structure assignment, in place of
24884 twice as many "ld" and "st" pairs. However, the use of this
24885 changed alignment directly violates the SPARC ABI. Thus, it's
24886 intended only for use on targets where the developer acknowledges
24887 that their resulting code is not directly in line with the rules of
24888 the ABI.
24889
24890 -mstd-struct-return
24891 -mno-std-struct-return
24892 With -mstd-struct-return, the compiler generates checking code in
24893 functions returning structures or unions to detect size mismatches
24894 between the two sides of function calls, as per the 32-bit ABI.
24895
24896 The default is -mno-std-struct-return. This option has no effect
24897 in 64-bit mode.
24898
24899 -mlra
24900 -mno-lra
24901 Enable Local Register Allocation. This is the default for SPARC
24902 since GCC 7 so -mno-lra needs to be passed to get old Reload.
24903
24904 -mcpu=cpu_type
24905 Set the instruction set, register set, and instruction scheduling
24906 parameters for machine type cpu_type. Supported values for
24907 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
24908 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
24909 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24910 niagara7 and m8.
24911
24912 Native Solaris and GNU/Linux toolchains also support the value
24913 native, which selects the best architecture option for the host
24914 processor. -mcpu=native has no effect if GCC does not recognize
24915 the processor.
24916
24917 Default instruction scheduling parameters are used for values that
24918 select an architecture and not an implementation. These are v7,
24919 v8, sparclite, sparclet, v9.
24920
24921 Here is a list of each supported architecture and their supported
24922 implementations.
24923
24924 v7 cypress, leon3v7
24925
24926 v8 supersparc, hypersparc, leon, leon3
24927
24928 sparclite
24929 f930, f934, sparclite86x
24930
24931 sparclet
24932 tsc701
24933
24934 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24935 niagara7, m8
24936
24937 By default (unless configured otherwise), GCC generates code for
24938 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
24939 compiler additionally optimizes it for the Cypress CY7C602 chip, as
24940 used in the SPARCStation/SPARCServer 3xx series. This is also
24941 appropriate for the older SPARCStation 1, 2, IPX etc.
24942
24943 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
24944 architecture. The only difference from V7 code is that the
24945 compiler emits the integer multiply and integer divide instructions
24946 which exist in SPARC-V8 but not in SPARC-V7. With
24947 -mcpu=supersparc, the compiler additionally optimizes it for the
24948 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
24949 series.
24950
24951 With -mcpu=sparclite, GCC generates code for the SPARClite variant
24952 of the SPARC architecture. This adds the integer multiply, integer
24953 divide step and scan ("ffs") instructions which exist in SPARClite
24954 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
24955 optimizes it for the Fujitsu MB86930 chip, which is the original
24956 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
24957 optimizes it for the Fujitsu MB86934 chip, which is the more recent
24958 SPARClite with FPU.
24959
24960 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
24961 the SPARC architecture. This adds the integer multiply,
24962 multiply/accumulate, integer divide step and scan ("ffs")
24963 instructions which exist in SPARClet but not in SPARC-V7. With
24964 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
24965 SPARClet chip.
24966
24967 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
24968 architecture. This adds 64-bit integer and floating-point move
24969 instructions, 3 additional floating-point condition code registers
24970 and conditional move instructions. With -mcpu=ultrasparc, the
24971 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
24972 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
24973 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
24974 -mcpu=niagara, the compiler additionally optimizes it for Sun
24975 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
24976 additionally optimizes it for Sun UltraSPARC T2 chips. With
24977 -mcpu=niagara3, the compiler additionally optimizes it for Sun
24978 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
24979 additionally optimizes it for Sun UltraSPARC T4 chips. With
24980 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
24981 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
24982 it for Oracle M8 chips.
24983
24984 -mtune=cpu_type
24985 Set the instruction scheduling parameters for machine type
24986 cpu_type, but do not set the instruction set or register set that
24987 the option -mcpu=cpu_type does.
24988
24989 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
24990 but the only useful values are those that select a particular CPU
24991 implementation. Those are cypress, supersparc, hypersparc, leon,
24992 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
24993 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
24994 m8. With native Solaris and GNU/Linux toolchains, native can also
24995 be used.
24996
24997 -mv8plus
24998 -mno-v8plus
24999 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
25000 difference from the V8 ABI is that the global and out registers are
25001 considered 64 bits wide. This is enabled by default on Solaris in
25002 32-bit mode for all SPARC-V9 processors.
25003
25004 -mvis
25005 -mno-vis
25006 With -mvis, GCC generates code that takes advantage of the
25007 UltraSPARC Visual Instruction Set extensions. The default is
25008 -mno-vis.
25009
25010 -mvis2
25011 -mno-vis2
25012 With -mvis2, GCC generates code that takes advantage of version 2.0
25013 of the UltraSPARC Visual Instruction Set extensions. The default
25014 is -mvis2 when targeting a cpu that supports such instructions,
25015 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
25016
25017 -mvis3
25018 -mno-vis3
25019 With -mvis3, GCC generates code that takes advantage of version 3.0
25020 of the UltraSPARC Visual Instruction Set extensions. The default
25021 is -mvis3 when targeting a cpu that supports such instructions,
25022 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
25023 -mvis.
25024
25025 -mvis4
25026 -mno-vis4
25027 With -mvis4, GCC generates code that takes advantage of version 4.0
25028 of the UltraSPARC Visual Instruction Set extensions. The default
25029 is -mvis4 when targeting a cpu that supports such instructions,
25030 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
25031 -mvis2 and -mvis.
25032
25033 -mvis4b
25034 -mno-vis4b
25035 With -mvis4b, GCC generates code that takes advantage of version
25036 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
25037 additional VIS instructions introduced in the Oracle SPARC
25038 Architecture 2017. The default is -mvis4b when targeting a cpu
25039 that supports such instructions, such as m8 and later. Setting
25040 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
25041
25042 -mcbcond
25043 -mno-cbcond
25044 With -mcbcond, GCC generates code that takes advantage of the
25045 UltraSPARC Compare-and-Branch-on-Condition instructions. The
25046 default is -mcbcond when targeting a CPU that supports such
25047 instructions, such as Niagara-4 and later.
25048
25049 -mfmaf
25050 -mno-fmaf
25051 With -mfmaf, GCC generates code that takes advantage of the
25052 UltraSPARC Fused Multiply-Add Floating-point instructions. The
25053 default is -mfmaf when targeting a CPU that supports such
25054 instructions, such as Niagara-3 and later.
25055
25056 -mfsmuld
25057 -mno-fsmuld
25058 With -mfsmuld, GCC generates code that takes advantage of the
25059 Floating-point Multiply Single to Double (FsMULd) instruction. The
25060 default is -mfsmuld when targeting a CPU supporting the
25061 architecture versions V8 or V9 with FPU except -mcpu=leon.
25062
25063 -mpopc
25064 -mno-popc
25065 With -mpopc, GCC generates code that takes advantage of the
25066 UltraSPARC Population Count instruction. The default is -mpopc
25067 when targeting a CPU that supports such an instruction, such as
25068 Niagara-2 and later.
25069
25070 -msubxc
25071 -mno-subxc
25072 With -msubxc, GCC generates code that takes advantage of the
25073 UltraSPARC Subtract-Extended-with-Carry instruction. The default
25074 is -msubxc when targeting a CPU that supports such an instruction,
25075 such as Niagara-7 and later.
25076
25077 -mfix-at697f
25078 Enable the documented workaround for the single erratum of the
25079 Atmel AT697F processor (which corresponds to erratum #13 of the
25080 AT697E processor).
25081
25082 -mfix-ut699
25083 Enable the documented workarounds for the floating-point errata and
25084 the data cache nullify errata of the UT699 processor.
25085
25086 -mfix-ut700
25087 Enable the documented workaround for the back-to-back store errata
25088 of the UT699E/UT700 processor.
25089
25090 -mfix-gr712rc
25091 Enable the documented workaround for the back-to-back store errata
25092 of the GR712RC processor.
25093
25094 These -m options are supported in addition to the above on SPARC-V9
25095 processors in 64-bit environments:
25096
25097 -m32
25098 -m64
25099 Generate code for a 32-bit or 64-bit environment. The 32-bit
25100 environment sets int, long and pointer to 32 bits. The 64-bit
25101 environment sets int to 32 bits and long and pointer to 64 bits.
25102
25103 -mcmodel=which
25104 Set the code model to one of
25105
25106 medlow
25107 The Medium/Low code model: 64-bit addresses, programs must be
25108 linked in the low 32 bits of memory. Programs can be
25109 statically or dynamically linked.
25110
25111 medmid
25112 The Medium/Middle code model: 64-bit addresses, programs must
25113 be linked in the low 44 bits of memory, the text and data
25114 segments must be less than 2GB in size and the data segment
25115 must be located within 2GB of the text segment.
25116
25117 medany
25118 The Medium/Anywhere code model: 64-bit addresses, programs may
25119 be linked anywhere in memory, the text and data segments must
25120 be less than 2GB in size and the data segment must be located
25121 within 2GB of the text segment.
25122
25123 embmedany
25124 The Medium/Anywhere code model for embedded systems: 64-bit
25125 addresses, the text and data segments must be less than 2GB in
25126 size, both starting anywhere in memory (determined at link
25127 time). The global register %g4 points to the base of the data
25128 segment. Programs are statically linked and PIC is not
25129 supported.
25130
25131 -mmemory-model=mem-model
25132 Set the memory model in force on the processor to one of
25133
25134 default
25135 The default memory model for the processor and operating
25136 system.
25137
25138 rmo Relaxed Memory Order
25139
25140 pso Partial Store Order
25141
25142 tso Total Store Order
25143
25144 sc Sequential Consistency
25145
25146 These memory models are formally defined in Appendix D of the
25147 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
25148 field.
25149
25150 -mstack-bias
25151 -mno-stack-bias
25152 With -mstack-bias, GCC assumes that the stack pointer, and frame
25153 pointer if present, are offset by -2047 which must be added back
25154 when making stack frame references. This is the default in 64-bit
25155 mode. Otherwise, assume no such offset is present.
25156
25157 Options for System V
25158 These additional options are available on System V Release 4 for
25159 compatibility with other compilers on those systems:
25160
25161 -G Create a shared object. It is recommended that -symbolic or
25162 -shared be used instead.
25163
25164 -Qy Identify the versions of each tool used by the compiler, in a
25165 ".ident" assembler directive in the output.
25166
25167 -Qn Refrain from adding ".ident" directives to the output file (this is
25168 the default).
25169
25170 -YP,dirs
25171 Search the directories dirs, and no others, for libraries specified
25172 with -l.
25173
25174 -Ym,dir
25175 Look in the directory dir to find the M4 preprocessor. The
25176 assembler uses this option.
25177
25178 TILE-Gx Options
25179 These -m options are supported on the TILE-Gx:
25180
25181 -mcmodel=small
25182 Generate code for the small model. The distance for direct calls
25183 is limited to 500M in either direction. PC-relative addresses are
25184 32 bits. Absolute addresses support the full address range.
25185
25186 -mcmodel=large
25187 Generate code for the large model. There is no limitation on call
25188 distance, pc-relative addresses, or absolute addresses.
25189
25190 -mcpu=name
25191 Selects the type of CPU to be targeted. Currently the only
25192 supported type is tilegx.
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 -mbig-endian
25201 -mlittle-endian
25202 Generate code in big/little endian mode, respectively.
25203
25204 TILEPro Options
25205 These -m options are supported on the TILEPro:
25206
25207 -mcpu=name
25208 Selects the type of CPU to be targeted. Currently the only
25209 supported type is tilepro.
25210
25211 -m32
25212 Generate code for a 32-bit environment, which sets int, long, and
25213 pointer to 32 bits. This is the only supported behavior so the
25214 flag is essentially ignored.
25215
25216 V850 Options
25217 These -m options are defined for V850 implementations:
25218
25219 -mlong-calls
25220 -mno-long-calls
25221 Treat all calls as being far away (near). If calls are assumed to
25222 be far away, the compiler always loads the function's address into
25223 a register, and calls indirect through the pointer.
25224
25225 -mno-ep
25226 -mep
25227 Do not optimize (do optimize) basic blocks that use the same index
25228 pointer 4 or more times to copy pointer into the "ep" register, and
25229 use the shorter "sld" and "sst" instructions. The -mep option is
25230 on by default if you optimize.
25231
25232 -mno-prolog-function
25233 -mprolog-function
25234 Do not use (do use) external functions to save and restore
25235 registers at the prologue and epilogue of a function. The external
25236 functions are slower, but use less code space if more than one
25237 function saves the same number of registers. The -mprolog-function
25238 option is on by default if you optimize.
25239
25240 -mspace
25241 Try to make the code as small as possible. At present, this just
25242 turns on the -mep and -mprolog-function options.
25243
25244 -mtda=n
25245 Put static or global variables whose size is n bytes or less into
25246 the tiny data area that register "ep" points to. The tiny data
25247 area can hold up to 256 bytes in total (128 bytes for byte
25248 references).
25249
25250 -msda=n
25251 Put static or global variables whose size is n bytes or less into
25252 the small data area that register "gp" points to. The small data
25253 area can hold up to 64 kilobytes.
25254
25255 -mzda=n
25256 Put static or global variables whose size is n bytes or less into
25257 the first 32 kilobytes of memory.
25258
25259 -mv850
25260 Specify that the target processor is the V850.
25261
25262 -mv850e3v5
25263 Specify that the target processor is the V850E3V5. The
25264 preprocessor constant "__v850e3v5__" is defined if this option is
25265 used.
25266
25267 -mv850e2v4
25268 Specify that the target processor is the V850E3V5. This is an
25269 alias for the -mv850e3v5 option.
25270
25271 -mv850e2v3
25272 Specify that the target processor is the V850E2V3. The
25273 preprocessor constant "__v850e2v3__" is defined if this option is
25274 used.
25275
25276 -mv850e2
25277 Specify that the target processor is the V850E2. The preprocessor
25278 constant "__v850e2__" is defined if this option is used.
25279
25280 -mv850e1
25281 Specify that the target processor is the V850E1. The preprocessor
25282 constants "__v850e1__" and "__v850e__" are defined if this option
25283 is used.
25284
25285 -mv850es
25286 Specify that the target processor is the V850ES. This is an alias
25287 for the -mv850e1 option.
25288
25289 -mv850e
25290 Specify that the target processor is the V850E. The preprocessor
25291 constant "__v850e__" is defined if this option is used.
25292
25293 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
25294 -mv850e2v3 nor -mv850e3v5 are defined then a default target
25295 processor is chosen and the relevant __v850*__ preprocessor
25296 constant is defined.
25297
25298 The preprocessor constants "__v850" and "__v851__" are always
25299 defined, regardless of which processor variant is the target.
25300
25301 -mdisable-callt
25302 -mno-disable-callt
25303 This option suppresses generation of the "CALLT" instruction for
25304 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
25305 v850 architecture.
25306
25307 This option is enabled by default when the RH850 ABI is in use (see
25308 -mrh850-abi), and disabled by default when the GCC ABI is in use.
25309 If "CALLT" instructions are being generated then the C preprocessor
25310 symbol "__V850_CALLT__" is defined.
25311
25312 -mrelax
25313 -mno-relax
25314 Pass on (or do not pass on) the -mrelax command-line option to the
25315 assembler.
25316
25317 -mlong-jumps
25318 -mno-long-jumps
25319 Disable (or re-enable) the generation of PC-relative jump
25320 instructions.
25321
25322 -msoft-float
25323 -mhard-float
25324 Disable (or re-enable) the generation of hardware floating point
25325 instructions. This option is only significant when the target
25326 architecture is V850E2V3 or higher. If hardware floating point
25327 instructions are being generated then the C preprocessor symbol
25328 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
25329 defined.
25330
25331 -mloop
25332 Enables the use of the e3v5 LOOP instruction. The use of this
25333 instruction is not enabled by default when the e3v5 architecture is
25334 selected because its use is still experimental.
25335
25336 -mrh850-abi
25337 -mghs
25338 Enables support for the RH850 version of the V850 ABI. This is the
25339 default. With this version of the ABI the following rules apply:
25340
25341 * Integer sized structures and unions are returned via a memory
25342 pointer rather than a register.
25343
25344 * Large structures and unions (more than 8 bytes in size) are
25345 passed by value.
25346
25347 * Functions are aligned to 16-bit boundaries.
25348
25349 * The -m8byte-align command-line option is supported.
25350
25351 * The -mdisable-callt command-line option is enabled by default.
25352 The -mno-disable-callt command-line option is not supported.
25353
25354 When this version of the ABI is enabled the C preprocessor symbol
25355 "__V850_RH850_ABI__" is defined.
25356
25357 -mgcc-abi
25358 Enables support for the old GCC version of the V850 ABI. With this
25359 version of the ABI the following rules apply:
25360
25361 * Integer sized structures and unions are returned in register
25362 "r10".
25363
25364 * Large structures and unions (more than 8 bytes in size) are
25365 passed by reference.
25366
25367 * Functions are aligned to 32-bit boundaries, unless optimizing
25368 for size.
25369
25370 * The -m8byte-align command-line option is not supported.
25371
25372 * The -mdisable-callt command-line option is supported but not
25373 enabled by default.
25374
25375 When this version of the ABI is enabled the C preprocessor symbol
25376 "__V850_GCC_ABI__" is defined.
25377
25378 -m8byte-align
25379 -mno-8byte-align
25380 Enables support for "double" and "long long" types to be aligned on
25381 8-byte boundaries. The default is to restrict the alignment of all
25382 objects to at most 4-bytes. When -m8byte-align is in effect the C
25383 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
25384
25385 -mbig-switch
25386 Generate code suitable for big switch tables. Use this option only
25387 if the assembler/linker complain about out of range branches within
25388 a switch table.
25389
25390 -mapp-regs
25391 This option causes r2 and r5 to be used in the code generated by
25392 the compiler. This setting is the default.
25393
25394 -mno-app-regs
25395 This option causes r2 and r5 to be treated as fixed registers.
25396
25397 VAX Options
25398 These -m options are defined for the VAX:
25399
25400 -munix
25401 Do not output certain jump instructions ("aobleq" and so on) that
25402 the Unix assembler for the VAX cannot handle across long ranges.
25403
25404 -mgnu
25405 Do output those jump instructions, on the assumption that the GNU
25406 assembler is being used.
25407
25408 -mg Output code for G-format floating-point numbers instead of
25409 D-format.
25410
25411 Visium Options
25412 -mdebug
25413 A program which performs file I/O and is destined to run on an MCM
25414 target should be linked with this option. It causes the libraries
25415 libc.a and libdebug.a to be linked. The program should be run on
25416 the target under the control of the GDB remote debugging stub.
25417
25418 -msim
25419 A program which performs file I/O and is destined to run on the
25420 simulator should be linked with option. This causes libraries
25421 libc.a and libsim.a to be linked.
25422
25423 -mfpu
25424 -mhard-float
25425 Generate code containing floating-point instructions. This is the
25426 default.
25427
25428 -mno-fpu
25429 -msoft-float
25430 Generate code containing library calls for floating-point.
25431
25432 -msoft-float changes the calling convention in the output file;
25433 therefore, it is only useful if you compile all of a program with
25434 this option. In particular, you need to compile libgcc.a, the
25435 library that comes with GCC, with -msoft-float in order for this to
25436 work.
25437
25438 -mcpu=cpu_type
25439 Set the instruction set, register set, and instruction scheduling
25440 parameters for machine type cpu_type. Supported values for
25441 cpu_type are mcm, gr5 and gr6.
25442
25443 mcm is a synonym of gr5 present for backward compatibility.
25444
25445 By default (unless configured otherwise), GCC generates code for
25446 the GR5 variant of the Visium architecture.
25447
25448 With -mcpu=gr6, GCC generates code for the GR6 variant of the
25449 Visium architecture. The only difference from GR5 code is that the
25450 compiler will generate block move instructions.
25451
25452 -mtune=cpu_type
25453 Set the instruction scheduling parameters for machine type
25454 cpu_type, but do not set the instruction set or register set that
25455 the option -mcpu=cpu_type would.
25456
25457 -msv-mode
25458 Generate code for the supervisor mode, where there are no
25459 restrictions on the access to general registers. This is the
25460 default.
25461
25462 -muser-mode
25463 Generate code for the user mode, where the access to some general
25464 registers is forbidden: on the GR5, registers r24 to r31 cannot be
25465 accessed in this mode; on the GR6, only registers r29 to r31 are
25466 affected.
25467
25468 VMS Options
25469 These -m options are defined for the VMS implementations:
25470
25471 -mvms-return-codes
25472 Return VMS condition codes from "main". The default is to return
25473 POSIX-style condition (e.g. error) codes.
25474
25475 -mdebug-main=prefix
25476 Flag the first routine whose name starts with prefix as the main
25477 routine for the debugger.
25478
25479 -mmalloc64
25480 Default to 64-bit memory allocation routines.
25481
25482 -mpointer-size=size
25483 Set the default size of pointers. Possible options for size are 32
25484 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
25485 no for supporting only 32 bit pointers. The later option disables
25486 "pragma pointer_size".
25487
25488 VxWorks Options
25489 The options in this section are defined for all VxWorks targets.
25490 Options specific to the target hardware are listed with the other
25491 options for that target.
25492
25493 -mrtp
25494 GCC can generate code for both VxWorks kernels and real time
25495 processes (RTPs). This option switches from the former to the
25496 latter. It also defines the preprocessor macro "__RTP__".
25497
25498 -non-static
25499 Link an RTP executable against shared libraries rather than static
25500 libraries. The options -static and -shared can also be used for
25501 RTPs; -static is the default.
25502
25503 -Bstatic
25504 -Bdynamic
25505 These options are passed down to the linker. They are defined for
25506 compatibility with Diab.
25507
25508 -Xbind-lazy
25509 Enable lazy binding of function calls. This option is equivalent
25510 to -Wl,-z,now and is defined for compatibility with Diab.
25511
25512 -Xbind-now
25513 Disable lazy binding of function calls. This option is the default
25514 and is defined for compatibility with Diab.
25515
25516 x86 Options
25517 These -m options are defined for the x86 family of computers.
25518
25519 -march=cpu-type
25520 Generate instructions for the machine type cpu-type. In contrast
25521 to -mtune=cpu-type, which merely tunes the generated code for the
25522 specified cpu-type, -march=cpu-type allows GCC to generate code
25523 that may not run at all on processors other than the one indicated.
25524 Specifying -march=cpu-type implies -mtune=cpu-type, except where
25525 noted otherwise.
25526
25527 The choices for cpu-type are:
25528
25529 native
25530 This selects the CPU to generate code for at compilation time
25531 by determining the processor type of the compiling machine.
25532 Using -march=native enables all instruction subsets supported
25533 by the local machine (hence the result might not run on
25534 different machines). Using -mtune=native produces code
25535 optimized for the local machine under the constraints of the
25536 selected instruction set.
25537
25538 x86-64
25539 A generic CPU with 64-bit extensions.
25540
25541 x86-64-v2
25542 x86-64-v3
25543 x86-64-v4
25544 These choices for cpu-type select the corresponding micro-
25545 architecture level from the x86-64 psABI. On ABIs other than
25546 the x86-64 psABI they select the same CPU features as the
25547 x86-64 psABI documents for the particular micro-architecture
25548 level.
25549
25550 Since these cpu-type values do not have a corresponding -mtune
25551 setting, using -march with these values enables generic tuning.
25552 Specific tuning can be enabled using the -mtune=other-cpu-type
25553 option with an appropriate other-cpu-type value.
25554
25555 i386
25556 Original Intel i386 CPU.
25557
25558 i486
25559 Intel i486 CPU. (No scheduling is implemented for this chip.)
25560
25561 i586
25562 pentium
25563 Intel Pentium CPU with no MMX support.
25564
25565 lakemont
25566 Intel Lakemont MCU, based on Intel Pentium CPU.
25567
25568 pentium-mmx
25569 Intel Pentium MMX CPU, based on Pentium core with MMX
25570 instruction set support.
25571
25572 pentiumpro
25573 Intel Pentium Pro CPU.
25574
25575 i686
25576 When used with -march, the Pentium Pro instruction set is used,
25577 so the code runs on all i686 family chips. When used with
25578 -mtune, it has the same meaning as generic.
25579
25580 pentium2
25581 Intel Pentium II CPU, based on Pentium Pro core with MMX
25582 instruction set support.
25583
25584 pentium3
25585 pentium3m
25586 Intel Pentium III CPU, based on Pentium Pro core with MMX and
25587 SSE instruction set support.
25588
25589 pentium-m
25590 Intel Pentium M; low-power version of Intel Pentium III CPU
25591 with MMX, SSE and SSE2 instruction set support. Used by
25592 Centrino notebooks.
25593
25594 pentium4
25595 pentium4m
25596 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
25597 support.
25598
25599 prescott
25600 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
25601 SSE3 instruction set support.
25602
25603 nocona
25604 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
25605 MMX, SSE, SSE2 and SSE3 instruction set support.
25606
25607 core2
25608 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
25609 and SSSE3 instruction set support.
25610
25611 nehalem
25612 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
25613 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
25614
25615 westmere
25616 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
25617 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
25618 set support.
25619
25620 sandybridge
25621 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25622 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
25623 instruction set support.
25624
25625 ivybridge
25626 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25627 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
25628 FSGSBASE, RDRND and F16C instruction set support.
25629
25630 haswell
25631 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25632 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25633 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
25634 set support.
25635
25636 broadwell
25637 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25638 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25639 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED ADCX and
25640 PREFETCHW instruction set support.
25641
25642 skylake
25643 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25644 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25645 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25646 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
25647 support.
25648
25649 bonnell
25650 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25651 SSE2, SSE3 and SSSE3 instruction set support.
25652
25653 silvermont
25654 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25655 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25656 PCLMUL and RDRND instruction set support.
25657
25658 goldmont
25659 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25660 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25661 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT and FSGSBASE
25662 instruction set support.
25663
25664 goldmont-plus
25665 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
25666 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25667 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25668 PTWRITE, RDPID, SGX and UMIP instruction set support.
25669
25670 tremont
25671 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25672 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25673 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25674 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25675 CLDEMOTE and WAITPKG instruction set support.
25676
25677 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
25678 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25679 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25680 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER and
25681 AVX512CD instruction set support.
25682
25683 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
25684 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25685 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25686 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25687 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set
25688 support.
25689
25690 skylake-avx512
25691 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
25692 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25693 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25694 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25695 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
25696 support.
25697
25698 cannonlake
25699 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
25700 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25701 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25702 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25703 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
25704 UMIP instruction set support.
25705
25706 icelake-client
25707 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
25708 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25709 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25710 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25711 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25712 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25713 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25714 support.
25715
25716 icelake-server
25717 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
25718 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25719 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25720 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25721 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25722 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25723 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
25724 WBNOINVD instruction set support.
25725
25726 cascadelake
25727 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25728 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25729 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25730 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25731 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
25732 support.
25733
25734 cooperlake
25735 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25736 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25737 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25738 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25739 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
25740 instruction set support.
25741
25742 tigerlake
25743 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25744 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25745 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25746 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25747 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25748 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25749 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG, WBNOINVD,
25750 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
25751 instruction set support.
25752
25753 sapphirerapids
25754 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
25755 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25756 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25757 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25758 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
25759 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE,
25760 PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-
25761 TILE, AMX-INT8 and AVX-VNNI instruction set support.
25762
25763 alderlake
25764 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25765 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25766 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25767 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25768 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
25769 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
25770 WIDEKL and AVX-VNNI instruction set support.
25771
25772 rocketlake
25773 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25774 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25775 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25776 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25777 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25778 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25779 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25780 support.
25781
25782 k6 AMD K6 CPU with MMX instruction set support.
25783
25784 k6-2
25785 k6-3
25786 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
25787 set support.
25788
25789 athlon
25790 athlon-tbird
25791 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
25792 prefetch instructions support.
25793
25794 athlon-4
25795 athlon-xp
25796 athlon-mp
25797 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
25798 full SSE instruction set support.
25799
25800 k8
25801 opteron
25802 athlon64
25803 athlon-fx
25804 Processors based on the AMD K8 core with x86-64 instruction set
25805 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
25806 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
25807 3DNow! and 64-bit instruction set extensions.)
25808
25809 k8-sse3
25810 opteron-sse3
25811 athlon64-sse3
25812 Improved versions of AMD K8 cores with SSE3 instruction set
25813 support.
25814
25815 amdfam10
25816 barcelona
25817 CPUs based on AMD Family 10h cores with x86-64 instruction set
25818 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
25819 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
25820
25821 bdver1
25822 CPUs based on AMD Family 15h cores with x86-64 instruction set
25823 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
25824 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
25825 and 64-bit instruction set extensions.)
25826
25827 bdver2
25828 AMD Family 15h core based CPUs with x86-64 instruction set
25829 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
25830 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
25831 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
25832
25833 bdver3
25834 AMD Family 15h core based CPUs with x86-64 instruction set
25835 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
25836 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
25837 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
25838 extensions.)
25839
25840 bdver4
25841 AMD Family 15h core based CPUs with x86-64 instruction set
25842 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
25843 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
25844 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
25845 instruction set extensions.)
25846
25847 znver1
25848 AMD Family 17h core based CPUs with x86-64 instruction set
25849 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
25850 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
25851 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
25852 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
25853 extensions.)
25854
25855 znver2
25856 AMD Family 17h core based CPUs with x86-64 instruction set
25857 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25858 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25859 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25860 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25861 WBNOINVD, and 64-bit instruction set extensions.)
25862
25863 znver3
25864 AMD Family 19h core based CPUs with x86-64 instruction set
25865 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25866 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25867 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25868 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25869 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
25870 extensions.)
25871
25872 btver1
25873 CPUs based on AMD Family 14h cores with x86-64 instruction set
25874 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
25875 CX16, ABM and 64-bit instruction set extensions.)
25876
25877 btver2
25878 CPUs based on AMD Family 16h cores with x86-64 instruction set
25879 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
25880 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
25881 and 64-bit instruction set extensions.
25882
25883 winchip-c6
25884 IDT WinChip C6 CPU, dealt in same way as i486 with additional
25885 MMX instruction set support.
25886
25887 winchip2
25888 IDT WinChip 2 CPU, dealt in same way as i486 with additional
25889 MMX and 3DNow! instruction set support.
25890
25891 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
25892 scheduling is implemented for this chip.)
25893
25894 c3-2
25895 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
25896 support. (No scheduling is implemented for this chip.)
25897
25898 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
25899 set support. (No scheduling is implemented for this chip.)
25900
25901 samuel-2
25902 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
25903 support. (No scheduling is implemented for this chip.)
25904
25905 nehemiah
25906 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
25907 (No scheduling is implemented for this chip.)
25908
25909 esther
25910 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
25911 set support. (No scheduling is implemented for this chip.)
25912
25913 eden-x2
25914 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
25915 instruction set support. (No scheduling is implemented for
25916 this chip.)
25917
25918 eden-x4
25919 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
25920 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
25921 scheduling is implemented for this chip.)
25922
25923 nano
25924 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
25925 SSSE3 instruction set support. (No scheduling is implemented
25926 for this chip.)
25927
25928 nano-1000
25929 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25930 instruction set support. (No scheduling is implemented for
25931 this chip.)
25932
25933 nano-2000
25934 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25935 instruction set support. (No scheduling is implemented for
25936 this chip.)
25937
25938 nano-3000
25939 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
25940 SSE4.1 instruction set support. (No scheduling is implemented
25941 for this chip.)
25942
25943 nano-x2
25944 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
25945 and SSE4.1 instruction set support. (No scheduling is
25946 implemented for this chip.)
25947
25948 nano-x4
25949 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
25950 and SSE4.1 instruction set support. (No scheduling is
25951 implemented for this chip.)
25952
25953 geode
25954 AMD Geode embedded processor with MMX and 3DNow! instruction
25955 set support.
25956
25957 -mtune=cpu-type
25958 Tune to cpu-type everything applicable about the generated code,
25959 except for the ABI and the set of available instructions. While
25960 picking a specific cpu-type schedules things appropriately for that
25961 particular chip, the compiler does not generate any code that
25962 cannot run on the default machine type unless you use a -march=cpu-
25963 type option. For example, if GCC is configured for
25964 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
25965 for Pentium 4 but still runs on i686 machines.
25966
25967 The choices for cpu-type are the same as for -march. In addition,
25968 -mtune supports 2 extra choices for cpu-type:
25969
25970 generic
25971 Produce code optimized for the most common IA32/AMD64/EM64T
25972 processors. If you know the CPU on which your code will run,
25973 then you should use the corresponding -mtune or -march option
25974 instead of -mtune=generic. But, if you do not know exactly
25975 what CPU users of your application will have, then you should
25976 use this option.
25977
25978 As new processors are deployed in the marketplace, the behavior
25979 of this option will change. Therefore, if you upgrade to a
25980 newer version of GCC, code generation controlled by this option
25981 will change to reflect the processors that are most common at
25982 the time that version of GCC is released.
25983
25984 There is no -march=generic option because -march indicates the
25985 instruction set the compiler can use, and there is no generic
25986 instruction set applicable to all processors. In contrast,
25987 -mtune indicates the processor (or, in this case, collection of
25988 processors) for which the code is optimized.
25989
25990 intel
25991 Produce code optimized for the most current Intel processors,
25992 which are Haswell and Silvermont for this version of GCC. If
25993 you know the CPU on which your code will run, then you should
25994 use the corresponding -mtune or -march option instead of
25995 -mtune=intel. But, if you want your application performs
25996 better on both Haswell and Silvermont, then you should use this
25997 option.
25998
25999 As new Intel processors are deployed in the marketplace, the
26000 behavior of this option will change. Therefore, if you upgrade
26001 to a newer version of GCC, code generation controlled by this
26002 option will change to reflect the most current Intel processors
26003 at the time that version of GCC is released.
26004
26005 There is no -march=intel option because -march indicates the
26006 instruction set the compiler can use, and there is no common
26007 instruction set applicable to all processors. In contrast,
26008 -mtune indicates the processor (or, in this case, collection of
26009 processors) for which the code is optimized.
26010
26011 -mcpu=cpu-type
26012 A deprecated synonym for -mtune.
26013
26014 -mfpmath=unit
26015 Generate floating-point arithmetic for selected unit unit. The
26016 choices for unit are:
26017
26018 387 Use the standard 387 floating-point coprocessor present on the
26019 majority of chips and emulated otherwise. Code compiled with
26020 this option runs almost everywhere. The temporary results are
26021 computed in 80-bit precision instead of the precision specified
26022 by the type, resulting in slightly different results compared
26023 to most of other chips. See -ffloat-store for more detailed
26024 description.
26025
26026 This is the default choice for non-Darwin x86-32 targets.
26027
26028 sse Use scalar floating-point instructions present in the SSE
26029 instruction set. This instruction set is supported by Pentium
26030 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
26031 and Athlon MP chips. The earlier version of the SSE
26032 instruction set supports only single-precision arithmetic, thus
26033 the double and extended-precision arithmetic are still done
26034 using 387. A later version, present only in Pentium 4 and AMD
26035 x86-64 chips, supports double-precision arithmetic too.
26036
26037 For the x86-32 compiler, you must use -march=cpu-type, -msse or
26038 -msse2 switches to enable SSE extensions and make this option
26039 effective. For the x86-64 compiler, these extensions are
26040 enabled by default.
26041
26042 The resulting code should be considerably faster in the
26043 majority of cases and avoid the numerical instability problems
26044 of 387 code, but may break some existing code that expects
26045 temporaries to be 80 bits.
26046
26047 This is the default choice for the x86-64 compiler, Darwin
26048 x86-32 targets, and the default choice for x86-32 targets with
26049 the SSE2 instruction set when -ffast-math is enabled.
26050
26051 sse,387
26052 sse+387
26053 both
26054 Attempt to utilize both instruction sets at once. This
26055 effectively doubles the amount of available registers, and on
26056 chips with separate execution units for 387 and SSE the
26057 execution resources too. Use this option with care, as it is
26058 still experimental, because the GCC register allocator does not
26059 model separate functional units well, resulting in unstable
26060 performance.
26061
26062 -masm=dialect
26063 Output assembly instructions using selected dialect. Also affects
26064 which dialect is used for basic "asm" and extended "asm". Supported
26065 choices (in dialect order) are att or intel. The default is att.
26066 Darwin does not support intel.
26067
26068 -mieee-fp
26069 -mno-ieee-fp
26070 Control whether or not the compiler uses IEEE floating-point
26071 comparisons. These correctly handle the case where the result of a
26072 comparison is unordered.
26073
26074 -m80387
26075 -mhard-float
26076 Generate output containing 80387 instructions for floating point.
26077
26078 -mno-80387
26079 -msoft-float
26080 Generate output containing library calls for floating point.
26081
26082 Warning: the requisite libraries are not part of GCC. Normally the
26083 facilities of the machine's usual C compiler are used, but this
26084 cannot be done directly in cross-compilation. You must make your
26085 own arrangements to provide suitable library functions for cross-
26086 compilation.
26087
26088 On machines where a function returns floating-point results in the
26089 80387 register stack, some floating-point opcodes may be emitted
26090 even if -msoft-float is used.
26091
26092 -mno-fp-ret-in-387
26093 Do not use the FPU registers for return values of functions.
26094
26095 The usual calling convention has functions return values of types
26096 "float" and "double" in an FPU register, even if there is no FPU.
26097 The idea is that the operating system should emulate an FPU.
26098
26099 The option -mno-fp-ret-in-387 causes such values to be returned in
26100 ordinary CPU registers instead.
26101
26102 -mno-fancy-math-387
26103 Some 387 emulators do not support the "sin", "cos" and "sqrt"
26104 instructions for the 387. Specify this option to avoid generating
26105 those instructions. This option is overridden when -march
26106 indicates that the target CPU always has an FPU and so the
26107 instruction does not need emulation. These instructions are not
26108 generated unless you also use the -funsafe-math-optimizations
26109 switch.
26110
26111 -malign-double
26112 -mno-align-double
26113 Control whether GCC aligns "double", "long double", and "long long"
26114 variables on a two-word boundary or a one-word boundary. Aligning
26115 "double" variables on a two-word boundary produces code that runs
26116 somewhat faster on a Pentium at the expense of more memory.
26117
26118 On x86-64, -malign-double is enabled by default.
26119
26120 Warning: if you use the -malign-double switch, structures
26121 containing the above types are aligned differently than the
26122 published application binary interface specifications for the
26123 x86-32 and are not binary compatible with structures in code
26124 compiled without that switch.
26125
26126 -m96bit-long-double
26127 -m128bit-long-double
26128 These switches control the size of "long double" type. The x86-32
26129 application binary interface specifies the size to be 96 bits, so
26130 -m96bit-long-double is the default in 32-bit mode.
26131
26132 Modern architectures (Pentium and newer) prefer "long double" to be
26133 aligned to an 8- or 16-byte boundary. In arrays or structures
26134 conforming to the ABI, this is not possible. So specifying
26135 -m128bit-long-double aligns "long double" to a 16-byte boundary by
26136 padding the "long double" with an additional 32-bit zero.
26137
26138 In the x86-64 compiler, -m128bit-long-double is the default choice
26139 as its ABI specifies that "long double" is aligned on 16-byte
26140 boundary.
26141
26142 Notice that neither of these options enable any extra precision
26143 over the x87 standard of 80 bits for a "long double".
26144
26145 Warning: if you override the default value for your target ABI,
26146 this changes the size of structures and arrays containing "long
26147 double" variables, as well as modifying the function calling
26148 convention for functions taking "long double". Hence they are not
26149 binary-compatible with code compiled without that switch.
26150
26151 -mlong-double-64
26152 -mlong-double-80
26153 -mlong-double-128
26154 These switches control the size of "long double" type. A size of 64
26155 bits makes the "long double" type equivalent to the "double" type.
26156 This is the default for 32-bit Bionic C library. A size of 128
26157 bits makes the "long double" type equivalent to the "__float128"
26158 type. This is the default for 64-bit Bionic C library.
26159
26160 Warning: if you override the default value for your target ABI,
26161 this changes the size of structures and arrays containing "long
26162 double" variables, as well as modifying the function calling
26163 convention for functions taking "long double". Hence they are not
26164 binary-compatible with code compiled without that switch.
26165
26166 -malign-data=type
26167 Control how GCC aligns variables. Supported values for type are
26168 compat uses increased alignment value compatible uses GCC 4.8 and
26169 earlier, abi uses alignment value as specified by the psABI, and
26170 cacheline uses increased alignment value to match the cache line
26171 size. compat is the default.
26172
26173 -mlarge-data-threshold=threshold
26174 When -mcmodel=medium is specified, data objects larger than
26175 threshold are placed in the large data section. This value must be
26176 the same across all objects linked into the binary, and defaults to
26177 65535.
26178
26179 -mrtd
26180 Use a different function-calling convention, in which functions
26181 that take a fixed number of arguments return with the "ret num"
26182 instruction, which pops their arguments while returning. This
26183 saves one instruction in the caller since there is no need to pop
26184 the arguments there.
26185
26186 You can specify that an individual function is called with this
26187 calling sequence with the function attribute "stdcall". You can
26188 also override the -mrtd option by using the function attribute
26189 "cdecl".
26190
26191 Warning: this calling convention is incompatible with the one
26192 normally used on Unix, so you cannot use it if you need to call
26193 libraries compiled with the Unix compiler.
26194
26195 Also, you must provide function prototypes for all functions that
26196 take variable numbers of arguments (including "printf"); otherwise
26197 incorrect code is generated for calls to those functions.
26198
26199 In addition, seriously incorrect code results if you call a
26200 function with too many arguments. (Normally, extra arguments are
26201 harmlessly ignored.)
26202
26203 -mregparm=num
26204 Control how many registers are used to pass integer arguments. By
26205 default, no registers are used to pass arguments, and at most 3
26206 registers can be used. You can control this behavior for a
26207 specific function by using the function attribute "regparm".
26208
26209 Warning: if you use this switch, and num is nonzero, then you must
26210 build all modules with the same value, including any libraries.
26211 This includes the system libraries and startup modules.
26212
26213 -msseregparm
26214 Use SSE register passing conventions for float and double arguments
26215 and return values. You can control this behavior for a specific
26216 function by using the function attribute "sseregparm".
26217
26218 Warning: if you use this switch then you must build all modules
26219 with the same value, including any libraries. This includes the
26220 system libraries and startup modules.
26221
26222 -mvect8-ret-in-mem
26223 Return 8-byte vectors in memory instead of MMX registers. This is
26224 the default on VxWorks to match the ABI of the Sun Studio compilers
26225 until version 12. Only use this option if you need to remain
26226 compatible with existing code produced by those previous compiler
26227 versions or older versions of GCC.
26228
26229 -mpc32
26230 -mpc64
26231 -mpc80
26232 Set 80387 floating-point precision to 32, 64 or 80 bits. When
26233 -mpc32 is specified, the significands of results of floating-point
26234 operations are rounded to 24 bits (single precision); -mpc64 rounds
26235 the significands of results of floating-point operations to 53 bits
26236 (double precision) and -mpc80 rounds the significands of results of
26237 floating-point operations to 64 bits (extended double precision),
26238 which is the default. When this option is used, floating-point
26239 operations in higher precisions are not available to the programmer
26240 without setting the FPU control word explicitly.
26241
26242 Setting the rounding of floating-point operations to less than the
26243 default 80 bits can speed some programs by 2% or more. Note that
26244 some mathematical libraries assume that extended-precision (80-bit)
26245 floating-point operations are enabled by default; routines in such
26246 libraries could suffer significant loss of accuracy, typically
26247 through so-called "catastrophic cancellation", when this option is
26248 used to set the precision to less than extended precision.
26249
26250 -mstackrealign
26251 Realign the stack at entry. On the x86, the -mstackrealign option
26252 generates an alternate prologue and epilogue that realigns the run-
26253 time stack if necessary. This supports mixing legacy codes that
26254 keep 4-byte stack alignment with modern codes that keep 16-byte
26255 stack alignment for SSE compatibility. See also the attribute
26256 "force_align_arg_pointer", applicable to individual functions.
26257
26258 -mpreferred-stack-boundary=num
26259 Attempt to keep the stack boundary aligned to a 2 raised to num
26260 byte boundary. If -mpreferred-stack-boundary is not specified, the
26261 default is 4 (16 bytes or 128 bits).
26262
26263 Warning: When generating code for the x86-64 architecture with SSE
26264 extensions disabled, -mpreferred-stack-boundary=3 can be used to
26265 keep the stack boundary aligned to 8 byte boundary. Since x86-64
26266 ABI require 16 byte stack alignment, this is ABI incompatible and
26267 intended to be used in controlled environment where stack space is
26268 important limitation. This option leads to wrong code when
26269 functions compiled with 16 byte stack alignment (such as functions
26270 from a standard library) are called with misaligned stack. In this
26271 case, SSE instructions may lead to misaligned memory access traps.
26272 In addition, variable arguments are handled incorrectly for 16 byte
26273 aligned objects (including x87 long double and __int128), leading
26274 to wrong results. You must build all modules with
26275 -mpreferred-stack-boundary=3, including any libraries. This
26276 includes the system libraries and startup modules.
26277
26278 -mincoming-stack-boundary=num
26279 Assume the incoming stack is aligned to a 2 raised to num byte
26280 boundary. If -mincoming-stack-boundary is not specified, the one
26281 specified by -mpreferred-stack-boundary is used.
26282
26283 On Pentium and Pentium Pro, "double" and "long double" values
26284 should be aligned to an 8-byte boundary (see -malign-double) or
26285 suffer significant run time performance penalties. On Pentium III,
26286 the Streaming SIMD Extension (SSE) data type "__m128" may not work
26287 properly if it is not 16-byte aligned.
26288
26289 To ensure proper alignment of this values on the stack, the stack
26290 boundary must be as aligned as that required by any value stored on
26291 the stack. Further, every function must be generated such that it
26292 keeps the stack aligned. Thus calling a function compiled with a
26293 higher preferred stack boundary from a function compiled with a
26294 lower preferred stack boundary most likely misaligns the stack. It
26295 is recommended that libraries that use callbacks always use the
26296 default setting.
26297
26298 This extra alignment does consume extra stack space, and generally
26299 increases code size. Code that is sensitive to stack space usage,
26300 such as embedded systems and operating system kernels, may want to
26301 reduce the preferred alignment to -mpreferred-stack-boundary=2.
26302
26303 -mmmx
26304 -msse
26305 -msse2
26306 -msse3
26307 -mssse3
26308 -msse4
26309 -msse4a
26310 -msse4.1
26311 -msse4.2
26312 -mavx
26313 -mavx2
26314 -mavx512f
26315 -mavx512pf
26316 -mavx512er
26317 -mavx512cd
26318 -mavx512vl
26319 -mavx512bw
26320 -mavx512dq
26321 -mavx512ifma
26322 -mavx512vbmi
26323 -msha
26324 -maes
26325 -mpclmul
26326 -mclflushopt
26327 -mclwb
26328 -mfsgsbase
26329 -mptwrite
26330 -mrdrnd
26331 -mf16c
26332 -mfma
26333 -mpconfig
26334 -mwbnoinvd
26335 -mfma4
26336 -mprfchw
26337 -mrdpid
26338 -mprefetchwt1
26339 -mrdseed
26340 -msgx
26341 -mxop
26342 -mlwp
26343 -m3dnow
26344 -m3dnowa
26345 -mpopcnt
26346 -mabm
26347 -madx
26348 -mbmi
26349 -mbmi2
26350 -mlzcnt
26351 -mfxsr
26352 -mxsave
26353 -mxsaveopt
26354 -mxsavec
26355 -mxsaves
26356 -mrtm
26357 -mhle
26358 -mtbm
26359 -mmwaitx
26360 -mclzero
26361 -mpku
26362 -mavx512vbmi2
26363 -mavx512bf16
26364 -mgfni
26365 -mvaes
26366 -mwaitpkg
26367 -mvpclmulqdq
26368 -mavx512bitalg
26369 -mmovdiri
26370 -mmovdir64b
26371 -menqcmd
26372 -muintr
26373 -mtsxldtrk
26374 -mavx512vpopcntdq
26375 -mavx512vp2intersect
26376 -mavx5124fmaps
26377 -mavx512vnni
26378 -mavxvnni
26379 -mavx5124vnniw
26380 -mcldemote
26381 -mserialize
26382 -mamx-tile
26383 -mamx-int8
26384 -mamx-bf16
26385 -mhreset
26386 -mkl
26387 -mwidekl
26388 These switches enable the use of instructions in the MMX, SSE,
26389 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
26390 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
26391 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
26392 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
26393 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
26394 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
26395 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
26396 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
26397 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
26398 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
26399 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI or CLDEMOTE extended
26400 instruction sets. Each has a corresponding -mno- option to disable
26401 use of these instructions.
26402
26403 These extensions are also available as built-in functions: see x86
26404 Built-in Functions, for details of the functions enabled and
26405 disabled by these switches.
26406
26407 To generate SSE/SSE2 instructions automatically from floating-point
26408 code (as opposed to 387 instructions), see -mfpmath=sse.
26409
26410 GCC depresses SSEx instructions when -mavx is used. Instead, it
26411 generates new AVX instructions or AVX equivalence for all SSEx
26412 instructions when needed.
26413
26414 These options enable GCC to use these extended instructions in
26415 generated code, even without -mfpmath=sse. Applications that
26416 perform run-time CPU detection must compile separate files for each
26417 supported architecture, using the appropriate flags. In
26418 particular, the file containing the CPU detection code should be
26419 compiled without these options.
26420
26421 -mdump-tune-features
26422 This option instructs GCC to dump the names of the x86 performance
26423 tuning features and default settings. The names can be used in
26424 -mtune-ctrl=feature-list.
26425
26426 -mtune-ctrl=feature-list
26427 This option is used to do fine grain control of x86 code generation
26428 features. feature-list is a comma separated list of feature names.
26429 See also -mdump-tune-features. When specified, the feature is
26430 turned on if it is not preceded with ^, otherwise, it is turned
26431 off. -mtune-ctrl=feature-list is intended to be used by GCC
26432 developers. Using it may lead to code paths not covered by testing
26433 and can potentially result in compiler ICEs or runtime errors.
26434
26435 -mno-default
26436 This option instructs GCC to turn off all tunable features. See
26437 also -mtune-ctrl=feature-list and -mdump-tune-features.
26438
26439 -mcld
26440 This option instructs GCC to emit a "cld" instruction in the
26441 prologue of functions that use string instructions. String
26442 instructions depend on the DF flag to select between autoincrement
26443 or autodecrement mode. While the ABI specifies the DF flag to be
26444 cleared on function entry, some operating systems violate this
26445 specification by not clearing the DF flag in their exception
26446 dispatchers. The exception handler can be invoked with the DF flag
26447 set, which leads to wrong direction mode when string instructions
26448 are used. This option can be enabled by default on 32-bit x86
26449 targets by configuring GCC with the --enable-cld configure option.
26450 Generation of "cld" instructions can be suppressed with the
26451 -mno-cld compiler option in this case.
26452
26453 -mvzeroupper
26454 This option instructs GCC to emit a "vzeroupper" instruction before
26455 a transfer of control flow out of the function to minimize the AVX
26456 to SSE transition penalty as well as remove unnecessary "zeroupper"
26457 intrinsics.
26458
26459 -mprefer-avx128
26460 This option instructs GCC to use 128-bit AVX instructions instead
26461 of 256-bit AVX instructions in the auto-vectorizer.
26462
26463 -mprefer-vector-width=opt
26464 This option instructs GCC to use opt-bit vector width in
26465 instructions instead of default on the selected platform.
26466
26467 none
26468 No extra limitations applied to GCC other than defined by the
26469 selected platform.
26470
26471 128 Prefer 128-bit vector width for instructions.
26472
26473 256 Prefer 256-bit vector width for instructions.
26474
26475 512 Prefer 512-bit vector width for instructions.
26476
26477 -mcx16
26478 This option enables GCC to generate "CMPXCHG16B" instructions in
26479 64-bit code to implement compare-and-exchange operations on 16-byte
26480 aligned 128-bit objects. This is useful for atomic updates of data
26481 structures exceeding one machine word in size. The compiler uses
26482 this instruction to implement __sync Builtins. However, for
26483 __atomic Builtins operating on 128-bit integers, a library call is
26484 always used.
26485
26486 -msahf
26487 This option enables generation of "SAHF" instructions in 64-bit
26488 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
26489 the introduction of Pentium 4 G1 step in December 2005, lacked the
26490 "LAHF" and "SAHF" instructions which are supported by AMD64. These
26491 are load and store instructions, respectively, for certain status
26492 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
26493 "fmod", "drem", and "remainder" built-in functions; see Other
26494 Builtins for details.
26495
26496 -mmovbe
26497 This option enables use of the "movbe" instruction to implement
26498 "__builtin_bswap32" and "__builtin_bswap64".
26499
26500 -mshstk
26501 The -mshstk option enables shadow stack built-in functions from x86
26502 Control-flow Enforcement Technology (CET).
26503
26504 -mcrc32
26505 This option enables built-in functions "__builtin_ia32_crc32qi",
26506 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
26507 "__builtin_ia32_crc32di" to generate the "crc32" machine
26508 instruction.
26509
26510 -mrecip
26511 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
26512 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
26513 Newton-Raphson step to increase precision instead of "DIVSS" and
26514 "SQRTSS" (and their vectorized variants) for single-precision
26515 floating-point arguments. These instructions are generated only
26516 when -funsafe-math-optimizations is enabled together with
26517 -ffinite-math-only and -fno-trapping-math. Note that while the
26518 throughput of the sequence is higher than the throughput of the
26519 non-reciprocal instruction, the precision of the sequence can be
26520 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
26521 0.99999994).
26522
26523 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
26524 "RSQRTPS") already with -ffast-math (or the above option
26525 combination), and doesn't need -mrecip.
26526
26527 Also note that GCC emits the above sequence with additional Newton-
26528 Raphson step for vectorized single-float division and vectorized
26529 "sqrtf(x)" already with -ffast-math (or the above option
26530 combination), and doesn't need -mrecip.
26531
26532 -mrecip=opt
26533 This option controls which reciprocal estimate instructions may be
26534 used. opt is a comma-separated list of options, which may be
26535 preceded by a ! to invert the option:
26536
26537 all Enable all estimate instructions.
26538
26539 default
26540 Enable the default instructions, equivalent to -mrecip.
26541
26542 none
26543 Disable all estimate instructions, equivalent to -mno-recip.
26544
26545 div Enable the approximation for scalar division.
26546
26547 vec-div
26548 Enable the approximation for vectorized division.
26549
26550 sqrt
26551 Enable the approximation for scalar square root.
26552
26553 vec-sqrt
26554 Enable the approximation for vectorized square root.
26555
26556 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
26557 approximations, except for square root.
26558
26559 -mveclibabi=type
26560 Specifies the ABI type to use for vectorizing intrinsics using an
26561 external library. Supported values for type are svml for the Intel
26562 short vector math library and acml for the AMD math core library.
26563 To use this option, both -ftree-vectorize and
26564 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
26565 ABI-compatible library must be specified at link time.
26566
26567 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
26568 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
26569 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
26570 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
26571 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
26572 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
26573 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
26574 and "vmlsAcos4" for corresponding function type when
26575 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
26576 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
26577 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
26578 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
26579 corresponding function type when -mveclibabi=acml is used.
26580
26581 -mabi=name
26582 Generate code for the specified calling convention. Permissible
26583 values are sysv for the ABI used on GNU/Linux and other systems,
26584 and ms for the Microsoft ABI. The default is to use the Microsoft
26585 ABI when targeting Microsoft Windows and the SysV ABI on all other
26586 systems. You can control this behavior for specific functions by
26587 using the function attributes "ms_abi" and "sysv_abi".
26588
26589 -mforce-indirect-call
26590 Force all calls to functions to be indirect. This is useful when
26591 using Intel Processor Trace where it generates more precise timing
26592 information for function calls.
26593
26594 -mmanual-endbr
26595 Insert ENDBR instruction at function entry only via the "cf_check"
26596 function attribute. This is useful when used with the option
26597 -fcf-protection=branch to control ENDBR insertion at the function
26598 entry.
26599
26600 -mcall-ms2sysv-xlogues
26601 Due to differences in 64-bit ABIs, any Microsoft ABI function that
26602 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
26603 clobbered. By default, the code for saving and restoring these
26604 registers is emitted inline, resulting in fairly lengthy prologues
26605 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
26606 epilogues that use stubs in the static portion of libgcc to perform
26607 these saves and restores, thus reducing function size at the cost
26608 of a few extra instructions.
26609
26610 -mtls-dialect=type
26611 Generate code to access thread-local storage using the gnu or gnu2
26612 conventions. gnu is the conservative default; gnu2 is more
26613 efficient, but it may add compile- and run-time requirements that
26614 cannot be satisfied on all systems.
26615
26616 -mpush-args
26617 -mno-push-args
26618 Use PUSH operations to store outgoing parameters. This method is
26619 shorter and usually equally fast as method using SUB/MOV operations
26620 and is enabled by default. In some cases disabling it may improve
26621 performance because of improved scheduling and reduced
26622 dependencies.
26623
26624 -maccumulate-outgoing-args
26625 If enabled, the maximum amount of space required for outgoing
26626 arguments is computed in the function prologue. This is faster on
26627 most modern CPUs because of reduced dependencies, improved
26628 scheduling and reduced stack usage when the preferred stack
26629 boundary is not equal to 2. The drawback is a notable increase in
26630 code size. This switch implies -mno-push-args.
26631
26632 -mthreads
26633 Support thread-safe exception handling on MinGW. Programs that
26634 rely on thread-safe exception handling must compile and link all
26635 code with the -mthreads option. When compiling, -mthreads defines
26636 -D_MT; when linking, it links in a special thread helper library
26637 -lmingwthrd which cleans up per-thread exception-handling data.
26638
26639 -mms-bitfields
26640 -mno-ms-bitfields
26641 Enable/disable bit-field layout compatible with the native
26642 Microsoft Windows compiler.
26643
26644 If "packed" is used on a structure, or if bit-fields are used, it
26645 may be that the Microsoft ABI lays out the structure differently
26646 than the way GCC normally does. Particularly when moving packed
26647 data between functions compiled with GCC and the native Microsoft
26648 compiler (either via function call or as data in a file), it may be
26649 necessary to access either format.
26650
26651 This option is enabled by default for Microsoft Windows targets.
26652 This behavior can also be controlled locally by use of variable or
26653 type attributes. For more information, see x86 Variable Attributes
26654 and x86 Type Attributes.
26655
26656 The Microsoft structure layout algorithm is fairly simple with the
26657 exception of the bit-field packing. The padding and alignment of
26658 members of structures and whether a bit-field can straddle a
26659 storage-unit boundary are determine by these rules:
26660
26661 1. Structure members are stored sequentially in the order in which
26662 they are
26663 declared: the first member has the lowest memory address and
26664 the last member the highest.
26665
26666 2. Every data object has an alignment requirement. The alignment
26667 requirement
26668 for all data except structures, unions, and arrays is either
26669 the size of the object or the current packing size (specified
26670 with either the "aligned" attribute or the "pack" pragma),
26671 whichever is less. For structures, unions, and arrays, the
26672 alignment requirement is the largest alignment requirement of
26673 its members. Every object is allocated an offset so that:
26674
26675 offset % alignment_requirement == 0
26676
26677 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
26678 allocation
26679 unit if the integral types are the same size and if the next
26680 bit-field fits into the current allocation unit without
26681 crossing the boundary imposed by the common alignment
26682 requirements of the bit-fields.
26683
26684 MSVC interprets zero-length bit-fields in the following ways:
26685
26686 1. If a zero-length bit-field is inserted between two bit-fields
26687 that
26688 are normally coalesced, the bit-fields are not coalesced.
26689
26690 For example:
26691
26692 struct
26693 {
26694 unsigned long bf_1 : 12;
26695 unsigned long : 0;
26696 unsigned long bf_2 : 12;
26697 } t1;
26698
26699 The size of "t1" is 8 bytes with the zero-length bit-field. If
26700 the zero-length bit-field were removed, "t1"'s size would be 4
26701 bytes.
26702
26703 2. If a zero-length bit-field is inserted after a bit-field, "foo",
26704 and the
26705 alignment of the zero-length bit-field is greater than the
26706 member that follows it, "bar", "bar" is aligned as the type of
26707 the zero-length bit-field.
26708
26709 For example:
26710
26711 struct
26712 {
26713 char foo : 4;
26714 short : 0;
26715 char bar;
26716 } t2;
26717
26718 struct
26719 {
26720 char foo : 4;
26721 short : 0;
26722 double bar;
26723 } t3;
26724
26725 For "t2", "bar" is placed at offset 2, rather than offset 1.
26726 Accordingly, the size of "t2" is 4. For "t3", the zero-length
26727 bit-field does not affect the alignment of "bar" or, as a
26728 result, the size of the structure.
26729
26730 Taking this into account, it is important to note the
26731 following:
26732
26733 1. If a zero-length bit-field follows a normal bit-field, the
26734 type of the
26735 zero-length bit-field may affect the alignment of the
26736 structure as whole. For example, "t2" has a size of 4
26737 bytes, since the zero-length bit-field follows a normal
26738 bit-field, and is of type short.
26739
26740 2. Even if a zero-length bit-field is not followed by a normal
26741 bit-field, it may
26742 still affect the alignment of the structure:
26743
26744 struct
26745 {
26746 char foo : 6;
26747 long : 0;
26748 } t4;
26749
26750 Here, "t4" takes up 4 bytes.
26751
26752 3. Zero-length bit-fields following non-bit-field members are
26753 ignored:
26754 struct
26755 {
26756 char foo;
26757 long : 0;
26758 char bar;
26759 } t5;
26760
26761 Here, "t5" takes up 2 bytes.
26762
26763 -mno-align-stringops
26764 Do not align the destination of inlined string operations. This
26765 switch reduces code size and improves performance in case the
26766 destination is already aligned, but GCC doesn't know about it.
26767
26768 -minline-all-stringops
26769 By default GCC inlines string operations only when the destination
26770 is known to be aligned to least a 4-byte boundary. This enables
26771 more inlining and increases code size, but may improve performance
26772 of code that depends on fast "memcpy" and "memset" for short
26773 lengths. The option enables inline expansion of "strlen" for all
26774 pointer alignments.
26775
26776 -minline-stringops-dynamically
26777 For string operations of unknown size, use run-time checks with
26778 inline code for small blocks and a library call for large blocks.
26779
26780 -mstringop-strategy=alg
26781 Override the internal decision heuristic for the particular
26782 algorithm to use for inlining string operations. The allowed
26783 values for alg are:
26784
26785 rep_byte
26786 rep_4byte
26787 rep_8byte
26788 Expand using i386 "rep" prefix of the specified size.
26789
26790 byte_loop
26791 loop
26792 unrolled_loop
26793 Expand into an inline loop.
26794
26795 libcall
26796 Always use a library call.
26797
26798 -mmemcpy-strategy=strategy
26799 Override the internal decision heuristic to decide if
26800 "__builtin_memcpy" should be inlined and what inline algorithm to
26801 use when the expected size of the copy operation is known. strategy
26802 is a comma-separated list of alg:max_size:dest_align triplets. alg
26803 is specified in -mstringop-strategy, max_size specifies the max
26804 byte size with which inline algorithm alg is allowed. For the last
26805 triplet, the max_size must be "-1". The max_size of the triplets in
26806 the list must be specified in increasing order. The minimal byte
26807 size for alg is 0 for the first triplet and "max_size + 1" of the
26808 preceding range.
26809
26810 -mmemset-strategy=strategy
26811 The option is similar to -mmemcpy-strategy= except that it is to
26812 control "__builtin_memset" expansion.
26813
26814 -momit-leaf-frame-pointer
26815 Don't keep the frame pointer in a register for leaf functions.
26816 This avoids the instructions to save, set up, and restore frame
26817 pointers and makes an extra register available in leaf functions.
26818 The option -fomit-leaf-frame-pointer removes the frame pointer for
26819 leaf functions, which might make debugging harder.
26820
26821 -mtls-direct-seg-refs
26822 -mno-tls-direct-seg-refs
26823 Controls whether TLS variables may be accessed with offsets from
26824 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
26825 whether the thread base pointer must be added. Whether or not this
26826 is valid depends on the operating system, and whether it maps the
26827 segment to cover the entire TLS area.
26828
26829 For systems that use the GNU C Library, the default is on.
26830
26831 -msse2avx
26832 -mno-sse2avx
26833 Specify that the assembler should encode SSE instructions with VEX
26834 prefix. The option -mavx turns this on by default.
26835
26836 -mfentry
26837 -mno-fentry
26838 If profiling is active (-pg), put the profiling counter call before
26839 the prologue. Note: On x86 architectures the attribute
26840 "ms_hook_prologue" isn't possible at the moment for -mfentry and
26841 -pg.
26842
26843 -mrecord-mcount
26844 -mno-record-mcount
26845 If profiling is active (-pg), generate a __mcount_loc section that
26846 contains pointers to each profiling call. This is useful for
26847 automatically patching and out calls.
26848
26849 -mnop-mcount
26850 -mno-nop-mcount
26851 If profiling is active (-pg), generate the calls to the profiling
26852 functions as NOPs. This is useful when they should be patched in
26853 later dynamically. This is likely only useful together with
26854 -mrecord-mcount.
26855
26856 -minstrument-return=type
26857 Instrument function exit in -pg -mfentry instrumented functions
26858 with call to specified function. This only instruments true returns
26859 ending with ret, but not sibling calls ending with jump. Valid
26860 types are none to not instrument, call to generate a call to
26861 __return__, or nop5 to generate a 5 byte nop.
26862
26863 -mrecord-return
26864 -mno-record-return
26865 Generate a __return_loc section pointing to all return
26866 instrumentation code.
26867
26868 -mfentry-name=name
26869 Set name of __fentry__ symbol called at function entry for -pg
26870 -mfentry functions.
26871
26872 -mfentry-section=name
26873 Set name of section to record -mrecord-mcount calls (default
26874 __mcount_loc).
26875
26876 -mskip-rax-setup
26877 -mno-skip-rax-setup
26878 When generating code for the x86-64 architecture with SSE
26879 extensions disabled, -mskip-rax-setup can be used to skip setting
26880 up RAX register when there are no variable arguments passed in
26881 vector registers.
26882
26883 Warning: Since RAX register is used to avoid unnecessarily saving
26884 vector registers on stack when passing variable arguments, the
26885 impacts of this option are callees may waste some stack space,
26886 misbehave or jump to a random location. GCC 4.4 or newer don't
26887 have those issues, regardless the RAX register value.
26888
26889 -m8bit-idiv
26890 -mno-8bit-idiv
26891 On some processors, like Intel Atom, 8-bit unsigned integer divide
26892 is much faster than 32-bit/64-bit integer divide. This option
26893 generates a run-time check. If both dividend and divisor are
26894 within range of 0 to 255, 8-bit unsigned integer divide is used
26895 instead of 32-bit/64-bit integer divide.
26896
26897 -mavx256-split-unaligned-load
26898 -mavx256-split-unaligned-store
26899 Split 32-byte AVX unaligned load and store.
26900
26901 -mstack-protector-guard=guard
26902 -mstack-protector-guard-reg=reg
26903 -mstack-protector-guard-offset=offset
26904 Generate stack protection code using canary at guard. Supported
26905 locations are global for global canary or tls for per-thread canary
26906 in the TLS block (the default). This option has effect only when
26907 -fstack-protector or -fstack-protector-all is specified.
26908
26909 With the latter choice the options -mstack-protector-guard-reg=reg
26910 and -mstack-protector-guard-offset=offset furthermore specify which
26911 segment register (%fs or %gs) to use as base register for reading
26912 the canary, and from what offset from that base register. The
26913 default for those is as specified in the relevant ABI.
26914
26915 -mgeneral-regs-only
26916 Generate code that uses only the general-purpose registers. This
26917 prevents the compiler from using floating-point, vector, mask and
26918 bound registers.
26919
26920 -mindirect-branch=choice
26921 Convert indirect call and jump with choice. The default is keep,
26922 which keeps indirect call and jump unmodified. thunk converts
26923 indirect call and jump to call and return thunk. thunk-inline
26924 converts indirect call and jump to inlined call and return thunk.
26925 thunk-extern converts indirect call and jump to external call and
26926 return thunk provided in a separate object file. You can control
26927 this behavior for a specific function by using the function
26928 attribute "indirect_branch".
26929
26930 Note that -mcmodel=large is incompatible with
26931 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
26932 the thunk function may not be reachable in the large code model.
26933
26934 Note that -mindirect-branch=thunk-extern is compatible with
26935 -fcf-protection=branch since the external thunk can be made to
26936 enable control-flow check.
26937
26938 -mfunction-return=choice
26939 Convert function return with choice. The default is keep, which
26940 keeps function return unmodified. thunk converts function return
26941 to call and return thunk. thunk-inline converts function return to
26942 inlined call and return thunk. thunk-extern converts function
26943 return to external call and return thunk provided in a separate
26944 object file. You can control this behavior for a specific function
26945 by using the function attribute "function_return".
26946
26947 Note that -mindirect-return=thunk-extern is compatible with
26948 -fcf-protection=branch since the external thunk can be made to
26949 enable control-flow check.
26950
26951 Note that -mcmodel=large is incompatible with
26952 -mfunction-return=thunk and -mfunction-return=thunk-extern since
26953 the thunk function may not be reachable in the large code model.
26954
26955 -mindirect-branch-register
26956 Force indirect call and jump via register.
26957
26958 These -m switches are supported in addition to the above on x86-64
26959 processors in 64-bit environments.
26960
26961 -m32
26962 -m64
26963 -mx32
26964 -m16
26965 -miamcu
26966 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
26967 option sets "int", "long", and pointer types to 32 bits, and
26968 generates code that runs on any i386 system.
26969
26970 The -m64 option sets "int" to 32 bits and "long" and pointer types
26971 to 64 bits, and generates code for the x86-64 architecture. For
26972 Darwin only the -m64 option also turns off the -fno-pic and
26973 -mdynamic-no-pic options.
26974
26975 The -mx32 option sets "int", "long", and pointer types to 32 bits,
26976 and generates code for the x86-64 architecture.
26977
26978 The -m16 option is the same as -m32, except for that it outputs the
26979 ".code16gcc" assembly directive at the beginning of the assembly
26980 output so that the binary can run in 16-bit mode.
26981
26982 The -miamcu option generates code which conforms to Intel MCU
26983 psABI. It requires the -m32 option to be turned on.
26984
26985 -mno-red-zone
26986 Do not use a so-called "red zone" for x86-64 code. The red zone is
26987 mandated by the x86-64 ABI; it is a 128-byte area beyond the
26988 location of the stack pointer that is not modified by signal or
26989 interrupt handlers and therefore can be used for temporary data
26990 without adjusting the stack pointer. The flag -mno-red-zone
26991 disables this red zone.
26992
26993 -mcmodel=small
26994 Generate code for the small code model: the program and its symbols
26995 must be linked in the lower 2 GB of the address space. Pointers
26996 are 64 bits. Programs can be statically or dynamically linked.
26997 This is the default code model.
26998
26999 -mcmodel=kernel
27000 Generate code for the kernel code model. The kernel runs in the
27001 negative 2 GB of the address space. This model has to be used for
27002 Linux kernel code.
27003
27004 -mcmodel=medium
27005 Generate code for the medium model: the program is linked in the
27006 lower 2 GB of the address space. Small symbols are also placed
27007 there. Symbols with sizes larger than -mlarge-data-threshold are
27008 put into large data or BSS sections and can be located above 2GB.
27009 Programs can be statically or dynamically linked.
27010
27011 -mcmodel=large
27012 Generate code for the large model. This model makes no assumptions
27013 about addresses and sizes of sections.
27014
27015 -maddress-mode=long
27016 Generate code for long address mode. This is only supported for
27017 64-bit and x32 environments. It is the default address mode for
27018 64-bit environments.
27019
27020 -maddress-mode=short
27021 Generate code for short address mode. This is only supported for
27022 32-bit and x32 environments. It is the default address mode for
27023 32-bit and x32 environments.
27024
27025 -mneeded
27026 -mno-needed
27027 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
27028 indicate the micro-architecture ISA level required to execute the
27029 binary.
27030
27031 x86 Windows Options
27032 These additional options are available for Microsoft Windows targets:
27033
27034 -mconsole
27035 This option specifies that a console application is to be
27036 generated, by instructing the linker to set the PE header subsystem
27037 type required for console applications. This option is available
27038 for Cygwin and MinGW targets and is enabled by default on those
27039 targets.
27040
27041 -mdll
27042 This option is available for Cygwin and MinGW targets. It
27043 specifies that a DLL---a dynamic link library---is to be generated,
27044 enabling the selection of the required runtime startup object and
27045 entry point.
27046
27047 -mnop-fun-dllimport
27048 This option is available for Cygwin and MinGW targets. It
27049 specifies that the "dllimport" attribute should be ignored.
27050
27051 -mthread
27052 This option is available for MinGW targets. It specifies that
27053 MinGW-specific thread support is to be used.
27054
27055 -municode
27056 This option is available for MinGW-w64 targets. It causes the
27057 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
27058 capable runtime startup code.
27059
27060 -mwin32
27061 This option is available for Cygwin and MinGW targets. It
27062 specifies that the typical Microsoft Windows predefined macros are
27063 to be set in the pre-processor, but does not influence the choice
27064 of runtime library/startup code.
27065
27066 -mwindows
27067 This option is available for Cygwin and MinGW targets. It
27068 specifies that a GUI application is to be generated by instructing
27069 the linker to set the PE header subsystem type appropriately.
27070
27071 -fno-set-stack-executable
27072 This option is available for MinGW targets. It specifies that the
27073 executable flag for the stack used by nested functions isn't set.
27074 This is necessary for binaries running in kernel mode of Microsoft
27075 Windows, as there the User32 API, which is used to set executable
27076 privileges, isn't available.
27077
27078 -fwritable-relocated-rdata
27079 This option is available for MinGW and Cygwin targets. It
27080 specifies that relocated-data in read-only section is put into the
27081 ".data" section. This is a necessary for older runtimes not
27082 supporting modification of ".rdata" sections for pseudo-relocation.
27083
27084 -mpe-aligned-commons
27085 This option is available for Cygwin and MinGW targets. It
27086 specifies that the GNU extension to the PE file format that permits
27087 the correct alignment of COMMON variables should be used when
27088 generating code. It is enabled by default if GCC detects that the
27089 target assembler found during configuration supports the feature.
27090
27091 See also under x86 Options for standard options.
27092
27093 Xstormy16 Options
27094 These options are defined for Xstormy16:
27095
27096 -msim
27097 Choose startup files and linker script suitable for the simulator.
27098
27099 Xtensa Options
27100 These options are supported for Xtensa targets:
27101
27102 -mconst16
27103 -mno-const16
27104 Enable or disable use of "CONST16" instructions for loading
27105 constant values. The "CONST16" instruction is currently not a
27106 standard option from Tensilica. When enabled, "CONST16"
27107 instructions are always used in place of the standard "L32R"
27108 instructions. The use of "CONST16" is enabled by default only if
27109 the "L32R" instruction is not available.
27110
27111 -mfused-madd
27112 -mno-fused-madd
27113 Enable or disable use of fused multiply/add and multiply/subtract
27114 instructions in the floating-point option. This has no effect if
27115 the floating-point option is not also enabled. Disabling fused
27116 multiply/add and multiply/subtract instructions forces the compiler
27117 to use separate instructions for the multiply and add/subtract
27118 operations. This may be desirable in some cases where strict IEEE
27119 754-compliant results are required: the fused multiply add/subtract
27120 instructions do not round the intermediate result, thereby
27121 producing results with more bits of precision than specified by the
27122 IEEE standard. Disabling fused multiply add/subtract instructions
27123 also ensures that the program output is not sensitive to the
27124 compiler's ability to combine multiply and add/subtract operations.
27125
27126 -mserialize-volatile
27127 -mno-serialize-volatile
27128 When this option is enabled, GCC inserts "MEMW" instructions before
27129 "volatile" memory references to guarantee sequential consistency.
27130 The default is -mserialize-volatile. Use -mno-serialize-volatile
27131 to omit the "MEMW" instructions.
27132
27133 -mforce-no-pic
27134 For targets, like GNU/Linux, where all user-mode Xtensa code must
27135 be position-independent code (PIC), this option disables PIC for
27136 compiling kernel code.
27137
27138 -mtext-section-literals
27139 -mno-text-section-literals
27140 These options control the treatment of literal pools. The default
27141 is -mno-text-section-literals, which places literals in a separate
27142 section in the output file. This allows the literal pool to be
27143 placed in a data RAM/ROM, and it also allows the linker to combine
27144 literal pools from separate object files to remove redundant
27145 literals and improve code size. With -mtext-section-literals, the
27146 literals are interspersed in the text section in order to keep them
27147 as close as possible to their references. This may be necessary
27148 for large assembly files. Literals for each function are placed
27149 right before that function.
27150
27151 -mauto-litpools
27152 -mno-auto-litpools
27153 These options control the treatment of literal pools. The default
27154 is -mno-auto-litpools, which places literals in a separate section
27155 in the output file unless -mtext-section-literals is used. With
27156 -mauto-litpools the literals are interspersed in the text section
27157 by the assembler. Compiler does not produce explicit ".literal"
27158 directives and loads literals into registers with "MOVI"
27159 instructions instead of "L32R" to let the assembler do relaxation
27160 and place literals as necessary. This option allows assembler to
27161 create several literal pools per function and assemble very big
27162 functions, which may not be possible with -mtext-section-literals.
27163
27164 -mtarget-align
27165 -mno-target-align
27166 When this option is enabled, GCC instructs the assembler to
27167 automatically align instructions to reduce branch penalties at the
27168 expense of some code density. The assembler attempts to widen
27169 density instructions to align branch targets and the instructions
27170 following call instructions. If there are not enough preceding
27171 safe density instructions to align a target, no widening is
27172 performed. The default is -mtarget-align. These options do not
27173 affect the treatment of auto-aligned instructions like "LOOP",
27174 which the assembler always aligns, either by widening density
27175 instructions or by inserting NOP instructions.
27176
27177 -mlongcalls
27178 -mno-longcalls
27179 When this option is enabled, GCC instructs the assembler to
27180 translate direct calls to indirect calls unless it can determine
27181 that the target of a direct call is in the range allowed by the
27182 call instruction. This translation typically occurs for calls to
27183 functions in other source files. Specifically, the assembler
27184 translates a direct "CALL" instruction into an "L32R" followed by a
27185 "CALLX" instruction. The default is -mno-longcalls. This option
27186 should be used in programs where the call target can potentially be
27187 out of range. This option is implemented in the assembler, not the
27188 compiler, so the assembly code generated by GCC still shows direct
27189 call instructions---look at the disassembled object code to see the
27190 actual instructions. Note that the assembler uses an indirect call
27191 for every cross-file call, not just those that really are out of
27192 range.
27193
27194 -mabi=name
27195 Generate code for the specified ABI. Permissible values are:
27196 call0, windowed. Default ABI is chosen by the Xtensa core
27197 configuration.
27198
27199 -mabi=call0
27200 When this option is enabled function parameters are passed in
27201 registers "a2" through "a7", registers "a12" through "a15" are
27202 caller-saved, and register "a15" may be used as a frame pointer.
27203 When this version of the ABI is enabled the C preprocessor symbol
27204 "__XTENSA_CALL0_ABI__" is defined.
27205
27206 -mabi=windowed
27207 When this option is enabled function parameters are passed in
27208 registers "a10" through "a15", and called function rotates register
27209 window by 8 registers on entry so that its arguments are found in
27210 registers "a2" through "a7". Register "a7" may be used as a frame
27211 pointer. Register window is rotated 8 registers back upon return.
27212 When this version of the ABI is enabled the C preprocessor symbol
27213 "__XTENSA_WINDOWED_ABI__" is defined.
27214
27215 zSeries Options
27216 These are listed under
27217
27219 This section describes several environment variables that affect how
27220 GCC operates. Some of them work by specifying directories or prefixes
27221 to use when searching for various kinds of files. Some are used to
27222 specify other aspects of the compilation environment.
27223
27224 Note that you can also specify places to search using options such as
27225 -B, -I and -L. These take precedence over places specified using
27226 environment variables, which in turn take precedence over those
27227 specified by the configuration of GCC.
27228
27229 LANG
27230 LC_CTYPE
27231 LC_MESSAGES
27232 LC_ALL
27233 These environment variables control the way that GCC uses
27234 localization information which allows GCC to work with different
27235 national conventions. GCC inspects the locale categories LC_CTYPE
27236 and LC_MESSAGES if it has been configured to do so. These locale
27237 categories can be set to any value supported by your installation.
27238 A typical value is en_GB.UTF-8 for English in the United Kingdom
27239 encoded in UTF-8.
27240
27241 The LC_CTYPE environment variable specifies character
27242 classification. GCC uses it to determine the character boundaries
27243 in a string; this is needed for some multibyte encodings that
27244 contain quote and escape characters that are otherwise interpreted
27245 as a string end or escape.
27246
27247 The LC_MESSAGES environment variable specifies the language to use
27248 in diagnostic messages.
27249
27250 If the LC_ALL environment variable is set, it overrides the value
27251 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
27252 default to the value of the LANG environment variable. If none of
27253 these variables are set, GCC defaults to traditional C English
27254 behavior.
27255
27256 TMPDIR
27257 If TMPDIR is set, it specifies the directory to use for temporary
27258 files. GCC uses temporary files to hold the output of one stage of
27259 compilation which is to be used as input to the next stage: for
27260 example, the output of the preprocessor, which is the input to the
27261 compiler proper.
27262
27263 GCC_COMPARE_DEBUG
27264 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
27265 -fcompare-debug to the compiler driver. See the documentation of
27266 this option for more details.
27267
27268 GCC_EXEC_PREFIX
27269 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
27270 names of the subprograms executed by the compiler. No slash is
27271 added when this prefix is combined with the name of a subprogram,
27272 but you can specify a prefix that ends with a slash if you wish.
27273
27274 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
27275 appropriate prefix to use based on the pathname it is invoked with.
27276
27277 If GCC cannot find the subprogram using the specified prefix, it
27278 tries looking in the usual places for the subprogram.
27279
27280 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
27281 prefix is the prefix to the installed compiler. In many cases
27282 prefix is the value of "prefix" when you ran the configure script.
27283
27284 Other prefixes specified with -B take precedence over this prefix.
27285
27286 This prefix is also used for finding files such as crt0.o that are
27287 used for linking.
27288
27289 In addition, the prefix is used in an unusual way in finding the
27290 directories to search for header files. For each of the standard
27291 directories whose name normally begins with /usr/local/lib/gcc
27292 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
27293 replacing that beginning with the specified prefix to produce an
27294 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
27295 just before it searches the standard directory /usr/local/lib/bar.
27296 If a standard directory begins with the configured prefix then the
27297 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
27298 header files.
27299
27300 COMPILER_PATH
27301 The value of COMPILER_PATH is a colon-separated list of
27302 directories, much like PATH. GCC tries the directories thus
27303 specified when searching for subprograms, if it cannot find the
27304 subprograms using GCC_EXEC_PREFIX.
27305
27306 LIBRARY_PATH
27307 The value of LIBRARY_PATH is a colon-separated list of directories,
27308 much like PATH. When configured as a native compiler, GCC tries
27309 the directories thus specified when searching for special linker
27310 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
27311 GCC also uses these directories when searching for ordinary
27312 libraries for the -l option (but directories specified with -L come
27313 first).
27314
27315 LANG
27316 This variable is used to pass locale information to the compiler.
27317 One way in which this information is used is to determine the
27318 character set to be used when character literals, string literals
27319 and comments are parsed in C and C++. When the compiler is
27320 configured to allow multibyte characters, the following values for
27321 LANG are recognized:
27322
27323 C-JIS
27324 Recognize JIS characters.
27325
27326 C-SJIS
27327 Recognize SJIS characters.
27328
27329 C-EUCJP
27330 Recognize EUCJP characters.
27331
27332 If LANG is not defined, or if it has some other value, then the
27333 compiler uses "mblen" and "mbtowc" as defined by the default locale
27334 to recognize and translate multibyte characters.
27335
27336 GCC_EXTRA_DIAGNOSTIC_OUTPUT
27337 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
27338 values, then additional text will be emitted to stderr when fix-it
27339 hints are emitted. -fdiagnostics-parseable-fixits and
27340 -fno-diagnostics-parseable-fixits take precedence over this
27341 environment variable.
27342
27343 fixits-v1
27344 Emit parseable fix-it hints, equivalent to
27345 -fdiagnostics-parseable-fixits. In particular, columns are
27346 expressed as a count of bytes, starting at byte 1 for the
27347 initial column.
27348
27349 fixits-v2
27350 As "fixits-v1", but columns are expressed as display columns,
27351 as per -fdiagnostics-column-unit=display.
27352
27353 Some additional environment variables affect the behavior of the
27354 preprocessor.
27355
27356 CPATH
27357 C_INCLUDE_PATH
27358 CPLUS_INCLUDE_PATH
27359 OBJC_INCLUDE_PATH
27360 Each variable's value is a list of directories separated by a
27361 special character, much like PATH, in which to look for header
27362 files. The special character, "PATH_SEPARATOR", is target-
27363 dependent and determined at GCC build time. For Microsoft Windows-
27364 based targets it is a semicolon, and for almost all other targets
27365 it is a colon.
27366
27367 CPATH specifies a list of directories to be searched as if
27368 specified with -I, but after any paths given with -I options on the
27369 command line. This environment variable is used regardless of
27370 which language is being preprocessed.
27371
27372 The remaining environment variables apply only when preprocessing
27373 the particular language indicated. Each specifies a list of
27374 directories to be searched as if specified with -isystem, but after
27375 any paths given with -isystem options on the command line.
27376
27377 In all these variables, an empty element instructs the compiler to
27378 search its current working directory. Empty elements can appear at
27379 the beginning or end of a path. For instance, if the value of
27380 CPATH is ":/special/include", that has the same effect as
27381 -I. -I/special/include.
27382
27383 DEPENDENCIES_OUTPUT
27384 If this variable is set, its value specifies how to output
27385 dependencies for Make based on the non-system header files
27386 processed by the compiler. System header files are ignored in the
27387 dependency output.
27388
27389 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
27390 case the Make rules are written to that file, guessing the target
27391 name from the source file name. Or the value can have the form
27392 file target, in which case the rules are written to file file using
27393 target as the target name.
27394
27395 In other words, this environment variable is equivalent to
27396 combining the options -MM and -MF, with an optional -MT switch too.
27397
27398 SUNPRO_DEPENDENCIES
27399 This variable is the same as DEPENDENCIES_OUTPUT (see above),
27400 except that system header files are not ignored, so it implies -M
27401 rather than -MM. However, the dependence on the main input file is
27402 omitted.
27403
27404 SOURCE_DATE_EPOCH
27405 If this variable is set, its value specifies a UNIX timestamp to be
27406 used in replacement of the current date and time in the "__DATE__"
27407 and "__TIME__" macros, so that the embedded timestamps become
27408 reproducible.
27409
27410 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
27411 the number of seconds (excluding leap seconds) since 01 Jan 1970
27412 00:00:00 represented in ASCII; identical to the output of "date
27413 +%s" on GNU/Linux and other systems that support the %s extension
27414 in the "date" command.
27415
27416 The value should be a known timestamp such as the last modification
27417 time of the source or package and it should be set by the build
27418 process.
27419
27421 For instructions on reporting bugs, see
27422 <http://bugzilla.redhat.com/bugzilla>.
27423
27425 1. On some systems, gcc -shared needs to build supplementary stub code
27426 for constructors to work. On multi-libbed systems, gcc -shared
27427 must select the correct support libraries to link against. Failing
27428 to supply the correct flags may lead to subtle defects. Supplying
27429 them in cases where they are not necessary is innocuous.
27430
27432 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
27433 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
27434
27436 See the Info entry for gcc, or
27437 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
27438 to GCC.
27439
27441 Copyright (c) 1988-2021 Free Software Foundation, Inc.
27442
27443 Permission is granted to copy, distribute and/or modify this document
27444 under the terms of the GNU Free Documentation License, Version 1.3 or
27445 any later version published by the Free Software Foundation; with the
27446 Invariant Sections being "GNU General Public License" and "Funding Free
27447 Software", the Front-Cover texts being (a) (see below), and with the
27448 Back-Cover Texts being (b) (see below). A copy of the license is
27449 included in the gfdl(7) man page.
27450
27451 (a) The FSF's Front-Cover Text is:
27452
27453 A GNU Manual
27454
27455 (b) The FSF's Back-Cover Text is:
27456
27457 You have freedom to copy and modify this GNU Manual, like GNU
27458 software. Copies published by the Free Software Foundation raise
27459 funds for GNU development.
27460
27461
27462
27463gcc-11 2021-05-31 GCC(1)