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
825
826 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
827 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
828 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
829 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
830 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
831 -msave-acc-in-interrupts
832
833 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
834 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
835 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
836 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
837 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
838 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
839 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
840 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
841 -mhotpatch=halfwords,halfwords
842
843 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
844 -mscore7 -mscore7d
845
846 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
847 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
848 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
849 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
850 -mnomacsave -mieee -mno-ieee -mbitops -misize
851 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
852 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
853 -mfixed-range=register-range -maccumulate-outgoing-args
854 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
855 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
856 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
857 -mpretend-cmove -mtas
858
859 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
860 -mno-impure-text -pthreads
861
862 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
863 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
864 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
865 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
866 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
867 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
868 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
869 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
870 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
871 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
872 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
873
874 System V Options -Qy -Qn -YP,paths -Ym,dir
875
876 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
877 -mlittle-endian -mcmodel=code-model
878
879 TILEPro Options -mcpu=cpu -m32
880
881 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
882 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
883 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
884 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
885 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
886 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
887
888 VAX Options -mg -mgnu -munix
889
890 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
891 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
892 -muser-mode
893
894 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
895 -mpointer-size=size
896
897 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
898 -Xbind-now
899
900 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
901 list -mdump-tune-features -mno-default -mfpmath=unit
902 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
903 -mhard-float -msoft-float -mno-wide-multiply -mrtd
904 -malign-double -mpreferred-stack-boundary=num
905 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
906 -mcrc32 -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
907 -mprefer-vector-width=opt -mmmx -msse -msse2 -msse3 -mssse3
908 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf
909 -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq
910 -mavx512ifma -mavx512vbmi -msha -maes -mpclmul -mfsgsbase
911 -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite
912 -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves -msse4a
913 -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
914 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle
915 -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
916 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
917 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
918 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
919 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
920 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
921 -mamx-bf16 -muintr -mhreset -mavxvnni -mcldemote -mms-bitfields
922 -mno-align-stringops -minline-all-stringops
923 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
924 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
925 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
926 -m96bit-long-double -mlong-double-64 -mlong-double-80
927 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
928 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
929 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
930 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
931 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
932 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
933 -minstrument-return=type -mfentry-name=name -mfentry-section=name
934 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
935 -malign-data=type -mstack-protector-guard=guard
936 -mstack-protector-guard-reg=reg
937 -mstack-protector-guard-offset=offset
938 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
939 -mcall-ms2sysv-xlogues -mindirect-branch=choice
940 -mfunction-return=choice -mindirect-branch-register -mneeded
941
942 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
943 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
944 -fno-set-stack-executable
945
946 Xstormy16 Options -msim
947
948 Xtensa Options -mconst16 -mno-const16 -mfused-madd
949 -mno-fused-madd -mforce-no-pic -mserialize-volatile
950 -mno-serialize-volatile -mtext-section-literals
951 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
952 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
953 -mabi=abi-type
954
955 zSeries Options See S/390 and zSeries Options.
956
957 Options Controlling the Kind of Output
958 Compilation can involve up to four stages: preprocessing, compilation
959 proper, assembly and linking, always in that order. GCC is capable of
960 preprocessing and compiling several files either into several assembler
961 input files, or into one assembler input file; then each assembler
962 input file produces an object file, and linking combines all the object
963 files (those newly compiled, and those specified as input) into an
964 executable file.
965
966 For any given input file, the file name suffix determines what kind of
967 compilation is done:
968
969 file.c
970 C source code that must be preprocessed.
971
972 file.i
973 C source code that should not be preprocessed.
974
975 file.ii
976 C++ source code that should not be preprocessed.
977
978 file.m
979 Objective-C source code. Note that you must link with the libobjc
980 library to make an Objective-C program work.
981
982 file.mi
983 Objective-C source code that should not be preprocessed.
984
985 file.mm
986 file.M
987 Objective-C++ source code. Note that you must link with the
988 libobjc library to make an Objective-C++ program work. Note that
989 .M refers to a literal capital M.
990
991 file.mii
992 Objective-C++ source code that should not be preprocessed.
993
994 file.h
995 C, C++, Objective-C or Objective-C++ header file to be turned into
996 a precompiled header (default), or C, C++ header file to be turned
997 into an Ada spec (via the -fdump-ada-spec switch).
998
999 file.cc
1000 file.cp
1001 file.cxx
1002 file.cpp
1003 file.CPP
1004 file.c++
1005 file.C
1006 C++ source code that must be preprocessed. Note that in .cxx, the
1007 last two letters must both be literally x. Likewise, .C refers to
1008 a literal capital C.
1009
1010 file.mm
1011 file.M
1012 Objective-C++ source code that must be preprocessed.
1013
1014 file.mii
1015 Objective-C++ source code that should not be preprocessed.
1016
1017 file.hh
1018 file.H
1019 file.hp
1020 file.hxx
1021 file.hpp
1022 file.HPP
1023 file.h++
1024 file.tcc
1025 C++ header file to be turned into a precompiled header or Ada spec.
1026
1027 file.f
1028 file.for
1029 file.ftn
1030 Fixed form Fortran source code that should not be preprocessed.
1031
1032 file.F
1033 file.FOR
1034 file.fpp
1035 file.FPP
1036 file.FTN
1037 Fixed form Fortran source code that must be preprocessed (with the
1038 traditional preprocessor).
1039
1040 file.f90
1041 file.f95
1042 file.f03
1043 file.f08
1044 Free form Fortran source code that should not be preprocessed.
1045
1046 file.F90
1047 file.F95
1048 file.F03
1049 file.F08
1050 Free form Fortran source code that must be preprocessed (with the
1051 traditional preprocessor).
1052
1053 file.go
1054 Go source code.
1055
1056 file.brig
1057 BRIG files (binary representation of HSAIL).
1058
1059 file.d
1060 D source code.
1061
1062 file.di
1063 D interface file.
1064
1065 file.dd
1066 D documentation code (Ddoc).
1067
1068 file.ads
1069 Ada source code file that contains a library unit declaration (a
1070 declaration of a package, subprogram, or generic, or a generic
1071 instantiation), or a library unit renaming declaration (a package,
1072 generic, or subprogram renaming declaration). Such files are also
1073 called specs.
1074
1075 file.adb
1076 Ada source code file containing a library unit body (a subprogram
1077 or package body). Such files are also called bodies.
1078
1079 file.s
1080 Assembler code.
1081
1082 file.S
1083 file.sx
1084 Assembler code that must be preprocessed.
1085
1086 other
1087 An object file to be fed straight into linking. Any file name with
1088 no recognized suffix is treated this way.
1089
1090 You can specify the input language explicitly with the -x option:
1091
1092 -x language
1093 Specify explicitly the language for the following input files
1094 (rather than letting the compiler choose a default based on the
1095 file name suffix). This option applies to all following input
1096 files until the next -x option. Possible values for language are:
1097
1098 c c-header cpp-output
1099 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1100 objective-c objective-c-header objective-c-cpp-output
1101 objective-c++ objective-c++-header objective-c++-cpp-output
1102 assembler assembler-with-cpp
1103 ada
1104 d
1105 f77 f77-cpp-input f95 f95-cpp-input
1106 go
1107 brig
1108
1109 -x none
1110 Turn off any specification of a language, so that subsequent files
1111 are handled according to their file name suffixes (as they are if
1112 -x has not been used at all).
1113
1114 If you only want some of the stages of compilation, you can use -x (or
1115 filename suffixes) to tell gcc where to start, and one of the options
1116 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1117 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1118
1119 -c Compile or assemble the source files, but do not link. The linking
1120 stage simply is not done. The ultimate output is in the form of an
1121 object file for each source file.
1122
1123 By default, the object file name for a source file is made by
1124 replacing the suffix .c, .i, .s, etc., with .o.
1125
1126 Unrecognized input files, not requiring compilation or assembly,
1127 are ignored.
1128
1129 -S Stop after the stage of compilation proper; do not assemble. The
1130 output is in the form of an assembler code file for each non-
1131 assembler input file specified.
1132
1133 By default, the assembler file name for a source file is made by
1134 replacing the suffix .c, .i, etc., with .s.
1135
1136 Input files that don't require compilation are ignored.
1137
1138 -E Stop after the preprocessing stage; do not run the compiler proper.
1139 The output is in the form of preprocessed source code, which is
1140 sent to the standard output.
1141
1142 Input files that don't require preprocessing are ignored.
1143
1144 -o file
1145 Place the primary output in file file. This applies to whatever
1146 sort of output is being produced, whether it be an executable file,
1147 an object file, an assembler file or preprocessed C code.
1148
1149 If -o is not specified, the default is to put an executable file in
1150 a.out, the object file for source.suffix in source.o, its assembler
1151 file in source.s, a precompiled header file in source.suffix.gch,
1152 and all preprocessed C source on standard output.
1153
1154 Though -o names only the primary output, it also affects the naming
1155 of auxiliary and dump outputs. See the examples below. Unless
1156 overridden, both auxiliary outputs and dump outputs are placed in
1157 the same directory as the primary output. In auxiliary outputs,
1158 the suffix of the input file is replaced with that of the auxiliary
1159 output file type; in dump outputs, the suffix of the dump file is
1160 appended to the input file suffix. In compilation commands, the
1161 base name of both auxiliary and dump outputs is that of the primary
1162 output; in compile and link commands, the primary output name,
1163 minus the executable suffix, is combined with the input file name.
1164 If both share the same base name, disregarding the suffix, the
1165 result of the combination is that base name, otherwise, they are
1166 concatenated, separated by a dash.
1167
1168 gcc -c foo.c ...
1169
1170 will use foo.o as the primary output, and place aux outputs and
1171 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1172 dump file foo.c.???r.final for -fdump-rtl-final.
1173
1174 If a non-linker output file is explicitly specified, aux and dump
1175 files by default take the same base name:
1176
1177 gcc -c foo.c -o dir/foobar.o ...
1178
1179 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1180
1181 A linker output will instead prefix aux and dump outputs:
1182
1183 gcc foo.c bar.c -o dir/foobar ...
1184
1185 will generally name aux outputs dir/foobar-foo.* and
1186 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1187 dir/foobar-bar.c.*.
1188
1189 The one exception to the above is when the executable shares the
1190 base name with the single input:
1191
1192 gcc foo.c -o dir/foo ...
1193
1194 in which case aux outputs are named dir/foo.* and dump outputs
1195 named dir/foo.c.*.
1196
1197 The location and the names of auxiliary and dump outputs can be
1198 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1199 -save-temps=cwd, and -save-temps=obj.
1200
1201 -dumpbase dumpbase
1202 This option sets the base name for auxiliary and dump output files.
1203 It does not affect the name of the primary output file.
1204 Intermediate outputs, when preserved, are not regarded as primary
1205 outputs, but as auxiliary outputs:
1206
1207 gcc -save-temps -S foo.c
1208
1209 saves the (no longer) temporary preprocessed file in foo.i, and
1210 then compiles to the (implied) output file foo.s, whereas:
1211
1212 gcc -save-temps -dumpbase save-foo -c foo.c
1213
1214 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1215 intermediate, thus auxiliary output), and then assembles to the
1216 (implied) output file foo.o.
1217
1218 Absent this option, dump and aux files take their names from the
1219 input file, or from the (non-linker) output file, if one is
1220 explicitly specified: dump output files (e.g. those requested by
1221 -fdump-* options) with the input name suffix, and aux output files
1222 (those requested by other non-dump options, e.g. "-save-temps",
1223 "-gsplit-dwarf", "-fcallgraph-info") without it.
1224
1225 Similar suffix differentiation of dump and aux outputs can be
1226 attained for explicitly-given -dumpbase basename.suf by also
1227 specifying -dumpbase-ext .suf.
1228
1229 If dumpbase is explicitly specified with any directory component,
1230 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1231 ignored, and instead of appending to it, dumpbase fully overrides
1232 it:
1233
1234 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1235 -dumpdir pfx- -save-temps=cwd ...
1236
1237 creates auxiliary and dump outputs named alt/foo.*, disregarding
1238 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1239 -dumpdir.
1240
1241 When -dumpbase is specified in a command that compiles multiple
1242 inputs, or that compiles and then links, it may be combined with
1243 dumppfx, as specified under -dumpdir. Then, each input file is
1244 compiled using the combined dumppfx, and default values for
1245 dumpbase and auxdropsuf are computed for each input file:
1246
1247 gcc foo.c bar.c -c -dumpbase main ...
1248
1249 creates foo.o and bar.o as primary outputs, and avoids overwriting
1250 the auxiliary and dump outputs by using the dumpbase as a prefix,
1251 creating auxiliary and dump outputs named main-foo.* and
1252 main-bar.*.
1253
1254 An empty string specified as dumpbase avoids the influence of the
1255 output basename in the naming of auxiliary and dump outputs during
1256 compilation, computing default values :
1257
1258 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1259
1260 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1261 how their basenames are taken from the input name, but the
1262 directory still defaults to that of the output.
1263
1264 The empty-string dumpbase does not prevent the use of the output
1265 basename for outputs during linking:
1266
1267 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1268
1269 The compilation of the source files will name auxiliary outputs
1270 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1271 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1272 as the prefix for dumps and auxiliary files.
1273
1274 -dumpbase-ext auxdropsuf
1275 When forming the name of an auxiliary (but not a dump) output file,
1276 drop trailing auxdropsuf from dumpbase before appending any
1277 suffixes. If not specified, this option defaults to the suffix of
1278 a default dumpbase, i.e., the suffix of the input file when
1279 -dumpbase is not present in the command line, or dumpbase is
1280 combined with dumppfx.
1281
1282 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1283
1284 creates dir/foo.o as the main output, and generates auxiliary
1285 outputs in dir/x-foo.*, taking the location of the primary output,
1286 and dropping the .c suffix from the dumpbase. Dump outputs retain
1287 the suffix: dir/x-foo.c.*.
1288
1289 This option is disregarded if it does not match the suffix of a
1290 specified dumpbase, except as an alternative to the executable
1291 suffix when appending the linker output base name to dumppfx, as
1292 specified below:
1293
1294 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1295
1296 creates main.out as the primary output, and avoids overwriting the
1297 auxiliary and dump outputs by using the executable name minus
1298 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1299 and main-bar.* and dump outputs named main-foo.c.* and
1300 main-bar.c.*.
1301
1302 -dumpdir dumppfx
1303 When forming the name of an auxiliary or dump output file, use
1304 dumppfx as a prefix:
1305
1306 gcc -dumpdir pfx- -c foo.c ...
1307
1308 creates foo.o as the primary output, and auxiliary outputs named
1309 pfx-foo.*, combining the given dumppfx with the default dumpbase
1310 derived from the default primary output, derived in turn from the
1311 input name. Dump outputs also take the input name suffix:
1312 pfx-foo.c.*.
1313
1314 If dumppfx is to be used as a directory name, it must end with a
1315 directory separator:
1316
1317 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1318
1319 creates obj/bar.o as the primary output, and auxiliary outputs
1320 named dir/bar.*, combining the given dumppfx with the default
1321 dumpbase derived from the primary output name. Dump outputs also
1322 take the input name suffix: dir/bar.c.*.
1323
1324 It defaults to the location of the output file; options
1325 -save-temps=cwd and -save-temps=obj override this default, just
1326 like an explicit -dumpdir option. In case multiple such options
1327 are given, the last one prevails:
1328
1329 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1330
1331 outputs foo.o, with auxiliary outputs named foo.* because
1332 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1333 option. It does not matter that =obj is the default for
1334 -save-temps, nor that the output directory is implicitly the
1335 current directory. Dump outputs are named foo.c.*.
1336
1337 When compiling from multiple input files, if -dumpbase is
1338 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1339 appended to (or override, if containing any directory components)
1340 an explicit or defaulted dumppfx, so that each of the multiple
1341 compilations gets differently-named aux and dump outputs.
1342
1343 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1344
1345 outputs auxiliary dumps to dir/pfx-main-foo.* and
1346 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1347 retain the input file suffix: dir/pfx-main-foo.c.* and
1348 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1349 compilation:
1350
1351 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1352
1353 that, applying -dumpbase to a single source, does not compute and
1354 append a separate dumpbase per input file. Its auxiliary and dump
1355 outputs go in dir/pfx-main.*.
1356
1357 When compiling and then linking from multiple input files, a
1358 defaulted or explicitly specified dumppfx also undergoes the
1359 dumpbase- transformation above (e.g. the compilation of foo.c and
1360 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1361 are given, the linker output base name, minus auxdropsuf, if
1362 specified, or the executable suffix otherwise, plus a dash is
1363 appended to the default dumppfx instead. Note, however, that
1364 unlike earlier cases of linking:
1365
1366 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1367
1368 does not append the output name main to dumppfx, because -dumpdir
1369 is explicitly specified. The goal is that the explicitly-specified
1370 dumppfx may contain the specified output name as part of the
1371 prefix, if desired; only an explicitly-specified -dumpbase would be
1372 combined with it, in order to avoid simply discarding a meaningful
1373 option.
1374
1375 When compiling and then linking from a single input file, the
1376 linker output base name will only be appended to the default
1377 dumppfx as above if it does not share the base name with the single
1378 input file name. This has been covered in single-input linking
1379 cases above, but not with an explicit -dumpdir that inhibits the
1380 combination, even if overridden by -save-temps=*:
1381
1382 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1383
1384 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1385 current working directory as ultimately requested by
1386 -save-temps=cwd.
1387
1388 Summing it all up for an intuitive though slightly imprecise data
1389 flow: the primary output name is broken into a directory part and a
1390 basename part; dumppfx is set to the former, unless overridden by
1391 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1392 unless overriden by -dumpbase. If there are multiple inputs or
1393 linking, this dumpbase may be combined with dumppfx and taken from
1394 each input file. Auxiliary output names for each input are formed
1395 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1396 output suffix; dump output names are only different in that the
1397 suffix from dumpbase is retained.
1398
1399 When it comes to auxiliary and dump outputs created during LTO
1400 recompilation, a combination of dumppfx and dumpbase, as given or
1401 as derived from the linker output name but not from inputs, even in
1402 cases in which this combination would not otherwise be used as
1403 such, is passed down with a trailing period replacing the compiler-
1404 added dash, if any, as a -dumpdir option to lto-wrapper; being
1405 involved in linking, this program does not normally get any
1406 -dumpbase and -dumpbase-ext, and it ignores them.
1407
1408 When running sub-compilers, lto-wrapper appends LTO stage names to
1409 the received dumppfx, ensures it contains a directory component so
1410 that it overrides any -dumpdir, and passes that as -dumpbase to
1411 sub-compilers.
1412
1413 -v Print (on standard error output) the commands executed to run the
1414 stages of compilation. Also print the version number of the
1415 compiler driver program and of the preprocessor and the compiler
1416 proper.
1417
1418 -###
1419 Like -v except the commands are not executed and arguments are
1420 quoted unless they contain only alphanumeric characters or "./-_".
1421 This is useful for shell scripts to capture the driver-generated
1422 command lines.
1423
1424 --help
1425 Print (on the standard output) a description of the command-line
1426 options understood by gcc. If the -v option is also specified then
1427 --help is also passed on to the various processes invoked by gcc,
1428 so that they can display the command-line options they accept. If
1429 the -Wextra option has also been specified (prior to the --help
1430 option), then command-line options that have no documentation
1431 associated with them are also displayed.
1432
1433 --target-help
1434 Print (on the standard output) a description of target-specific
1435 command-line options for each tool. For some targets extra target-
1436 specific information may also be printed.
1437
1438 --help={class|[^]qualifier}[,...]
1439 Print (on the standard output) a description of the command-line
1440 options understood by the compiler that fit into all specified
1441 classes and qualifiers. These are the supported classes:
1442
1443 optimizers
1444 Display all of the optimization options supported by the
1445 compiler.
1446
1447 warnings
1448 Display all of the options controlling warning messages
1449 produced by the compiler.
1450
1451 target
1452 Display target-specific options. Unlike the --target-help
1453 option however, target-specific options of the linker and
1454 assembler are not displayed. This is because those tools do
1455 not currently support the extended --help= syntax.
1456
1457 params
1458 Display the values recognized by the --param option.
1459
1460 language
1461 Display the options supported for language, where language is
1462 the name of one of the languages supported in this version of
1463 GCC. If an option is supported by all languages, one needs to
1464 select common class.
1465
1466 common
1467 Display the options that are common to all languages.
1468
1469 These are the supported qualifiers:
1470
1471 undocumented
1472 Display only those options that are undocumented.
1473
1474 joined
1475 Display options taking an argument that appears after an equal
1476 sign in the same continuous piece of text, such as:
1477 --help=target.
1478
1479 separate
1480 Display options taking an argument that appears as a separate
1481 word following the original option, such as: -o output-file.
1482
1483 Thus for example to display all the undocumented target-specific
1484 switches supported by the compiler, use:
1485
1486 --help=target,undocumented
1487
1488 The sense of a qualifier can be inverted by prefixing it with the ^
1489 character, so for example to display all binary warning options
1490 (i.e., ones that are either on or off and that do not take an
1491 argument) that have a description, use:
1492
1493 --help=warnings,^joined,^undocumented
1494
1495 The argument to --help= should not consist solely of inverted
1496 qualifiers.
1497
1498 Combining several classes is possible, although this usually
1499 restricts the output so much that there is nothing to display. One
1500 case where it does work, however, is when one of the classes is
1501 target. For example, to display all the target-specific
1502 optimization options, use:
1503
1504 --help=target,optimizers
1505
1506 The --help= option can be repeated on the command line. Each
1507 successive use displays its requested class of options, skipping
1508 those that have already been displayed. If --help is also
1509 specified anywhere on the command line then this takes precedence
1510 over any --help= option.
1511
1512 If the -Q option appears on the command line before the --help=
1513 option, then the descriptive text displayed by --help= is changed.
1514 Instead of describing the displayed options, an indication is given
1515 as to whether the option is enabled, disabled or set to a specific
1516 value (assuming that the compiler knows this at the point where the
1517 --help= option is used).
1518
1519 Here is a truncated example from the ARM port of gcc:
1520
1521 % gcc -Q -mabi=2 --help=target -c
1522 The following options are target specific:
1523 -mabi= 2
1524 -mabort-on-noreturn [disabled]
1525 -mapcs [disabled]
1526
1527 The output is sensitive to the effects of previous command-line
1528 options, so for example it is possible to find out which
1529 optimizations are enabled at -O2 by using:
1530
1531 -Q -O2 --help=optimizers
1532
1533 Alternatively you can discover which binary optimizations are
1534 enabled by -O3 by using:
1535
1536 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1537 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1538 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1539
1540 --version
1541 Display the version number and copyrights of the invoked GCC.
1542
1543 -pass-exit-codes
1544 Normally the gcc program exits with the code of 1 if any phase of
1545 the compiler returns a non-success return code. If you specify
1546 -pass-exit-codes, the gcc program instead returns with the
1547 numerically highest error produced by any phase returning an error
1548 indication. The C, C++, and Fortran front ends return 4 if an
1549 internal compiler error is encountered.
1550
1551 -pipe
1552 Use pipes rather than temporary files for communication between the
1553 various stages of compilation. This fails to work on some systems
1554 where the assembler is unable to read from a pipe; but the GNU
1555 assembler has no trouble.
1556
1557 -specs=file
1558 Process file after the compiler reads in the standard specs file,
1559 in order to override the defaults which the gcc driver program uses
1560 when determining what switches to pass to cc1, cc1plus, as, ld,
1561 etc. More than one -specs=file can be specified on the command
1562 line, and they are processed in order, from left to right.
1563
1564 -wrapper
1565 Invoke all subcommands under a wrapper program. The name of the
1566 wrapper program and its parameters are passed as a comma separated
1567 list.
1568
1569 gcc -c t.c -wrapper gdb,--args
1570
1571 This invokes all subprograms of gcc under gdb --args, thus the
1572 invocation of cc1 is gdb --args cc1 ....
1573
1574 -ffile-prefix-map=old=new
1575 When compiling files residing in directory old, record any
1576 references to them in the result of the compilation as if the files
1577 resided in directory new instead. Specifying this option is
1578 equivalent to specifying all the individual -f*-prefix-map options.
1579 This can be used to make reproducible builds that are location
1580 independent. See also -fmacro-prefix-map and -fdebug-prefix-map.
1581
1582 -fplugin=name.so
1583 Load the plugin code in file name.so, assumed to be a shared object
1584 to be dlopen'd by the compiler. The base name of the shared object
1585 file is used to identify the plugin for the purposes of argument
1586 parsing (See -fplugin-arg-name-key=value below). Each plugin
1587 should define the callback functions specified in the Plugins API.
1588
1589 -fplugin-arg-name-key=value
1590 Define an argument called key with a value of value for the plugin
1591 called name.
1592
1593 -fdump-ada-spec[-slim]
1594 For C and C++ source and include files, generate corresponding Ada
1595 specs.
1596
1597 -fada-spec-parent=unit
1598 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1599 specs as child units of parent unit.
1600
1601 -fdump-go-spec=file
1602 For input files in any language, generate corresponding Go
1603 declarations in file. This generates Go "const", "type", "var",
1604 and "func" declarations which may be a useful way to start writing
1605 a Go interface to code written in some other language.
1606
1607 @file
1608 Read command-line options from file. The options read are inserted
1609 in place of the original @file option. If file does not exist, or
1610 cannot be read, then the option will be treated literally, and not
1611 removed.
1612
1613 Options in file are separated by whitespace. A whitespace
1614 character may be included in an option by surrounding the entire
1615 option in either single or double quotes. Any character (including
1616 a backslash) may be included by prefixing the character to be
1617 included with a backslash. The file may itself contain additional
1618 @file options; any such options will be processed recursively.
1619
1620 Compiling C++ Programs
1621 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1622 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1623 (for shared template code) .tcc; and preprocessed C++ files use the
1624 suffix .ii. GCC recognizes files with these names and compiles them as
1625 C++ programs even if you call the compiler the same way as for
1626 compiling C programs (usually with the name gcc).
1627
1628 However, the use of gcc does not add the C++ library. g++ is a program
1629 that calls GCC and automatically specifies linking against the C++
1630 library. It treats .c, .h and .i files as C++ source files instead of
1631 C source files unless -x is used. This program is also useful when
1632 precompiling a C header file with a .h extension for use in C++
1633 compilations. On many systems, g++ is also installed with the name
1634 c++.
1635
1636 When you compile C++ programs, you may specify many of the same
1637 command-line options that you use for compiling programs in any
1638 language; or command-line options meaningful for C and related
1639 languages; or options that are meaningful only for C++ programs.
1640
1641 Options Controlling C Dialect
1642 The following options control the dialect of C (or languages derived
1643 from C, such as C++, Objective-C and Objective-C++) that the compiler
1644 accepts:
1645
1646 -ansi
1647 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1648 equivalent to -std=c++98.
1649
1650 This turns off certain features of GCC that are incompatible with
1651 ISO C90 (when compiling C code), or of standard C++ (when compiling
1652 C++ code), such as the "asm" and "typeof" keywords, and predefined
1653 macros such as "unix" and "vax" that identify the type of system
1654 you are using. It also enables the undesirable and rarely used ISO
1655 trigraph feature. For the C compiler, it disables recognition of
1656 C++ style // comments as well as the "inline" keyword.
1657
1658 The alternate keywords "__asm__", "__extension__", "__inline__" and
1659 "__typeof__" continue to work despite -ansi. You would not want to
1660 use them in an ISO C program, of course, but it is useful to put
1661 them in header files that might be included in compilations done
1662 with -ansi. Alternate predefined macros such as "__unix__" and
1663 "__vax__" are also available, with or without -ansi.
1664
1665 The -ansi option does not cause non-ISO programs to be rejected
1666 gratuitously. For that, -Wpedantic is required in addition to
1667 -ansi.
1668
1669 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1670 used. Some header files may notice this macro and refrain from
1671 declaring certain functions or defining certain macros that the ISO
1672 standard doesn't call for; this is to avoid interfering with any
1673 programs that might use these names for other things.
1674
1675 Functions that are normally built in but do not have semantics
1676 defined by ISO C (such as "alloca" and "ffs") are not built-in
1677 functions when -ansi is used.
1678
1679 -std=
1680 Determine the language standard. This option is currently only
1681 supported when compiling C or C++.
1682
1683 The compiler can accept several base standards, such as c90 or
1684 c++98, and GNU dialects of those standards, such as gnu90 or
1685 gnu++98. When a base standard is specified, the compiler accepts
1686 all programs following that standard plus those using GNU
1687 extensions that do not contradict it. For example, -std=c90 turns
1688 off certain features of GCC that are incompatible with ISO C90,
1689 such as the "asm" and "typeof" keywords, but not other GNU
1690 extensions that do not have a meaning in ISO C90, such as omitting
1691 the middle term of a "?:" expression. On the other hand, when a GNU
1692 dialect of a standard is specified, all features supported by the
1693 compiler are enabled, even when those features change the meaning
1694 of the base standard. As a result, some strict-conforming programs
1695 may be rejected. The particular standard is used by -Wpedantic to
1696 identify which features are GNU extensions given that version of
1697 the standard. For example -std=gnu90 -Wpedantic warns about C++
1698 style // comments, while -std=gnu99 -Wpedantic does not.
1699
1700 A value for this option must be provided; possible values are
1701
1702 c90
1703 c89
1704 iso9899:1990
1705 Support all ISO C90 programs (certain GNU extensions that
1706 conflict with ISO C90 are disabled). Same as -ansi for C code.
1707
1708 iso9899:199409
1709 ISO C90 as modified in amendment 1.
1710
1711 c99
1712 c9x
1713 iso9899:1999
1714 iso9899:199x
1715 ISO C99. This standard is substantially completely supported,
1716 modulo bugs and floating-point issues (mainly but not entirely
1717 relating to optional C99 features from Annexes F and G). See
1718 <http://gcc.gnu.org/c99status.html> for more information. The
1719 names c9x and iso9899:199x are deprecated.
1720
1721 c11
1722 c1x
1723 iso9899:2011
1724 ISO C11, the 2011 revision of the ISO C standard. This
1725 standard is substantially completely supported, modulo bugs,
1726 floating-point issues (mainly but not entirely relating to
1727 optional C11 features from Annexes F and G) and the optional
1728 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1729 The name c1x is deprecated.
1730
1731 c17
1732 c18
1733 iso9899:2017
1734 iso9899:2018
1735 ISO C17, the 2017 revision of the ISO C standard (published in
1736 2018). This standard is same as C11 except for corrections of
1737 defects (all of which are also applied with -std=c11) and a new
1738 value of "__STDC_VERSION__", and so is supported to the same
1739 extent as C11.
1740
1741 c2x The next version of the ISO C standard, still under
1742 development. The support for this version is experimental and
1743 incomplete.
1744
1745 gnu90
1746 gnu89
1747 GNU dialect of ISO C90 (including some C99 features).
1748
1749 gnu99
1750 gnu9x
1751 GNU dialect of ISO C99. The name gnu9x is deprecated.
1752
1753 gnu11
1754 gnu1x
1755 GNU dialect of ISO C11. The name gnu1x is deprecated.
1756
1757 gnu17
1758 gnu18
1759 GNU dialect of ISO C17. This is the default for C code.
1760
1761 gnu2x
1762 The next version of the ISO C standard, still under
1763 development, plus GNU extensions. The support for this version
1764 is experimental and incomplete.
1765
1766 c++98
1767 c++03
1768 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1769 and some additional defect reports. Same as -ansi for C++ code.
1770
1771 gnu++98
1772 gnu++03
1773 GNU dialect of -std=c++98.
1774
1775 c++11
1776 c++0x
1777 The 2011 ISO C++ standard plus amendments. The name c++0x is
1778 deprecated.
1779
1780 gnu++11
1781 gnu++0x
1782 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1783
1784 c++14
1785 c++1y
1786 The 2014 ISO C++ standard plus amendments. The name c++1y is
1787 deprecated.
1788
1789 gnu++14
1790 gnu++1y
1791 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1792
1793 c++17
1794 c++1z
1795 The 2017 ISO C++ standard plus amendments. The name c++1z is
1796 deprecated.
1797
1798 gnu++17
1799 gnu++1z
1800 GNU dialect of -std=c++17. This is the default for C++ code.
1801 The name gnu++1z is deprecated.
1802
1803 c++20
1804 c++2a
1805 The 2020 ISO C++ standard plus amendments. Support is
1806 experimental, and could change in incompatible ways in future
1807 releases. The name c++2a is deprecated.
1808
1809 gnu++20
1810 gnu++2a
1811 GNU dialect of -std=c++20. Support is experimental, and could
1812 change in incompatible ways in future releases. The name
1813 gnu++2a is deprecated.
1814
1815 c++2b
1816 c++23
1817 The next revision of the ISO C++ standard, planned for 2023.
1818 Support is highly experimental, and will almost certainly
1819 change in incompatible ways in future releases.
1820
1821 gnu++2b
1822 gnu++23
1823 GNU dialect of -std=c++2b. Support is highly experimental, and
1824 will almost certainly change in incompatible ways in future
1825 releases.
1826
1827 -fgnu89-inline
1828 The option -fgnu89-inline tells GCC to use the traditional GNU
1829 semantics for "inline" functions when in C99 mode.
1830
1831 Using this option is roughly equivalent to adding the "gnu_inline"
1832 function attribute to all inline functions.
1833
1834 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1835 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1836 specifies the default behavior). This option is not supported in
1837 -std=c90 or -std=gnu90 mode.
1838
1839 The preprocessor macros "__GNUC_GNU_INLINE__" and
1840 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1841 effect for "inline" functions.
1842
1843 -fpermitted-flt-eval-methods=style
1844 ISO/IEC TS 18661-3 defines new permissible values for
1845 "FLT_EVAL_METHOD" that indicate that operations and constants with
1846 a semantic type that is an interchange or extended format should be
1847 evaluated to the precision and range of that type. These new
1848 values are a superset of those permitted under C99/C11, which does
1849 not specify the meaning of other positive values of
1850 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
1851 been written expecting the possibility of the new values.
1852
1853 -fpermitted-flt-eval-methods specifies whether the compiler should
1854 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
1855 the extended set of values specified in ISO/IEC TS 18661-3.
1856
1857 style is either "c11" or "ts-18661-3" as appropriate.
1858
1859 The default when in a standards compliant mode (-std=c11 or
1860 similar) is -fpermitted-flt-eval-methods=c11. The default when in
1861 a GNU dialect (-std=gnu11 or similar) is
1862 -fpermitted-flt-eval-methods=ts-18661-3.
1863
1864 -aux-info filename
1865 Output to the given filename prototyped declarations for all
1866 functions declared and/or defined in a translation unit, including
1867 those in header files. This option is silently ignored in any
1868 language other than C.
1869
1870 Besides declarations, the file indicates, in comments, the origin
1871 of each declaration (source file and line), whether the declaration
1872 was implicit, prototyped or unprototyped (I, N for new or O for
1873 old, respectively, in the first character after the line number and
1874 the colon), and whether it came from a declaration or a definition
1875 (C or F, respectively, in the following character). In the case of
1876 function definitions, a K&R-style list of arguments followed by
1877 their declarations is also provided, inside comments, after the
1878 declaration.
1879
1880 -fallow-parameterless-variadic-functions
1881 Accept variadic functions without named parameters.
1882
1883 Although it is possible to define such a function, this is not very
1884 useful as it is not possible to read the arguments. This is only
1885 supported for C as this construct is allowed by C++.
1886
1887 -fno-asm
1888 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1889 code can use these words as identifiers. You can use the keywords
1890 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
1891 -fno-asm.
1892
1893 In C++, this switch only affects the "typeof" keyword, since "asm"
1894 and "inline" are standard keywords. You may want to use the
1895 -fno-gnu-keywords flag instead, which has the same effect. In C99
1896 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
1897 and "typeof" keywords, since "inline" is a standard keyword in ISO
1898 C99.
1899
1900 -fno-builtin
1901 -fno-builtin-function
1902 Don't recognize built-in functions that do not begin with
1903 __builtin_ as prefix.
1904
1905 GCC normally generates special code to handle certain built-in
1906 functions more efficiently; for instance, calls to "alloca" may
1907 become single instructions which adjust the stack directly, and
1908 calls to "memcpy" may become inline copy loops. The resulting code
1909 is often both smaller and faster, but since the function calls no
1910 longer appear as such, you cannot set a breakpoint on those calls,
1911 nor can you change the behavior of the functions by linking with a
1912 different library. In addition, when a function is recognized as a
1913 built-in function, GCC may use information about that function to
1914 warn about problems with calls to that function, or to generate
1915 more efficient code, even if the resulting code still contains
1916 calls to that function. For example, warnings are given with
1917 -Wformat for bad calls to "printf" when "printf" is built in and
1918 "strlen" is known not to modify global memory.
1919
1920 With the -fno-builtin-function option only the built-in function
1921 function is disabled. function must not begin with __builtin_. If
1922 a function is named that is not built-in in this version of GCC,
1923 this option is ignored. There is no corresponding
1924 -fbuiltin-function option; if you wish to enable built-in functions
1925 selectively when using -fno-builtin or -ffreestanding, you may
1926 define macros such as:
1927
1928 #define abs(n) __builtin_abs ((n))
1929 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1930
1931 -fgimple
1932 Enable parsing of function definitions marked with "__GIMPLE".
1933 This is an experimental feature that allows unit testing of GIMPLE
1934 passes.
1935
1936 -fhosted
1937 Assert that compilation targets a hosted environment. This implies
1938 -fbuiltin. A hosted environment is one in which the entire
1939 standard library is available, and in which "main" has a return
1940 type of "int". Examples are nearly everything except a kernel.
1941 This is equivalent to -fno-freestanding.
1942
1943 -ffreestanding
1944 Assert that compilation targets a freestanding environment. This
1945 implies -fno-builtin. A freestanding environment is one in which
1946 the standard library may not exist, and program startup may not
1947 necessarily be at "main". The most obvious example is an OS
1948 kernel. This is equivalent to -fno-hosted.
1949
1950 -fopenacc
1951 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
1952 "!$acc" in Fortran. When -fopenacc is specified, the compiler
1953 generates accelerated code according to the OpenACC Application
1954 Programming Interface v2.6 <https://www.openacc.org>. This option
1955 implies -pthread, and thus is only supported on targets that have
1956 support for -pthread.
1957
1958 -fopenacc-dim=geom
1959 Specify default compute dimensions for parallel offload regions
1960 that do not explicitly specify. The geom value is a triple of
1961 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
1962 size can be omitted, to use a target-specific default value.
1963
1964 -fopenmp
1965 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
1966 "!$omp" in Fortran. When -fopenmp is specified, the compiler
1967 generates parallel code according to the OpenMP Application Program
1968 Interface v4.5 <https://www.openmp.org>. This option implies
1969 -pthread, and thus is only supported on targets that have support
1970 for -pthread. -fopenmp implies -fopenmp-simd.
1971
1972 -fopenmp-simd
1973 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
1974 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
1975
1976 -fgnu-tm
1977 When the option -fgnu-tm is specified, the compiler generates code
1978 for the Linux variant of Intel's current Transactional Memory ABI
1979 specification document (Revision 1.1, May 6 2009). This is an
1980 experimental feature whose interface may change in future versions
1981 of GCC, as the official specification changes. Please note that
1982 not all architectures are supported for this feature.
1983
1984 For more information on GCC's support for transactional memory,
1985
1986 Note that the transactional memory feature is not supported with
1987 non-call exceptions (-fnon-call-exceptions).
1988
1989 -fms-extensions
1990 Accept some non-standard constructs used in Microsoft header files.
1991
1992 In C++ code, this allows member names in structures to be similar
1993 to previous types declarations.
1994
1995 typedef int UOW;
1996 struct ABC {
1997 UOW UOW;
1998 };
1999
2000 Some cases of unnamed fields in structures and unions are only
2001 accepted with this option.
2002
2003 Note that this option is off for all targets except for x86 targets
2004 using ms-abi.
2005
2006 -fplan9-extensions
2007 Accept some non-standard constructs used in Plan 9 code.
2008
2009 This enables -fms-extensions, permits passing pointers to
2010 structures with anonymous fields to functions that expect pointers
2011 to elements of the type of the field, and permits referring to
2012 anonymous fields declared using a typedef. This is only
2013 supported for C, not C++.
2014
2015 -fcond-mismatch
2016 Allow conditional expressions with mismatched types in the second
2017 and third arguments. The value of such an expression is void.
2018 This option is not supported for C++.
2019
2020 -flax-vector-conversions
2021 Allow implicit conversions between vectors with differing numbers
2022 of elements and/or incompatible element types. This option should
2023 not be used for new code.
2024
2025 -funsigned-char
2026 Let the type "char" be unsigned, like "unsigned char".
2027
2028 Each kind of machine has a default for what "char" should be. It
2029 is either like "unsigned char" by default or like "signed char" by
2030 default.
2031
2032 Ideally, a portable program should always use "signed char" or
2033 "unsigned char" when it depends on the signedness of an object.
2034 But many programs have been written to use plain "char" and expect
2035 it to be signed, or expect it to be unsigned, depending on the
2036 machines they were written for. This option, and its inverse, let
2037 you make such a program work with the opposite default.
2038
2039 The type "char" is always a distinct type from each of "signed
2040 char" or "unsigned char", even though its behavior is always just
2041 like one of those two.
2042
2043 -fsigned-char
2044 Let the type "char" be signed, like "signed char".
2045
2046 Note that this is equivalent to -fno-unsigned-char, which is the
2047 negative form of -funsigned-char. Likewise, the option
2048 -fno-signed-char is equivalent to -funsigned-char.
2049
2050 -fsigned-bitfields
2051 -funsigned-bitfields
2052 -fno-signed-bitfields
2053 -fno-unsigned-bitfields
2054 These options control whether a bit-field is signed or unsigned,
2055 when the declaration does not use either "signed" or "unsigned".
2056 By default, such a bit-field is signed, because this is consistent:
2057 the basic integer types such as "int" are signed types.
2058
2059 -fsso-struct=endianness
2060 Set the default scalar storage order of structures and unions to
2061 the specified endianness. The accepted values are big-endian,
2062 little-endian and native for the native endianness of the target
2063 (the default). This option is not supported for C++.
2064
2065 Warning: the -fsso-struct switch causes GCC to generate code that
2066 is not binary compatible with code generated without it if the
2067 specified endianness is not the native endianness of the target.
2068
2069 Options Controlling C++ Dialect
2070 This section describes the command-line options that are only
2071 meaningful for C++ programs. You can also use most of the GNU compiler
2072 options regardless of what language your program is in. For example,
2073 you might compile a file firstClass.C like this:
2074
2075 g++ -g -fstrict-enums -O -c firstClass.C
2076
2077 In this example, only -fstrict-enums is an option meant only for C++
2078 programs; you can use the other options with any language supported by
2079 GCC.
2080
2081 Some options for compiling C programs, such as -std, are also relevant
2082 for C++ programs.
2083
2084 Here is a list of options that are only for compiling C++ programs:
2085
2086 -fabi-version=n
2087 Use version n of the C++ ABI. The default is version 0.
2088
2089 Version 0 refers to the version conforming most closely to the C++
2090 ABI specification. Therefore, the ABI obtained using version 0
2091 will change in different versions of G++ as ABI bugs are fixed.
2092
2093 Version 1 is the version of the C++ ABI that first appeared in G++
2094 3.2.
2095
2096 Version 2 is the version of the C++ ABI that first appeared in G++
2097 3.4, and was the default through G++ 4.9.
2098
2099 Version 3 corrects an error in mangling a constant address as a
2100 template argument.
2101
2102 Version 4, which first appeared in G++ 4.5, implements a standard
2103 mangling for vector types.
2104
2105 Version 5, which first appeared in G++ 4.6, corrects the mangling
2106 of attribute const/volatile on function pointer types, decltype of
2107 a plain decl, and use of a function parameter in the declaration of
2108 another parameter.
2109
2110 Version 6, which first appeared in G++ 4.7, corrects the promotion
2111 behavior of C++11 scoped enums and the mangling of template
2112 argument packs, const/static_cast, prefix ++ and --, and a class
2113 scope function used as a template argument.
2114
2115 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2116 as a builtin type and corrects the mangling of lambdas in default
2117 argument scope.
2118
2119 Version 8, which first appeared in G++ 4.9, corrects the
2120 substitution behavior of function types with function-cv-
2121 qualifiers.
2122
2123 Version 9, which first appeared in G++ 5.2, corrects the alignment
2124 of "nullptr_t".
2125
2126 Version 10, which first appeared in G++ 6.1, adds mangling of
2127 attributes that affect type identity, such as ia32 calling
2128 convention attributes (e.g. stdcall).
2129
2130 Version 11, which first appeared in G++ 7, corrects the mangling of
2131 sizeof... expressions and operator names. For multiple entities
2132 with the same name within a function, that are declared in
2133 different scopes, the mangling now changes starting with the
2134 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2135
2136 Version 12, which first appeared in G++ 8, corrects the calling
2137 conventions for empty classes on the x86_64 target and for classes
2138 with only deleted copy/move constructors. It accidentally changes
2139 the calling convention for classes with a deleted copy constructor
2140 and a trivial move constructor.
2141
2142 Version 13, which first appeared in G++ 8.2, fixes the accidental
2143 change in version 12.
2144
2145 Version 14, which first appeared in G++ 10, corrects the mangling
2146 of the nullptr expression.
2147
2148 Version 15, which first appeared in G++ 11, changes the mangling of
2149 "__alignof__" to be distinct from that of "alignof", and dependent
2150 operator names.
2151
2152 See also -Wabi.
2153
2154 -fabi-compat-version=n
2155 On targets that support strong aliases, G++ works around mangling
2156 changes by creating an alias with the correct mangled name when
2157 defining a symbol with an incorrect mangled name. This switch
2158 specifies which ABI version to use for the alias.
2159
2160 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
2161 compatibility). If another ABI version is explicitly selected,
2162 this defaults to 0. For compatibility with GCC versions 3.2
2163 through 4.9, use -fabi-compat-version=2.
2164
2165 If this option is not provided but -Wabi=n is, that version is used
2166 for compatibility aliases. If this option is provided along with
2167 -Wabi (without the version), the version from this option is used
2168 for the warning.
2169
2170 -fno-access-control
2171 Turn off all access checking. This switch is mainly useful for
2172 working around bugs in the access control code.
2173
2174 -faligned-new
2175 Enable support for C++17 "new" of types that require more alignment
2176 than "void* ::operator new(std::size_t)" provides. A numeric
2177 argument such as "-faligned-new=32" can be used to specify how much
2178 alignment (in bytes) is provided by that function, but few users
2179 will need to override the default of "alignof(std::max_align_t)".
2180
2181 This flag is enabled by default for -std=c++17.
2182
2183 -fchar8_t
2184 -fno-char8_t
2185 Enable support for "char8_t" as adopted for C++20. This includes
2186 the addition of a new "char8_t" fundamental type, changes to the
2187 types of UTF-8 string and character literals, new signatures for
2188 user-defined literals, associated standard library updates, and new
2189 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2190
2191 This option enables functions to be overloaded for ordinary and
2192 UTF-8 strings:
2193
2194 int f(const char *); // #1
2195 int f(const char8_t *); // #2
2196 int v1 = f("text"); // Calls #1
2197 int v2 = f(u8"text"); // Calls #2
2198
2199 and introduces new signatures for user-defined literals:
2200
2201 int operator""_udl1(char8_t);
2202 int v3 = u8'x'_udl1;
2203 int operator""_udl2(const char8_t*, std::size_t);
2204 int v4 = u8"text"_udl2;
2205 template<typename T, T...> int operator""_udl3();
2206 int v5 = u8"text"_udl3;
2207
2208 The change to the types of UTF-8 string and character literals
2209 introduces incompatibilities with ISO C++11 and later standards.
2210 For example, the following code is well-formed under ISO C++11, but
2211 is ill-formed when -fchar8_t is specified.
2212
2213 char ca[] = u8"xx"; // error: char-array initialized from wide
2214 // string
2215 const char *cp = u8"xx";// error: invalid conversion from
2216 // `const char8_t*' to `const char*'
2217 int f(const char*);
2218 auto v = f(u8"xx"); // error: invalid conversion from
2219 // `const char8_t*' to `const char*'
2220 std::string s{u8"xx"}; // error: no matching function for call to
2221 // `std::basic_string<char>::basic_string()'
2222 using namespace std::literals;
2223 s = u8"xx"s; // error: conversion from
2224 // `basic_string<char8_t>' to non-scalar
2225 // type `basic_string<char>' requested
2226
2227 -fcheck-new
2228 Check that the pointer returned by "operator new" is non-null
2229 before attempting to modify the storage allocated. This check is
2230 normally unnecessary because the C++ standard specifies that
2231 "operator new" only returns 0 if it is declared "throw()", in which
2232 case the compiler always checks the return value even without this
2233 option. In all other cases, when "operator new" has a non-empty
2234 exception specification, memory exhaustion is signalled by throwing
2235 "std::bad_alloc". See also new (nothrow).
2236
2237 -fconcepts
2238 -fconcepts-ts
2239 Below -std=c++20, -fconcepts enables support for the C++ Extensions
2240 for Concepts Technical Specification, ISO 19217 (2015).
2241
2242 With -std=c++20 and above, Concepts are part of the language
2243 standard, so -fconcepts defaults to on. But the standard
2244 specification of Concepts differs significantly from the TS, so
2245 some constructs that were allowed in the TS but didn't make it into
2246 the standard can still be enabled by -fconcepts-ts.
2247
2248 -fconstexpr-depth=n
2249 Set the maximum nested evaluation depth for C++11 constexpr
2250 functions to n. A limit is needed to detect endless recursion
2251 during constant expression evaluation. The minimum specified by
2252 the standard is 512.
2253
2254 -fconstexpr-cache-depth=n
2255 Set the maximum level of nested evaluation depth for C++11
2256 constexpr functions that will be cached to n. This is a heuristic
2257 that trades off compilation speed (when the cache avoids repeated
2258 calculations) against memory consumption (when the cache grows very
2259 large from highly recursive evaluations). The default is 8. Very
2260 few users are likely to want to adjust it, but if your code does
2261 heavy constexpr calculations you might want to experiment to find
2262 which value works best for you.
2263
2264 -fconstexpr-loop-limit=n
2265 Set the maximum number of iterations for a loop in C++14 constexpr
2266 functions to n. A limit is needed to detect infinite loops during
2267 constant expression evaluation. The default is 262144 (1<<18).
2268
2269 -fconstexpr-ops-limit=n
2270 Set the maximum number of operations during a single constexpr
2271 evaluation. Even when number of iterations of a single loop is
2272 limited with the above limit, if there are several nested loops and
2273 each of them has many iterations but still smaller than the above
2274 limit, or if in a body of some loop or even outside of a loop too
2275 many expressions need to be evaluated, the resulting constexpr
2276 evaluation might take too long. The default is 33554432 (1<<25).
2277
2278 -fcoroutines
2279 Enable support for the C++ coroutines extension (experimental).
2280
2281 -fno-elide-constructors
2282 The C++ standard allows an implementation to omit creating a
2283 temporary that is only used to initialize another object of the
2284 same type. Specifying this option disables that optimization, and
2285 forces G++ to call the copy constructor in all cases. This option
2286 also causes G++ to call trivial member functions which otherwise
2287 would be expanded inline.
2288
2289 In C++17, the compiler is required to omit these temporaries, but
2290 this option still affects trivial member functions.
2291
2292 -fno-enforce-eh-specs
2293 Don't generate code to check for violation of exception
2294 specifications at run time. This option violates the C++ standard,
2295 but may be useful for reducing code size in production builds, much
2296 like defining "NDEBUG". This does not give user code permission to
2297 throw exceptions in violation of the exception specifications; the
2298 compiler still optimizes based on the specifications, so throwing
2299 an unexpected exception results in undefined behavior at run time.
2300
2301 -fextern-tls-init
2302 -fno-extern-tls-init
2303 The C++11 and OpenMP standards allow "thread_local" and
2304 "threadprivate" variables to have dynamic (runtime) initialization.
2305 To support this, any use of such a variable goes through a wrapper
2306 function that performs any necessary initialization. When the use
2307 and definition of the variable are in the same translation unit,
2308 this overhead can be optimized away, but when the use is in a
2309 different translation unit there is significant overhead even if
2310 the variable doesn't actually need dynamic initialization. If the
2311 programmer can be sure that no use of the variable in a non-
2312 defining TU needs to trigger dynamic initialization (either because
2313 the variable is statically initialized, or a use of the variable in
2314 the defining TU will be executed before any uses in another TU),
2315 they can avoid this overhead with the -fno-extern-tls-init option.
2316
2317 On targets that support symbol aliases, the default is
2318 -fextern-tls-init. On targets that do not support symbol aliases,
2319 the default is -fno-extern-tls-init.
2320
2321 -fno-gnu-keywords
2322 Do not recognize "typeof" as a keyword, so that code can use this
2323 word as an identifier. You can use the keyword "__typeof__"
2324 instead. This option is implied by the strict ISO C++ dialects:
2325 -ansi, -std=c++98, -std=c++11, etc.
2326
2327 -fno-implicit-templates
2328 Never emit code for non-inline templates that are instantiated
2329 implicitly (i.e. by use); only emit code for explicit
2330 instantiations. If you use this option, you must take care to
2331 structure your code to include all the necessary explicit
2332 instantiations to avoid getting undefined symbols at link time.
2333
2334 -fno-implicit-inline-templates
2335 Don't emit code for implicit instantiations of inline templates,
2336 either. The default is to handle inlines differently so that
2337 compiles with and without optimization need the same set of
2338 explicit instantiations.
2339
2340 -fno-implement-inlines
2341 To save space, do not emit out-of-line copies of inline functions
2342 controlled by "#pragma implementation". This causes linker errors
2343 if these functions are not inlined everywhere they are called.
2344
2345 -fmodules-ts
2346 -fno-modules-ts
2347 Enable support for C++20 modules The -fno-modules-ts is usually
2348 not needed, as that is the default. Even though this is a C++20
2349 feature, it is not currently implicitly enabled by selecting that
2350 standard version.
2351
2352 -fmodule-header
2353 -fmodule-header=user
2354 -fmodule-header=system
2355 Compile a header file to create an importable header unit.
2356
2357 -fmodule-implicit-inline
2358 Member functions defined in their class definitions are not
2359 implicitly inline for modular code. This is different to
2360 traditional C++ behavior, for good reasons. However, it may result
2361 in a difficulty during code porting. This option makes such
2362 function definitions implicitly inline. It does however generate
2363 an ABI incompatibility, so you must use it everywhere or nowhere.
2364 (Such definitions outside of a named module remain implicitly
2365 inline, regardless.)
2366
2367 -fno-module-lazy
2368 Disable lazy module importing and module mapper creation.
2369
2370 -fmodule-mapper=[hostname]:port[?ident]
2371 -fmodule-mapper=|program[?ident] args...
2372 -fmodule-mapper==socket[?ident]
2373 -fmodule-mapper=<>[inout][?ident]
2374 -fmodule-mapper=<in>out[?ident]
2375 -fmodule-mapper=file[?ident]
2376 An oracle to query for module name to filename mappings. If
2377 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2378 if that is unset, an in-process default is provided.
2379
2380 -fmodule-only
2381 Only emit the Compiled Module Interface, inhibiting any object
2382 file.
2383
2384 -fms-extensions
2385 Disable Wpedantic warnings about constructs used in MFC, such as
2386 implicit int and getting a pointer to member function via non-
2387 standard syntax.
2388
2389 -fnew-inheriting-ctors
2390 Enable the P0136 adjustment to the semantics of C++11 constructor
2391 inheritance. This is part of C++17 but also considered to be a
2392 Defect Report against C++11 and C++14. This flag is enabled by
2393 default unless -fabi-version=10 or lower is specified.
2394
2395 -fnew-ttp-matching
2396 Enable the P0522 resolution to Core issue 150, template template
2397 parameters and default arguments: this allows a template with
2398 default template arguments as an argument for a template template
2399 parameter with fewer template parameters. This flag is enabled by
2400 default for -std=c++17.
2401
2402 -fno-nonansi-builtins
2403 Disable built-in declarations of functions that are not mandated by
2404 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2405 "bzero", "conjf", and other related functions.
2406
2407 -fnothrow-opt
2408 Treat a "throw()" exception specification as if it were a
2409 "noexcept" specification to reduce or eliminate the text size
2410 overhead relative to a function with no exception specification.
2411 If the function has local variables of types with non-trivial
2412 destructors, the exception specification actually makes the
2413 function smaller because the EH cleanups for those variables can be
2414 optimized away. The semantic effect is that an exception thrown
2415 out of a function with such an exception specification results in a
2416 call to "terminate" rather than "unexpected".
2417
2418 -fno-operator-names
2419 Do not treat the operator name keywords "and", "bitand", "bitor",
2420 "compl", "not", "or" and "xor" as synonyms as keywords.
2421
2422 -fno-optional-diags
2423 Disable diagnostics that the standard says a compiler does not need
2424 to issue. Currently, the only such diagnostic issued by G++ is the
2425 one for a name having multiple meanings within a class.
2426
2427 -fpermissive
2428 Downgrade some diagnostics about nonconformant code from errors to
2429 warnings. Thus, using -fpermissive allows some nonconforming code
2430 to compile.
2431
2432 -fno-pretty-templates
2433 When an error message refers to a specialization of a function
2434 template, the compiler normally prints the signature of the
2435 template followed by the template arguments and any typedefs or
2436 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2437 than "void f(int)") so that it's clear which template is involved.
2438 When an error message refers to a specialization of a class
2439 template, the compiler omits any template arguments that match the
2440 default template arguments for that template. If either of these
2441 behaviors make it harder to understand the error message rather
2442 than easier, you can use -fno-pretty-templates to disable them.
2443
2444 -fno-rtti
2445 Disable generation of information about every class with virtual
2446 functions for use by the C++ run-time type identification features
2447 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2448 language, you can save some space by using this flag. Note that
2449 exception handling uses the same information, but G++ generates it
2450 as needed. The "dynamic_cast" operator can still be used for casts
2451 that do not require run-time type information, i.e. casts to "void
2452 *" or to unambiguous base classes.
2453
2454 Mixing code compiled with -frtti with that compiled with -fno-rtti
2455 may not work. For example, programs may fail to link if a class
2456 compiled with -fno-rtti is used as a base for a class compiled with
2457 -frtti.
2458
2459 -fsized-deallocation
2460 Enable the built-in global declarations
2461
2462 void operator delete (void *, std::size_t) noexcept;
2463 void operator delete[] (void *, std::size_t) noexcept;
2464
2465 as introduced in C++14. This is useful for user-defined
2466 replacement deallocation functions that, for example, use the size
2467 of the object to make deallocation faster. Enabled by default
2468 under -std=c++14 and above. The flag -Wsized-deallocation warns
2469 about places that might want to add a definition.
2470
2471 -fstrict-enums
2472 Allow the compiler to optimize using the assumption that a value of
2473 enumerated type can only be one of the values of the enumeration
2474 (as defined in the C++ standard; basically, a value that can be
2475 represented in the minimum number of bits needed to represent all
2476 the enumerators). This assumption may not be valid if the program
2477 uses a cast to convert an arbitrary integer value to the enumerated
2478 type.
2479
2480 -fstrong-eval-order
2481 Evaluate member access, array subscripting, and shift expressions
2482 in left-to-right order, and evaluate assignment in right-to-left
2483 order, as adopted for C++17. Enabled by default with -std=c++17.
2484 -fstrong-eval-order=some enables just the ordering of member access
2485 and shift expressions, and is the default without -std=c++17.
2486
2487 -ftemplate-backtrace-limit=n
2488 Set the maximum number of template instantiation notes for a single
2489 warning or error to n. The default value is 10.
2490
2491 -ftemplate-depth=n
2492 Set the maximum instantiation depth for template classes to n. A
2493 limit on the template instantiation depth is needed to detect
2494 endless recursions during template class instantiation. ANSI/ISO
2495 C++ conforming programs must not rely on a maximum depth greater
2496 than 17 (changed to 1024 in C++11). The default value is 900, as
2497 the compiler can run out of stack space before hitting 1024 in some
2498 situations.
2499
2500 -fno-threadsafe-statics
2501 Do not emit the extra code to use the routines specified in the C++
2502 ABI for thread-safe initialization of local statics. You can use
2503 this option to reduce code size slightly in code that doesn't need
2504 to be thread-safe.
2505
2506 -fuse-cxa-atexit
2507 Register destructors for objects with static storage duration with
2508 the "__cxa_atexit" function rather than the "atexit" function.
2509 This option is required for fully standards-compliant handling of
2510 static destructors, but only works if your C library supports
2511 "__cxa_atexit".
2512
2513 -fno-use-cxa-get-exception-ptr
2514 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2515 causes "std::uncaught_exception" to be incorrect, but is necessary
2516 if the runtime routine is not available.
2517
2518 -fvisibility-inlines-hidden
2519 This switch declares that the user does not attempt to compare
2520 pointers to inline functions or methods where the addresses of the
2521 two functions are taken in different shared objects.
2522
2523 The effect of this is that GCC may, effectively, mark inline
2524 methods with "__attribute__ ((visibility ("hidden")))" so that they
2525 do not appear in the export table of a DSO and do not require a PLT
2526 indirection when used within the DSO. Enabling this option can
2527 have a dramatic effect on load and link times of a DSO as it
2528 massively reduces the size of the dynamic export table when the
2529 library makes heavy use of templates.
2530
2531 The behavior of this switch is not quite the same as marking the
2532 methods as hidden directly, because it does not affect static
2533 variables local to the function or cause the compiler to deduce
2534 that the function is defined in only one shared object.
2535
2536 You may mark a method as having a visibility explicitly to negate
2537 the effect of the switch for that method. For example, if you do
2538 want to compare pointers to a particular inline method, you might
2539 mark it as having default visibility. Marking the enclosing class
2540 with explicit visibility has no effect.
2541
2542 Explicitly instantiated inline methods are unaffected by this
2543 option as their linkage might otherwise cross a shared library
2544 boundary.
2545
2546 -fvisibility-ms-compat
2547 This flag attempts to use visibility settings to make GCC's C++
2548 linkage model compatible with that of Microsoft Visual Studio.
2549
2550 The flag makes these changes to GCC's linkage model:
2551
2552 1. It sets the default visibility to "hidden", like
2553 -fvisibility=hidden.
2554
2555 2. Types, but not their members, are not hidden by default.
2556
2557 3. The One Definition Rule is relaxed for types without explicit
2558 visibility specifications that are defined in more than one
2559 shared object: those declarations are permitted if they are
2560 permitted when this option is not used.
2561
2562 In new code it is better to use -fvisibility=hidden and export
2563 those classes that are intended to be externally visible.
2564 Unfortunately it is possible for code to rely, perhaps
2565 accidentally, on the Visual Studio behavior.
2566
2567 Among the consequences of these changes are that static data
2568 members of the same type with the same name but defined in
2569 different shared objects are different, so changing one does not
2570 change the other; and that pointers to function members defined in
2571 different shared objects may not compare equal. When this flag is
2572 given, it is a violation of the ODR to define types with the same
2573 name differently.
2574
2575 -fno-weak
2576 Do not use weak symbol support, even if it is provided by the
2577 linker. By default, G++ uses weak symbols if they are available.
2578 This option exists only for testing, and should not be used by end-
2579 users; it results in inferior code and has no benefits. This
2580 option may be removed in a future release of G++.
2581
2582 -fext-numeric-literals (C++ and Objective-C++ only)
2583 Accept imaginary, fixed-point, or machine-defined literal number
2584 suffixes as GNU extensions. When this option is turned off these
2585 suffixes are treated as C++11 user-defined literal numeric
2586 suffixes. This is on by default for all pre-C++11 dialects and all
2587 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2588 This option is off by default for ISO C++11 onwards (-std=c++11,
2589 ...).
2590
2591 -nostdinc++
2592 Do not search for header files in the standard directories specific
2593 to C++, but do still search the other standard directories. (This
2594 option is used when building the C++ library.)
2595
2596 -flang-info-include-translate
2597 -flang-info-include-translate-not
2598 -flang-info-include-translate=header
2599 Inform of include translation events. The first will note accepted
2600 include translations, the second will note declined include
2601 translations. The header form will inform of include translations
2602 relating to that specific header. If header is of the form "user"
2603 or "<system>" it will be resolved to a specific user or system
2604 header using the include path.
2605
2606 -flang-info-module-cmi
2607 -flang-info-module-cmi=module
2608 Inform of Compiled Module Interface pathnames. The first will note
2609 all read CMI pathnames. The module form will not reading a
2610 specific module's CMI. module may be a named module or a header-
2611 unit (the latter indicated by either being a pathname containing
2612 directory separators or enclosed in "<>" or "").
2613
2614 -stdlib=libstdc++,libc++
2615 When G++ is configured to support this option, it allows
2616 specification of alternate C++ runtime libraries. Two options are
2617 available: libstdc++ (the default, native C++ runtime for G++) and
2618 libc++ which is the C++ runtime installed on some operating systems
2619 (e.g. Darwin versions from Darwin11 onwards). The option switches
2620 G++ to use the headers from the specified library and to emit
2621 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2622 for linking.
2623
2624 In addition, these warning options have meanings only for C++ programs:
2625
2626 -Wabi-tag (C++ and Objective-C++ only)
2627 Warn when a type with an ABI tag is used in a context that does not
2628 have that ABI tag. See C++ Attributes for more information about
2629 ABI tags.
2630
2631 -Wcomma-subscript (C++ and Objective-C++ only)
2632 Warn about uses of a comma expression within a subscripting
2633 expression. This usage was deprecated in C++20. However, a comma
2634 expression wrapped in "( )" is not deprecated. Example:
2635
2636 void f(int *a, int b, int c) {
2637 a[b,c]; // deprecated
2638 a[(b,c)]; // OK
2639 }
2640
2641 Enabled by default with -std=c++20.
2642
2643 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2644 Warn when performing class template argument deduction (CTAD) on a
2645 type with no explicitly written deduction guides. This warning
2646 will point out cases where CTAD succeeded only because the compiler
2647 synthesized the implicit deduction guides, which might not be what
2648 the programmer intended. Certain style guides allow CTAD only on
2649 types that specifically "opt-in"; i.e., on types that are designed
2650 to support CTAD. This warning can be suppressed with the following
2651 pattern:
2652
2653 struct allow_ctad_t; // any name works
2654 template <typename T> struct S {
2655 S(T) { }
2656 };
2657 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
2658
2659 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2660 Warn when a class seems unusable because all the constructors or
2661 destructors in that class are private, and it has neither friends
2662 nor public static member functions. Also warn if there are no non-
2663 private methods, and there's at least one private member function
2664 that isn't a constructor or destructor.
2665
2666 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2667 Warn when "delete" is used to destroy an instance of a class that
2668 has virtual functions and non-virtual destructor. It is unsafe to
2669 delete an instance of a derived class through a pointer to a base
2670 class if the base class does not have a virtual destructor. This
2671 warning is enabled by -Wall.
2672
2673 -Wdeprecated-copy (C++ and Objective-C++ only)
2674 Warn that the implicit declaration of a copy constructor or copy
2675 assignment operator is deprecated if the class has a user-provided
2676 copy constructor or copy assignment operator, in C++11 and up.
2677 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2678 also deprecate if the class has a user-provided destructor.
2679
2680 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2681 Disable the warning about the case when the usual arithmetic
2682 conversions are applied on operands where one is of enumeration
2683 type and the other is of a different enumeration type. This
2684 conversion was deprecated in C++20. For example:
2685
2686 enum E1 { e };
2687 enum E2 { f };
2688 int k = f - e;
2689
2690 -Wdeprecated-enum-enum-conversion is enabled by default with
2691 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2692 -Wenum-conversion.
2693
2694 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2695 Disable the warning about the case when the usual arithmetic
2696 conversions are applied on operands where one is of enumeration
2697 type and the other is of a floating-point type. This conversion
2698 was deprecated in C++20. For example:
2699
2700 enum E1 { e };
2701 enum E2 { f };
2702 bool b = e <= 3.7;
2703
2704 -Wdeprecated-enum-float-conversion is enabled by default with
2705 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2706 -Wenum-conversion.
2707
2708 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2709 Do not warn about uses of "std::initializer_list" that are likely
2710 to result in dangling pointers. Since the underlying array for an
2711 "initializer_list" is handled like a normal C++ temporary object,
2712 it is easy to inadvertently keep a pointer to the array past the
2713 end of the array's lifetime. For example:
2714
2715 * If a function returns a temporary "initializer_list", or a
2716 local "initializer_list" variable, the array's lifetime ends at
2717 the end of the return statement, so the value returned has a
2718 dangling pointer.
2719
2720 * If a new-expression creates an "initializer_list", the array
2721 only lives until the end of the enclosing full-expression, so
2722 the "initializer_list" in the heap has a dangling pointer.
2723
2724 * When an "initializer_list" variable is assigned from a brace-
2725 enclosed initializer list, the temporary array created for the
2726 right side of the assignment only lives until the end of the
2727 full-expression, so at the next statement the
2728 "initializer_list" variable has a dangling pointer.
2729
2730 // li's initial underlying array lives as long as li
2731 std::initializer_list<int> li = { 1,2,3 };
2732 // assignment changes li to point to a temporary array
2733 li = { 4, 5 };
2734 // now the temporary is gone and li has a dangling pointer
2735 int i = li.begin()[0] // undefined behavior
2736
2737 * When a list constructor stores the "begin" pointer from the
2738 "initializer_list" argument, this doesn't extend the lifetime
2739 of the array, so if a class variable is constructed from a
2740 temporary "initializer_list", the pointer is left dangling by
2741 the end of the variable declaration statement.
2742
2743 -Winvalid-imported-macros
2744 Verify all imported macro definitions are valid at the end of
2745 compilation. This is not enabled by default, as it requires
2746 additional processing to determine. It may be useful when
2747 preparing sets of header-units to ensure consistent macros.
2748
2749 -Wno-literal-suffix (C++ and Objective-C++ only)
2750 Do not warn when a string or character literal is followed by a ud-
2751 suffix which does not begin with an underscore. As a conforming
2752 extension, GCC treats such suffixes as separate preprocessing
2753 tokens in order to maintain backwards compatibility with code that
2754 uses formatting macros from "<inttypes.h>". For example:
2755
2756 #define __STDC_FORMAT_MACROS
2757 #include <inttypes.h>
2758 #include <stdio.h>
2759
2760 int main() {
2761 int64_t i64 = 123;
2762 printf("My int64: %" PRId64"\n", i64);
2763 }
2764
2765 In this case, "PRId64" is treated as a separate preprocessing
2766 token.
2767
2768 This option also controls warnings when a user-defined literal
2769 operator is declared with a literal suffix identifier that doesn't
2770 begin with an underscore. Literal suffix identifiers that don't
2771 begin with an underscore are reserved for future standardization.
2772
2773 These warnings are enabled by default.
2774
2775 -Wno-narrowing (C++ and Objective-C++ only)
2776 For C++11 and later standards, narrowing conversions are diagnosed
2777 by default, as required by the standard. A narrowing conversion
2778 from a constant produces an error, and a narrowing conversion from
2779 a non-constant produces a warning, but -Wno-narrowing suppresses
2780 the diagnostic. Note that this does not affect the meaning of
2781 well-formed code; narrowing conversions are still considered ill-
2782 formed in SFINAE contexts.
2783
2784 With -Wnarrowing in C++98, warn when a narrowing conversion
2785 prohibited by C++11 occurs within { }, e.g.
2786
2787 int i = { 2.2 }; // error: narrowing from double to int
2788
2789 This flag is included in -Wall and -Wc++11-compat.
2790
2791 -Wnoexcept (C++ and Objective-C++ only)
2792 Warn when a noexcept-expression evaluates to false because of a
2793 call to a function that does not have a non-throwing exception
2794 specification (i.e. "throw()" or "noexcept") but is known by the
2795 compiler to never throw an exception.
2796
2797 -Wnoexcept-type (C++ and Objective-C++ only)
2798 Warn if the C++17 feature making "noexcept" part of a function type
2799 changes the mangled name of a symbol relative to C++14. Enabled by
2800 -Wabi and -Wc++17-compat.
2801
2802 As an example:
2803
2804 template <class T> void f(T t) { t(); };
2805 void g() noexcept;
2806 void h() { f(g); }
2807
2808 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2809 "f<void(*)()noexcept>".
2810
2811 -Wclass-memaccess (C++ and Objective-C++ only)
2812 Warn when the destination of a call to a raw memory function such
2813 as "memset" or "memcpy" is an object of class type, and when
2814 writing into such an object might bypass the class non-trivial or
2815 deleted constructor or copy assignment, violate const-correctness
2816 or encapsulation, or corrupt virtual table pointers. Modifying the
2817 representation of such objects may violate invariants maintained by
2818 member functions of the class. For example, the call to "memset"
2819 below is undefined because it modifies a non-trivial class object
2820 and is, therefore, diagnosed. The safe way to either initialize or
2821 clear the storage of objects of such types is by using the
2822 appropriate constructor or assignment operator, if one is
2823 available.
2824
2825 std::string str = "abc";
2826 memset (&str, 0, sizeof str);
2827
2828 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2829 casting the pointer to the class object to "void *" or to a type
2830 that can be safely accessed by the raw memory function suppresses
2831 the warning.
2832
2833 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2834 Warn when a class has virtual functions and an accessible non-
2835 virtual destructor itself or in an accessible polymorphic base
2836 class, in which case it is possible but unsafe to delete an
2837 instance of a derived class through a pointer to the class itself
2838 or base class. This warning is automatically enabled if -Weffc++
2839 is specified.
2840
2841 -Wregister (C++ and Objective-C++ only)
2842 Warn on uses of the "register" storage class specifier, except when
2843 it is part of the GNU Explicit Register Variables extension. The
2844 use of the "register" keyword as storage class specifier has been
2845 deprecated in C++11 and removed in C++17. Enabled by default with
2846 -std=c++17.
2847
2848 -Wreorder (C++ and Objective-C++ only)
2849 Warn when the order of member initializers given in the code does
2850 not match the order in which they must be executed. For instance:
2851
2852 struct A {
2853 int i;
2854 int j;
2855 A(): j (0), i (1) { }
2856 };
2857
2858 The compiler rearranges the member initializers for "i" and "j" to
2859 match the declaration order of the members, emitting a warning to
2860 that effect. This warning is enabled by -Wall.
2861
2862 -Wno-pessimizing-move (C++ and Objective-C++ only)
2863 This warning warns when a call to "std::move" prevents copy
2864 elision. A typical scenario when copy elision can occur is when
2865 returning in a function with a class return type, when the
2866 expression being returned is the name of a non-volatile automatic
2867 object, and is not a function parameter, and has the same type as
2868 the function return type.
2869
2870 struct T {
2871 ...
2872 };
2873 T fn()
2874 {
2875 T t;
2876 ...
2877 return std::move (t);
2878 }
2879
2880 But in this example, the "std::move" call prevents copy elision.
2881
2882 This warning is enabled by -Wall.
2883
2884 -Wno-redundant-move (C++ and Objective-C++ only)
2885 This warning warns about redundant calls to "std::move"; that is,
2886 when a move operation would have been performed even without the
2887 "std::move" call. This happens because the compiler is forced to
2888 treat the object as if it were an rvalue in certain situations such
2889 as returning a local variable, where copy elision isn't applicable.
2890 Consider:
2891
2892 struct T {
2893 ...
2894 };
2895 T fn(T t)
2896 {
2897 ...
2898 return std::move (t);
2899 }
2900
2901 Here, the "std::move" call is redundant. Because G++ implements
2902 Core Issue 1579, another example is:
2903
2904 struct T { // convertible to U
2905 ...
2906 };
2907 struct U {
2908 ...
2909 };
2910 U fn()
2911 {
2912 T t;
2913 ...
2914 return std::move (t);
2915 }
2916
2917 In this example, copy elision isn't applicable because the type of
2918 the expression being returned and the function return type differ,
2919 yet G++ treats the return value as if it were designated by an
2920 rvalue.
2921
2922 This warning is enabled by -Wextra.
2923
2924 -Wrange-loop-construct (C++ and Objective-C++ only)
2925 This warning warns when a C++ range-based for-loop is creating an
2926 unnecessary copy. This can happen when the range declaration is
2927 not a reference, but probably should be. For example:
2928
2929 struct S { char arr[128]; };
2930 void fn () {
2931 S arr[5];
2932 for (const auto x : arr) { ... }
2933 }
2934
2935 It does not warn when the type being copied is a trivially-copyable
2936 type whose size is less than 64 bytes.
2937
2938 This warning also warns when a loop variable in a range-based for-
2939 loop is initialized with a value of a different type resulting in a
2940 copy. For example:
2941
2942 void fn() {
2943 int arr[10];
2944 for (const double &x : arr) { ... }
2945 }
2946
2947 In the example above, in every iteration of the loop a temporary
2948 value of type "double" is created and destroyed, to which the
2949 reference "const double &" is bound.
2950
2951 This warning is enabled by -Wall.
2952
2953 -Wredundant-tags (C++ and Objective-C++ only)
2954 Warn about redundant class-key and enum-key in references to class
2955 types and enumerated types in contexts where the key can be
2956 eliminated without causing an ambiguity. For example:
2957
2958 struct foo;
2959 struct foo *p; // warn that keyword struct can be eliminated
2960
2961 On the other hand, in this example there is no warning:
2962
2963 struct foo;
2964 void foo (); // "hides" struct foo
2965 void bar (struct foo&); // no warning, keyword struct is necessary
2966
2967 -Wno-subobject-linkage (C++ and Objective-C++ only)
2968 Do not warn if a class type has a base or a field whose type uses
2969 the anonymous namespace or depends on a type with no linkage. If a
2970 type A depends on a type B with no or internal linkage, defining it
2971 in multiple translation units would be an ODR violation because the
2972 meaning of B is different in each translation unit. If A only
2973 appears in a single translation unit, the best way to silence the
2974 warning is to give it internal linkage by putting it in an
2975 anonymous namespace as well. The compiler doesn't give this
2976 warning for types defined in the main .C file, as those are
2977 unlikely to have multiple definitions. -Wsubobject-linkage is
2978 enabled by default.
2979
2980 -Weffc++ (C++ and Objective-C++ only)
2981 Warn about violations of the following style guidelines from Scott
2982 Meyers' Effective C++ series of books:
2983
2984 * Define a copy constructor and an assignment operator for
2985 classes with dynamically-allocated memory.
2986
2987 * Prefer initialization to assignment in constructors.
2988
2989 * Have "operator=" return a reference to *this.
2990
2991 * Don't try to return a reference when you must return an object.
2992
2993 * Distinguish between prefix and postfix forms of increment and
2994 decrement operators.
2995
2996 * Never overload "&&", "||", or ",".
2997
2998 This option also enables -Wnon-virtual-dtor, which is also one of
2999 the effective C++ recommendations. However, the check is extended
3000 to warn about the lack of virtual destructor in accessible non-
3001 polymorphic bases classes too.
3002
3003 When selecting this option, be aware that the standard library
3004 headers do not obey all of these guidelines; use grep -v to filter
3005 out those warnings.
3006
3007 -Wno-exceptions (C++ and Objective-C++ only)
3008 Disable the warning about the case when an exception handler is
3009 shadowed by another handler, which can point out a wrong ordering
3010 of exception handlers.
3011
3012 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3013 Warn about the use of an uncasted "NULL" as sentinel. When
3014 compiling only with GCC this is a valid sentinel, as "NULL" is
3015 defined to "__null". Although it is a null pointer constant rather
3016 than a null pointer, it is guaranteed to be of the same size as a
3017 pointer. But this use is not portable across different compilers.
3018
3019 -Wno-non-template-friend (C++ and Objective-C++ only)
3020 Disable warnings when non-template friend functions are declared
3021 within a template. In very old versions of GCC that predate
3022 implementation of the ISO standard, declarations such as friend int
3023 foo(int), where the name of the friend is an unqualified-id, could
3024 be interpreted as a particular specialization of a template
3025 function; the warning exists to diagnose compatibility problems,
3026 and is enabled by default.
3027
3028 -Wold-style-cast (C++ and Objective-C++ only)
3029 Warn if an old-style (C-style) cast to a non-void type is used
3030 within a C++ program. The new-style casts ("dynamic_cast",
3031 "static_cast", "reinterpret_cast", and "const_cast") are less
3032 vulnerable to unintended effects and much easier to search for.
3033
3034 -Woverloaded-virtual (C++ and Objective-C++ only)
3035 Warn when a function declaration hides virtual functions from a
3036 base class. For example, in:
3037
3038 struct A {
3039 virtual void f();
3040 };
3041
3042 struct B: public A {
3043 void f(int);
3044 };
3045
3046 the "A" class version of "f" is hidden in "B", and code like:
3047
3048 B* b;
3049 b->f();
3050
3051 fails to compile.
3052
3053 -Wno-pmf-conversions (C++ and Objective-C++ only)
3054 Disable the diagnostic for converting a bound pointer to member
3055 function to a plain pointer.
3056
3057 -Wsign-promo (C++ and Objective-C++ only)
3058 Warn when overload resolution chooses a promotion from unsigned or
3059 enumerated type to a signed type, over a conversion to an unsigned
3060 type of the same size. Previous versions of G++ tried to preserve
3061 unsignedness, but the standard mandates the current behavior.
3062
3063 -Wtemplates (C++ and Objective-C++ only)
3064 Warn when a primary template declaration is encountered. Some
3065 coding rules disallow templates, and this may be used to enforce
3066 that rule. The warning is inactive inside a system header file,
3067 such as the STL, so one can still use the STL. One may also
3068 instantiate or specialize templates.
3069
3070 -Wno-mismatched-new-delete (C++ and Objective-C++ only)
3071 Warn for mismatches between calls to "operator new" or "operator
3072 delete" and the corresponding call to the allocation or
3073 deallocation function. This includes invocations of C++ "operator
3074 delete" with pointers returned from either mismatched forms of
3075 "operator new", or from other functions that allocate objects for
3076 which the "operator delete" isn't a suitable deallocator, as well
3077 as calls to other deallocation functions with pointers returned
3078 from "operator new" for which the deallocation function isn't
3079 suitable.
3080
3081 For example, the "delete" expression in the function below is
3082 diagnosed because it doesn't match the array form of the "new"
3083 expression the pointer argument was returned from. Similarly, the
3084 call to "free" is also diagnosed.
3085
3086 void f ()
3087 {
3088 int *a = new int[n];
3089 delete a; // warning: mismatch in array forms of expressions
3090
3091 char *p = new char[n];
3092 free (p); // warning: mismatch between new and free
3093 }
3094
3095 The related option -Wmismatched-dealloc diagnoses mismatches
3096 involving allocation and deallocation functions other than
3097 "operator new" and "operator delete".
3098
3099 -Wmismatched-new-delete is enabled by default.
3100
3101 -Wmismatched-tags (C++ and Objective-C++ only)
3102 Warn for declarations of structs, classes, and class templates and
3103 their specializations with a class-key that does not match either
3104 the definition or the first declaration if no definition is
3105 provided.
3106
3107 For example, the declaration of "struct Object" in the argument
3108 list of "draw" triggers the warning. To avoid it, either remove
3109 the redundant class-key "struct" or replace it with "class" to
3110 match its definition.
3111
3112 class Object {
3113 public:
3114 virtual ~Object () = 0;
3115 };
3116 void draw (struct Object*);
3117
3118 It is not wrong to declare a class with the class-key "struct" as
3119 the example above shows. The -Wmismatched-tags option is intended
3120 to help achieve a consistent style of class declarations. In code
3121 that is intended to be portable to Windows-based compilers the
3122 warning helps prevent unresolved references due to the difference
3123 in the mangling of symbols declared with different class-keys. The
3124 option can be used either on its own or in conjunction with
3125 -Wredundant-tags.
3126
3127 -Wmultiple-inheritance (C++ and Objective-C++ only)
3128 Warn when a class is defined with multiple direct base classes.
3129 Some coding rules disallow multiple inheritance, and this may be
3130 used to enforce that rule. The warning is inactive inside a system
3131 header file, such as the STL, so one can still use the STL. One
3132 may also define classes that indirectly use multiple inheritance.
3133
3134 -Wvirtual-inheritance
3135 Warn when a class is defined with a virtual direct base class.
3136 Some coding rules disallow multiple inheritance, and this may be
3137 used to enforce that rule. The warning is inactive inside a system
3138 header file, such as the STL, so one can still use the STL. One
3139 may also define classes that indirectly use virtual inheritance.
3140
3141 -Wno-virtual-move-assign
3142 Suppress warnings about inheriting from a virtual base with a non-
3143 trivial C++11 move assignment operator. This is dangerous because
3144 if the virtual base is reachable along more than one path, it is
3145 moved multiple times, which can mean both objects end up in the
3146 moved-from state. If the move assignment operator is written to
3147 avoid moving from a moved-from object, this warning can be
3148 disabled.
3149
3150 -Wnamespaces
3151 Warn when a namespace definition is opened. Some coding rules
3152 disallow namespaces, and this may be used to enforce that rule.
3153 The warning is inactive inside a system header file, such as the
3154 STL, so one can still use the STL. One may also use using
3155 directives and qualified names.
3156
3157 -Wno-terminate (C++ and Objective-C++ only)
3158 Disable the warning about a throw-expression that will immediately
3159 result in a call to "terminate".
3160
3161 -Wno-vexing-parse (C++ and Objective-C++ only)
3162 Warn about the most vexing parse syntactic ambiguity. This warns
3163 about the cases when a declaration looks like a variable
3164 definition, but the C++ language requires it to be interpreted as a
3165 function declaration. For instance:
3166
3167 void f(double a) {
3168 int i(); // extern int i (void);
3169 int n(int(a)); // extern int n (int);
3170 }
3171
3172 Another example:
3173
3174 struct S { S(int); };
3175 void f(double a) {
3176 S x(int(a)); // extern struct S x (int);
3177 S y(int()); // extern struct S y (int (*) (void));
3178 S z(); // extern struct S z (void);
3179 }
3180
3181 The warning will suggest options how to deal with such an
3182 ambiguity; e.g., it can suggest removing the parentheses or using
3183 braces instead.
3184
3185 This warning is enabled by default.
3186
3187 -Wno-class-conversion (C++ and Objective-C++ only)
3188 Do not warn when a conversion function converts an object to the
3189 same type, to a base class of that type, or to void; such a
3190 conversion function will never be called.
3191
3192 -Wvolatile (C++ and Objective-C++ only)
3193 Warn about deprecated uses of the "volatile" qualifier. This
3194 includes postfix and prefix "++" and "--" expressions of
3195 "volatile"-qualified types, using simple assignments where the left
3196 operand is a "volatile"-qualified non-class type for their value,
3197 compound assignments where the left operand is a
3198 "volatile"-qualified non-class type, "volatile"-qualified function
3199 return type, "volatile"-qualified parameter type, and structured
3200 bindings of a "volatile"-qualified type. This usage was deprecated
3201 in C++20.
3202
3203 Enabled by default with -std=c++20.
3204
3205 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3206 Warn when a literal 0 is used as null pointer constant. This can
3207 be useful to facilitate the conversion to "nullptr" in C++11.
3208
3209 -Waligned-new
3210 Warn about a new-expression of a type that requires greater
3211 alignment than the "alignof(std::max_align_t)" but uses an
3212 allocation function without an explicit alignment parameter. This
3213 option is enabled by -Wall.
3214
3215 Normally this only warns about global allocation functions, but
3216 -Waligned-new=all also warns about class member allocation
3217 functions.
3218
3219 -Wno-placement-new
3220 -Wplacement-new=n
3221 Warn about placement new expressions with undefined behavior, such
3222 as constructing an object in a buffer that is smaller than the type
3223 of the object. For example, the placement new expression below is
3224 diagnosed because it attempts to construct an array of 64 integers
3225 in a buffer only 64 bytes large.
3226
3227 char buf [64];
3228 new (buf) int[64];
3229
3230 This warning is enabled by default.
3231
3232 -Wplacement-new=1
3233 This is the default warning level of -Wplacement-new. At this
3234 level the warning is not issued for some strictly undefined
3235 constructs that GCC allows as extensions for compatibility with
3236 legacy code. For example, the following "new" expression is
3237 not diagnosed at this level even though it has undefined
3238 behavior according to the C++ standard because it writes past
3239 the end of the one-element array.
3240
3241 struct S { int n, a[1]; };
3242 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3243 new (s->a)int [32]();
3244
3245 -Wplacement-new=2
3246 At this level, in addition to diagnosing all the same
3247 constructs as at level 1, a diagnostic is also issued for
3248 placement new expressions that construct an object in the last
3249 member of structure whose type is an array of a single element
3250 and whose size is less than the size of the object being
3251 constructed. While the previous example would be diagnosed,
3252 the following construct makes use of the flexible member array
3253 extension to avoid the warning at level 2.
3254
3255 struct S { int n, a[]; };
3256 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3257 new (s->a)int [32]();
3258
3259 -Wcatch-value
3260 -Wcatch-value=n (C++ and Objective-C++ only)
3261 Warn about catch handlers that do not catch via reference. With
3262 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3263 class types that are caught by value. With -Wcatch-value=2 warn
3264 about all class types that are caught by value. With
3265 -Wcatch-value=3 warn about all types that are not caught by
3266 reference. -Wcatch-value is enabled by -Wall.
3267
3268 -Wconditionally-supported (C++ and Objective-C++ only)
3269 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3270
3271 -Wno-delete-incomplete (C++ and Objective-C++ only)
3272 Do not warn when deleting a pointer to incomplete type, which may
3273 cause undefined behavior at runtime. This warning is enabled by
3274 default.
3275
3276 -Wextra-semi (C++, Objective-C++ only)
3277 Warn about redundant semicolons after in-class function
3278 definitions.
3279
3280 -Wno-inaccessible-base (C++, Objective-C++ only)
3281 This option controls warnings when a base class is inaccessible in
3282 a class derived from it due to ambiguity. The warning is enabled
3283 by default. Note that the warning for ambiguous virtual bases is
3284 enabled by the -Wextra option.
3285
3286 struct A { int a; };
3287
3288 struct B : A { };
3289
3290 struct C : B, A { };
3291
3292 -Wno-inherited-variadic-ctor
3293 Suppress warnings about use of C++11 inheriting constructors when
3294 the base class inherited from has a C variadic constructor; the
3295 warning is on by default because the ellipsis is not inherited.
3296
3297 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3298 Suppress warnings from applying the "offsetof" macro to a non-POD
3299 type. According to the 2014 ISO C++ standard, applying "offsetof"
3300 to a non-standard-layout type is undefined. In existing C++
3301 implementations, however, "offsetof" typically gives meaningful
3302 results. This flag is for users who are aware that they are
3303 writing nonportable code and who have deliberately chosen to ignore
3304 the warning about it.
3305
3306 The restrictions on "offsetof" may be relaxed in a future version
3307 of the C++ standard.
3308
3309 -Wsized-deallocation (C++ and Objective-C++ only)
3310 Warn about a definition of an unsized deallocation function
3311
3312 void operator delete (void *) noexcept;
3313 void operator delete[] (void *) noexcept;
3314
3315 without a definition of the corresponding sized deallocation
3316 function
3317
3318 void operator delete (void *, std::size_t) noexcept;
3319 void operator delete[] (void *, std::size_t) noexcept;
3320
3321 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3322
3323 -Wsuggest-final-types
3324 Warn about types with virtual methods where code quality would be
3325 improved if the type were declared with the C++11 "final"
3326 specifier, or, if possible, declared in an anonymous namespace.
3327 This allows GCC to more aggressively devirtualize the polymorphic
3328 calls. This warning is more effective with link-time optimization,
3329 where the information about the class hierarchy graph is more
3330 complete.
3331
3332 -Wsuggest-final-methods
3333 Warn about virtual methods where code quality would be improved if
3334 the method were declared with the C++11 "final" specifier, or, if
3335 possible, its type were declared in an anonymous namespace or with
3336 the "final" specifier. This warning is more effective with link-
3337 time optimization, where the information about the class hierarchy
3338 graph is more complete. It is recommended to first consider
3339 suggestions of -Wsuggest-final-types and then rebuild with new
3340 annotations.
3341
3342 -Wsuggest-override
3343 Warn about overriding virtual functions that are not marked with
3344 the "override" keyword.
3345
3346 -Wuseless-cast (C++ and Objective-C++ only)
3347 Warn when an expression is casted to its own type.
3348
3349 -Wno-conversion-null (C++ and Objective-C++ only)
3350 Do not warn for conversions between "NULL" and non-pointer types.
3351 -Wconversion-null is enabled by default.
3352
3353 Options Controlling Objective-C and Objective-C++ Dialects
3354 (NOTE: This manual does not describe the Objective-C and Objective-C++
3355 languages themselves.
3356
3357 This section describes the command-line options that are only
3358 meaningful for Objective-C and Objective-C++ programs. You can also
3359 use most of the language-independent GNU compiler options. For
3360 example, you might compile a file some_class.m like this:
3361
3362 gcc -g -fgnu-runtime -O -c some_class.m
3363
3364 In this example, -fgnu-runtime is an option meant only for Objective-C
3365 and Objective-C++ programs; you can use the other options with any
3366 language supported by GCC.
3367
3368 Note that since Objective-C is an extension of the C language,
3369 Objective-C compilations may also use options specific to the C front-
3370 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3371 use C++-specific options (e.g., -Wabi).
3372
3373 Here is a list of options that are only for compiling Objective-C and
3374 Objective-C++ programs:
3375
3376 -fconstant-string-class=class-name
3377 Use class-name as the name of the class to instantiate for each
3378 literal string specified with the syntax "@"..."". The default
3379 class name is "NXConstantString" if the GNU runtime is being used,
3380 and "NSConstantString" if the NeXT runtime is being used (see
3381 below). The -fconstant-cfstrings option, if also present,
3382 overrides the -fconstant-string-class setting and cause "@"...""
3383 literals to be laid out as constant CoreFoundation strings.
3384
3385 -fgnu-runtime
3386 Generate object code compatible with the standard GNU Objective-C
3387 runtime. This is the default for most types of systems.
3388
3389 -fnext-runtime
3390 Generate output compatible with the NeXT runtime. This is the
3391 default for NeXT-based systems, including Darwin and Mac OS X. The
3392 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3393 is used.
3394
3395 -fno-nil-receivers
3396 Assume that all Objective-C message dispatches ("[receiver
3397 message:arg]") in this translation unit ensure that the receiver is
3398 not "nil". This allows for more efficient entry points in the
3399 runtime to be used. This option is only available in conjunction
3400 with the NeXT runtime and ABI version 0 or 1.
3401
3402 -fobjc-abi-version=n
3403 Use version n of the Objective-C ABI for the selected runtime.
3404 This option is currently supported only for the NeXT runtime. In
3405 that case, Version 0 is the traditional (32-bit) ABI without
3406 support for properties and other Objective-C 2.0 additions.
3407 Version 1 is the traditional (32-bit) ABI with support for
3408 properties and other Objective-C 2.0 additions. Version 2 is the
3409 modern (64-bit) ABI. If nothing is specified, the default is
3410 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3411 machines.
3412
3413 -fobjc-call-cxx-cdtors
3414 For each Objective-C class, check if any of its instance variables
3415 is a C++ object with a non-trivial default constructor. If so,
3416 synthesize a special "- (id) .cxx_construct" instance method which
3417 runs non-trivial default constructors on any such instance
3418 variables, in order, and then return "self". Similarly, check if
3419 any instance variable is a C++ object with a non-trivial
3420 destructor, and if so, synthesize a special "- (void)
3421 .cxx_destruct" method which runs all such default destructors, in
3422 reverse order.
3423
3424 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3425 thusly generated only operate on instance variables declared in the
3426 current Objective-C class, and not those inherited from
3427 superclasses. It is the responsibility of the Objective-C runtime
3428 to invoke all such methods in an object's inheritance hierarchy.
3429 The "- (id) .cxx_construct" methods are invoked by the runtime
3430 immediately after a new object instance is allocated; the "- (void)
3431 .cxx_destruct" methods are invoked immediately before the runtime
3432 deallocates an object instance.
3433
3434 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3435 later has support for invoking the "- (id) .cxx_construct" and "-
3436 (void) .cxx_destruct" methods.
3437
3438 -fobjc-direct-dispatch
3439 Allow fast jumps to the message dispatcher. On Darwin this is
3440 accomplished via the comm page.
3441
3442 -fobjc-exceptions
3443 Enable syntactic support for structured exception handling in
3444 Objective-C, similar to what is offered by C++. This option is
3445 required to use the Objective-C keywords @try, @throw, @catch,
3446 @finally and @synchronized. This option is available with both the
3447 GNU runtime and the NeXT runtime (but not available in conjunction
3448 with the NeXT runtime on Mac OS X 10.2 and earlier).
3449
3450 -fobjc-gc
3451 Enable garbage collection (GC) in Objective-C and Objective-C++
3452 programs. This option is only available with the NeXT runtime; the
3453 GNU runtime has a different garbage collection implementation that
3454 does not require special compiler flags.
3455
3456 -fobjc-nilcheck
3457 For the NeXT runtime with version 2 of the ABI, check for a nil
3458 receiver in method invocations before doing the actual method call.
3459 This is the default and can be disabled using -fno-objc-nilcheck.
3460 Class methods and super calls are never checked for nil in this way
3461 no matter what this flag is set to. Currently this flag does
3462 nothing when the GNU runtime, or an older version of the NeXT
3463 runtime ABI, is used.
3464
3465 -fobjc-std=objc1
3466 Conform to the language syntax of Objective-C 1.0, the language
3467 recognized by GCC 4.0. This only affects the Objective-C additions
3468 to the C/C++ language; it does not affect conformance to C/C++
3469 standards, which is controlled by the separate C/C++ dialect option
3470 flags. When this option is used with the Objective-C or
3471 Objective-C++ compiler, any Objective-C syntax that is not
3472 recognized by GCC 4.0 is rejected. This is useful if you need to
3473 make sure that your Objective-C code can be compiled with older
3474 versions of GCC.
3475
3476 -freplace-objc-classes
3477 Emit a special marker instructing ld(1) not to statically link in
3478 the resulting object file, and allow dyld(1) to load it in at run
3479 time instead. This is used in conjunction with the Fix-and-
3480 Continue debugging mode, where the object file in question may be
3481 recompiled and dynamically reloaded in the course of program
3482 execution, without the need to restart the program itself.
3483 Currently, Fix-and-Continue functionality is only available in
3484 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3485
3486 -fzero-link
3487 When compiling for the NeXT runtime, the compiler ordinarily
3488 replaces calls to "objc_getClass("...")" (when the name of the
3489 class is known at compile time) with static class references that
3490 get initialized at load time, which improves run-time performance.
3491 Specifying the -fzero-link flag suppresses this behavior and causes
3492 calls to "objc_getClass("...")" to be retained. This is useful in
3493 Zero-Link debugging mode, since it allows for individual class
3494 implementations to be modified during program execution. The GNU
3495 runtime currently always retains calls to "objc_get_class("...")"
3496 regardless of command-line options.
3497
3498 -fno-local-ivars
3499 By default instance variables in Objective-C can be accessed as if
3500 they were local variables from within the methods of the class
3501 they're declared in. This can lead to shadowing between instance
3502 variables and other variables declared either locally inside a
3503 class method or globally with the same name. Specifying the
3504 -fno-local-ivars flag disables this behavior thus avoiding variable
3505 shadowing issues.
3506
3507 -fivar-visibility=[public|protected|private|package]
3508 Set the default instance variable visibility to the specified
3509 option so that instance variables declared outside the scope of any
3510 access modifier directives default to the specified visibility.
3511
3512 -gen-decls
3513 Dump interface declarations for all classes seen in the source file
3514 to a file named sourcename.decl.
3515
3516 -Wassign-intercept (Objective-C and Objective-C++ only)
3517 Warn whenever an Objective-C assignment is being intercepted by the
3518 garbage collector.
3519
3520 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3521 Do not warn if a property for an Objective-C object has no assign
3522 semantics specified.
3523
3524 -Wno-protocol (Objective-C and Objective-C++ only)
3525 If a class is declared to implement a protocol, a warning is issued
3526 for every method in the protocol that is not implemented by the
3527 class. The default behavior is to issue a warning for every method
3528 not explicitly implemented in the class, even if a method
3529 implementation is inherited from the superclass. If you use the
3530 -Wno-protocol option, then methods inherited from the superclass
3531 are considered to be implemented, and no warning is issued for
3532 them.
3533
3534 -Wobjc-root-class (Objective-C and Objective-C++ only)
3535 Warn if a class interface lacks a superclass. Most classes will
3536 inherit from "NSObject" (or "Object") for example. When declaring
3537 classes intended to be root classes, the warning can be suppressed
3538 by marking their interfaces with
3539 "__attribute__((objc_root_class))".
3540
3541 -Wselector (Objective-C and Objective-C++ only)
3542 Warn if multiple methods of different types for the same selector
3543 are found during compilation. The check is performed on the list
3544 of methods in the final stage of compilation. Additionally, a
3545 check is performed for each selector appearing in a
3546 "@selector(...)" expression, and a corresponding method for that
3547 selector has been found during compilation. Because these checks
3548 scan the method table only at the end of compilation, these
3549 warnings are not produced if the final stage of compilation is not
3550 reached, for example because an error is found during compilation,
3551 or because the -fsyntax-only option is being used.
3552
3553 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3554 Warn if multiple methods with differing argument and/or return
3555 types are found for a given selector when attempting to send a
3556 message using this selector to a receiver of type "id" or "Class".
3557 When this flag is off (which is the default behavior), the compiler
3558 omits such warnings if any differences found are confined to types
3559 that share the same size and alignment.
3560
3561 -Wundeclared-selector (Objective-C and Objective-C++ only)
3562 Warn if a "@selector(...)" expression referring to an undeclared
3563 selector is found. A selector is considered undeclared if no
3564 method with that name has been declared before the "@selector(...)"
3565 expression, either explicitly in an @interface or @protocol
3566 declaration, or implicitly in an @implementation section. This
3567 option always performs its checks as soon as a "@selector(...)"
3568 expression is found, while -Wselector only performs its checks in
3569 the final stage of compilation. This also enforces the coding
3570 style convention that methods and selectors must be declared before
3571 being used.
3572
3573 -print-objc-runtime-info
3574 Generate C header describing the largest structure that is passed
3575 by value, if any.
3576
3577 Options to Control Diagnostic Messages Formatting
3578 Traditionally, diagnostic messages have been formatted irrespective of
3579 the output device's aspect (e.g. its width, ...). You can use the
3580 options described below to control the formatting algorithm for
3581 diagnostic messages, e.g. how many characters per line, how often
3582 source location information should be reported. Note that some
3583 language front ends may not honor these options.
3584
3585 -fmessage-length=n
3586 Try to format error messages so that they fit on lines of about n
3587 characters. If n is zero, then no line-wrapping is done; each
3588 error message appears on a single line. This is the default for
3589 all front ends.
3590
3591 Note - this option also affects the display of the #error and
3592 #warning pre-processor directives, and the deprecated
3593 function/type/variable attribute. It does not however affect the
3594 pragma GCC warning and pragma GCC error pragmas.
3595
3596 -fdiagnostics-plain-output
3597 This option requests that diagnostic output look as plain as
3598 possible, which may be useful when running dejagnu or other
3599 utilities that need to parse diagnostics output and prefer that it
3600 remain more stable over time. -fdiagnostics-plain-output is
3601 currently equivalent to the following options:
3602 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3603 -fdiagnostics-color=never -fdiagnostics-urls=never
3604 -fdiagnostics-path-format=separate-events In the future, if GCC
3605 changes the default appearance of its diagnostics, the
3606 corresponding option to disable the new behavior will be added to
3607 this list.
3608
3609 -fdiagnostics-show-location=once
3610 Only meaningful in line-wrapping mode. Instructs the diagnostic
3611 messages reporter to emit source location information once; that
3612 is, in case the message is too long to fit on a single physical
3613 line and has to be wrapped, the source location won't be emitted
3614 (as prefix) again, over and over, in subsequent continuation lines.
3615 This is the default behavior.
3616
3617 -fdiagnostics-show-location=every-line
3618 Only meaningful in line-wrapping mode. Instructs the diagnostic
3619 messages reporter to emit the same source location information (as
3620 prefix) for physical lines that result from the process of breaking
3621 a message which is too long to fit on a single line.
3622
3623 -fdiagnostics-color[=WHEN]
3624 -fno-diagnostics-color
3625 Use color in diagnostics. WHEN is never, always, or auto. The
3626 default depends on how the compiler has been configured, it can be
3627 any of the above WHEN options or also never if GCC_COLORS
3628 environment variable isn't present in the environment, and auto
3629 otherwise. auto makes GCC use color only when the standard error
3630 is a terminal, and when not executing in an emacs shell. The forms
3631 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3632 -fdiagnostics-color=always and -fdiagnostics-color=never,
3633 respectively.
3634
3635 The colors are defined by the environment variable GCC_COLORS. Its
3636 value is a colon-separated list of capabilities and Select Graphic
3637 Rendition (SGR) substrings. SGR commands are interpreted by the
3638 terminal or terminal emulator. (See the section in the
3639 documentation of your text terminal for permitted values and their
3640 meanings as character attributes.) These substring values are
3641 integers in decimal representation and can be concatenated with
3642 semicolons. Common values to concatenate include 1 for bold, 4 for
3643 underline, 5 for blink, 7 for inverse, 39 for default foreground
3644 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3645 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3646 modes foreground colors, 49 for default background color, 40 to 47
3647 for background colors, 100 to 107 for 16-color mode background
3648 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3649 background colors.
3650
3651 The default GCC_COLORS is
3652
3653 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3654 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3655 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3656 type-diff=01;32
3657
3658 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3659 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3660 GCC_COLORS to the empty string disables colors. Supported
3661 capabilities are as follows.
3662
3663 "error="
3664 SGR substring for error: markers.
3665
3666 "warning="
3667 SGR substring for warning: markers.
3668
3669 "note="
3670 SGR substring for note: markers.
3671
3672 "path="
3673 SGR substring for colorizing paths of control-flow events as
3674 printed via -fdiagnostics-path-format=, such as the identifiers
3675 of individual events and lines indicating interprocedural calls
3676 and returns.
3677
3678 "range1="
3679 SGR substring for first additional range.
3680
3681 "range2="
3682 SGR substring for second additional range.
3683
3684 "locus="
3685 SGR substring for location information, file:line or
3686 file:line:column etc.
3687
3688 "quote="
3689 SGR substring for information printed within quotes.
3690
3691 "fixit-insert="
3692 SGR substring for fix-it hints suggesting text to be inserted
3693 or replaced.
3694
3695 "fixit-delete="
3696 SGR substring for fix-it hints suggesting text to be deleted.
3697
3698 "diff-filename="
3699 SGR substring for filename headers within generated patches.
3700
3701 "diff-hunk="
3702 SGR substring for the starts of hunks within generated patches.
3703
3704 "diff-delete="
3705 SGR substring for deleted lines within generated patches.
3706
3707 "diff-insert="
3708 SGR substring for inserted lines within generated patches.
3709
3710 "type-diff="
3711 SGR substring for highlighting mismatching types within
3712 template arguments in the C++ frontend.
3713
3714 -fdiagnostics-urls[=WHEN]
3715 Use escape sequences to embed URLs in diagnostics. For example,
3716 when -fdiagnostics-show-option emits text showing the command-line
3717 option controlling a diagnostic, embed a URL for documentation of
3718 that option.
3719
3720 WHEN is never, always, or auto. auto makes GCC use URL escape
3721 sequences only when the standard error is a terminal, and when not
3722 executing in an emacs shell or any graphical terminal which is
3723 known to be incompatible with this feature, see below.
3724
3725 The default depends on how the compiler has been configured. It
3726 can be any of the above WHEN options.
3727
3728 GCC can also be configured (via the
3729 --with-diagnostics-urls=auto-if-env configure-time option) so that
3730 the default is affected by environment variables. Under such a
3731 configuration, GCC defaults to using auto if either GCC_URLS or
3732 TERM_URLS environment variables are present and non-empty in the
3733 environment of the compiler, or never if neither are.
3734
3735 However, even with -fdiagnostics-urls=always the behavior is
3736 dependent on those environment variables: If GCC_URLS is set to
3737 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3738 use ST escape sequences. If set to bel, the default, URLs use BEL
3739 escape sequences. Any other non-empty value enables the feature.
3740 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3741 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3742 character, CTRL-G that usually sounds like a beep.
3743
3744 At this time GCC tries to detect also a few terminals that are
3745 known to not implement the URL feature, and have bugs or at least
3746 had bugs in some versions that are still in use, where the URL
3747 escapes are likely to misbehave, i.e. print garbage on the screen.
3748 That list is currently xfce4-terminal, certain known to be buggy
3749 gnome-terminal versions, the linux console, and mingw. This check
3750 can be skipped with the -fdiagnostics-urls=always.
3751
3752 -fno-diagnostics-show-option
3753 By default, each diagnostic emitted includes text indicating the
3754 command-line option that directly controls the diagnostic (if such
3755 an option is known to the diagnostic machinery). Specifying the
3756 -fno-diagnostics-show-option flag suppresses that behavior.
3757
3758 -fno-diagnostics-show-caret
3759 By default, each diagnostic emitted includes the original source
3760 line and a caret ^ indicating the column. This option suppresses
3761 this information. The source line is truncated to n characters, if
3762 the -fmessage-length=n option is given. When the output is done to
3763 the terminal, the width is limited to the width given by the
3764 COLUMNS environment variable or, if not set, to the terminal width.
3765
3766 -fno-diagnostics-show-labels
3767 By default, when printing source code (via
3768 -fdiagnostics-show-caret), diagnostics can label ranges of source
3769 code with pertinent information, such as the types of expressions:
3770
3771 printf ("foo %s bar", long_i + long_j);
3772 ~^ ~~~~~~~~~~~~~~~
3773 | |
3774 char * long int
3775
3776 This option suppresses the printing of these labels (in the example
3777 above, the vertical bars and the "char *" and "long int" text).
3778
3779 -fno-diagnostics-show-cwe
3780 Diagnostic messages can optionally have an associated
3781 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3782 only provides such metadata for some of the -fanalyzer diagnostics.
3783 GCC plugins may also provide diagnostics with such metadata. By
3784 default, if this information is present, it will be printed with
3785 the diagnostic. This option suppresses the printing of this
3786 metadata.
3787
3788 -fno-diagnostics-show-line-numbers
3789 By default, when printing source code (via
3790 -fdiagnostics-show-caret), a left margin is printed, showing line
3791 numbers. This option suppresses this left margin.
3792
3793 -fdiagnostics-minimum-margin-width=width
3794 This option controls the minimum width of the left margin printed
3795 by -fdiagnostics-show-line-numbers. It defaults to 6.
3796
3797 -fdiagnostics-parseable-fixits
3798 Emit fix-it hints in a machine-parseable format, suitable for
3799 consumption by IDEs. For each fix-it, a line will be printed after
3800 the relevant diagnostic, starting with the string "fix-it:". For
3801 example:
3802
3803 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3804
3805 The location is expressed as a half-open range, expressed as a
3806 count of bytes, starting at byte 1 for the initial column. In the
3807 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3808 replaced with the given string:
3809
3810 00000000011111111112222222222
3811 12345678901234567890123456789
3812 gtk_widget_showall (dlg);
3813 ^^^^^^^^^^^^^^^^^^
3814 gtk_widget_show_all
3815
3816 The filename and replacement string escape backslash as "\\", tab
3817 as "\t", newline as "\n", double quotes as "\"", non-printable
3818 characters as octal (e.g. vertical tab as "\013").
3819
3820 An empty replacement string indicates that the given range is to be
3821 removed. An empty range (e.g. "45:3-45:3") indicates that the
3822 string is to be inserted at the given position.
3823
3824 -fdiagnostics-generate-patch
3825 Print fix-it hints to stderr in unified diff format, after any
3826 diagnostics are printed. For example:
3827
3828 --- test.c
3829 +++ test.c
3830 @ -42,5 +42,5 @
3831
3832 void show_cb(GtkDialog *dlg)
3833 {
3834 - gtk_widget_showall(dlg);
3835 + gtk_widget_show_all(dlg);
3836 }
3837
3838 The diff may or may not be colorized, following the same rules as
3839 for diagnostics (see -fdiagnostics-color).
3840
3841 -fdiagnostics-show-template-tree
3842 In the C++ frontend, when printing diagnostics showing mismatching
3843 template types, such as:
3844
3845 could not convert 'std::map<int, std::vector<double> >()'
3846 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3847
3848 the -fdiagnostics-show-template-tree flag enables printing a tree-
3849 like structure showing the common and differing parts of the types,
3850 such as:
3851
3852 map<
3853 [...],
3854 vector<
3855 [double != float]>>
3856
3857 The parts that differ are highlighted with color ("double" and
3858 "float" in this case).
3859
3860 -fno-elide-type
3861 By default when the C++ frontend prints diagnostics showing
3862 mismatching template types, common parts of the types are printed
3863 as "[...]" to simplify the error message. For example:
3864
3865 could not convert 'std::map<int, std::vector<double> >()'
3866 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3867
3868 Specifying the -fno-elide-type flag suppresses that behavior. This
3869 flag also affects the output of the
3870 -fdiagnostics-show-template-tree flag.
3871
3872 -fdiagnostics-path-format=KIND
3873 Specify how to print paths of control-flow events for diagnostics
3874 that have such a path associated with them.
3875
3876 KIND is none, separate-events, or inline-events, the default.
3877
3878 none means to not print diagnostic paths.
3879
3880 separate-events means to print a separate "note" diagnostic for
3881 each event within the diagnostic. For example:
3882
3883 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
3884 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
3885 test.c:27:3: note: (2) when 'i < count'
3886 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3887
3888 inline-events means to print the events "inline" within the source
3889 code. This view attempts to consolidate the events into runs of
3890 sufficiently-close events, printing them as labelled ranges within
3891 the source.
3892
3893 For example, the same events as above might be printed as:
3894
3895 'test': events 1-3
3896 |
3897 | 25 | list = PyList_New(0);
3898 | | ^~~~~~~~~~~~~
3899 | | |
3900 | | (1) when 'PyList_New' fails, returning NULL
3901 | 26 |
3902 | 27 | for (i = 0; i < count; i++) {
3903 | | ~~~
3904 | | |
3905 | | (2) when 'i < count'
3906 | 28 | item = PyLong_FromLong(random());
3907 | 29 | PyList_Append(list, item);
3908 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
3909 | | |
3910 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3911 |
3912
3913 Interprocedural control flow is shown by grouping the events by
3914 stack frame, and using indentation to show how stack frames are
3915 nested, pushed, and popped.
3916
3917 For example:
3918
3919 'test': events 1-2
3920 |
3921 | 133 | {
3922 | | ^
3923 | | |
3924 | | (1) entering 'test'
3925 | 134 | boxed_int *obj = make_boxed_int (i);
3926 | | ~~~~~~~~~~~~~~~~~~
3927 | | |
3928 | | (2) calling 'make_boxed_int'
3929 |
3930 +--> 'make_boxed_int': events 3-4
3931 |
3932 | 120 | {
3933 | | ^
3934 | | |
3935 | | (3) entering 'make_boxed_int'
3936 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
3937 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3938 | | |
3939 | | (4) calling 'wrapped_malloc'
3940 |
3941 +--> 'wrapped_malloc': events 5-6
3942 |
3943 | 7 | {
3944 | | ^
3945 | | |
3946 | | (5) entering 'wrapped_malloc'
3947 | 8 | return malloc (size);
3948 | | ~~~~~~~~~~~~~
3949 | | |
3950 | | (6) calling 'malloc'
3951 |
3952 <-------------+
3953 |
3954 'test': event 7
3955 |
3956 | 138 | free_boxed_int (obj);
3957 | | ^~~~~~~~~~~~~~~~~~~~
3958 | | |
3959 | | (7) calling 'free_boxed_int'
3960 |
3961 (etc)
3962
3963 -fdiagnostics-show-path-depths
3964 This option provides additional information when printing control-
3965 flow paths associated with a diagnostic.
3966
3967 If this is option is provided then the stack depth will be printed
3968 for each run of events within
3969 -fdiagnostics-path-format=separate-events.
3970
3971 This is intended for use by GCC developers and plugin developers
3972 when debugging diagnostics that report interprocedural control
3973 flow.
3974
3975 -fno-show-column
3976 Do not print column numbers in diagnostics. This may be necessary
3977 if diagnostics are being scanned by a program that does not
3978 understand the column numbers, such as dejagnu.
3979
3980 -fdiagnostics-column-unit=UNIT
3981 Select the units for the column number. This affects traditional
3982 diagnostics (in the absence of -fno-show-column), as well as JSON
3983 format diagnostics if requested.
3984
3985 The default UNIT, display, considers the number of display columns
3986 occupied by each character. This may be larger than the number of
3987 bytes required to encode the character, in the case of tab
3988 characters, or it may be smaller, in the case of multibyte
3989 characters. For example, the character "GREEK SMALL LETTER PI
3990 (U+03C0)" occupies one display column, and its UTF-8 encoding
3991 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
3992 occupies two display columns, and its UTF-8 encoding requires four
3993 bytes.
3994
3995 Setting UNIT to byte changes the column number to the raw byte
3996 count in all cases, as was traditionally output by GCC prior to
3997 version 11.1.0.
3998
3999 -fdiagnostics-column-origin=ORIGIN
4000 Select the origin for column numbers, i.e. the column number
4001 assigned to the first column. The default value of 1 corresponds
4002 to traditional GCC behavior and to the GNU style guide. Some
4003 utilities may perform better with an origin of 0; any non-negative
4004 value may be specified.
4005
4006 -fdiagnostics-format=FORMAT
4007 Select a different format for printing diagnostics. FORMAT is text
4008 or json. The default is text.
4009
4010 The json format consists of a top-level JSON array containing JSON
4011 objects representing the diagnostics.
4012
4013 The JSON is emitted as one line, without formatting; the examples
4014 below have been formatted for clarity.
4015
4016 Diagnostics can have child diagnostics. For example, this error
4017 and note:
4018
4019 misleading-indentation.c:15:3: warning: this 'if' clause does not
4020 guard... [-Wmisleading-indentation]
4021 15 | if (flag)
4022 | ^~
4023 misleading-indentation.c:17:5: note: ...this statement, but the latter
4024 is misleadingly indented as if it were guarded by the 'if'
4025 17 | y = 2;
4026 | ^
4027
4028 might be printed in JSON form (after formatting) like this:
4029
4030 [
4031 {
4032 "kind": "warning",
4033 "locations": [
4034 {
4035 "caret": {
4036 "display-column": 3,
4037 "byte-column": 3,
4038 "column": 3,
4039 "file": "misleading-indentation.c",
4040 "line": 15
4041 },
4042 "finish": {
4043 "display-column": 4,
4044 "byte-column": 4,
4045 "column": 4,
4046 "file": "misleading-indentation.c",
4047 "line": 15
4048 }
4049 }
4050 ],
4051 "message": "this \u2018if\u2019 clause does not guard...",
4052 "option": "-Wmisleading-indentation",
4053 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4054 "children": [
4055 {
4056 "kind": "note",
4057 "locations": [
4058 {
4059 "caret": {
4060 "display-column": 5,
4061 "byte-column": 5,
4062 "column": 5,
4063 "file": "misleading-indentation.c",
4064 "line": 17
4065 }
4066 }
4067 ],
4068 "message": "...this statement, but the latter is ..."
4069 }
4070 ]
4071 "column-origin": 1,
4072 },
4073 ...
4074 ]
4075
4076 where the "note" is a child of the "warning".
4077
4078 A diagnostic has a "kind". If this is "warning", then there is an
4079 "option" key describing the command-line option controlling the
4080 warning.
4081
4082 A diagnostic can contain zero or more locations. Each location has
4083 an optional "label" string and up to three positions within it: a
4084 "caret" position and optional "start" and "finish" positions. A
4085 position is described by a "file" name, a "line" number, and three
4086 numbers indicating a column position:
4087
4088 * "display-column" counts display columns, accounting for tabs
4089 and multibyte characters.
4090
4091 * "byte-column" counts raw bytes.
4092
4093 * "column" is equal to one of the previous two, as dictated by
4094 the -fdiagnostics-column-unit option.
4095
4096 All three columns are relative to the origin specified by
4097 -fdiagnostics-column-origin, which is typically equal to 1 but may
4098 be set, for instance, to 0 for compatibility with other utilities
4099 that number columns from 0. The column origin is recorded in the
4100 JSON output in the "column-origin" tag. In the remaining examples
4101 below, the extra column number outputs have been omitted for
4102 brevity.
4103
4104 For example, this error:
4105
4106 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4107 'struct s'} and 'T' {aka 'struct t'})
4108 64 | return callee_4a () + callee_4b ();
4109 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4110 | | |
4111 | | T {aka struct t}
4112 | S {aka struct s}
4113
4114 has three locations. Its primary location is at the "+" token at
4115 column 23. It has two secondary locations, describing the left and
4116 right-hand sides of the expression, which have labels. It might be
4117 printed in JSON form as:
4118
4119 {
4120 "children": [],
4121 "kind": "error",
4122 "locations": [
4123 {
4124 "caret": {
4125 "column": 23, "file": "bad-binary-ops.c", "line": 64
4126 }
4127 },
4128 {
4129 "caret": {
4130 "column": 10, "file": "bad-binary-ops.c", "line": 64
4131 },
4132 "finish": {
4133 "column": 21, "file": "bad-binary-ops.c", "line": 64
4134 },
4135 "label": "S {aka struct s}"
4136 },
4137 {
4138 "caret": {
4139 "column": 25, "file": "bad-binary-ops.c", "line": 64
4140 },
4141 "finish": {
4142 "column": 36, "file": "bad-binary-ops.c", "line": 64
4143 },
4144 "label": "T {aka struct t}"
4145 }
4146 ],
4147 "message": "invalid operands to binary + ..."
4148 }
4149
4150 If a diagnostic contains fix-it hints, it has a "fixits" array,
4151 consisting of half-open intervals, similar to the output of
4152 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4153 a replacement fix-it hint:
4154
4155 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4156 mean 'color'?
4157 8 | return ptr->colour;
4158 | ^~~~~~
4159 | color
4160
4161 might be printed in JSON form as:
4162
4163 {
4164 "children": [],
4165 "fixits": [
4166 {
4167 "next": {
4168 "column": 21,
4169 "file": "demo.c",
4170 "line": 8
4171 },
4172 "start": {
4173 "column": 15,
4174 "file": "demo.c",
4175 "line": 8
4176 },
4177 "string": "color"
4178 }
4179 ],
4180 "kind": "error",
4181 "locations": [
4182 {
4183 "caret": {
4184 "column": 15,
4185 "file": "demo.c",
4186 "line": 8
4187 },
4188 "finish": {
4189 "column": 20,
4190 "file": "demo.c",
4191 "line": 8
4192 }
4193 }
4194 ],
4195 "message": "\u2018struct s\u2019 has no member named ..."
4196 }
4197
4198 where the fix-it hint suggests replacing the text from "start" up
4199 to but not including "next" with "string"'s value. Deletions are
4200 expressed via an empty value for "string", insertions by having
4201 "start" equal "next".
4202
4203 If the diagnostic has a path of control-flow events associated with
4204 it, it has a "path" array of objects representing the events. Each
4205 event object has a "description" string, a "location" object, along
4206 with a "function" string and a "depth" number for representing
4207 interprocedural paths. The "function" represents the current
4208 function at that event, and the "depth" represents the stack depth
4209 relative to some baseline: the higher, the more frames are within
4210 the stack.
4211
4212 For example, the intraprocedural example shown for
4213 -fdiagnostics-path-format= might have this JSON for its path:
4214
4215 "path": [
4216 {
4217 "depth": 0,
4218 "description": "when 'PyList_New' fails, returning NULL",
4219 "function": "test",
4220 "location": {
4221 "column": 10,
4222 "file": "test.c",
4223 "line": 25
4224 }
4225 },
4226 {
4227 "depth": 0,
4228 "description": "when 'i < count'",
4229 "function": "test",
4230 "location": {
4231 "column": 3,
4232 "file": "test.c",
4233 "line": 27
4234 }
4235 },
4236 {
4237 "depth": 0,
4238 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4239 "function": "test",
4240 "location": {
4241 "column": 5,
4242 "file": "test.c",
4243 "line": 29
4244 }
4245 }
4246 ]
4247
4248 Options to Request or Suppress Warnings
4249 Warnings are diagnostic messages that report constructions that are not
4250 inherently erroneous but that are risky or suggest there may have been
4251 an error.
4252
4253 The following language-independent options do not enable specific
4254 warnings but control the kinds of diagnostics produced by GCC.
4255
4256 -fsyntax-only
4257 Check the code for syntax errors, but don't do anything beyond
4258 that.
4259
4260 -fmax-errors=n
4261 Limits the maximum number of error messages to n, at which point
4262 GCC bails out rather than attempting to continue processing the
4263 source code. If n is 0 (the default), there is no limit on the
4264 number of error messages produced. If -Wfatal-errors is also
4265 specified, then -Wfatal-errors takes precedence over this option.
4266
4267 -w Inhibit all warning messages.
4268
4269 -Werror
4270 Make all warnings into errors.
4271
4272 -Werror=
4273 Make the specified warning into an error. The specifier for a
4274 warning is appended; for example -Werror=switch turns the warnings
4275 controlled by -Wswitch into errors. This switch takes a negative
4276 form, to be used to negate -Werror for specific warnings; for
4277 example -Wno-error=switch makes -Wswitch warnings not be errors,
4278 even when -Werror is in effect.
4279
4280 The warning message for each controllable warning includes the
4281 option that controls the warning. That option can then be used
4282 with -Werror= and -Wno-error= as described above. (Printing of the
4283 option in the warning message can be disabled using the
4284 -fno-diagnostics-show-option flag.)
4285
4286 Note that specifying -Werror=foo automatically implies -Wfoo.
4287 However, -Wno-error=foo does not imply anything.
4288
4289 -Wfatal-errors
4290 This option causes the compiler to abort compilation on the first
4291 error occurred rather than trying to keep going and printing
4292 further error messages.
4293
4294 You can request many specific warnings with options beginning with -W,
4295 for example -Wimplicit to request warnings on implicit declarations.
4296 Each of these specific warning options also has a negative form
4297 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4298 manual lists only one of the two forms, whichever is not the default.
4299 For further language-specific options also refer to C++ Dialect Options
4300 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4301 can be produced by enabling the static analyzer;
4302
4303 Some options, such as -Wall and -Wextra, turn on other options, such as
4304 -Wunused, which may turn on further options, such as -Wunused-value.
4305 The combined effect of positive and negative forms is that more
4306 specific options have priority over less specific ones, independently
4307 of their position in the command-line. For options of the same
4308 specificity, the last one takes effect. Options enabled or disabled via
4309 pragmas take effect as if they appeared at the end of the command-line.
4310
4311 When an unrecognized warning option is requested (e.g.,
4312 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4313 not recognized. However, if the -Wno- form is used, the behavior is
4314 slightly different: no diagnostic is produced for -Wno-unknown-warning
4315 unless other diagnostics are being produced. This allows the use of
4316 new -Wno- options with old compilers, but if something goes wrong, the
4317 compiler warns that an unrecognized option is present.
4318
4319 The effectiveness of some warnings depends on optimizations also being
4320 enabled. For example -Wsuggest-final-types is more effective with link-
4321 time optimization and -Wmaybe-uninitialized does not warn at all unless
4322 optimization is enabled.
4323
4324 -Wpedantic
4325 -pedantic
4326 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4327 all programs that use forbidden extensions, and some other programs
4328 that do not follow ISO C and ISO C++. For ISO C, follows the
4329 version of the ISO C standard specified by any -std option used.
4330
4331 Valid ISO C and ISO C++ programs should compile properly with or
4332 without this option (though a rare few require -ansi or a -std
4333 option specifying the required version of ISO C). However, without
4334 this option, certain GNU extensions and traditional C and C++
4335 features are supported as well. With this option, they are
4336 rejected.
4337
4338 -Wpedantic does not cause warning messages for use of the alternate
4339 keywords whose names begin and end with __. This alternate format
4340 can also be used to disable warnings for non-ISO __intN types, i.e.
4341 __intN__. Pedantic warnings are also disabled in the expression
4342 that follows "__extension__". However, only system header files
4343 should use these escape routes; application programs should avoid
4344 them.
4345
4346 Some users try to use -Wpedantic to check programs for strict ISO C
4347 conformance. They soon find that it does not do quite what they
4348 want: it finds some non-ISO practices, but not all---only those for
4349 which ISO C requires a diagnostic, and some others for which
4350 diagnostics have been added.
4351
4352 A feature to report any failure to conform to ISO C might be useful
4353 in some instances, but would require considerable additional work
4354 and would be quite different from -Wpedantic. We don't have plans
4355 to support such a feature in the near future.
4356
4357 Where the standard specified with -std represents a GNU extended
4358 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4359 standard, the version of ISO C on which the GNU extended dialect is
4360 based. Warnings from -Wpedantic are given where they are required
4361 by the base standard. (It does not make sense for such warnings to
4362 be given only for features not in the specified GNU C dialect,
4363 since by definition the GNU dialects of C include all features the
4364 compiler supports with the given option, and there would be nothing
4365 to warn about.)
4366
4367 -pedantic-errors
4368 Give an error whenever the base standard (see -Wpedantic) requires
4369 a diagnostic, in some cases where there is undefined behavior at
4370 compile-time and in some other cases that do not prevent
4371 compilation of programs that are valid according to the standard.
4372 This is not equivalent to -Werror=pedantic, since there are errors
4373 enabled by this option and not enabled by the latter and vice
4374 versa.
4375
4376 -Wall
4377 This enables all the warnings about constructions that some users
4378 consider questionable, and that are easy to avoid (or modify to
4379 prevent the warning), even in conjunction with macros. This also
4380 enables some language-specific warnings described in C++ Dialect
4381 Options and Objective-C and Objective-C++ Dialect Options.
4382
4383 -Wall turns on the following warning flags:
4384
4385 -Waddress -Warray-bounds=1 (only with -O2) -Warray-parameter=2 (C
4386 and Objective-C only) -Wbool-compare -Wbool-operation
4387 -Wc++11-compat -Wc++14-compat -Wcatch-value (C++ and Objective-C++
4388 only) -Wchar-subscripts -Wcomment -Wduplicate-decl-specifier (C and
4389 Objective-C only) -Wenum-compare (in C/ObjC; this is on by default
4390 in C++) -Wformat -Wformat-overflow -Wformat-truncation
4391 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
4392 -Wimplicit-int (C and Objective-C only)
4393 -Wimplicit-function-declaration (C and Objective-C only)
4394 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
4395 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4396 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4397 (only for C/C++) -Wmissing-attributes -Wmissing-braces (only for
4398 C/ObjC) -Wmultistatement-macros -Wnarrowing (only for C++)
4399 -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses
4400 -Wpessimizing-move (only for C++) -Wpointer-sign
4401 -Wrange-loop-construct (only for C++) -Wreorder -Wrestrict
4402 -Wreturn-type -Wsequence-point -Wsign-compare (only in C++)
4403 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
4404 -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch
4405 -Wtautological-compare -Wtrigraphs -Wuninitialized
4406 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
4407 -Wunused-variable -Wvla-parameter (C and Objective-C only)
4408 -Wvolatile-register-var -Wzero-length-bounds
4409
4410 Note that some warning flags are not implied by -Wall. Some of
4411 them warn about constructions that users generally do not consider
4412 questionable, but which occasionally you might wish to check for;
4413 others warn about constructions that are necessary or hard to avoid
4414 in some cases, and there is no simple way to modify the code to
4415 suppress the warning. Some of them are enabled by -Wextra but many
4416 of them must be enabled individually.
4417
4418 -Wextra
4419 This enables some extra warning flags that are not enabled by
4420 -Wall. (This option used to be called -W. The older name is still
4421 supported, but the newer name is more descriptive.)
4422
4423 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4424 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4425 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4426 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4427 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4428 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4429 -Wshift-negative-value (in C++03 and in C99 and newer)
4430 -Wunused-parameter (only with -Wunused or -Wall)
4431 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4432
4433 The option -Wextra also prints warning messages for the following
4434 cases:
4435
4436 * A pointer is compared against integer zero with "<", "<=", ">",
4437 or ">=".
4438
4439 * (C++ only) An enumerator and a non-enumerator both appear in a
4440 conditional expression.
4441
4442 * (C++ only) Ambiguous virtual bases.
4443
4444 * (C++ only) Subscripting an array that has been declared
4445 "register".
4446
4447 * (C++ only) Taking the address of a variable that has been
4448 declared "register".
4449
4450 * (C++ only) A base class is not initialized in the copy
4451 constructor of a derived class.
4452
4453 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4454 Warn about code affected by ABI changes. This includes code that
4455 may not be compatible with the vendor-neutral C++ ABI as well as
4456 the psABI for the particular target.
4457
4458 Since G++ now defaults to updating the ABI with each major release,
4459 normally -Wabi warns only about C++ ABI compatibility problems if
4460 there is a check added later in a release series for an ABI issue
4461 discovered since the initial release. -Wabi warns about more
4462 things if an older ABI version is selected (with -fabi-version=n).
4463
4464 -Wabi can also be used with an explicit version number to warn
4465 about C++ ABI compatibility with a particular -fabi-version level,
4466 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4467
4468 If an explicit version number is provided and -fabi-compat-version
4469 is not specified, the version number from this option is used for
4470 compatibility aliases. If no explicit version number is provided
4471 with this option, but -fabi-compat-version is specified, that
4472 version number is used for C++ ABI warnings.
4473
4474 Although an effort has been made to warn about all such cases,
4475 there are probably some cases that are not warned about, even
4476 though G++ is generating incompatible code. There may also be
4477 cases where warnings are emitted even though the code that is
4478 generated is compatible.
4479
4480 You should rewrite your code to avoid these warnings if you are
4481 concerned about the fact that code generated by G++ may not be
4482 binary compatible with code generated by other compilers.
4483
4484 Known incompatibilities in -fabi-version=2 (which was the default
4485 from GCC 3.4 to 4.9) include:
4486
4487 * A template with a non-type template parameter of reference type
4488 was mangled incorrectly:
4489
4490 extern int N;
4491 template <int &> struct S {};
4492 void n (S<N>) {2}
4493
4494 This was fixed in -fabi-version=3.
4495
4496 * SIMD vector types declared using "__attribute ((vector_size))"
4497 were mangled in a non-standard way that does not allow for
4498 overloading of functions taking vectors of different sizes.
4499
4500 The mangling was changed in -fabi-version=4.
4501
4502 * "__attribute ((const))" and "noreturn" were mangled as type
4503 qualifiers, and "decltype" of a plain declaration was folded
4504 away.
4505
4506 These mangling issues were fixed in -fabi-version=5.
4507
4508 * Scoped enumerators passed as arguments to a variadic function
4509 are promoted like unscoped enumerators, causing "va_arg" to
4510 complain. On most targets this does not actually affect the
4511 parameter passing ABI, as there is no way to pass an argument
4512 smaller than "int".
4513
4514 Also, the ABI changed the mangling of template argument packs,
4515 "const_cast", "static_cast", prefix increment/decrement, and a
4516 class scope function used as a template argument.
4517
4518 These issues were corrected in -fabi-version=6.
4519
4520 * Lambdas in default argument scope were mangled incorrectly, and
4521 the ABI changed the mangling of "nullptr_t".
4522
4523 These issues were corrected in -fabi-version=7.
4524
4525 * When mangling a function type with function-cv-qualifiers, the
4526 un-qualified function type was incorrectly treated as a
4527 substitution candidate.
4528
4529 This was fixed in -fabi-version=8, the default for GCC 5.1.
4530
4531 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
4532 to unaligned accesses. Note that this did not affect the ABI
4533 of a function with a "nullptr_t" parameter, as parameters have
4534 a minimum alignment.
4535
4536 This was fixed in -fabi-version=9, the default for GCC 5.2.
4537
4538 * Target-specific attributes that affect the identity of a type,
4539 such as ia32 calling conventions on a function type (stdcall,
4540 regparm, etc.), did not affect the mangled name, leading to
4541 name collisions when function pointers were used as template
4542 arguments.
4543
4544 This was fixed in -fabi-version=10, the default for GCC 6.1.
4545
4546 This option also enables warnings about psABI-related changes. The
4547 known psABI changes at this point include:
4548
4549 * For SysV/x86-64, unions with "long double" members are passed
4550 in memory as specified in psABI. Prior to GCC 4.4, this was
4551 not the case. For example:
4552
4553 union U {
4554 long double ld;
4555 int i;
4556 };
4557
4558 "union U" is now always passed in memory.
4559
4560 -Wchar-subscripts
4561 Warn if an array subscript has type "char". This is a common cause
4562 of error, as programmers often forget that this type is signed on
4563 some machines. This warning is enabled by -Wall.
4564
4565 -Wno-coverage-mismatch
4566 Warn if feedback profiles do not match when using the -fprofile-use
4567 option. If a source file is changed between compiling with
4568 -fprofile-generate and with -fprofile-use, the files with the
4569 profile feedback can fail to match the source file and GCC cannot
4570 use the profile feedback information. By default, this warning is
4571 enabled and is treated as an error. -Wno-coverage-mismatch can be
4572 used to disable the warning or -Wno-error=coverage-mismatch can be
4573 used to disable the error. Disabling the error for this warning
4574 can result in poorly optimized code and is useful only in the case
4575 of very minor changes such as bug fixes to an existing code-base.
4576 Completely disabling the warning is not recommended.
4577
4578 -Wno-cpp
4579 (C, Objective-C, C++, Objective-C++ and Fortran only) Suppress
4580 warning messages emitted by "#warning" directives.
4581
4582 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
4583 Give a warning when a value of type "float" is implicitly promoted
4584 to "double". CPUs with a 32-bit "single-precision" floating-point
4585 unit implement "float" in hardware, but emulate "double" in
4586 software. On such a machine, doing computations using "double"
4587 values is much more expensive because of the overhead required for
4588 software emulation.
4589
4590 It is easy to accidentally do computations with "double" because
4591 floating-point literals are implicitly of type "double". For
4592 example, in:
4593
4594 float area(float radius)
4595 {
4596 return 3.14159 * radius * radius;
4597 }
4598
4599 the compiler performs the entire computation with "double" because
4600 the floating-point literal is a "double".
4601
4602 -Wduplicate-decl-specifier (C and Objective-C only)
4603 Warn if a declaration has duplicate "const", "volatile", "restrict"
4604 or "_Atomic" specifier. This warning is enabled by -Wall.
4605
4606 -Wformat
4607 -Wformat=n
4608 Check calls to "printf" and "scanf", etc., to make sure that the
4609 arguments supplied have types appropriate to the format string
4610 specified, and that the conversions specified in the format string
4611 make sense. This includes standard functions, and others specified
4612 by format attributes, in the "printf", "scanf", "strftime" and
4613 "strfmon" (an X/Open extension, not in the C standard) families (or
4614 other target-specific families). Which functions are checked
4615 without format attributes having been specified depends on the
4616 standard version selected, and such checks of functions without the
4617 attribute specified are disabled by -ffreestanding or -fno-builtin.
4618
4619 The formats are checked against the format features supported by
4620 GNU libc version 2.2. These include all ISO C90 and C99 features,
4621 as well as features from the Single Unix Specification and some BSD
4622 and GNU extensions. Other library implementations may not support
4623 all these features; GCC does not support warning about features
4624 that go beyond a particular library's limitations. However, if
4625 -Wpedantic is used with -Wformat, warnings are given about format
4626 features not in the selected standard version (but not for
4627 "strfmon" formats, since those are not in any version of the C
4628 standard).
4629
4630 -Wformat=1
4631 -Wformat
4632 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4633 equivalent to -Wformat=0. Since -Wformat also checks for null
4634 format arguments for several functions, -Wformat also implies
4635 -Wnonnull. Some aspects of this level of format checking can
4636 be disabled by the options: -Wno-format-contains-nul,
4637 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4638 is enabled by -Wall.
4639
4640 -Wformat=2
4641 Enable -Wformat plus additional format checks. Currently
4642 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4643 -Wformat-y2k.
4644
4645 -Wno-format-contains-nul
4646 If -Wformat is specified, do not warn about format strings that
4647 contain NUL bytes.
4648
4649 -Wno-format-extra-args
4650 If -Wformat is specified, do not warn about excess arguments to a
4651 "printf" or "scanf" format function. The C standard specifies that
4652 such arguments are ignored.
4653
4654 Where the unused arguments lie between used arguments that are
4655 specified with $ operand number specifications, normally warnings
4656 are still given, since the implementation could not know what type
4657 to pass to "va_arg" to skip the unused arguments. However, in the
4658 case of "scanf" formats, this option suppresses the warning if the
4659 unused arguments are all pointers, since the Single Unix
4660 Specification says that such unused arguments are allowed.
4661
4662 -Wformat-overflow
4663 -Wformat-overflow=level
4664 Warn about calls to formatted input/output functions such as
4665 "sprintf" and "vsprintf" that might overflow the destination
4666 buffer. When the exact number of bytes written by a format
4667 directive cannot be determined at compile-time it is estimated
4668 based on heuristics that depend on the level argument and on
4669 optimization. While enabling optimization will in most cases
4670 improve the accuracy of the warning, it may also result in false
4671 positives.
4672
4673 -Wformat-overflow
4674 -Wformat-overflow=1
4675 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4676 conservative approach that warns only about calls that most
4677 likely overflow the buffer. At this level, numeric arguments
4678 to format directives with unknown values are assumed to have
4679 the value of one, and strings of unknown length to be empty.
4680 Numeric arguments that are known to be bounded to a subrange of
4681 their type, or string arguments whose output is bounded either
4682 by their directive's precision or by a finite set of string
4683 literals, are assumed to take on the value within the range
4684 that results in the most bytes on output. For example, the
4685 call to "sprintf" below is diagnosed because even with both a
4686 and b equal to zero, the terminating NUL character ('\0')
4687 appended by the function to the destination buffer will be
4688 written past its end. Increasing the size of the buffer by a
4689 single byte is sufficient to avoid the warning, though it may
4690 not be sufficient to avoid the overflow.
4691
4692 void f (int a, int b)
4693 {
4694 char buf [13];
4695 sprintf (buf, "a = %i, b = %i\n", a, b);
4696 }
4697
4698 -Wformat-overflow=2
4699 Level 2 warns also about calls that might overflow the
4700 destination buffer given an argument of sufficient length or
4701 magnitude. At level 2, unknown numeric arguments are assumed
4702 to have the minimum representable value for signed types with a
4703 precision greater than 1, and the maximum representable value
4704 otherwise. Unknown string arguments whose length cannot be
4705 assumed to be bounded either by the directive's precision, or
4706 by a finite set of string literals they may evaluate to, or the
4707 character array they may point to, are assumed to be 1
4708 character long.
4709
4710 At level 2, the call in the example above is again diagnosed,
4711 but this time because with a equal to a 32-bit "INT_MIN" the
4712 first %i directive will write some of its digits beyond the end
4713 of the destination buffer. To make the call safe regardless of
4714 the values of the two variables, the size of the destination
4715 buffer must be increased to at least 34 bytes. GCC includes
4716 the minimum size of the buffer in an informational note
4717 following the warning.
4718
4719 An alternative to increasing the size of the destination buffer
4720 is to constrain the range of formatted values. The maximum
4721 length of string arguments can be bounded by specifying the
4722 precision in the format directive. When numeric arguments of
4723 format directives can be assumed to be bounded by less than the
4724 precision of their type, choosing an appropriate length
4725 modifier to the format specifier will reduce the required
4726 buffer size. For example, if a and b in the example above can
4727 be assumed to be within the precision of the "short int" type
4728 then using either the %hi format directive or casting the
4729 argument to "short" reduces the maximum required size of the
4730 buffer to 24 bytes.
4731
4732 void f (int a, int b)
4733 {
4734 char buf [23];
4735 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4736 }
4737
4738 -Wno-format-zero-length
4739 If -Wformat is specified, do not warn about zero-length formats.
4740 The C standard specifies that zero-length formats are allowed.
4741
4742 -Wformat-nonliteral
4743 If -Wformat is specified, also warn if the format string is not a
4744 string literal and so cannot be checked, unless the format function
4745 takes its format arguments as a "va_list".
4746
4747 -Wformat-security
4748 If -Wformat is specified, also warn about uses of format functions
4749 that represent possible security problems. At present, this warns
4750 about calls to "printf" and "scanf" functions where the format
4751 string is not a string literal and there are no format arguments,
4752 as in "printf (foo);". This may be a security hole if the format
4753 string came from untrusted input and contains %n. (This is
4754 currently a subset of what -Wformat-nonliteral warns about, but in
4755 future warnings may be added to -Wformat-security that are not
4756 included in -Wformat-nonliteral.)
4757
4758 -Wformat-signedness
4759 If -Wformat is specified, also warn if the format string requires
4760 an unsigned argument and the argument is signed and vice versa.
4761
4762 -Wformat-truncation
4763 -Wformat-truncation=level
4764 Warn about calls to formatted input/output functions such as
4765 "snprintf" and "vsnprintf" that might result in output truncation.
4766 When the exact number of bytes written by a format directive cannot
4767 be determined at compile-time it is estimated based on heuristics
4768 that depend on the level argument and on optimization. While
4769 enabling optimization will in most cases improve the accuracy of
4770 the warning, it may also result in false positives. Except as
4771 noted otherwise, the option uses the same logic -Wformat-overflow.
4772
4773 -Wformat-truncation
4774 -Wformat-truncation=1
4775 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4776 conservative approach that warns only about calls to bounded
4777 functions whose return value is unused and that will most
4778 likely result in output truncation.
4779
4780 -Wformat-truncation=2
4781 Level 2 warns also about calls to bounded functions whose
4782 return value is used and that might result in truncation given
4783 an argument of sufficient length or magnitude.
4784
4785 -Wformat-y2k
4786 If -Wformat is specified, also warn about "strftime" formats that
4787 may yield only a two-digit year.
4788
4789 -Wnonnull
4790 Warn about passing a null pointer for arguments marked as requiring
4791 a non-null value by the "nonnull" function attribute.
4792
4793 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4794 with the -Wno-nonnull option.
4795
4796 -Wnonnull-compare
4797 Warn when comparing an argument marked with the "nonnull" function
4798 attribute against null inside the function.
4799
4800 -Wnonnull-compare is included in -Wall. It can be disabled with
4801 the -Wno-nonnull-compare option.
4802
4803 -Wnull-dereference
4804 Warn if the compiler detects paths that trigger erroneous or
4805 undefined behavior due to dereferencing a null pointer. This
4806 option is only active when -fdelete-null-pointer-checks is active,
4807 which is enabled by optimizations in most targets. The precision
4808 of the warnings depends on the optimization options used.
4809
4810 -Winit-self (C, C++, Objective-C and Objective-C++ only)
4811 Warn about uninitialized variables that are initialized with
4812 themselves. Note this option can only be used with the
4813 -Wuninitialized option.
4814
4815 For example, GCC warns about "i" being uninitialized in the
4816 following snippet only when -Winit-self has been specified:
4817
4818 int f()
4819 {
4820 int i = i;
4821 return i;
4822 }
4823
4824 This warning is enabled by -Wall in C++.
4825
4826 -Wno-implicit-int (C and Objective-C only)
4827 This option controls warnings when a declaration does not specify a
4828 type. This warning is enabled by default in C99 and later dialects
4829 of C, and also by -Wall.
4830
4831 -Wno-implicit-function-declaration (C and Objective-C only)
4832 This option controls warnings when a function is used before being
4833 declared. This warning is enabled by default in C99 and later
4834 dialects of C, and also by -Wall. The warning is made into an
4835 error by -pedantic-errors.
4836
4837 -Wimplicit (C and Objective-C only)
4838 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
4839 warning is enabled by -Wall.
4840
4841 -Wimplicit-fallthrough
4842 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
4843 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
4844
4845 -Wimplicit-fallthrough=n
4846 Warn when a switch case falls through. For example:
4847
4848 switch (cond)
4849 {
4850 case 1:
4851 a = 1;
4852 break;
4853 case 2:
4854 a = 2;
4855 case 3:
4856 a = 3;
4857 break;
4858 }
4859
4860 This warning does not warn when the last statement of a case cannot
4861 fall through, e.g. when there is a return statement or a call to
4862 function declared with the noreturn attribute.
4863 -Wimplicit-fallthrough= also takes into account control flow
4864 statements, such as ifs, and only warns when appropriate. E.g.
4865
4866 switch (cond)
4867 {
4868 case 1:
4869 if (i > 3) {
4870 bar (5);
4871 break;
4872 } else if (i < 1) {
4873 bar (0);
4874 } else
4875 return;
4876 default:
4877 ...
4878 }
4879
4880 Since there are occasions where a switch case fall through is
4881 desirable, GCC provides an attribute, "__attribute__
4882 ((fallthrough))", that is to be used along with a null statement to
4883 suppress this warning that would normally occur:
4884
4885 switch (cond)
4886 {
4887 case 1:
4888 bar (0);
4889 __attribute__ ((fallthrough));
4890 default:
4891 ...
4892 }
4893
4894 C++17 provides a standard way to suppress the
4895 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
4896 the GNU attribute. In C++11 or C++14 users can use
4897 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
4898 these attributes, it is also possible to add a fallthrough comment
4899 to silence the warning. The whole body of the C or C++ style
4900 comment should match the given regular expressions listed below.
4901 The option argument n specifies what kind of comments are accepted:
4902
4903 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
4904 *<-Wimplicit-fallthrough=1 matches ".*" regular>
4905 expression, any comment is used as fallthrough comment.
4906
4907 *<-Wimplicit-fallthrough=2 case insensitively matches>
4908 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
4909
4910 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
4911 following regular expressions:
4912
4913 *<"-fallthrough">
4914 *<"@fallthrough@">
4915 *<"lint -fallthrough[ \t]*">
4916 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
4917 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
4918 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
4919 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4920 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
4921 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4922 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
4923 following regular expressions:
4924
4925 *<"-fallthrough">
4926 *<"@fallthrough@">
4927 *<"lint -fallthrough[ \t]*">
4928 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
4929 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
4930 fallthrough comments, only attributes disable the warning.
4931
4932 The comment needs to be followed after optional whitespace and
4933 other comments by "case" or "default" keywords or by a user label
4934 that precedes some "case" or "default" label.
4935
4936 switch (cond)
4937 {
4938 case 1:
4939 bar (0);
4940 /* FALLTHRU */
4941 default:
4942 ...
4943 }
4944
4945 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
4946
4947 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
4948 Control if warnings triggered by the "warn_if_not_aligned"
4949 attribute should be issued. These warnings are enabled by default.
4950
4951 -Wignored-qualifiers (C and C++ only)
4952 Warn if the return type of a function has a type qualifier such as
4953 "const". For ISO C such a type qualifier has no effect, since the
4954 value returned by a function is not an lvalue. For C++, the
4955 warning is only emitted for scalar types or "void". ISO C
4956 prohibits qualified "void" return types on function definitions, so
4957 such return types always receive a warning even without this
4958 option.
4959
4960 This warning is also enabled by -Wextra.
4961
4962 -Wno-ignored-attributes (C and C++ only)
4963 This option controls warnings when an attribute is ignored. This
4964 is different from the -Wattributes option in that it warns whenever
4965 the compiler decides to drop an attribute, not that the attribute
4966 is either unknown, used in a wrong place, etc. This warning is
4967 enabled by default.
4968
4969 -Wmain
4970 Warn if the type of "main" is suspicious. "main" should be a
4971 function with external linkage, returning int, taking either zero
4972 arguments, two, or three arguments of appropriate types. This
4973 warning is enabled by default in C++ and is enabled by either -Wall
4974 or -Wpedantic.
4975
4976 -Wmisleading-indentation (C and C++ only)
4977 Warn when the indentation of the code does not reflect the block
4978 structure. Specifically, a warning is issued for "if", "else",
4979 "while", and "for" clauses with a guarded statement that does not
4980 use braces, followed by an unguarded statement with the same
4981 indentation.
4982
4983 In the following example, the call to "bar" is misleadingly
4984 indented as if it were guarded by the "if" conditional.
4985
4986 if (some_condition ())
4987 foo ();
4988 bar (); /* Gotcha: this is not guarded by the "if". */
4989
4990 In the case of mixed tabs and spaces, the warning uses the
4991 -ftabstop= option to determine if the statements line up
4992 (defaulting to 8).
4993
4994 The warning is not issued for code involving multiline preprocessor
4995 logic such as the following example.
4996
4997 if (flagA)
4998 foo (0);
4999 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5000 if (flagB)
5001 #endif
5002 foo (1);
5003
5004 The warning is not issued after a "#line" directive, since this
5005 typically indicates autogenerated code, and no assumptions can be
5006 made about the layout of the file that the directive references.
5007
5008 This warning is enabled by -Wall in C and C++.
5009
5010 -Wmissing-attributes
5011 Warn when a declaration of a function is missing one or more
5012 attributes that a related function is declared with and whose
5013 absence may adversely affect the correctness or efficiency of
5014 generated code. For example, the warning is issued for
5015 declarations of aliases that use attributes to specify less
5016 restrictive requirements than those of their targets. This
5017 typically represents a potential optimization opportunity. By
5018 contrast, the -Wattribute-alias=2 option controls warnings issued
5019 when the alias is more restrictive than the target, which could
5020 lead to incorrect code generation. Attributes considered include
5021 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5022 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5023 "returns_nonnull", and "returns_twice".
5024
5025 In C++, the warning is issued when an explicit specialization of a
5026 primary template declared with attribute "alloc_align",
5027 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5028 or "nonnull" is declared without it. Attributes "deprecated",
5029 "error", and "warning" suppress the warning..
5030
5031 You can use the "copy" attribute to apply the same set of
5032 attributes to a declaration as that on another declaration without
5033 explicitly enumerating the attributes. This attribute can be
5034 applied to declarations of functions, variables, or types.
5035
5036 -Wmissing-attributes is enabled by -Wall.
5037
5038 For example, since the declaration of the primary function template
5039 below makes use of both attribute "malloc" and "alloc_size" the
5040 declaration of the explicit specialization of the template is
5041 diagnosed because it is missing one of the attributes.
5042
5043 template <class T>
5044 T* __attribute__ ((malloc, alloc_size (1)))
5045 allocate (size_t);
5046
5047 template <>
5048 void* __attribute__ ((malloc)) // missing alloc_size
5049 allocate<void> (size_t);
5050
5051 -Wmissing-braces
5052 Warn if an aggregate or union initializer is not fully bracketed.
5053 In the following example, the initializer for "a" is not fully
5054 bracketed, but that for "b" is fully bracketed.
5055
5056 int a[2][2] = { 0, 1, 2, 3 };
5057 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5058
5059 This warning is enabled by -Wall.
5060
5061 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
5062 Warn if a user-supplied include directory does not exist.
5063
5064 -Wno-missing-profile
5065 This option controls warnings if feedback profiles are missing when
5066 using the -fprofile-use option. This option diagnoses those cases
5067 where a new function or a new file is added between compiling with
5068 -fprofile-generate and with -fprofile-use, without regenerating the
5069 profiles. In these cases, the profile feedback data files do not
5070 contain any profile feedback information for the newly added
5071 function or file respectively. Also, in the case when profile
5072 count data (.gcda) files are removed, GCC cannot use any profile
5073 feedback information. In all these cases, warnings are issued to
5074 inform you that a profile generation step is due. Ignoring the
5075 warning can result in poorly optimized code. -Wno-missing-profile
5076 can be used to disable the warning, but this is not recommended and
5077 should be done only when non-existent profile data is justified.
5078
5079 -Wno-mismatched-dealloc
5080 Warn for calls to deallocation functions with pointer arguments
5081 returned from from allocations functions for which the former isn't
5082 a suitable deallocator. A pair of functions can be associated as
5083 matching allocators and deallocators by use of attribute "malloc".
5084 Unless disabled by the -fno-builtin option the standard functions
5085 "calloc", "malloc", "realloc", and "free", as well as the
5086 corresponding forms of C++ "operator new" and "operator delete" are
5087 implicitly associated as matching allocators and deallocators. In
5088 the following example "mydealloc" is the deallocator for pointers
5089 returned from "myalloc".
5090
5091 void mydealloc (void*);
5092
5093 __attribute__ ((malloc (mydealloc, 1))) void*
5094 myalloc (size_t);
5095
5096 void f (void)
5097 {
5098 void *p = myalloc (32);
5099 // ...use p...
5100 free (p); // warning: not a matching deallocator for myalloc
5101 mydealloc (p); // ok
5102 }
5103
5104 In C++, the related option -Wmismatched-new-delete diagnoses
5105 mismatches involving either "operator new" or "operator delete".
5106
5107 Option -Wmismatched-dealloc is enabled by default.
5108
5109 -Wmultistatement-macros
5110 Warn about unsafe multiple statement macros that appear to be
5111 guarded by a clause such as "if", "else", "for", "switch", or
5112 "while", in which only the first statement is actually guarded
5113 after the macro is expanded.
5114
5115 For example:
5116
5117 #define DOIT x++; y++
5118 if (c)
5119 DOIT;
5120
5121 will increment "y" unconditionally, not just when "c" holds. The
5122 can usually be fixed by wrapping the macro in a do-while loop:
5123
5124 #define DOIT do { x++; y++; } while (0)
5125 if (c)
5126 DOIT;
5127
5128 This warning is enabled by -Wall in C and C++.
5129
5130 -Wparentheses
5131 Warn if parentheses are omitted in certain contexts, such as when
5132 there is an assignment in a context where a truth value is
5133 expected, or when operators are nested whose precedence people
5134 often get confused about.
5135
5136 Also warn if a comparison like "x<=y<=z" appears; this is
5137 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5138 interpretation from that of ordinary mathematical notation.
5139
5140 Also warn for dangerous uses of the GNU extension to "?:" with
5141 omitted middle operand. When the condition in the "?": operator is
5142 a boolean expression, the omitted value is always 1. Often
5143 programmers expect it to be a value computed inside the conditional
5144 expression instead.
5145
5146 For C++ this also warns for some cases of unnecessary parentheses
5147 in declarations, which can indicate an attempt at a function call
5148 instead of a declaration:
5149
5150 {
5151 // Declares a local variable called mymutex.
5152 std::unique_lock<std::mutex> (mymutex);
5153 // User meant std::unique_lock<std::mutex> lock (mymutex);
5154 }
5155
5156 This warning is enabled by -Wall.
5157
5158 -Wsequence-point
5159 Warn about code that may have undefined semantics because of
5160 violations of sequence point rules in the C and C++ standards.
5161
5162 The C and C++ standards define the order in which expressions in a
5163 C/C++ program are evaluated in terms of sequence points, which
5164 represent a partial ordering between the execution of parts of the
5165 program: those executed before the sequence point, and those
5166 executed after it. These occur after the evaluation of a full
5167 expression (one which is not part of a larger expression), after
5168 the evaluation of the first operand of a "&&", "||", "? :" or ","
5169 (comma) operator, before a function is called (but after the
5170 evaluation of its arguments and the expression denoting the called
5171 function), and in certain other places. Other than as expressed by
5172 the sequence point rules, the order of evaluation of subexpressions
5173 of an expression is not specified. All these rules describe only a
5174 partial order rather than a total order, since, for example, if two
5175 functions are called within one expression with no sequence point
5176 between them, the order in which the functions are called is not
5177 specified. However, the standards committee have ruled that
5178 function calls do not overlap.
5179
5180 It is not specified when between sequence points modifications to
5181 the values of objects take effect. Programs whose behavior depends
5182 on this have undefined behavior; the C and C++ standards specify
5183 that "Between the previous and next sequence point an object shall
5184 have its stored value modified at most once by the evaluation of an
5185 expression. Furthermore, the prior value shall be read only to
5186 determine the value to be stored.". If a program breaks these
5187 rules, the results on any particular implementation are entirely
5188 unpredictable.
5189
5190 Examples of code with undefined behavior are "a = a++;", "a[n] =
5191 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5192 diagnosed by this option, and it may give an occasional false
5193 positive result, but in general it has been found fairly effective
5194 at detecting this sort of problem in programs.
5195
5196 The C++17 standard will define the order of evaluation of operands
5197 in more cases: in particular it requires that the right-hand side
5198 of an assignment be evaluated before the left-hand side, so the
5199 above examples are no longer undefined. But this option will still
5200 warn about them, to help people avoid writing code that is
5201 undefined in C and earlier revisions of C++.
5202
5203 The standard is worded confusingly, therefore there is some debate
5204 over the precise meaning of the sequence point rules in subtle
5205 cases. Links to discussions of the problem, including proposed
5206 formal definitions, may be found on the GCC readings page, at
5207 <http://gcc.gnu.org/readings.html>.
5208
5209 This warning is enabled by -Wall for C and C++.
5210
5211 -Wno-return-local-addr
5212 Do not warn about returning a pointer (or in C++, a reference) to a
5213 variable that goes out of scope after the function returns.
5214
5215 -Wreturn-type
5216 Warn whenever a function is defined with a return type that
5217 defaults to "int". Also warn about any "return" statement with no
5218 return value in a function whose return type is not "void" (falling
5219 off the end of the function body is considered returning without a
5220 value).
5221
5222 For C only, warn about a "return" statement with an expression in a
5223 function whose return type is "void", unless the expression type is
5224 also "void". As a GNU extension, the latter case is accepted
5225 without a warning unless -Wpedantic is used. Attempting to use the
5226 return value of a non-"void" function other than "main" that flows
5227 off the end by reaching the closing curly brace that terminates the
5228 function is undefined.
5229
5230 Unlike in C, in C++, flowing off the end of a non-"void" function
5231 other than "main" results in undefined behavior even when the value
5232 of the function is not used.
5233
5234 This warning is enabled by default in C++ and by -Wall otherwise.
5235
5236 -Wno-shift-count-negative
5237 Controls warnings if a shift count is negative. This warning is
5238 enabled by default.
5239
5240 -Wno-shift-count-overflow
5241 Controls warnings if a shift count is greater than or equal to the
5242 bit width of the type. This warning is enabled by default.
5243
5244 -Wshift-negative-value
5245 Warn if left shifting a negative value. This warning is enabled by
5246 -Wextra in C99 and C++11 modes (and newer).
5247
5248 -Wno-shift-overflow
5249 -Wshift-overflow=n
5250 These options control warnings about left shift overflows.
5251
5252 -Wshift-overflow=1
5253 This is the warning level of -Wshift-overflow and is enabled by
5254 default in C99 and C++11 modes (and newer). This warning level
5255 does not warn about left-shifting 1 into the sign bit.
5256 (However, in C, such an overflow is still rejected in contexts
5257 where an integer constant expression is required.) No warning
5258 is emitted in C++20 mode (and newer), as signed left shifts
5259 always wrap.
5260
5261 -Wshift-overflow=2
5262 This warning level also warns about left-shifting 1 into the
5263 sign bit, unless C++14 mode (or newer) is active.
5264
5265 -Wswitch
5266 Warn whenever a "switch" statement has an index of enumerated type
5267 and lacks a "case" for one or more of the named codes of that
5268 enumeration. (The presence of a "default" label prevents this
5269 warning.) "case" labels outside the enumeration range also provoke
5270 warnings when this option is used (even if there is a "default"
5271 label). This warning is enabled by -Wall.
5272
5273 -Wswitch-default
5274 Warn whenever a "switch" statement does not have a "default" case.
5275
5276 -Wswitch-enum
5277 Warn whenever a "switch" statement has an index of enumerated type
5278 and lacks a "case" for one or more of the named codes of that
5279 enumeration. "case" labels outside the enumeration range also
5280 provoke warnings when this option is used. The only difference
5281 between -Wswitch and this option is that this option gives a
5282 warning about an omitted enumeration code even if there is a
5283 "default" label.
5284
5285 -Wno-switch-bool
5286 Do not warn when a "switch" statement has an index of boolean type
5287 and the case values are outside the range of a boolean type. It is
5288 possible to suppress this warning by casting the controlling
5289 expression to a type other than "bool". For example:
5290
5291 switch ((int) (a == 4))
5292 {
5293 ...
5294 }
5295
5296 This warning is enabled by default for C and C++ programs.
5297
5298 -Wno-switch-outside-range
5299 This option controls warnings when a "switch" case has a value that
5300 is outside of its respective type range. This warning is enabled
5301 by default for C and C++ programs.
5302
5303 -Wno-switch-unreachable
5304 Do not warn when a "switch" statement contains statements between
5305 the controlling expression and the first case label, which will
5306 never be executed. For example:
5307
5308 switch (cond)
5309 {
5310 i = 15;
5311 ...
5312 case 5:
5313 ...
5314 }
5315
5316 -Wswitch-unreachable does not warn if the statement between the
5317 controlling expression and the first case label is just a
5318 declaration:
5319
5320 switch (cond)
5321 {
5322 int i;
5323 ...
5324 case 5:
5325 i = 5;
5326 ...
5327 }
5328
5329 This warning is enabled by default for C and C++ programs.
5330
5331 -Wsync-nand (C and C++ only)
5332 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5333 built-in functions are used. These functions changed semantics in
5334 GCC 4.4.
5335
5336 -Wunused-but-set-parameter
5337 Warn whenever a function parameter is assigned to, but otherwise
5338 unused (aside from its declaration).
5339
5340 To suppress this warning use the "unused" attribute.
5341
5342 This warning is also enabled by -Wunused together with -Wextra.
5343
5344 -Wunused-but-set-variable
5345 Warn whenever a local variable is assigned to, but otherwise unused
5346 (aside from its declaration). This warning is enabled by -Wall.
5347
5348 To suppress this warning use the "unused" attribute.
5349
5350 This warning is also enabled by -Wunused, which is enabled by
5351 -Wall.
5352
5353 -Wunused-function
5354 Warn whenever a static function is declared but not defined or a
5355 non-inline static function is unused. This warning is enabled by
5356 -Wall.
5357
5358 -Wunused-label
5359 Warn whenever a label is declared but not used. This warning is
5360 enabled by -Wall.
5361
5362 To suppress this warning use the "unused" attribute.
5363
5364 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5365 Warn when a typedef locally defined in a function is not used.
5366 This warning is enabled by -Wall.
5367
5368 -Wunused-parameter
5369 Warn whenever a function parameter is unused aside from its
5370 declaration.
5371
5372 To suppress this warning use the "unused" attribute.
5373
5374 -Wno-unused-result
5375 Do not warn if a caller of a function marked with attribute
5376 "warn_unused_result" does not use its return value. The default is
5377 -Wunused-result.
5378
5379 -Wunused-variable
5380 Warn whenever a local or static variable is unused aside from its
5381 declaration. This option implies -Wunused-const-variable=1 for C,
5382 but not for C++. This warning is enabled by -Wall.
5383
5384 To suppress this warning use the "unused" attribute.
5385
5386 -Wunused-const-variable
5387 -Wunused-const-variable=n
5388 Warn whenever a constant static variable is unused aside from its
5389 declaration. -Wunused-const-variable=1 is enabled by
5390 -Wunused-variable for C, but not for C++. In C this declares
5391 variable storage, but in C++ this is not an error since const
5392 variables take the place of "#define"s.
5393
5394 To suppress this warning use the "unused" attribute.
5395
5396 -Wunused-const-variable=1
5397 This is the warning level that is enabled by -Wunused-variable
5398 for C. It warns only about unused static const variables
5399 defined in the main compilation unit, but not about static
5400 const variables declared in any header included.
5401
5402 -Wunused-const-variable=2
5403 This warning level also warns for unused constant static
5404 variables in headers (excluding system headers). This is the
5405 warning level of -Wunused-const-variable and must be explicitly
5406 requested since in C++ this isn't an error and in C it might be
5407 harder to clean up all headers included.
5408
5409 -Wunused-value
5410 Warn whenever a statement computes a result that is explicitly not
5411 used. To suppress this warning cast the unused expression to
5412 "void". This includes an expression-statement or the left-hand side
5413 of a comma expression that contains no side effects. For example,
5414 an expression such as "x[i,j]" causes a warning, while
5415 "x[(void)i,j]" does not.
5416
5417 This warning is enabled by -Wall.
5418
5419 -Wunused
5420 All the above -Wunused options combined.
5421
5422 In order to get a warning about an unused function parameter, you
5423 must either specify -Wextra -Wunused (note that -Wall implies
5424 -Wunused), or separately specify -Wunused-parameter.
5425
5426 -Wuninitialized
5427 Warn if an object with automatic or allocated storage duration is
5428 used without having been initialized. In C++, also warn if a non-
5429 static reference or non-static "const" member appears in a class
5430 without constructors.
5431
5432 In addition, passing a pointer (or in C++, a reference) to an
5433 uninitialized object to a "const"-qualified argument of a built-in
5434 function known to read the object is also diagnosed by this
5435 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5436
5437 If you want to warn about code that uses the uninitialized value of
5438 the variable in its own initializer, use the -Winit-self option.
5439
5440 These warnings occur for individual uninitialized elements of
5441 structure, union or array variables as well as for variables that
5442 are uninitialized as a whole. They do not occur for variables or
5443 elements declared "volatile". Because these warnings depend on
5444 optimization, the exact variables or elements for which there are
5445 warnings depend on the precise optimization options and version of
5446 GCC used.
5447
5448 Note that there may be no warning about a variable that is used
5449 only to compute a value that itself is never used, because such
5450 computations may be deleted by data flow analysis before the
5451 warnings are printed.
5452
5453 -Wno-invalid-memory-model
5454 This option controls warnings for invocations of __atomic Builtins,
5455 __sync Builtins, and the C11 atomic generic functions with a memory
5456 consistency argument that is either invalid for the operation or
5457 outside the range of values of the "memory_order" enumeration. For
5458 example, since the "__atomic_store" and "__atomic_store_n" built-
5459 ins are only defined for the relaxed, release, and sequentially
5460 consistent memory orders the following code is diagnosed:
5461
5462 void store (int *i)
5463 {
5464 __atomic_store_n (i, 0, memory_order_consume);
5465 }
5466
5467 -Winvalid-memory-model is enabled by default.
5468
5469 -Wmaybe-uninitialized
5470 For an object with automatic or allocated storage duration, if
5471 there exists a path from the function entry to a use of the object
5472 that is initialized, but there exist some other paths for which the
5473 object is not initialized, the compiler emits a warning if it
5474 cannot prove the uninitialized paths are not executed at run time.
5475
5476 In addition, passing a pointer (or in C++, a reference) to an
5477 uninitialized object to a "const"-qualified function argument is
5478 also diagnosed by this warning. (-Wuninitialized is issued for
5479 built-in functions known to read the object.) Annotating the
5480 function with attribute "access (none)" indicates that the argument
5481 isn't used to access the object and avoids the warning.
5482
5483 These warnings are only possible in optimizing compilation, because
5484 otherwise GCC does not keep track of the state of variables.
5485
5486 These warnings are made optional because GCC may not be able to
5487 determine when the code is correct in spite of appearing to have an
5488 error. Here is one example of how this can happen:
5489
5490 {
5491 int x;
5492 switch (y)
5493 {
5494 case 1: x = 1;
5495 break;
5496 case 2: x = 4;
5497 break;
5498 case 3: x = 5;
5499 }
5500 foo (x);
5501 }
5502
5503 If the value of "y" is always 1, 2 or 3, then "x" is always
5504 initialized, but GCC doesn't know this. To suppress the warning,
5505 you need to provide a default case with assert(0) or similar code.
5506
5507 This option also warns when a non-volatile automatic variable might
5508 be changed by a call to "longjmp". The compiler sees only the
5509 calls to "setjmp". It cannot know where "longjmp" will be called;
5510 in fact, a signal handler could call it at any point in the code.
5511 As a result, you may get a warning even when there is in fact no
5512 problem because "longjmp" cannot in fact be called at the place
5513 that would cause a problem.
5514
5515 Some spurious warnings can be avoided if you declare all the
5516 functions you use that never return as "noreturn".
5517
5518 This warning is enabled by -Wall or -Wextra.
5519
5520 -Wunknown-pragmas
5521 Warn when a "#pragma" directive is encountered that is not
5522 understood by GCC. If this command-line option is used, warnings
5523 are even issued for unknown pragmas in system header files. This
5524 is not the case if the warnings are only enabled by the -Wall
5525 command-line option.
5526
5527 -Wno-pragmas
5528 Do not warn about misuses of pragmas, such as incorrect parameters,
5529 invalid syntax, or conflicts between pragmas. See also
5530 -Wunknown-pragmas.
5531
5532 -Wno-prio-ctor-dtor
5533 Do not warn if a priority from 0 to 100 is used for constructor or
5534 destructor. The use of constructor and destructor attributes allow
5535 you to assign a priority to the constructor/destructor to control
5536 its order of execution before "main" is called or after it returns.
5537 The priority values must be greater than 100 as the compiler
5538 reserves priority values between 0--100 for the implementation.
5539
5540 -Wstrict-aliasing
5541 This option is only active when -fstrict-aliasing is active. It
5542 warns about code that might break the strict aliasing rules that
5543 the compiler is using for optimization. The warning does not catch
5544 all cases, but does attempt to catch the more common pitfalls. It
5545 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
5546
5547 -Wstrict-aliasing=n
5548 This option is only active when -fstrict-aliasing is active. It
5549 warns about code that might break the strict aliasing rules that
5550 the compiler is using for optimization. Higher levels correspond
5551 to higher accuracy (fewer false positives). Higher levels also
5552 correspond to more effort, similar to the way -O works.
5553 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
5554
5555 Level 1: Most aggressive, quick, least accurate. Possibly useful
5556 when higher levels do not warn but -fstrict-aliasing still breaks
5557 the code, as it has very few false negatives. However, it has many
5558 false positives. Warns for all pointer conversions between
5559 possibly incompatible types, even if never dereferenced. Runs in
5560 the front end only.
5561
5562 Level 2: Aggressive, quick, not too precise. May still have many
5563 false positives (not as many as level 1 though), and few false
5564 negatives (but possibly more than level 1). Unlike level 1, it
5565 only warns when an address is taken. Warns about incomplete types.
5566 Runs in the front end only.
5567
5568 Level 3 (default for -Wstrict-aliasing): Should have very few false
5569 positives and few false negatives. Slightly slower than levels 1
5570 or 2 when optimization is enabled. Takes care of the common
5571 pun+dereference pattern in the front end: "*(int*)&some_float". If
5572 optimization is enabled, it also runs in the back end, where it
5573 deals with multiple statement cases using flow-sensitive points-to
5574 information. Only warns when the converted pointer is
5575 dereferenced. Does not warn about incomplete types.
5576
5577 -Wstrict-overflow
5578 -Wstrict-overflow=n
5579 This option is only active when signed overflow is undefined. It
5580 warns about cases where the compiler optimizes based on the
5581 assumption that signed overflow does not occur. Note that it does
5582 not warn about all cases where the code might overflow: it only
5583 warns about cases where the compiler implements some optimization.
5584 Thus this warning depends on the optimization level.
5585
5586 An optimization that assumes that signed overflow does not occur is
5587 perfectly safe if the values of the variables involved are such
5588 that overflow never does, in fact, occur. Therefore this warning
5589 can easily give a false positive: a warning about code that is not
5590 actually a problem. To help focus on important issues, several
5591 warning levels are defined. No warnings are issued for the use of
5592 undefined signed overflow when estimating how many iterations a
5593 loop requires, in particular when determining whether a loop will
5594 be executed at all.
5595
5596 -Wstrict-overflow=1
5597 Warn about cases that are both questionable and easy to avoid.
5598 For example the compiler simplifies "x + 1 > x" to 1. This
5599 level of -Wstrict-overflow is enabled by -Wall; higher levels
5600 are not, and must be explicitly requested.
5601
5602 -Wstrict-overflow=2
5603 Also warn about other cases where a comparison is simplified to
5604 a constant. For example: "abs (x) >= 0". This can only be
5605 simplified when signed integer overflow is undefined, because
5606 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
5607 zero. -Wstrict-overflow (with no level) is the same as
5608 -Wstrict-overflow=2.
5609
5610 -Wstrict-overflow=3
5611 Also warn about other cases where a comparison is simplified.
5612 For example: "x + 1 > 1" is simplified to "x > 0".
5613
5614 -Wstrict-overflow=4
5615 Also warn about other simplifications not covered by the above
5616 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
5617
5618 -Wstrict-overflow=5
5619 Also warn about cases where the compiler reduces the magnitude
5620 of a constant involved in a comparison. For example: "x + 2 >
5621 y" is simplified to "x + 1 >= y". This is reported only at the
5622 highest warning level because this simplification applies to
5623 many comparisons, so this warning level gives a very large
5624 number of false positives.
5625
5626 -Wstring-compare
5627 Warn for calls to "strcmp" and "strncmp" whose result is determined
5628 to be either zero or non-zero in tests for such equality owing to
5629 the length of one argument being greater than the size of the array
5630 the other argument is stored in (or the bound in the case of
5631 "strncmp"). Such calls could be mistakes. For example, the call
5632 to "strcmp" below is diagnosed because its result is necessarily
5633 non-zero irrespective of the contents of the array "a".
5634
5635 extern char a[4];
5636 void f (char *d)
5637 {
5638 strcpy (d, "string");
5639 ...
5640 if (0 == strcmp (a, d)) // cannot be true
5641 puts ("a and d are the same");
5642 }
5643
5644 -Wstring-compare is enabled by -Wextra.
5645
5646 -Wno-stringop-overflow
5647 -Wstringop-overflow
5648 -Wstringop-overflow=type
5649 Warn for calls to string manipulation functions such as "memcpy"
5650 and "strcpy" that are determined to overflow the destination
5651 buffer. The optional argument is one greater than the type of
5652 Object Size Checking to perform to determine the size of the
5653 destination. The argument is meaningful only for functions that
5654 operate on character arrays but not for raw memory functions like
5655 "memcpy" which always make use of Object Size type-0. The option
5656 also warns for calls that specify a size in excess of the largest
5657 possible object or at most "SIZE_MAX / 2" bytes. The option
5658 produces the best results with optimization enabled but can detect
5659 a small subset of simple buffer overflows even without optimization
5660 in calls to the GCC built-in functions like "__builtin_memcpy" that
5661 correspond to the standard functions. In any case, the option
5662 warns about just a subset of buffer overflows detected by the
5663 corresponding overflow checking built-ins. For example, the option
5664 issues a warning for the "strcpy" call below because it copies at
5665 least 5 characters (the string "blue" including the terminating
5666 NUL) into the buffer of size 4.
5667
5668 enum Color { blue, purple, yellow };
5669 const char* f (enum Color clr)
5670 {
5671 static char buf [4];
5672 const char *str;
5673 switch (clr)
5674 {
5675 case blue: str = "blue"; break;
5676 case purple: str = "purple"; break;
5677 case yellow: str = "yellow"; break;
5678 }
5679
5680 return strcpy (buf, str); // warning here
5681 }
5682
5683 Option -Wstringop-overflow=2 is enabled by default.
5684
5685 -Wstringop-overflow
5686 -Wstringop-overflow=1
5687 The -Wstringop-overflow=1 option uses type-zero Object Size
5688 Checking to determine the sizes of destination objects. At
5689 this setting the option does not warn for writes past the end
5690 of subobjects of larger objects accessed by pointers unless the
5691 size of the largest surrounding object is known. When the
5692 destination may be one of several objects it is assumed to be
5693 the largest one of them. On Linux systems, when optimization
5694 is enabled at this setting the option warns for the same code
5695 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
5696 value.
5697
5698 -Wstringop-overflow=2
5699 The -Wstringop-overflow=2 option uses type-one Object Size
5700 Checking to determine the sizes of destination objects. At
5701 this setting the option warns about overflows when writing to
5702 members of the largest complete objects whose exact size is
5703 known. However, it does not warn for excessive writes to the
5704 same members of unknown objects referenced by pointers since
5705 they may point to arrays containing unknown numbers of
5706 elements. This is the default setting of the option.
5707
5708 -Wstringop-overflow=3
5709 The -Wstringop-overflow=3 option uses type-two Object Size
5710 Checking to determine the sizes of destination objects. At
5711 this setting the option warns about overflowing the smallest
5712 object or data member. This is the most restrictive setting of
5713 the option that may result in warnings for safe code.
5714
5715 -Wstringop-overflow=4
5716 The -Wstringop-overflow=4 option uses type-three Object Size
5717 Checking to determine the sizes of destination objects. At
5718 this setting the option warns about overflowing any data
5719 members, and when the destination is one of several objects it
5720 uses the size of the largest of them to decide whether to issue
5721 a warning. Similarly to -Wstringop-overflow=3 this setting of
5722 the option may result in warnings for benign code.
5723
5724 -Wno-stringop-overread
5725 Warn for calls to string manipulation functions such as "memchr",
5726 or "strcpy" that are determined to read past the end of the source
5727 sequence.
5728
5729 Option -Wstringop-overread is enabled by default.
5730
5731 -Wno-stringop-truncation
5732 Do not warn for calls to bounded string manipulation functions such
5733 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5734 copied string or leave the destination unchanged.
5735
5736 In the following example, the call to "strncat" specifies a bound
5737 that is less than the length of the source string. As a result,
5738 the copy of the source will be truncated and so the call is
5739 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5740 as the bound.
5741
5742 void append (char *buf, size_t bufsize)
5743 {
5744 strncat (buf, ".txt", 3);
5745 }
5746
5747 As another example, the following call to "strncpy" results in
5748 copying to "d" just the characters preceding the terminating NUL,
5749 without appending the NUL to the end. Assuming the result of
5750 "strncpy" is necessarily a NUL-terminated string is a common
5751 mistake, and so the call is diagnosed. To avoid the warning when
5752 the result is not expected to be NUL-terminated, call "memcpy"
5753 instead.
5754
5755 void copy (char *d, const char *s)
5756 {
5757 strncpy (d, s, strlen (s));
5758 }
5759
5760 In the following example, the call to "strncpy" specifies the size
5761 of the destination buffer as the bound. If the length of the
5762 source string is equal to or greater than this size the result of
5763 the copy will not be NUL-terminated. Therefore, the call is also
5764 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5765 bound and set the last element of the buffer to "NUL".
5766
5767 void copy (const char *s)
5768 {
5769 char buf[80];
5770 strncpy (buf, s, sizeof buf);
5771 ...
5772 }
5773
5774 In situations where a character array is intended to store a
5775 sequence of bytes with no terminating "NUL" such an array may be
5776 annotated with attribute "nonstring" to avoid this warning. Such
5777 arrays, however, are not suitable arguments to functions that
5778 expect "NUL"-terminated strings. To help detect accidental misuses
5779 of such arrays GCC issues warnings unless it can prove that the use
5780 is safe.
5781
5782 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
5783 Warn for cases where adding an attribute may be beneficial. The
5784 attributes currently supported are listed below.
5785
5786 -Wsuggest-attribute=pure
5787 -Wsuggest-attribute=const
5788 -Wsuggest-attribute=noreturn
5789 -Wmissing-noreturn
5790 -Wsuggest-attribute=malloc
5791 Warn about functions that might be candidates for attributes
5792 "pure", "const" or "noreturn" or "malloc". The compiler only
5793 warns for functions visible in other compilation units or (in
5794 the case of "pure" and "const") if it cannot prove that the
5795 function returns normally. A function returns normally if it
5796 doesn't contain an infinite loop or return abnormally by
5797 throwing, calling "abort" or trapping. This analysis requires
5798 option -fipa-pure-const, which is enabled by default at -O and
5799 higher. Higher optimization levels improve the accuracy of the
5800 analysis.
5801
5802 -Wsuggest-attribute=format
5803 -Wmissing-format-attribute
5804 Warn about function pointers that might be candidates for
5805 "format" attributes. Note these are only possible candidates,
5806 not absolute ones. GCC guesses that function pointers with
5807 "format" attributes that are used in assignment,
5808 initialization, parameter passing or return statements should
5809 have a corresponding "format" attribute in the resulting type.
5810 I.e. the left-hand side of the assignment or initialization,
5811 the type of the parameter variable, or the return type of the
5812 containing function respectively should also have a "format"
5813 attribute to avoid the warning.
5814
5815 GCC also warns about function definitions that might be
5816 candidates for "format" attributes. Again, these are only
5817 possible candidates. GCC guesses that "format" attributes
5818 might be appropriate for any function that calls a function
5819 like "vprintf" or "vscanf", but this might not always be the
5820 case, and some functions for which "format" attributes are
5821 appropriate may not be detected.
5822
5823 -Wsuggest-attribute=cold
5824 Warn about functions that might be candidates for "cold"
5825 attribute. This is based on static detection and generally
5826 only warns about functions which always leads to a call to
5827 another "cold" function such as wrappers of C++ "throw" or
5828 fatal error reporting functions leading to "abort".
5829
5830 -Walloc-zero
5831 Warn about calls to allocation functions decorated with attribute
5832 "alloc_size" that specify zero bytes, including those to the built-
5833 in forms of the functions "aligned_alloc", "alloca", "calloc",
5834 "malloc", and "realloc". Because the behavior of these functions
5835 when called with a zero size differs among implementations (and in
5836 the case of "realloc" has been deprecated) relying on it may result
5837 in subtle portability bugs and should be avoided.
5838
5839 -Walloc-size-larger-than=byte-size
5840 Warn about calls to functions decorated with attribute "alloc_size"
5841 that attempt to allocate objects larger than the specified number
5842 of bytes, or where the result of the size computation in an integer
5843 type with infinite precision would exceed the value of PTRDIFF_MAX
5844 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
5845 default. Warnings controlled by the option can be disabled either
5846 by specifying byte-size of SIZE_MAX or more or by
5847 -Wno-alloc-size-larger-than.
5848
5849 -Wno-alloc-size-larger-than
5850 Disable -Walloc-size-larger-than= warnings. The option is
5851 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
5852
5853 -Walloca
5854 This option warns on all uses of "alloca" in the source.
5855
5856 -Walloca-larger-than=byte-size
5857 This option warns on calls to "alloca" with an integer argument
5858 whose value is either zero, or that is not bounded by a controlling
5859 predicate that limits its value to at most byte-size. It also
5860 warns for calls to "alloca" where the bound value is unknown.
5861 Arguments of non-integer types are considered unbounded even if
5862 they appear to be constrained to the expected range.
5863
5864 For example, a bounded case of "alloca" could be:
5865
5866 void func (size_t n)
5867 {
5868 void *p;
5869 if (n <= 1000)
5870 p = alloca (n);
5871 else
5872 p = malloc (n);
5873 f (p);
5874 }
5875
5876 In the above example, passing "-Walloca-larger-than=1000" would not
5877 issue a warning because the call to "alloca" is known to be at most
5878 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
5879 the compiler would emit a warning.
5880
5881 Unbounded uses, on the other hand, are uses of "alloca" with no
5882 controlling predicate constraining its integer argument. For
5883 example:
5884
5885 void func ()
5886 {
5887 void *p = alloca (n);
5888 f (p);
5889 }
5890
5891 If "-Walloca-larger-than=500" were passed, the above would trigger
5892 a warning, but this time because of the lack of bounds checking.
5893
5894 Note, that even seemingly correct code involving signed integers
5895 could cause a warning:
5896
5897 void func (signed int n)
5898 {
5899 if (n < 500)
5900 {
5901 p = alloca (n);
5902 f (p);
5903 }
5904 }
5905
5906 In the above example, n could be negative, causing a larger than
5907 expected argument to be implicitly cast into the "alloca" call.
5908
5909 This option also warns when "alloca" is used in a loop.
5910
5911 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
5912 usually only effective when -ftree-vrp is active (default for -O2
5913 and above).
5914
5915 See also -Wvla-larger-than=byte-size.
5916
5917 -Wno-alloca-larger-than
5918 Disable -Walloca-larger-than= warnings. The option is equivalent
5919 to -Walloca-larger-than=SIZE_MAX or larger.
5920
5921 -Warith-conversion
5922 Do warn about implicit conversions from arithmetic operations even
5923 when conversion of the operands to the same type cannot change
5924 their values. This affects warnings from -Wconversion,
5925 -Wfloat-conversion, and -Wsign-conversion.
5926
5927 void f (char c, int i)
5928 {
5929 c = c + i; // warns with B<-Wconversion>
5930 c = c + 1; // only warns with B<-Warith-conversion>
5931 }
5932
5933 -Warray-bounds
5934 -Warray-bounds=n
5935 This option is only active when -ftree-vrp is active (default for
5936 -O2 and above). It warns about subscripts to arrays that are always
5937 out of bounds. This warning is enabled by -Wall.
5938
5939 -Warray-bounds=1
5940 This is the warning level of -Warray-bounds and is enabled by
5941 -Wall; higher levels are not, and must be explicitly requested.
5942
5943 -Warray-bounds=2
5944 This warning level also warns about out of bounds access for
5945 arrays at the end of a struct and for arrays accessed through
5946 pointers. This warning level may give a larger number of false
5947 positives and is deactivated by default.
5948
5949 -Warray-parameter
5950 -Warray-parameter=n
5951 Warn about redeclarations of functions involving arguments of array
5952 or pointer types of inconsistent kinds or forms, and enable the
5953 detection of out-of-bounds accesses to such parameters by warnings
5954 such as -Warray-bounds.
5955
5956 If the first function declaration uses the array form the bound
5957 specified in the array is assumed to be the minimum number of
5958 elements expected to be provided in calls to the function and the
5959 maximum number of elements accessed by it. Failing to provide
5960 arguments of sufficient size or accessing more than the maximum
5961 number of elements may be diagnosed by warnings such as
5962 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
5963 involving array parameters declared using the "T[static N]" form.
5964
5965 For example, the warning triggers for the following redeclarations
5966 because the first one allows an array of any size to be passed to
5967 "f" while the second one with the keyword "static" specifies that
5968 the array argument must have at least four elements.
5969
5970 void f (int[static 4]);
5971 void f (int[]); // warning (inconsistent array form)
5972
5973 void g (void)
5974 {
5975 int *p = (int *)malloc (4);
5976 f (p); // warning (array too small)
5977 ...
5978 }
5979
5980 At level 2 the warning also triggers for redeclarations involving
5981 any other inconsistency in array or pointer argument forms denoting
5982 array sizes. Pointers and arrays of unspecified bound are
5983 considered equivalent and do not trigger a warning.
5984
5985 void g (int*);
5986 void g (int[]); // no warning
5987 void g (int[8]); // warning (inconsistent array bound)
5988
5989 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
5990 option triggers warnings for similar inconsistencies involving
5991 Variable Length Array arguments.
5992
5993 -Wattribute-alias=n
5994 -Wno-attribute-alias
5995 Warn about declarations using the "alias" and similar attributes
5996 whose target is incompatible with the type of the alias.
5997
5998 -Wattribute-alias=1
5999 The default warning level of the -Wattribute-alias option
6000 diagnoses incompatibilities between the type of the alias
6001 declaration and that of its target. Such incompatibilities are
6002 typically indicative of bugs.
6003
6004 -Wattribute-alias=2
6005 At this level -Wattribute-alias also diagnoses cases where the
6006 attributes of the alias declaration are more restrictive than
6007 the attributes applied to its target. These mismatches can
6008 potentially result in incorrect code generation. In other
6009 cases they may be benign and could be resolved simply by adding
6010 the missing attribute to the target. For comparison, see the
6011 -Wmissing-attributes option, which controls diagnostics when
6012 the alias declaration is less restrictive than the target,
6013 rather than more restrictive.
6014
6015 Attributes considered include "alloc_align", "alloc_size",
6016 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6017 "noreturn", "nothrow", "pure", "returns_nonnull", and
6018 "returns_twice".
6019
6020 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6021 the default. You can disable these warnings with either
6022 -Wno-attribute-alias or -Wattribute-alias=0.
6023
6024 -Wbool-compare
6025 Warn about boolean expression compared with an integer value
6026 different from "true"/"false". For instance, the following
6027 comparison is always false:
6028
6029 int n = 5;
6030 ...
6031 if ((n > 1) == 2) { ... }
6032
6033 This warning is enabled by -Wall.
6034
6035 -Wbool-operation
6036 Warn about suspicious operations on expressions of a boolean type.
6037 For instance, bitwise negation of a boolean is very likely a bug in
6038 the program. For C, this warning also warns about incrementing or
6039 decrementing a boolean, which rarely makes sense. (In C++,
6040 decrementing a boolean is always invalid. Incrementing a boolean
6041 is invalid in C++17, and deprecated otherwise.)
6042
6043 This warning is enabled by -Wall.
6044
6045 -Wduplicated-branches
6046 Warn when an if-else has identical branches. This warning detects
6047 cases like
6048
6049 if (p != NULL)
6050 return 0;
6051 else
6052 return 0;
6053
6054 It doesn't warn when both branches contain just a null statement.
6055 This warning also warn for conditional operators:
6056
6057 int i = x ? *p : *p;
6058
6059 -Wduplicated-cond
6060 Warn about duplicated conditions in an if-else-if chain. For
6061 instance, warn for the following code:
6062
6063 if (p->q != NULL) { ... }
6064 else if (p->q != NULL) { ... }
6065
6066 -Wframe-address
6067 Warn when the __builtin_frame_address or __builtin_return_address
6068 is called with an argument greater than 0. Such calls may return
6069 indeterminate values or crash the program. The warning is included
6070 in -Wall.
6071
6072 -Wno-discarded-qualifiers (C and Objective-C only)
6073 Do not warn if type qualifiers on pointers are being discarded.
6074 Typically, the compiler warns if a "const char *" variable is
6075 passed to a function that takes a "char *" parameter. This option
6076 can be used to suppress such a warning.
6077
6078 -Wno-discarded-array-qualifiers (C and Objective-C only)
6079 Do not warn if type qualifiers on arrays which are pointer targets
6080 are being discarded. Typically, the compiler warns if a "const int
6081 (*)[]" variable is passed to a function that takes a "int (*)[]"
6082 parameter. This option can be used to suppress such a warning.
6083
6084 -Wno-incompatible-pointer-types (C and Objective-C only)
6085 Do not warn when there is a conversion between pointers that have
6086 incompatible types. This warning is for cases not covered by
6087 -Wno-pointer-sign, which warns for pointer argument passing or
6088 assignment with different signedness.
6089
6090 -Wno-int-conversion (C and Objective-C only)
6091 Do not warn about incompatible integer to pointer and pointer to
6092 integer conversions. This warning is about implicit conversions;
6093 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6094 -Wno-pointer-to-int-cast may be used.
6095
6096 -Wzero-length-bounds
6097 Warn about accesses to elements of zero-length array members that
6098 might overlap other members of the same object. Declaring interior
6099 zero-length arrays is discouraged because accesses to them are
6100 undefined. See
6101
6102 For example, the first two stores in function "bad" are diagnosed
6103 because the array elements overlap the subsequent members "b" and
6104 "c". The third store is diagnosed by -Warray-bounds because it is
6105 beyond the bounds of the enclosing object.
6106
6107 struct X { int a[0]; int b, c; };
6108 struct X x;
6109
6110 void bad (void)
6111 {
6112 x.a[0] = 0; // -Wzero-length-bounds
6113 x.a[1] = 1; // -Wzero-length-bounds
6114 x.a[2] = 2; // -Warray-bounds
6115 }
6116
6117 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6118
6119 -Wno-div-by-zero
6120 Do not warn about compile-time integer division by zero. Floating-
6121 point division by zero is not warned about, as it can be a
6122 legitimate way of obtaining infinities and NaNs.
6123
6124 -Wsystem-headers
6125 Print warning messages for constructs found in system header files.
6126 Warnings from system headers are normally suppressed, on the
6127 assumption that they usually do not indicate real problems and
6128 would only make the compiler output harder to read. Using this
6129 command-line option tells GCC to emit warnings from system headers
6130 as if they occurred in user code. However, note that using -Wall
6131 in conjunction with this option does not warn about unknown pragmas
6132 in system headers---for that, -Wunknown-pragmas must also be used.
6133
6134 -Wtautological-compare
6135 Warn if a self-comparison always evaluates to true or false. This
6136 warning detects various mistakes such as:
6137
6138 int i = 1;
6139 ...
6140 if (i > i) { ... }
6141
6142 This warning also warns about bitwise comparisons that always
6143 evaluate to true or false, for instance:
6144
6145 if ((a & 16) == 10) { ... }
6146
6147 will always be false.
6148
6149 This warning is enabled by -Wall.
6150
6151 -Wtrampolines
6152 Warn about trampolines generated for pointers to nested functions.
6153 A trampoline is a small piece of data or code that is created at
6154 run time on the stack when the address of a nested function is
6155 taken, and is used to call the nested function indirectly. For
6156 some targets, it is made up of data only and thus requires no
6157 special treatment. But, for most targets, it is made up of code
6158 and thus requires the stack to be made executable in order for the
6159 program to work properly.
6160
6161 -Wfloat-equal
6162 Warn if floating-point values are used in equality comparisons.
6163
6164 The idea behind this is that sometimes it is convenient (for the
6165 programmer) to consider floating-point values as approximations to
6166 infinitely precise real numbers. If you are doing this, then you
6167 need to compute (by analyzing the code, or in some other way) the
6168 maximum or likely maximum error that the computation introduces,
6169 and allow for it when performing comparisons (and when producing
6170 output, but that's a different problem). In particular, instead of
6171 testing for equality, you should check to see whether the two
6172 values have ranges that overlap; and this is done with the
6173 relational operators, so equality comparisons are probably
6174 mistaken.
6175
6176 -Wtraditional (C and Objective-C only)
6177 Warn about certain constructs that behave differently in
6178 traditional and ISO C. Also warn about ISO C constructs that have
6179 no traditional C equivalent, and/or problematic constructs that
6180 should be avoided.
6181
6182 * Macro parameters that appear within string literals in the
6183 macro body. In traditional C macro replacement takes place
6184 within string literals, but in ISO C it does not.
6185
6186 * In traditional C, some preprocessor directives did not exist.
6187 Traditional preprocessors only considered a line to be a
6188 directive if the # appeared in column 1 on the line. Therefore
6189 -Wtraditional warns about directives that traditional C
6190 understands but ignores because the # does not appear as the
6191 first character on the line. It also suggests you hide
6192 directives like "#pragma" not understood by traditional C by
6193 indenting them. Some traditional implementations do not
6194 recognize "#elif", so this option suggests avoiding it
6195 altogether.
6196
6197 * A function-like macro that appears without arguments.
6198
6199 * The unary plus operator.
6200
6201 * The U integer constant suffix, or the F or L floating-point
6202 constant suffixes. (Traditional C does support the L suffix on
6203 integer constants.) Note, these suffixes appear in macros
6204 defined in the system headers of most modern systems, e.g. the
6205 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6206 code might normally lead to spurious warnings, however GCC's
6207 integrated preprocessor has enough context to avoid warning in
6208 these cases.
6209
6210 * A function declared external in one block and then used after
6211 the end of the block.
6212
6213 * A "switch" statement has an operand of type "long".
6214
6215 * A non-"static" function declaration follows a "static" one.
6216 This construct is not accepted by some traditional C compilers.
6217
6218 * The ISO type of an integer constant has a different width or
6219 signedness from its traditional type. This warning is only
6220 issued if the base of the constant is ten. I.e. hexadecimal or
6221 octal values, which typically represent bit patterns, are not
6222 warned about.
6223
6224 * Usage of ISO string concatenation is detected.
6225
6226 * Initialization of automatic aggregates.
6227
6228 * Identifier conflicts with labels. Traditional C lacks a
6229 separate namespace for labels.
6230
6231 * Initialization of unions. If the initializer is zero, the
6232 warning is omitted. This is done under the assumption that the
6233 zero initializer in user code appears conditioned on e.g.
6234 "__STDC__" to avoid missing initializer warnings and relies on
6235 default initialization to zero in the traditional C case.
6236
6237 * Conversions by prototypes between fixed/floating-point values
6238 and vice versa. The absence of these prototypes when compiling
6239 with traditional C causes serious problems. This is a subset
6240 of the possible conversion warnings; for the full set use
6241 -Wtraditional-conversion.
6242
6243 * Use of ISO C style function definitions. This warning
6244 intentionally is not issued for prototype declarations or
6245 variadic functions because these ISO C features appear in your
6246 code when using libiberty's traditional C compatibility macros,
6247 "PARAMS" and "VPARAMS". This warning is also bypassed for
6248 nested functions because that feature is already a GCC
6249 extension and thus not relevant to traditional C compatibility.
6250
6251 -Wtraditional-conversion (C and Objective-C only)
6252 Warn if a prototype causes a type conversion that is different from
6253 what would happen to the same argument in the absence of a
6254 prototype. This includes conversions of fixed point to floating
6255 and vice versa, and conversions changing the width or signedness of
6256 a fixed-point argument except when the same as the default
6257 promotion.
6258
6259 -Wdeclaration-after-statement (C and Objective-C only)
6260 Warn when a declaration is found after a statement in a block.
6261 This construct, known from C++, was introduced with ISO C99 and is
6262 by default allowed in GCC. It is not supported by ISO C90.
6263
6264 -Wshadow
6265 Warn whenever a local variable or type declaration shadows another
6266 variable, parameter, type, class member (in C++), or instance
6267 variable (in Objective-C) or whenever a built-in function is
6268 shadowed. Note that in C++, the compiler warns if a local variable
6269 shadows an explicit typedef, but not if it shadows a
6270 struct/class/enum. If this warning is enabled, it includes also
6271 all instances of local shadowing. This means that
6272 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6273 -Wshadow is used. Same as -Wshadow=global.
6274
6275 -Wno-shadow-ivar (Objective-C only)
6276 Do not warn whenever a local variable shadows an instance variable
6277 in an Objective-C method.
6278
6279 -Wshadow=global
6280 Warn for any shadowing. Same as -Wshadow.
6281
6282 -Wshadow=local
6283 Warn when a local variable shadows another local variable or
6284 parameter.
6285
6286 -Wshadow=compatible-local
6287 Warn when a local variable shadows another local variable or
6288 parameter whose type is compatible with that of the shadowing
6289 variable. In C++, type compatibility here means the type of the
6290 shadowing variable can be converted to that of the shadowed
6291 variable. The creation of this flag (in addition to
6292 -Wshadow=local) is based on the idea that when a local variable
6293 shadows another one of incompatible type, it is most likely
6294 intentional, not a bug or typo, as shown in the following example:
6295
6296 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6297 {
6298 for (int i = 0; i < N; ++i)
6299 {
6300 ...
6301 }
6302 ...
6303 }
6304
6305 Since the two variable "i" in the example above have incompatible
6306 types, enabling only -Wshadow=compatible-local does not emit a
6307 warning. Because their types are incompatible, if a programmer
6308 accidentally uses one in place of the other, type checking is
6309 expected to catch that and emit an error or warning. Use of this
6310 flag instead of -Wshadow=local can possibly reduce the number of
6311 warnings triggered by intentional shadowing. Note that this also
6312 means that shadowing "const char *i" by "char *i" does not emit a
6313 warning.
6314
6315 This warning is also enabled by -Wshadow=local.
6316
6317 -Wlarger-than=byte-size
6318 Warn whenever an object is defined whose size exceeds byte-size.
6319 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6320 controlled by the option can be disabled either by specifying byte-
6321 size of SIZE_MAX or more or by -Wno-larger-than.
6322
6323 Also warn for calls to bounded functions such as "memchr" or
6324 "strnlen" that specify a bound greater than the largest possible
6325 object, which is PTRDIFF_MAX bytes by default. These warnings can
6326 only be disabled by -Wno-larger-than.
6327
6328 -Wno-larger-than
6329 Disable -Wlarger-than= warnings. The option is equivalent to
6330 -Wlarger-than=SIZE_MAX or larger.
6331
6332 -Wframe-larger-than=byte-size
6333 Warn if the size of a function frame exceeds byte-size. The
6334 computation done to determine the stack frame size is approximate
6335 and not conservative. The actual requirements may be somewhat
6336 greater than byte-size even if you do not get a warning. In
6337 addition, any space allocated via "alloca", variable-length arrays,
6338 or related constructs is not included by the compiler when
6339 determining whether or not to issue a warning.
6340 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6341 controlled by the option can be disabled either by specifying byte-
6342 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6343
6344 -Wno-frame-larger-than
6345 Disable -Wframe-larger-than= warnings. The option is equivalent to
6346 -Wframe-larger-than=SIZE_MAX or larger.
6347
6348 -Wno-free-nonheap-object
6349 Warn when attempting to deallocate an object that was either not
6350 allocated on the heap, or by using a pointer that was not returned
6351 from a prior call to the corresponding allocation function. For
6352 example, because the call to "stpcpy" returns a pointer to the
6353 terminating nul character and not to the begginning of the object,
6354 the call to "free" below is diagnosed.
6355
6356 void f (char *p)
6357 {
6358 p = stpcpy (p, "abc");
6359 // ...
6360 free (p); // warning
6361 }
6362
6363 -Wfree-nonheap-object is enabled by default.
6364
6365 -Wstack-usage=byte-size
6366 Warn if the stack usage of a function might exceed byte-size. The
6367 computation done to determine the stack usage is conservative. Any
6368 space allocated via "alloca", variable-length arrays, or related
6369 constructs is included by the compiler when determining whether or
6370 not to issue a warning.
6371
6372 The message is in keeping with the output of -fstack-usage.
6373
6374 * If the stack usage is fully static but exceeds the specified
6375 amount, it's:
6376
6377 warning: stack usage is 1120 bytes
6378
6379 * If the stack usage is (partly) dynamic but bounded, it's:
6380
6381 warning: stack usage might be 1648 bytes
6382
6383 * If the stack usage is (partly) dynamic and not bounded, it's:
6384
6385 warning: stack usage might be unbounded
6386
6387 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
6388 controlled by the option can be disabled either by specifying byte-
6389 size of SIZE_MAX or more or by -Wno-stack-usage.
6390
6391 -Wno-stack-usage
6392 Disable -Wstack-usage= warnings. The option is equivalent to
6393 -Wstack-usage=SIZE_MAX or larger.
6394
6395 -Wunsafe-loop-optimizations
6396 Warn if the loop cannot be optimized because the compiler cannot
6397 assume anything on the bounds of the loop indices. With
6398 -funsafe-loop-optimizations warn if the compiler makes such
6399 assumptions.
6400
6401 -Wno-pedantic-ms-format (MinGW targets only)
6402 When used in combination with -Wformat and -pedantic without GNU
6403 extensions, this option disables the warnings about non-ISO
6404 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
6405 used on Windows targets, which depend on the MS runtime.
6406
6407 -Wpointer-arith
6408 Warn about anything that depends on the "size of" a function type
6409 or of "void". GNU C assigns these types a size of 1, for
6410 convenience in calculations with "void *" pointers and pointers to
6411 functions. In C++, warn also when an arithmetic operation involves
6412 "NULL". This warning is also enabled by -Wpedantic.
6413
6414 -Wno-pointer-compare
6415 Do not warn if a pointer is compared with a zero character
6416 constant. This usually means that the pointer was meant to be
6417 dereferenced. For example:
6418
6419 const char *p = foo ();
6420 if (p == '\0')
6421 return 42;
6422
6423 Note that the code above is invalid in C++11.
6424
6425 This warning is enabled by default.
6426
6427 -Wtsan
6428 Warn about unsupported features in ThreadSanitizer.
6429
6430 ThreadSanitizer does not support "std::atomic_thread_fence" and can
6431 report false positives.
6432
6433 This warning is enabled by default.
6434
6435 -Wtype-limits
6436 Warn if a comparison is always true or always false due to the
6437 limited range of the data type, but do not warn for constant
6438 expressions. For example, warn if an unsigned variable is compared
6439 against zero with "<" or ">=". This warning is also enabled by
6440 -Wextra.
6441
6442 -Wabsolute-value (C and Objective-C only)
6443 Warn for calls to standard functions that compute the absolute
6444 value of an argument when a more appropriate standard function is
6445 available. For example, calling "abs(3.14)" triggers the warning
6446 because the appropriate function to call to compute the absolute
6447 value of a double argument is "fabs". The option also triggers
6448 warnings when the argument in a call to such a function has an
6449 unsigned type. This warning can be suppressed with an explicit
6450 type cast and it is also enabled by -Wextra.
6451
6452 -Wcomment
6453 -Wcomments
6454 Warn whenever a comment-start sequence /* appears in a /* comment,
6455 or whenever a backslash-newline appears in a // comment. This
6456 warning is enabled by -Wall.
6457
6458 -Wtrigraphs
6459 Warn if any trigraphs are encountered that might change the meaning
6460 of the program. Trigraphs within comments are not warned about,
6461 except those that would form escaped newlines.
6462
6463 This option is implied by -Wall. If -Wall is not given, this
6464 option is still enabled unless trigraphs are enabled. To get
6465 trigraph conversion without warnings, but get the other -Wall
6466 warnings, use -trigraphs -Wall -Wno-trigraphs.
6467
6468 -Wundef
6469 Warn if an undefined identifier is evaluated in an "#if" directive.
6470 Such identifiers are replaced with zero.
6471
6472 -Wexpansion-to-defined
6473 Warn whenever defined is encountered in the expansion of a macro
6474 (including the case where the macro is expanded by an #if
6475 directive). Such usage is not portable. This warning is also
6476 enabled by -Wpedantic and -Wextra.
6477
6478 -Wunused-macros
6479 Warn about macros defined in the main file that are unused. A
6480 macro is used if it is expanded or tested for existence at least
6481 once. The preprocessor also warns if the macro has not been used
6482 at the time it is redefined or undefined.
6483
6484 Built-in macros, macros defined on the command line, and macros
6485 defined in include files are not warned about.
6486
6487 Note: If a macro is actually used, but only used in skipped
6488 conditional blocks, then the preprocessor reports it as unused. To
6489 avoid the warning in such a case, you might improve the scope of
6490 the macro's definition by, for example, moving it into the first
6491 skipped block. Alternatively, you could provide a dummy use with
6492 something like:
6493
6494 #if defined the_macro_causing_the_warning
6495 #endif
6496
6497 -Wno-endif-labels
6498 Do not warn whenever an "#else" or an "#endif" are followed by
6499 text. This sometimes happens in older programs with code of the
6500 form
6501
6502 #if FOO
6503 ...
6504 #else FOO
6505 ...
6506 #endif FOO
6507
6508 The second and third "FOO" should be in comments. This warning is
6509 on by default.
6510
6511 -Wbad-function-cast (C and Objective-C only)
6512 Warn when a function call is cast to a non-matching type. For
6513 example, warn if a call to a function returning an integer type is
6514 cast to a pointer type.
6515
6516 -Wc90-c99-compat (C and Objective-C only)
6517 Warn about features not present in ISO C90, but present in ISO C99.
6518 For instance, warn about use of variable length arrays, "long long"
6519 type, "bool" type, compound literals, designated initializers, and
6520 so on. This option is independent of the standards mode. Warnings
6521 are disabled in the expression that follows "__extension__".
6522
6523 -Wc99-c11-compat (C and Objective-C only)
6524 Warn about features not present in ISO C99, but present in ISO C11.
6525 For instance, warn about use of anonymous structures and unions,
6526 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
6527 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
6528 so on. This option is independent of the standards mode. Warnings
6529 are disabled in the expression that follows "__extension__".
6530
6531 -Wc11-c2x-compat (C and Objective-C only)
6532 Warn about features not present in ISO C11, but present in ISO C2X.
6533 For instance, warn about omitting the string in "_Static_assert",
6534 use of [[]] syntax for attributes, use of decimal floating-point
6535 types, and so on. This option is independent of the standards
6536 mode. Warnings are disabled in the expression that follows
6537 "__extension__".
6538
6539 -Wc++-compat (C and Objective-C only)
6540 Warn about ISO C constructs that are outside of the common subset
6541 of ISO C and ISO C++, e.g. request for implicit conversion from
6542 "void *" to a pointer to non-"void" type.
6543
6544 -Wc++11-compat (C++ and Objective-C++ only)
6545 Warn about C++ constructs whose meaning differs between ISO C++
6546 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
6547 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
6548 enabled by -Wall.
6549
6550 -Wc++14-compat (C++ and Objective-C++ only)
6551 Warn about C++ constructs whose meaning differs between ISO C++
6552 2011 and ISO C++ 2014. This warning is enabled by -Wall.
6553
6554 -Wc++17-compat (C++ and Objective-C++ only)
6555 Warn about C++ constructs whose meaning differs between ISO C++
6556 2014 and ISO C++ 2017. This warning is enabled by -Wall.
6557
6558 -Wc++20-compat (C++ and Objective-C++ only)
6559 Warn about C++ constructs whose meaning differs between ISO C++
6560 2017 and ISO C++ 2020. This warning is enabled by -Wall.
6561
6562 -Wcast-qual
6563 Warn whenever a pointer is cast so as to remove a type qualifier
6564 from the target type. For example, warn if a "const char *" is
6565 cast to an ordinary "char *".
6566
6567 Also warn when making a cast that introduces a type qualifier in an
6568 unsafe way. For example, casting "char **" to "const char **" is
6569 unsafe, as in this example:
6570
6571 /* p is char ** value. */
6572 const char **q = (const char **) p;
6573 /* Assignment of readonly string to const char * is OK. */
6574 *q = "string";
6575 /* Now char** pointer points to read-only memory. */
6576 **p = 'b';
6577
6578 -Wcast-align
6579 Warn whenever a pointer is cast such that the required alignment of
6580 the target is increased. For example, warn if a "char *" is cast
6581 to an "int *" on machines where integers can only be accessed at
6582 two- or four-byte boundaries.
6583
6584 -Wcast-align=strict
6585 Warn whenever a pointer is cast such that the required alignment of
6586 the target is increased. For example, warn if a "char *" is cast
6587 to an "int *" regardless of the target machine.
6588
6589 -Wcast-function-type
6590 Warn when a function pointer is cast to an incompatible function
6591 pointer. In a cast involving function types with a variable
6592 argument list only the types of initial arguments that are provided
6593 are considered. Any parameter of pointer-type matches any other
6594 pointer-type. Any benign differences in integral types are
6595 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
6596 qualifiers are ignored. The function type "void (*) (void)" is
6597 special and matches everything, which can be used to suppress this
6598 warning. In a cast involving pointer to member types this warning
6599 warns whenever the type cast is changing the pointer to member
6600 type. This warning is enabled by -Wextra.
6601
6602 -Wwrite-strings
6603 When compiling C, give string constants the type "const
6604 char[length]" so that copying the address of one into a non-"const"
6605 "char *" pointer produces a warning. These warnings help you find
6606 at compile time code that can try to write into a string constant,
6607 but only if you have been very careful about using "const" in
6608 declarations and prototypes. Otherwise, it is just a nuisance.
6609 This is why we did not make -Wall request these warnings.
6610
6611 When compiling C++, warn about the deprecated conversion from
6612 string literals to "char *". This warning is enabled by default
6613 for C++ programs.
6614
6615 -Wclobbered
6616 Warn for variables that might be changed by "longjmp" or "vfork".
6617 This warning is also enabled by -Wextra.
6618
6619 -Wconversion
6620 Warn for implicit conversions that may alter a value. This includes
6621 conversions between real and integer, like "abs (x)" when "x" is
6622 "double"; conversions between signed and unsigned, like "unsigned
6623 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
6624 not warn for explicit casts like "abs ((int) x)" and "ui =
6625 (unsigned) -1", or if the value is not changed by the conversion
6626 like in "abs (2.0)". Warnings about conversions between signed and
6627 unsigned integers can be disabled by using -Wno-sign-conversion.
6628
6629 For C++, also warn for confusing overload resolution for user-
6630 defined conversions; and conversions that never use a type
6631 conversion operator: conversions to "void", the same type, a base
6632 class or a reference to them. Warnings about conversions between
6633 signed and unsigned integers are disabled by default in C++ unless
6634 -Wsign-conversion is explicitly enabled.
6635
6636 Warnings about conversion from arithmetic on a small type back to
6637 that type are only given with -Warith-conversion.
6638
6639 -Wdangling-else
6640 Warn about constructions where there may be confusion to which "if"
6641 statement an "else" branch belongs. Here is an example of such a
6642 case:
6643
6644 {
6645 if (a)
6646 if (b)
6647 foo ();
6648 else
6649 bar ();
6650 }
6651
6652 In C/C++, every "else" branch belongs to the innermost possible
6653 "if" statement, which in this example is "if (b)". This is often
6654 not what the programmer expected, as illustrated in the above
6655 example by indentation the programmer chose. When there is the
6656 potential for this confusion, GCC issues a warning when this flag
6657 is specified. To eliminate the warning, add explicit braces around
6658 the innermost "if" statement so there is no way the "else" can
6659 belong to the enclosing "if". The resulting code looks like this:
6660
6661 {
6662 if (a)
6663 {
6664 if (b)
6665 foo ();
6666 else
6667 bar ();
6668 }
6669 }
6670
6671 This warning is enabled by -Wparentheses.
6672
6673 -Wdate-time
6674 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
6675 encountered as they might prevent bit-wise-identical reproducible
6676 compilations.
6677
6678 -Wempty-body
6679 Warn if an empty body occurs in an "if", "else" or "do while"
6680 statement. This warning is also enabled by -Wextra.
6681
6682 -Wno-endif-labels
6683 Do not warn about stray tokens after "#else" and "#endif".
6684
6685 -Wenum-compare
6686 Warn about a comparison between values of different enumerated
6687 types. In C++ enumerated type mismatches in conditional
6688 expressions are also diagnosed and the warning is enabled by
6689 default. In C this warning is enabled by -Wall.
6690
6691 -Wenum-conversion
6692 Warn when a value of enumerated type is implicitly converted to a
6693 different enumerated type. This warning is enabled by -Wextra in
6694 C.
6695
6696 -Wjump-misses-init (C, Objective-C only)
6697 Warn if a "goto" statement or a "switch" statement jumps forward
6698 across the initialization of a variable, or jumps backward to a
6699 label after the variable has been initialized. This only warns
6700 about variables that are initialized when they are declared. This
6701 warning is only supported for C and Objective-C; in C++ this sort
6702 of branch is an error in any case.
6703
6704 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
6705 with the -Wno-jump-misses-init option.
6706
6707 -Wsign-compare
6708 Warn when a comparison between signed and unsigned values could
6709 produce an incorrect result when the signed value is converted to
6710 unsigned. In C++, this warning is also enabled by -Wall. In C, it
6711 is also enabled by -Wextra.
6712
6713 -Wsign-conversion
6714 Warn for implicit conversions that may change the sign of an
6715 integer value, like assigning a signed integer expression to an
6716 unsigned integer variable. An explicit cast silences the warning.
6717 In C, this option is enabled also by -Wconversion.
6718
6719 -Wfloat-conversion
6720 Warn for implicit conversions that reduce the precision of a real
6721 value. This includes conversions from real to integer, and from
6722 higher precision real to lower precision real values. This option
6723 is also enabled by -Wconversion.
6724
6725 -Wno-scalar-storage-order
6726 Do not warn on suspicious constructs involving reverse scalar
6727 storage order.
6728
6729 -Wsizeof-array-div
6730 Warn about divisions of two sizeof operators when the first one is
6731 applied to an array and the divisor does not equal the size of the
6732 array element. In such a case, the computation will not yield the
6733 number of elements in the array, which is likely what the user
6734 intended. This warning warns e.g. about
6735
6736 int fn ()
6737 {
6738 int arr[10];
6739 return sizeof (arr) / sizeof (short);
6740 }
6741
6742 This warning is enabled by -Wall.
6743
6744 -Wsizeof-pointer-div
6745 Warn for suspicious divisions of two sizeof expressions that divide
6746 the pointer size by the element size, which is the usual way to
6747 compute the array size but won't work out correctly with pointers.
6748 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
6749 "ptr" is not an array, but a pointer. This warning is enabled by
6750 -Wall.
6751
6752 -Wsizeof-pointer-memaccess
6753 Warn for suspicious length parameters to certain string and memory
6754 built-in functions if the argument uses "sizeof". This warning
6755 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
6756 is not an array, but a pointer, and suggests a possible fix, or
6757 about "memcpy (&foo, ptr, sizeof (&foo));".
6758 -Wsizeof-pointer-memaccess also warns about calls to bounded string
6759 copy functions like "strncat" or "strncpy" that specify as the
6760 bound a "sizeof" expression of the source array. For example, in
6761 the following function the call to "strncat" specifies the size of
6762 the source string as the bound. That is almost certainly a mistake
6763 and so the call is diagnosed.
6764
6765 void make_file (const char *name)
6766 {
6767 char path[PATH_MAX];
6768 strncpy (path, name, sizeof path - 1);
6769 strncat (path, ".text", sizeof ".text");
6770 ...
6771 }
6772
6773 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
6774
6775 -Wno-sizeof-array-argument
6776 Do not warn when the "sizeof" operator is applied to a parameter
6777 that is declared as an array in a function definition. This
6778 warning is enabled by default for C and C++ programs.
6779
6780 -Wmemset-elt-size
6781 Warn for suspicious calls to the "memset" built-in function, if the
6782 first argument references an array, and the third argument is a
6783 number equal to the number of elements, but not equal to the size
6784 of the array in memory. This indicates that the user has omitted a
6785 multiplication by the element size. This warning is enabled by
6786 -Wall.
6787
6788 -Wmemset-transposed-args
6789 Warn for suspicious calls to the "memset" built-in function where
6790 the second argument is not zero and the third argument is zero.
6791 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
6792 because "memset (buf, 0, sizeof buf)" was meant instead. The
6793 diagnostic is only emitted if the third argument is a literal zero.
6794 Otherwise, if it is an expression that is folded to zero, or a cast
6795 of zero to some type, it is far less likely that the arguments have
6796 been mistakenly transposed and no warning is emitted. This warning
6797 is enabled by -Wall.
6798
6799 -Waddress
6800 Warn about suspicious uses of memory addresses. These include using
6801 the address of a function in a conditional expression, such as
6802 "void func(void); if (func)", and comparisons against the memory
6803 address of a string literal, such as "if (x == "abc")". Such uses
6804 typically indicate a programmer error: the address of a function
6805 always evaluates to true, so their use in a conditional usually
6806 indicate that the programmer forgot the parentheses in a function
6807 call; and comparisons against string literals result in unspecified
6808 behavior and are not portable in C, so they usually indicate that
6809 the programmer intended to use "strcmp". This warning is enabled
6810 by -Wall.
6811
6812 -Wno-address-of-packed-member
6813 Do not warn when the address of packed member of struct or union is
6814 taken, which usually results in an unaligned pointer value. This
6815 is enabled by default.
6816
6817 -Wlogical-op
6818 Warn about suspicious uses of logical operators in expressions.
6819 This includes using logical operators in contexts where a bit-wise
6820 operator is likely to be expected. Also warns when the operands of
6821 a logical operator are the same:
6822
6823 extern int a;
6824 if (a < 0 && a < 0) { ... }
6825
6826 -Wlogical-not-parentheses
6827 Warn about logical not used on the left hand side operand of a
6828 comparison. This option does not warn if the right operand is
6829 considered to be a boolean expression. Its purpose is to detect
6830 suspicious code like the following:
6831
6832 int a;
6833 ...
6834 if (!a > 1) { ... }
6835
6836 It is possible to suppress the warning by wrapping the LHS into
6837 parentheses:
6838
6839 if ((!a) > 1) { ... }
6840
6841 This warning is enabled by -Wall.
6842
6843 -Waggregate-return
6844 Warn if any functions that return structures or unions are defined
6845 or called. (In languages where you can return an array, this also
6846 elicits a warning.)
6847
6848 -Wno-aggressive-loop-optimizations
6849 Warn if in a loop with constant number of iterations the compiler
6850 detects undefined behavior in some statement during one or more of
6851 the iterations.
6852
6853 -Wno-attributes
6854 Do not warn if an unexpected "__attribute__" is used, such as
6855 unrecognized attributes, function attributes applied to variables,
6856 etc. This does not stop errors for incorrect use of supported
6857 attributes.
6858
6859 -Wno-builtin-declaration-mismatch
6860 Warn if a built-in function is declared with an incompatible
6861 signature or as a non-function, or when a built-in function
6862 declared with a type that does not include a prototype is called
6863 with arguments whose promoted types do not match those expected by
6864 the function. When -Wextra is specified, also warn when a built-in
6865 function that takes arguments is declared without a prototype. The
6866 -Wbuiltin-declaration-mismatch warning is enabled by default. To
6867 avoid the warning include the appropriate header to bring the
6868 prototypes of built-in functions into scope.
6869
6870 For example, the call to "memset" below is diagnosed by the warning
6871 because the function expects a value of type "size_t" as its
6872 argument but the type of 32 is "int". With -Wextra, the
6873 declaration of the function is diagnosed as well.
6874
6875 extern void* memset ();
6876 void f (void *d)
6877 {
6878 memset (d, '\0', 32);
6879 }
6880
6881 -Wno-builtin-macro-redefined
6882 Do not warn if certain built-in macros are redefined. This
6883 suppresses warnings for redefinition of "__TIMESTAMP__",
6884 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
6885
6886 -Wstrict-prototypes (C and Objective-C only)
6887 Warn if a function is declared or defined without specifying the
6888 argument types. (An old-style function definition is permitted
6889 without a warning if preceded by a declaration that specifies the
6890 argument types.)
6891
6892 -Wold-style-declaration (C and Objective-C only)
6893 Warn for obsolescent usages, according to the C Standard, in a
6894 declaration. For example, warn if storage-class specifiers like
6895 "static" are not the first things in a declaration. This warning
6896 is also enabled by -Wextra.
6897
6898 -Wold-style-definition (C and Objective-C only)
6899 Warn if an old-style function definition is used. A warning is
6900 given even if there is a previous prototype. A definition using ()
6901 is not considered an old-style definition in C2X mode, because it
6902 is equivalent to (void) in that case, but is considered an old-
6903 style definition for older standards.
6904
6905 -Wmissing-parameter-type (C and Objective-C only)
6906 A function parameter is declared without a type specifier in
6907 K&R-style functions:
6908
6909 void foo(bar) { }
6910
6911 This warning is also enabled by -Wextra.
6912
6913 -Wmissing-prototypes (C and Objective-C only)
6914 Warn if a global function is defined without a previous prototype
6915 declaration. This warning is issued even if the definition itself
6916 provides a prototype. Use this option to detect global functions
6917 that do not have a matching prototype declaration in a header file.
6918 This option is not valid for C++ because all function declarations
6919 provide prototypes and a non-matching declaration declares an
6920 overload rather than conflict with an earlier declaration. Use
6921 -Wmissing-declarations to detect missing declarations in C++.
6922
6923 -Wmissing-declarations
6924 Warn if a global function is defined without a previous
6925 declaration. Do so even if the definition itself provides a
6926 prototype. Use this option to detect global functions that are not
6927 declared in header files. In C, no warnings are issued for
6928 functions with previous non-prototype declarations; use
6929 -Wmissing-prototypes to detect missing prototypes. In C++, no
6930 warnings are issued for function templates, or for inline
6931 functions, or for functions in anonymous namespaces.
6932
6933 -Wmissing-field-initializers
6934 Warn if a structure's initializer has some fields missing. For
6935 example, the following code causes such a warning, because "x.h" is
6936 implicitly zero:
6937
6938 struct s { int f, g, h; };
6939 struct s x = { 3, 4 };
6940
6941 This option does not warn about designated initializers, so the
6942 following modification does not trigger a warning:
6943
6944 struct s { int f, g, h; };
6945 struct s x = { .f = 3, .g = 4 };
6946
6947 In C this option does not warn about the universal zero initializer
6948 { 0 }:
6949
6950 struct s { int f, g, h; };
6951 struct s x = { 0 };
6952
6953 Likewise, in C++ this option does not warn about the empty { }
6954 initializer, for example:
6955
6956 struct s { int f, g, h; };
6957 s x = { };
6958
6959 This warning is included in -Wextra. To get other -Wextra warnings
6960 without this one, use -Wextra -Wno-missing-field-initializers.
6961
6962 -Wno-multichar
6963 Do not warn if a multicharacter constant ('FOOF') is used. Usually
6964 they indicate a typo in the user's code, as they have
6965 implementation-defined values, and should not be used in portable
6966 code.
6967
6968 -Wnormalized=[none|id|nfc|nfkc]
6969 In ISO C and ISO C++, two identifiers are different if they are
6970 different sequences of characters. However, sometimes when
6971 characters outside the basic ASCII character set are used, you can
6972 have two different character sequences that look the same. To
6973 avoid confusion, the ISO 10646 standard sets out some normalization
6974 rules which when applied ensure that two sequences that look the
6975 same are turned into the same sequence. GCC can warn you if you
6976 are using identifiers that have not been normalized; this option
6977 controls that warning.
6978
6979 There are four levels of warning supported by GCC. The default is
6980 -Wnormalized=nfc, which warns about any identifier that is not in
6981 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
6982 form for most uses. It is equivalent to -Wnormalized.
6983
6984 Unfortunately, there are some characters allowed in identifiers by
6985 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6986 identifiers. That is, there's no way to use these symbols in
6987 portable ISO C or C++ and have all your identifiers in NFC.
6988 -Wnormalized=id suppresses the warning for these characters. It is
6989 hoped that future versions of the standards involved will correct
6990 this, which is why this option is not the default.
6991
6992 You can switch the warning off for all characters by writing
6993 -Wnormalized=none or -Wno-normalized. You should only do this if
6994 you are using some other normalization scheme (like "D"), because
6995 otherwise you can easily create bugs that are literally impossible
6996 to see.
6997
6998 Some characters in ISO 10646 have distinct meanings but look
6999 identical in some fonts or display methodologies, especially once
7000 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7001 LATIN SMALL LETTER N", displays just like a regular "n" that has
7002 been placed in a superscript. ISO 10646 defines the NFKC
7003 normalization scheme to convert all these into a standard form as
7004 well, and GCC warns if your code is not in NFKC if you use
7005 -Wnormalized=nfkc. This warning is comparable to warning about
7006 every identifier that contains the letter O because it might be
7007 confused with the digit 0, and so is not the default, but may be
7008 useful as a local coding convention if the programming environment
7009 cannot be fixed to display these characters distinctly.
7010
7011 -Wno-attribute-warning
7012 Do not warn about usage of functions declared with "warning"
7013 attribute. By default, this warning is enabled.
7014 -Wno-attribute-warning can be used to disable the warning or
7015 -Wno-error=attribute-warning can be used to disable the error when
7016 compiled with -Werror flag.
7017
7018 -Wno-deprecated
7019 Do not warn about usage of deprecated features.
7020
7021 -Wno-deprecated-declarations
7022 Do not warn about uses of functions, variables, and types marked as
7023 deprecated by using the "deprecated" attribute.
7024
7025 -Wno-overflow
7026 Do not warn about compile-time overflow in constant expressions.
7027
7028 -Wno-odr
7029 Warn about One Definition Rule violations during link-time
7030 optimization. Enabled by default.
7031
7032 -Wopenmp-simd
7033 Warn if the vectorizer cost model overrides the OpenMP simd
7034 directive set by user. The -fsimd-cost-model=unlimited option can
7035 be used to relax the cost model.
7036
7037 -Woverride-init (C and Objective-C only)
7038 Warn if an initialized field without side effects is overridden
7039 when using designated initializers.
7040
7041 This warning is included in -Wextra. To get other -Wextra warnings
7042 without this one, use -Wextra -Wno-override-init.
7043
7044 -Wno-override-init-side-effects (C and Objective-C only)
7045 Do not warn if an initialized field with side effects is overridden
7046 when using designated initializers. This warning is enabled by
7047 default.
7048
7049 -Wpacked
7050 Warn if a structure is given the packed attribute, but the packed
7051 attribute has no effect on the layout or size of the structure.
7052 Such structures may be mis-aligned for little benefit. For
7053 instance, in this code, the variable "f.x" in "struct bar" is
7054 misaligned even though "struct bar" does not itself have the packed
7055 attribute:
7056
7057 struct foo {
7058 int x;
7059 char a, b, c, d;
7060 } __attribute__((packed));
7061 struct bar {
7062 char z;
7063 struct foo f;
7064 };
7065
7066 -Wnopacked-bitfield-compat
7067 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7068 bit-fields of type "char". This was fixed in GCC 4.4 but the
7069 change can lead to differences in the structure layout. GCC
7070 informs you when the offset of such a field has changed in GCC 4.4.
7071 For example there is no longer a 4-bit padding between field "a"
7072 and "b" in this structure:
7073
7074 struct foo
7075 {
7076 char a:4;
7077 char b:8;
7078 } __attribute__ ((packed));
7079
7080 This warning is enabled by default. Use
7081 -Wno-packed-bitfield-compat to disable this warning.
7082
7083 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7084 Warn if a structure field with explicitly specified alignment in a
7085 packed struct or union is misaligned. For example, a warning will
7086 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7087 is less than 8", in this code:
7088
7089 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7090 struct __attribute__ ((packed)) S {
7091 struct S8 s8;
7092 };
7093
7094 This warning is enabled by -Wall.
7095
7096 -Wpadded
7097 Warn if padding is included in a structure, either to align an
7098 element of the structure or to align the whole structure.
7099 Sometimes when this happens it is possible to rearrange the fields
7100 of the structure to reduce the padding and so make the structure
7101 smaller.
7102
7103 -Wredundant-decls
7104 Warn if anything is declared more than once in the same scope, even
7105 in cases where multiple declaration is valid and changes nothing.
7106
7107 -Wrestrict
7108 Warn when an object referenced by a "restrict"-qualified parameter
7109 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7110 another argument, or when copies between such objects overlap. For
7111 example, the call to the "strcpy" function below attempts to
7112 truncate the string by replacing its initial characters with the
7113 last four. However, because the call writes the terminating NUL
7114 into "a[4]", the copies overlap and the call is diagnosed.
7115
7116 void foo (void)
7117 {
7118 char a[] = "abcd1234";
7119 strcpy (a, a + 4);
7120 ...
7121 }
7122
7123 The -Wrestrict option detects some instances of simple overlap even
7124 without optimization but works best at -O2 and above. It is
7125 included in -Wall.
7126
7127 -Wnested-externs (C and Objective-C only)
7128 Warn if an "extern" declaration is encountered within a function.
7129
7130 -Winline
7131 Warn if a function that is declared as inline cannot be inlined.
7132 Even with this option, the compiler does not warn about failures to
7133 inline functions declared in system headers.
7134
7135 The compiler uses a variety of heuristics to determine whether or
7136 not to inline a function. For example, the compiler takes into
7137 account the size of the function being inlined and the amount of
7138 inlining that has already been done in the current function.
7139 Therefore, seemingly insignificant changes in the source program
7140 can cause the warnings produced by -Winline to appear or disappear.
7141
7142 -Wint-in-bool-context
7143 Warn for suspicious use of integer values where boolean values are
7144 expected, such as conditional expressions (?:) using non-boolean
7145 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7146 Or left shifting of signed integers in boolean context, like "for
7147 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7148 regardless of the data type. This warning is enabled by -Wall.
7149
7150 -Wno-int-to-pointer-cast
7151 Suppress warnings from casts to pointer type of an integer of a
7152 different size. In C++, casting to a pointer type of smaller size
7153 is an error. Wint-to-pointer-cast is enabled by default.
7154
7155 -Wno-pointer-to-int-cast (C and Objective-C only)
7156 Suppress warnings from casts from a pointer to an integer type of a
7157 different size.
7158
7159 -Winvalid-pch
7160 Warn if a precompiled header is found in the search path but cannot
7161 be used.
7162
7163 -Wlong-long
7164 Warn if "long long" type is used. This is enabled by either
7165 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
7166 the warning messages, use -Wno-long-long.
7167
7168 -Wvariadic-macros
7169 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7170 alternate syntax is used in ISO C99 mode. This is enabled by
7171 either -Wpedantic or -Wtraditional. To inhibit the warning
7172 messages, use -Wno-variadic-macros.
7173
7174 -Wno-varargs
7175 Do not warn upon questionable usage of the macros used to handle
7176 variable arguments like "va_start". These warnings are enabled by
7177 default.
7178
7179 -Wvector-operation-performance
7180 Warn if vector operation is not implemented via SIMD capabilities
7181 of the architecture. Mainly useful for the performance tuning.
7182 Vector operation can be implemented "piecewise", which means that
7183 the scalar operation is performed on every vector element; "in
7184 parallel", which means that the vector operation is implemented
7185 using scalars of wider type, which normally is more performance
7186 efficient; and "as a single scalar", which means that vector fits
7187 into a scalar type.
7188
7189 -Wvla
7190 Warn if a variable-length array is used in the code. -Wno-vla
7191 prevents the -Wpedantic warning of the variable-length array.
7192
7193 -Wvla-larger-than=byte-size
7194 If this option is used, the compiler warns for declarations of
7195 variable-length arrays whose size is either unbounded, or bounded
7196 by an argument that allows the array size to exceed byte-size
7197 bytes. This is similar to how -Walloca-larger-than=byte-size
7198 works, but with variable-length arrays.
7199
7200 Note that GCC may optimize small variable-length arrays of a known
7201 value into plain arrays, so this warning may not get triggered for
7202 such arrays.
7203
7204 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
7205 typically only effective when -ftree-vrp is active (default for -O2
7206 and above).
7207
7208 See also -Walloca-larger-than=byte-size.
7209
7210 -Wno-vla-larger-than
7211 Disable -Wvla-larger-than= warnings. The option is equivalent to
7212 -Wvla-larger-than=SIZE_MAX or larger.
7213
7214 -Wvla-parameter
7215 Warn about redeclarations of functions involving arguments of
7216 Variable Length Array types of inconsistent kinds or forms, and
7217 enable the detection of out-of-bounds accesses to such parameters
7218 by warnings such as -Warray-bounds.
7219
7220 If the first function declaration uses the VLA form the bound
7221 specified in the array is assumed to be the minimum number of
7222 elements expected to be provided in calls to the function and the
7223 maximum number of elements accessed by it. Failing to provide
7224 arguments of sufficient size or accessing more than the maximum
7225 number of elements may be diagnosed.
7226
7227 For example, the warning triggers for the following redeclarations
7228 because the first one allows an array of any size to be passed to
7229 "f" while the second one specifies that the array argument must
7230 have at least "n" elements. In addition, calling "f" with the
7231 assotiated VLA bound parameter in excess of the actual VLA bound
7232 triggers a warning as well.
7233
7234 void f (int n, int[n]);
7235 void f (int, int[]); // warning: argument 2 previously declared as a VLA
7236
7237 void g (int n)
7238 {
7239 if (n > 4)
7240 return;
7241 int a[n];
7242 f (sizeof a, a); // warning: access to a by f may be out of bounds
7243 ...
7244 }
7245
7246 -Wvla-parameter is included in -Wall. The -Warray-parameter option
7247 triggers warnings for similar problems involving ordinary array
7248 arguments.
7249
7250 -Wvolatile-register-var
7251 Warn if a register variable is declared volatile. The volatile
7252 modifier does not inhibit all optimizations that may eliminate
7253 reads and/or writes to register variables. This warning is enabled
7254 by -Wall.
7255
7256 -Wdisabled-optimization
7257 Warn if a requested optimization pass is disabled. This warning
7258 does not generally indicate that there is anything wrong with your
7259 code; it merely indicates that GCC's optimizers are unable to
7260 handle the code effectively. Often, the problem is that your code
7261 is too big or too complex; GCC refuses to optimize programs when
7262 the optimization itself is likely to take inordinate amounts of
7263 time.
7264
7265 -Wpointer-sign (C and Objective-C only)
7266 Warn for pointer argument passing or assignment with different
7267 signedness. This option is only supported for C and Objective-C.
7268 It is implied by -Wall and by -Wpedantic, which can be disabled
7269 with -Wno-pointer-sign.
7270
7271 -Wstack-protector
7272 This option is only active when -fstack-protector is active. It
7273 warns about functions that are not protected against stack
7274 smashing.
7275
7276 -Woverlength-strings
7277 Warn about string constants that are longer than the "minimum
7278 maximum" length specified in the C standard. Modern compilers
7279 generally allow string constants that are much longer than the
7280 standard's minimum limit, but very portable programs should avoid
7281 using longer strings.
7282
7283 The limit applies after string constant concatenation, and does not
7284 count the trailing NUL. In C90, the limit was 509 characters; in
7285 C99, it was raised to 4095. C++98 does not specify a normative
7286 minimum maximum, so we do not diagnose overlength strings in C++.
7287
7288 This option is implied by -Wpedantic, and can be disabled with
7289 -Wno-overlength-strings.
7290
7291 -Wunsuffixed-float-constants (C and Objective-C only)
7292 Issue a warning for any floating constant that does not have a
7293 suffix. When used together with -Wsystem-headers it warns about
7294 such constants in system header files. This can be useful when
7295 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
7296 the decimal floating-point extension to C99.
7297
7298 -Wno-lto-type-mismatch
7299 During the link-time optimization, do not warn about type
7300 mismatches in global declarations from different compilation units.
7301 Requires -flto to be enabled. Enabled by default.
7302
7303 -Wno-designated-init (C and Objective-C only)
7304 Suppress warnings when a positional initializer is used to
7305 initialize a structure that has been marked with the
7306 "designated_init" attribute.
7307
7308 Options That Control Static Analysis
7309 -fanalyzer
7310 This option enables an static analysis of program flow which looks
7311 for "interesting" interprocedural paths through the code, and
7312 issues warnings for problems found on them.
7313
7314 This analysis is much more expensive than other GCC warnings.
7315
7316 Enabling this option effectively enables the following warnings:
7317
7318 -Wanalyzer-double-fclose -Wanalyzer-double-free
7319 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
7320 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
7321 -Wanalyzer-mismatching-deallocation
7322 -Wanalyzer-possible-null-argument
7323 -Wanalyzer-possible-null-dereference -Wanalyzer-null-argument
7324 -Wanalyzer-null-dereference -Wanalyzer-shift-count-negative
7325 -Wanalyzer-shift-count-overflow -Wanalyzer-stale-setjmp-buffer
7326 -Wanalyzer-tainted-array-index
7327 -Wanalyzer-unsafe-call-within-signal-handler
7328 -Wanalyzer-use-after-free
7329 -Wanalyzer-use-of-pointer-in-stale-stack-frame
7330 -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal
7331
7332 This option is only available if GCC was configured with analyzer
7333 support enabled.
7334
7335 -Wanalyzer-too-complex
7336 If -fanalyzer is enabled, the analyzer uses various heuristics to
7337 attempt to explore the control flow and data flow in the program,
7338 but these can be defeated by sufficiently complicated code.
7339
7340 By default, the analysis silently stops if the code is too
7341 complicated for the analyzer to fully explore and it reaches an
7342 internal limit. The -Wanalyzer-too-complex option warns if this
7343 occurs.
7344
7345 -Wno-analyzer-double-fclose
7346 This warning requires -fanalyzer, which enables it; use
7347 -Wno-analyzer-double-fclose to disable it.
7348
7349 This diagnostic warns for paths through the code in which a "FILE
7350 *" can have "fclose" called on it more than once.
7351
7352 -Wno-analyzer-double-free
7353 This warning requires -fanalyzer, which enables it; use
7354 -Wno-analyzer-double-free to disable it.
7355
7356 This diagnostic warns for paths through the code in which a pointer
7357 can have a deallocator called on it more than once, either "free",
7358 or a deallocator referenced by attribute "malloc".
7359
7360 -Wno-analyzer-exposure-through-output-file
7361 This warning requires -fanalyzer, which enables it; use
7362 -Wno-analyzer-exposure-through-output-file to disable it.
7363
7364 This diagnostic warns for paths through the code in which a
7365 security-sensitive value is written to an output file (such as
7366 writing a password to a log file).
7367
7368 -Wno-analyzer-file-leak
7369 This warning requires -fanalyzer, which enables it; use
7370 -Wno-analyzer-file-leak to disable it.
7371
7372 This diagnostic warns for paths through the code in which a
7373 "<stdio.h>" "FILE *" stream object is leaked.
7374
7375 -Wno-analyzer-free-of-non-heap
7376 This warning requires -fanalyzer, which enables it; use
7377 -Wno-analyzer-free-of-non-heap to disable it.
7378
7379 This diagnostic warns for paths through the code in which "free" is
7380 called on a non-heap pointer (e.g. an on-stack buffer, or a
7381 global).
7382
7383 -Wno-analyzer-malloc-leak
7384 This warning requires -fanalyzer, which enables it; use
7385 -Wno-analyzer-malloc-leak to disable it.
7386
7387 This diagnostic warns for paths through the code in which a pointer
7388 allocated via an allocator is leaked: either "malloc", or a
7389 function marked with attribute "malloc".
7390
7391 -Wno-analyzer-mismatching-deallocation
7392 This warning requires -fanalyzer, which enables it; use
7393 -Wno-analyzer-mismatching-deallocation to disable it.
7394
7395 This diagnostic warns for paths through the code in which the wrong
7396 deallocation function is called on a pointer value, based on which
7397 function was used to allocate the pointer value. The diagnostic
7398 will warn about mismatches between "free", scalar "delete" and
7399 vector "delete[]", and those marked as allocator/deallocator pairs
7400 using attribute "malloc".
7401
7402 -Wno-analyzer-possible-null-argument
7403 This warning requires -fanalyzer, which enables it; use
7404 -Wno-analyzer-possible-null-argument to disable it.
7405
7406 This diagnostic warns for paths through the code in which a
7407 possibly-NULL value is passed to a function argument marked with
7408 "__attribute__((nonnull))" as requiring a non-NULL value.
7409
7410 -Wno-analyzer-possible-null-dereference
7411 This warning requires -fanalyzer, which enables it; use
7412 -Wno-analyzer-possible-null-dereference to disable it.
7413
7414 This diagnostic warns for paths through the code in which a
7415 possibly-NULL value is dereferenced.
7416
7417 -Wno-analyzer-null-argument
7418 This warning requires -fanalyzer, which enables it; use
7419 -Wno-analyzer-null-argument to disable it.
7420
7421 This diagnostic warns for paths through the code in which a value
7422 known to be NULL is passed to a function argument marked with
7423 "__attribute__((nonnull))" as requiring a non-NULL value.
7424
7425 -Wno-analyzer-null-dereference
7426 This warning requires -fanalyzer, which enables it; use
7427 -Wno-analyzer-null-dereference to disable it.
7428
7429 This diagnostic warns for paths through the code in which a value
7430 known to be NULL is dereferenced.
7431
7432 -Wno-analyzer-shift-count-negative
7433 This warning requires -fanalyzer, which enables it; use
7434 -Wno-analyzer-shift-count-negative to disable it.
7435
7436 This diagnostic warns for paths through the code in which a shift
7437 is attempted with a negative count. It is analogous to the
7438 -Wshift-count-negative diagnostic implemented in the C/C++ front
7439 ends, but is implemented based on analyzing interprocedural paths,
7440 rather than merely parsing the syntax tree. However, the analyzer
7441 does not prioritize detection of such paths, so false negatives are
7442 more likely relative to other warnings.
7443
7444 -Wno-analyzer-shift-count-overflow
7445 This warning requires -fanalyzer, which enables it; use
7446 -Wno-analyzer-shift-count-overflow to disable it.
7447
7448 This diagnostic warns for paths through the code in which a shift
7449 is attempted with a count greater than or equal to the precision of
7450 the operand's type. It is analogous to the -Wshift-count-overflow
7451 diagnostic implemented in the C/C++ front ends, but is implemented
7452 based on analyzing interprocedural paths, rather than merely
7453 parsing the syntax tree. However, the analyzer does not prioritize
7454 detection of such paths, so false negatives are more likely
7455 relative to other warnings.
7456
7457 -Wno-analyzer-stale-setjmp-buffer
7458 This warning requires -fanalyzer, which enables it; use
7459 -Wno-analyzer-stale-setjmp-buffer to disable it.
7460
7461 This diagnostic warns for paths through the code in which "longjmp"
7462 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
7463 function that has returned.
7464
7465 When "setjmp" is called on a "jmp_buf" to record a rewind location,
7466 it records the stack frame. The stack frame becomes invalid when
7467 the function containing the "setjmp" call returns. Attempting to
7468 rewind to it via "longjmp" would reference a stack frame that no
7469 longer exists, and likely lead to a crash (or worse).
7470
7471 -Wno-analyzer-tainted-array-index
7472 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7473 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
7474
7475 This diagnostic warns for paths through the code in which a value
7476 that could be under an attacker's control is used as the index of
7477 an array access without being sanitized.
7478
7479 -Wno-analyzer-unsafe-call-within-signal-handler
7480 This warning requires -fanalyzer, which enables it; use
7481 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
7482
7483 This diagnostic warns for paths through the code in which a
7484 function known to be async-signal-unsafe (such as "fprintf") is
7485 called from a signal handler.
7486
7487 -Wno-analyzer-use-after-free
7488 This warning requires -fanalyzer, which enables it; use
7489 -Wno-analyzer-use-after-free to disable it.
7490
7491 This diagnostic warns for paths through the code in which a pointer
7492 is used after a deallocator is called on it: either "free", or a
7493 deallocator referenced by attribute "malloc".
7494
7495 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
7496 This warning requires -fanalyzer, which enables it; use
7497 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
7498
7499 This diagnostic warns for paths through the code in which a pointer
7500 is dereferenced that points to a variable in a stale stack frame.
7501
7502 -Wno-analyzer-write-to-const
7503 This warning requires -fanalyzer, which enables it; use
7504 -Wno-analyzer-write-to-const to disable it.
7505
7506 This diagnostic warns for paths through the code in which the
7507 analyzer detects an attempt to write through a pointer to a "const"
7508 object. However, the analyzer does not prioritize detection of
7509 such paths, so false negatives are more likely relative to other
7510 warnings.
7511
7512 -Wno-analyzer-write-to-string-literal
7513 This warning requires -fanalyzer, which enables it; use
7514 -Wno-analyzer-write-to-string-literal to disable it.
7515
7516 This diagnostic warns for paths through the code in which the
7517 analyzer detects an attempt to write through a pointer to a string
7518 literal. However, the analyzer does not prioritize detection of
7519 such paths, so false negatives are more likely relative to other
7520 warnings.
7521
7522 Pertinent parameters for controlling the exploration are: --param
7523 analyzer-bb-explosion-factor=value, --param
7524 analyzer-max-enodes-per-program-point=value, --param
7525 analyzer-max-recursion-depth=value, and --param
7526 analyzer-min-snodes-for-call-summary=value.
7527
7528 The following options control the analyzer.
7529
7530 -fanalyzer-call-summaries
7531 Simplify interprocedural analysis by computing the effect of
7532 certain calls, rather than exploring all paths through the function
7533 from callsite to each possible return.
7534
7535 If enabled, call summaries are only used for functions with more
7536 than one call site, and that are sufficiently complicated (as per
7537 --param analyzer-min-snodes-for-call-summary=value).
7538
7539 -fanalyzer-checker=name
7540 Restrict the analyzer to run just the named checker, and enable it.
7541
7542 Some checkers are disabled by default (even with -fanalyzer), such
7543 as the "taint" checker that implements
7544 -Wanalyzer-tainted-array-index, and this option is required to
7545 enable them.
7546
7547 -fno-analyzer-feasibility
7548 This option is intended for analyzer developers.
7549
7550 By default the analyzer verifies that there is a feasible control
7551 flow path for each diagnostic it emits: that the conditions that
7552 hold are not mutually exclusive. Diagnostics for which no feasible
7553 path can be found are rejected. This filtering can be suppressed
7554 with -fno-analyzer-feasibility, for debugging issues in this code.
7555
7556 -fanalyzer-fine-grained
7557 This option is intended for analyzer developers.
7558
7559 Internally the analyzer builds an "exploded graph" that combines
7560 control flow graphs with data flow information.
7561
7562 By default, an edge in this graph can contain the effects of a run
7563 of multiple statements within a basic block. With
7564 -fanalyzer-fine-grained, each statement gets its own edge.
7565
7566 -fanalyzer-show-duplicate-count
7567 This option is intended for analyzer developers: if multiple
7568 diagnostics have been detected as being duplicates of each other,
7569 it emits a note when reporting the best diagnostic, giving the
7570 number of additional diagnostics that were suppressed by the
7571 deduplication logic.
7572
7573 -fno-analyzer-state-merge
7574 This option is intended for analyzer developers.
7575
7576 By default the analyzer attempts to simplify analysis by merging
7577 sufficiently similar states at each program point as it builds its
7578 "exploded graph". With -fno-analyzer-state-merge this merging can
7579 be suppressed, for debugging state-handling issues.
7580
7581 -fno-analyzer-state-purge
7582 This option is intended for analyzer developers.
7583
7584 By default the analyzer attempts to simplify analysis by purging
7585 aspects of state at a program point that appear to no longer be
7586 relevant e.g. the values of locals that aren't accessed later in
7587 the function and which aren't relevant to leak analysis.
7588
7589 With -fno-analyzer-state-purge this purging of state can be
7590 suppressed, for debugging state-handling issues.
7591
7592 -fanalyzer-transitivity
7593 This option enables transitivity of constraints within the
7594 analyzer.
7595
7596 -fanalyzer-verbose-edges
7597 This option is intended for analyzer developers. It enables more
7598 verbose, lower-level detail in the descriptions of control flow
7599 within diagnostic paths.
7600
7601 -fanalyzer-verbose-state-changes
7602 This option is intended for analyzer developers. It enables more
7603 verbose, lower-level detail in the descriptions of events relating
7604 to state machines within diagnostic paths.
7605
7606 -fanalyzer-verbosity=level
7607 This option controls the complexity of the control flow paths that
7608 are emitted for analyzer diagnostics.
7609
7610 The level can be one of:
7611
7612 0 At this level, interprocedural call and return events are
7613 displayed, along with the most pertinent state-change events
7614 relating to a diagnostic. For example, for a double-"free"
7615 diagnostic, both calls to "free" will be shown.
7616
7617 1 As per the previous level, but also show events for the entry
7618 to each function.
7619
7620 2 As per the previous level, but also show events relating to
7621 control flow that are significant to triggering the issue (e.g.
7622 "true path taken" at a conditional).
7623
7624 This level is the default.
7625
7626 3 As per the previous level, but show all control flow events,
7627 not just significant ones.
7628
7629 4 This level is intended for analyzer developers; it adds various
7630 other events intended for debugging the analyzer.
7631
7632 -fdump-analyzer
7633 Dump internal details about what the analyzer is doing to
7634 file.analyzer.txt. This option is overridden by
7635 -fdump-analyzer-stderr.
7636
7637 -fdump-analyzer-stderr
7638 Dump internal details about what the analyzer is doing to stderr.
7639 This option overrides -fdump-analyzer.
7640
7641 -fdump-analyzer-callgraph
7642 Dump a representation of the call graph suitable for viewing with
7643 GraphViz to file.callgraph.dot.
7644
7645 -fdump-analyzer-exploded-graph
7646 Dump a representation of the "exploded graph" suitable for viewing
7647 with GraphViz to file.eg.dot. Nodes are color-coded based on
7648 state-machine states to emphasize state changes.
7649
7650 -fdump-analyzer-exploded-nodes
7651 Emit diagnostics showing where nodes in the "exploded graph" are in
7652 relation to the program source.
7653
7654 -fdump-analyzer-exploded-nodes-2
7655 Dump a textual representation of the "exploded graph" to
7656 file.eg.txt.
7657
7658 -fdump-analyzer-exploded-nodes-3
7659 Dump a textual representation of the "exploded graph" to one dump
7660 file per node, to file.eg-id.txt. This is typically a large number
7661 of dump files.
7662
7663 -fdump-analyzer-feasibility
7664 Dump internal details about the analyzer's search for feasible
7665 paths. The details are written in a form suitable for viewing with
7666 GraphViz to filenames of the form file.*.fg.dot and file.*.tg.dot.
7667
7668 -fdump-analyzer-json
7669 Dump a compressed JSON representation of analyzer internals to
7670 file.analyzer.json.gz. The precise format is subject to change.
7671
7672 -fdump-analyzer-state-purge
7673 As per -fdump-analyzer-supergraph, dump a representation of the
7674 "supergraph" suitable for viewing with GraphViz, but annotate the
7675 graph with information on what state will be purged at each node.
7676 The graph is written to file.state-purge.dot.
7677
7678 -fdump-analyzer-supergraph
7679 Dump representations of the "supergraph" suitable for viewing with
7680 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
7681 These show all of the control flow graphs in the program, with
7682 interprocedural edges for calls and returns. The second dump
7683 contains annotations showing nodes in the "exploded graph" and
7684 diagnostics associated with them.
7685
7686 Options for Debugging Your Program
7687 To tell GCC to emit extra information for use by a debugger, in almost
7688 all cases you need only to add -g to your other options.
7689
7690 GCC allows you to use -g with -O. The shortcuts taken by optimized
7691 code may occasionally be surprising: some variables you declared may
7692 not exist at all; flow of control may briefly move where you did not
7693 expect it; some statements may not be executed because they compute
7694 constant results or their values are already at hand; some statements
7695 may execute in different places because they have been moved out of
7696 loops. Nevertheless it is possible to debug optimized output. This
7697 makes it reasonable to use the optimizer for programs that might have
7698 bugs.
7699
7700 If you are not using some other optimization option, consider using -Og
7701 with -g. With no -O option at all, some compiler passes that collect
7702 information useful for debugging do not run at all, so that -Og may
7703 result in a better debugging experience.
7704
7705 -g Produce debugging information in the operating system's native
7706 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
7707 debugging information.
7708
7709 On most systems that use stabs format, -g enables use of extra
7710 debugging information that only GDB can use; this extra information
7711 makes debugging work better in GDB but probably makes other
7712 debuggers crash or refuse to read the program. If you want to
7713 control for certain whether to generate the extra information, use
7714 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
7715
7716 -ggdb
7717 Produce debugging information for use by GDB. This means to use
7718 the most expressive format available (DWARF, stabs, or the native
7719 format if neither of those are supported), including GDB extensions
7720 if at all possible.
7721
7722 -gdwarf
7723 -gdwarf-version
7724 Produce debugging information in DWARF format (if that is
7725 supported). The value of version may be either 2, 3, 4 or 5; the
7726 default version for most targets is 5 (with the exception of
7727 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
7728 AIX, which defaults to version 4).
7729
7730 Note that with DWARF Version 2, some ports require and always use
7731 some non-conflicting DWARF 3 extensions in the unwind tables.
7732
7733 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
7734 maximum benefit. Version 5 requires GDB 8.0 or higher.
7735
7736 GCC no longer supports DWARF Version 1, which is substantially
7737 different than Version 2 and later. For historical reasons, some
7738 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
7739 reference to DWARF Version 2 in their names, but apply to all
7740 currently-supported versions of DWARF.
7741
7742 -gstabs
7743 Produce debugging information in stabs format (if that is
7744 supported), without GDB extensions. This is the format used by DBX
7745 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
7746 this option produces stabs debugging output that is not understood
7747 by DBX. On System V Release 4 systems this option requires the GNU
7748 assembler.
7749
7750 -gstabs+
7751 Produce debugging information in stabs format (if that is
7752 supported), using GNU extensions understood only by the GNU
7753 debugger (GDB). The use of these extensions is likely to make
7754 other debuggers crash or refuse to read the program.
7755
7756 -gxcoff
7757 Produce debugging information in XCOFF format (if that is
7758 supported). This is the format used by the DBX debugger on IBM
7759 RS/6000 systems.
7760
7761 -gxcoff+
7762 Produce debugging information in XCOFF format (if that is
7763 supported), using GNU extensions understood only by the GNU
7764 debugger (GDB). The use of these extensions is likely to make
7765 other debuggers crash or refuse to read the program, and may cause
7766 assemblers other than the GNU assembler (GAS) to fail with an
7767 error.
7768
7769 -gvms
7770 Produce debugging information in Alpha/VMS debug format (if that is
7771 supported). This is the format used by DEBUG on Alpha/VMS systems.
7772
7773 -glevel
7774 -ggdblevel
7775 -gstabslevel
7776 -gxcofflevel
7777 -gvmslevel
7778 Request debugging information and also use level to specify how
7779 much information. The default level is 2.
7780
7781 Level 0 produces no debug information at all. Thus, -g0 negates
7782 -g.
7783
7784 Level 1 produces minimal information, enough for making backtraces
7785 in parts of the program that you don't plan to debug. This
7786 includes descriptions of functions and external variables, and line
7787 number tables, but no information about local variables.
7788
7789 Level 3 includes extra information, such as all the macro
7790 definitions present in the program. Some debuggers support macro
7791 expansion when you use -g3.
7792
7793 If you use multiple -g options, with or without level numbers, the
7794 last such option is the one that is effective.
7795
7796 -gdwarf does not accept a concatenated debug level, to avoid
7797 confusion with -gdwarf-level. Instead use an additional -glevel
7798 option to change the debug level for DWARF.
7799
7800 -fno-eliminate-unused-debug-symbols
7801 By default, no debug information is produced for symbols that are
7802 not actually used. Use this option if you want debug information
7803 for all symbols.
7804
7805 -femit-class-debug-always
7806 Instead of emitting debugging information for a C++ class in only
7807 one object file, emit it in all object files using the class. This
7808 option should be used only with debuggers that are unable to handle
7809 the way GCC normally emits debugging information for classes
7810 because using this option increases the size of debugging
7811 information by as much as a factor of two.
7812
7813 -fno-merge-debug-strings
7814 Direct the linker to not merge together strings in the debugging
7815 information that are identical in different object files. Merging
7816 is not supported by all assemblers or linkers. Merging decreases
7817 the size of the debug information in the output file at the cost of
7818 increasing link processing time. Merging is enabled by default.
7819
7820 -fdebug-prefix-map=old=new
7821 When compiling files residing in directory old, record debugging
7822 information describing them as if the files resided in directory
7823 new instead. This can be used to replace a build-time path with an
7824 install-time path in the debug info. It can also be used to change
7825 an absolute path to a relative path by using . for new. This can
7826 give more reproducible builds, which are location independent, but
7827 may require an extra command to tell GDB where to find the source
7828 files. See also -ffile-prefix-map.
7829
7830 -fvar-tracking
7831 Run variable tracking pass. It computes where variables are stored
7832 at each position in code. Better debugging information is then
7833 generated (if the debugging information format supports this
7834 information).
7835
7836 It is enabled by default when compiling with optimization (-Os, -O,
7837 -O2, ...), debugging information (-g) and the debug info format
7838 supports it.
7839
7840 -fvar-tracking-assignments
7841 Annotate assignments to user variables early in the compilation and
7842 attempt to carry the annotations over throughout the compilation
7843 all the way to the end, in an attempt to improve debug information
7844 while optimizing. Use of -gdwarf-4 is recommended along with it.
7845
7846 It can be enabled even if var-tracking is disabled, in which case
7847 annotations are created and maintained, but discarded at the end.
7848 By default, this flag is enabled together with -fvar-tracking,
7849 except when selective scheduling is enabled.
7850
7851 -gsplit-dwarf
7852 If DWARF debugging information is enabled, separate as much
7853 debugging information as possible into a separate output file with
7854 the extension .dwo. This option allows the build system to avoid
7855 linking files with debug information. To be useful, this option
7856 requires a debugger capable of reading .dwo files.
7857
7858 -gdwarf32
7859 -gdwarf64
7860 If DWARF debugging information is enabled, the -gdwarf32 selects
7861 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
7862 format. The default is target specific, on most targets it is
7863 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
7864 support more than 2GiB of debug information in any of the DWARF
7865 debug information sections. The 64-bit DWARF format allows larger
7866 debug information and might not be well supported by all consumers
7867 yet.
7868
7869 -gdescribe-dies
7870 Add description attributes to some DWARF DIEs that have no name
7871 attribute, such as artificial variables, external references and
7872 call site parameter DIEs.
7873
7874 -gpubnames
7875 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
7876
7877 -ggnu-pubnames
7878 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
7879 format suitable for conversion into a GDB index. This option is
7880 only useful with a linker that can produce GDB index version 7.
7881
7882 -fdebug-types-section
7883 When using DWARF Version 4 or higher, type DIEs can be put into
7884 their own ".debug_types" section instead of making them part of the
7885 ".debug_info" section. It is more efficient to put them in a
7886 separate comdat section since the linker can then remove
7887 duplicates. But not all DWARF consumers support ".debug_types"
7888 sections yet and on some objects ".debug_types" produces larger
7889 instead of smaller debugging information.
7890
7891 -grecord-gcc-switches
7892 -gno-record-gcc-switches
7893 This switch causes the command-line options used to invoke the
7894 compiler that may affect code generation to be appended to the
7895 DW_AT_producer attribute in DWARF debugging information. The
7896 options are concatenated with spaces separating them from each
7897 other and from the compiler version. It is enabled by default.
7898 See also -frecord-gcc-switches for another way of storing compiler
7899 options into the object file.
7900
7901 -gstrict-dwarf
7902 Disallow using extensions of later DWARF standard version than
7903 selected with -gdwarf-version. On most targets using non-
7904 conflicting DWARF extensions from later standard versions is
7905 allowed.
7906
7907 -gno-strict-dwarf
7908 Allow using extensions of later DWARF standard version than
7909 selected with -gdwarf-version.
7910
7911 -gas-loc-support
7912 Inform the compiler that the assembler supports ".loc" directives.
7913 It may then use them for the assembler to generate DWARF2+ line
7914 number tables.
7915
7916 This is generally desirable, because assembler-generated line-
7917 number tables are a lot more compact than those the compiler can
7918 generate itself.
7919
7920 This option will be enabled by default if, at GCC configure time,
7921 the assembler was found to support such directives.
7922
7923 -gno-as-loc-support
7924 Force GCC to generate DWARF2+ line number tables internally, if
7925 DWARF2+ line number tables are to be generated.
7926
7927 -gas-locview-support
7928 Inform the compiler that the assembler supports "view" assignment
7929 and reset assertion checking in ".loc" directives.
7930
7931 This option will be enabled by default if, at GCC configure time,
7932 the assembler was found to support them.
7933
7934 -gno-as-locview-support
7935 Force GCC to assign view numbers internally, if
7936 -gvariable-location-views are explicitly requested.
7937
7938 -gcolumn-info
7939 -gno-column-info
7940 Emit location column information into DWARF debugging information,
7941 rather than just file and line. This option is enabled by default.
7942
7943 -gstatement-frontiers
7944 -gno-statement-frontiers
7945 This option causes GCC to create markers in the internal
7946 representation at the beginning of statements, and to keep them
7947 roughly in place throughout compilation, using them to guide the
7948 output of "is_stmt" markers in the line number table. This is
7949 enabled by default when compiling with optimization (-Os, -O, -O2,
7950 ...), and outputting DWARF 2 debug information at the normal level.
7951
7952 -gvariable-location-views
7953 -gvariable-location-views=incompat5
7954 -gno-variable-location-views
7955 Augment variable location lists with progressive view numbers
7956 implied from the line number table. This enables debug information
7957 consumers to inspect state at certain points of the program, even
7958 if no instructions associated with the corresponding source
7959 locations are present at that point. If the assembler lacks
7960 support for view numbers in line number tables, this will cause the
7961 compiler to emit the line number table, which generally makes them
7962 somewhat less compact. The augmented line number tables and
7963 location lists are fully backward-compatible, so they can be
7964 consumed by debug information consumers that are not aware of these
7965 augmentations, but they won't derive any benefit from them either.
7966
7967 This is enabled by default when outputting DWARF 2 debug
7968 information at the normal level, as long as there is assembler
7969 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
7970 is not. When assembler support is not available, this may still be
7971 enabled, but it will force GCC to output internal line number
7972 tables, and if -ginternal-reset-location-views is not enabled, that
7973 will most certainly lead to silently mismatching location views.
7974
7975 There is a proposed representation for view numbers that is not
7976 backward compatible with the location list format introduced in
7977 DWARF 5, that can be enabled with
7978 -gvariable-location-views=incompat5. This option may be removed in
7979 the future, is only provided as a reference implementation of the
7980 proposed representation. Debug information consumers are not
7981 expected to support this extended format, and they would be
7982 rendered unable to decode location lists using it.
7983
7984 -ginternal-reset-location-views
7985 -gno-internal-reset-location-views
7986 Attempt to determine location views that can be omitted from
7987 location view lists. This requires the compiler to have very
7988 accurate insn length estimates, which isn't always the case, and it
7989 may cause incorrect view lists to be generated silently when using
7990 an assembler that does not support location view lists. The GNU
7991 assembler will flag any such error as a "view number mismatch".
7992 This is only enabled on ports that define a reliable estimation
7993 function.
7994
7995 -ginline-points
7996 -gno-inline-points
7997 Generate extended debug information for inlined functions.
7998 Location view tracking markers are inserted at inlined entry
7999 points, so that address and view numbers can be computed and output
8000 in debug information. This can be enabled independently of
8001 location views, in which case the view numbers won't be output, but
8002 it can only be enabled along with statement frontiers, and it is
8003 only enabled by default if location views are enabled.
8004
8005 -gz[=type]
8006 Produce compressed debug sections in DWARF format, if that is
8007 supported. If type is not given, the default type depends on the
8008 capabilities of the assembler and linker used. type may be one of
8009 none (don't compress debug sections), zlib (use zlib compression in
8010 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8011 GNU format). If the linker doesn't support writing compressed
8012 debug sections, the option is rejected. Otherwise, if the
8013 assembler does not support them, -gz is silently ignored when
8014 producing object files.
8015
8016 -femit-struct-debug-baseonly
8017 Emit debug information for struct-like types only when the base
8018 name of the compilation source file matches the base name of file
8019 in which the struct is defined.
8020
8021 This option substantially reduces the size of debugging
8022 information, but at significant potential loss in type information
8023 to the debugger. See -femit-struct-debug-reduced for a less
8024 aggressive option. See -femit-struct-debug-detailed for more
8025 detailed control.
8026
8027 This option works only with DWARF debug output.
8028
8029 -femit-struct-debug-reduced
8030 Emit debug information for struct-like types only when the base
8031 name of the compilation source file matches the base name of file
8032 in which the type is defined, unless the struct is a template or
8033 defined in a system header.
8034
8035 This option significantly reduces the size of debugging
8036 information, with some potential loss in type information to the
8037 debugger. See -femit-struct-debug-baseonly for a more aggressive
8038 option. See -femit-struct-debug-detailed for more detailed
8039 control.
8040
8041 This option works only with DWARF debug output.
8042
8043 -femit-struct-debug-detailed[=spec-list]
8044 Specify the struct-like types for which the compiler generates
8045 debug information. The intent is to reduce duplicate struct debug
8046 information between different object files within the same program.
8047
8048 This option is a detailed version of -femit-struct-debug-reduced
8049 and -femit-struct-debug-baseonly, which serves for most needs.
8050
8051 A specification has the
8052 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8053
8054 The optional first word limits the specification to structs that
8055 are used directly (dir:) or used indirectly (ind:). A struct type
8056 is used directly when it is the type of a variable, member.
8057 Indirect uses arise through pointers to structs. That is, when use
8058 of an incomplete struct is valid, the use is indirect. An example
8059 is struct one direct; struct two * indirect;.
8060
8061 The optional second word limits the specification to ordinary
8062 structs (ord:) or generic structs (gen:). Generic structs are a
8063 bit complicated to explain. For C++, these are non-explicit
8064 specializations of template classes, or non-template classes within
8065 the above. Other programming languages have generics, but
8066 -femit-struct-debug-detailed does not yet implement them.
8067
8068 The third word specifies the source files for those structs for
8069 which the compiler should emit debug information. The values none
8070 and any have the normal meaning. The value base means that the
8071 base of name of the file in which the type declaration appears must
8072 match the base of the name of the main compilation file. In
8073 practice, this means that when compiling foo.c, debug information
8074 is generated for types declared in that file and foo.h, but not
8075 other header files. The value sys means those types satisfying
8076 base or declared in system or compiler headers.
8077
8078 You may need to experiment to determine the best settings for your
8079 application.
8080
8081 The default is -femit-struct-debug-detailed=all.
8082
8083 This option works only with DWARF debug output.
8084
8085 -fno-dwarf2-cfi-asm
8086 Emit DWARF unwind info as compiler generated ".eh_frame" section
8087 instead of using GAS ".cfi_*" directives.
8088
8089 -fno-eliminate-unused-debug-types
8090 Normally, when producing DWARF output, GCC avoids producing debug
8091 symbol output for types that are nowhere used in the source file
8092 being compiled. Sometimes it is useful to have GCC emit debugging
8093 information for all types declared in a compilation unit,
8094 regardless of whether or not they are actually used in that
8095 compilation unit, for example if, in the debugger, you want to cast
8096 a value to a type that is not actually used in your program (but is
8097 declared). More often, however, this results in a significant
8098 amount of wasted space.
8099
8100 Options That Control Optimization
8101 These options control various sorts of optimizations.
8102
8103 Without any optimization option, the compiler's goal is to reduce the
8104 cost of compilation and to make debugging produce the expected results.
8105 Statements are independent: if you stop the program with a breakpoint
8106 between statements, you can then assign a new value to any variable or
8107 change the program counter to any other statement in the function and
8108 get exactly the results you expect from the source code.
8109
8110 Turning on optimization flags makes the compiler attempt to improve the
8111 performance and/or code size at the expense of compilation time and
8112 possibly the ability to debug the program.
8113
8114 The compiler performs optimization based on the knowledge it has of the
8115 program. Compiling multiple files at once to a single output file mode
8116 allows the compiler to use information gained from all of the files
8117 when compiling each of them.
8118
8119 Not all optimizations are controlled directly by a flag. Only
8120 optimizations that have a flag are listed in this section.
8121
8122 Most optimizations are completely disabled at -O0 or if an -O level is
8123 not set on the command line, even if individual optimization flags are
8124 specified. Similarly, -Og suppresses many optimization passes.
8125
8126 Depending on the target and how GCC was configured, a slightly
8127 different set of optimizations may be enabled at each -O level than
8128 those listed here. You can invoke GCC with -Q --help=optimizers to
8129 find out the exact set of optimizations that are enabled at each level.
8130
8131 -O
8132 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8133 lot more memory for a large function.
8134
8135 With -O, the compiler tries to reduce code size and execution time,
8136 without performing any optimizations that take a great deal of
8137 compilation time.
8138
8139 -O turns on the following optimization flags:
8140
8141 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8142 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8143 -fdse -fforward-propagate -fguess-branch-probability
8144 -fif-conversion -fif-conversion2 -finline-functions-called-once
8145 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8146 -fipa-reference-addressable -fmerge-constants
8147 -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks
8148 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types
8149 -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch
8150 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
8151 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
8152 -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr
8153 -ftree-sra -ftree-ter -funit-at-a-time
8154
8155 -O2 Optimize even more. GCC performs nearly all supported
8156 optimizations that do not involve a space-speed tradeoff. As
8157 compared to -O, this option increases both compilation time and the
8158 performance of the generated code.
8159
8160 -O2 turns on all optimization flags specified by -O. It also turns
8161 on the following optimization flags:
8162
8163 -falign-functions -falign-jumps -falign-labels -falign-loops
8164 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8165 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8166 -fdevirtualize-speculatively -fexpensive-optimizations
8167 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8168 -finline-functions -finline-small-functions -findirect-inlining
8169 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8170 -fisolate-erroneous-paths-dereference -flra-remat
8171 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8172 -fpeephole2 -freorder-blocks-algorithm=stc
8173 -freorder-blocks-and-partition -freorder-functions
8174 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8175 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8176 -fthread-jumps -ftree-builtin-call-dce -ftree-pre
8177 -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
8178
8179 Please note the warning under -fgcse about invoking -O2 on programs
8180 that use computed gotos.
8181
8182 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8183 and also turns on the following optimization flags:
8184
8185 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8186 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8187 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8188 -ftree-loop-vectorize -ftree-partial-pre -ftree-slp-vectorize
8189 -funswitch-loops -fvect-cost-model -fvect-cost-model=dynamic
8190 -fversion-loops-for-strides
8191
8192 -O0 Reduce compilation time and make debugging produce the expected
8193 results. This is the default.
8194
8195 -Os Optimize for size. -Os enables all -O2 optimizations except those
8196 that often increase code size:
8197
8198 -falign-functions -falign-jumps -falign-labels -falign-loops
8199 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8200
8201 It also enables -finline-functions, causes the compiler to tune for
8202 code size rather than execution speed, and performs further
8203 optimizations designed to reduce code size.
8204
8205 -Ofast
8206 Disregard strict standards compliance. -Ofast enables all -O3
8207 optimizations. It also enables optimizations that are not valid
8208 for all standard-compliant programs. It turns on -ffast-math,
8209 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8210 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8211
8212 -Og Optimize debugging experience. -Og should be the optimization
8213 level of choice for the standard edit-compile-debug cycle, offering
8214 a reasonable level of optimization while maintaining fast
8215 compilation and a good debugging experience. It is a better choice
8216 than -O0 for producing debuggable code because some compiler passes
8217 that collect debug information are disabled at -O0.
8218
8219 Like -O0, -Og completely disables a number of optimization passes
8220 so that individual options controlling them have no effect.
8221 Otherwise -Og enables all -O1 optimization flags except for those
8222 that may interfere with debugging:
8223
8224 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8225 -fif-conversion2 -finline-functions-called-once
8226 -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-dse
8227 -ftree-pta -ftree-sra
8228
8229 If you use multiple -O options, with or without level numbers, the last
8230 such option is the one that is effective.
8231
8232 Options of the form -fflag specify machine-independent flags. Most
8233 flags have both positive and negative forms; the negative form of -ffoo
8234 is -fno-foo. In the table below, only one of the forms is listed---the
8235 one you typically use. You can figure out the other form by either
8236 removing no- or adding it.
8237
8238 The following options control specific optimizations. They are either
8239 activated by -O options or are related to ones that are. You can use
8240 the following flags in the rare cases when "fine-tuning" of
8241 optimizations to be performed is desired.
8242
8243 -fno-defer-pop
8244 For machines that must pop arguments after a function call, always
8245 pop the arguments as soon as each function returns. At levels -O1
8246 and higher, -fdefer-pop is the default; this allows the compiler to
8247 let arguments accumulate on the stack for several function calls
8248 and pop them all at once.
8249
8250 -fforward-propagate
8251 Perform a forward propagation pass on RTL. The pass tries to
8252 combine two instructions and checks if the result can be
8253 simplified. If loop unrolling is active, two passes are performed
8254 and the second is scheduled after loop unrolling.
8255
8256 This option is enabled by default at optimization levels -O, -O2,
8257 -O3, -Os.
8258
8259 -ffp-contract=style
8260 -ffp-contract=off disables floating-point expression contraction.
8261 -ffp-contract=fast enables floating-point expression contraction
8262 such as forming of fused multiply-add operations if the target has
8263 native support for them. -ffp-contract=on enables floating-point
8264 expression contraction if allowed by the language standard. This
8265 is currently not implemented and treated equal to
8266 -ffp-contract=off.
8267
8268 The default is -ffp-contract=fast.
8269
8270 -fomit-frame-pointer
8271 Omit the frame pointer in functions that don't need one. This
8272 avoids the instructions to save, set up and restore the frame
8273 pointer; on many targets it also makes an extra register available.
8274
8275 On some targets this flag has no effect because the standard
8276 calling sequence always uses a frame pointer, so it cannot be
8277 omitted.
8278
8279 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8280 pointer is used in all functions. Several targets always omit the
8281 frame pointer in leaf functions.
8282
8283 Enabled by default at -O and higher.
8284
8285 -foptimize-sibling-calls
8286 Optimize sibling and tail recursive calls.
8287
8288 Enabled at levels -O2, -O3, -Os.
8289
8290 -foptimize-strlen
8291 Optimize various standard C string functions (e.g. "strlen",
8292 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8293 faster alternatives.
8294
8295 Enabled at levels -O2, -O3.
8296
8297 -fno-inline
8298 Do not expand any functions inline apart from those marked with the
8299 "always_inline" attribute. This is the default when not
8300 optimizing.
8301
8302 Single functions can be exempted from inlining by marking them with
8303 the "noinline" attribute.
8304
8305 -finline-small-functions
8306 Integrate functions into their callers when their body is smaller
8307 than expected function call code (so overall size of program gets
8308 smaller). The compiler heuristically decides which functions are
8309 simple enough to be worth integrating in this way. This inlining
8310 applies to all functions, even those not declared inline.
8311
8312 Enabled at levels -O2, -O3, -Os.
8313
8314 -findirect-inlining
8315 Inline also indirect calls that are discovered to be known at
8316 compile time thanks to previous inlining. This option has any
8317 effect only when inlining itself is turned on by the
8318 -finline-functions or -finline-small-functions options.
8319
8320 Enabled at levels -O2, -O3, -Os.
8321
8322 -finline-functions
8323 Consider all functions for inlining, even if they are not declared
8324 inline. The compiler heuristically decides which functions are
8325 worth integrating in this way.
8326
8327 If all calls to a given function are integrated, and the function
8328 is declared "static", then the function is normally not output as
8329 assembler code in its own right.
8330
8331 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8332 -fauto-profile.
8333
8334 -finline-functions-called-once
8335 Consider all "static" functions called once for inlining into their
8336 caller even if they are not marked "inline". If a call to a given
8337 function is integrated, then the function is not output as
8338 assembler code in its own right.
8339
8340 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8341
8342 -fearly-inlining
8343 Inline functions marked by "always_inline" and functions whose body
8344 seems smaller than the function call overhead early before doing
8345 -fprofile-generate instrumentation and real inlining pass. Doing
8346 so makes profiling significantly cheaper and usually inlining
8347 faster on programs having large chains of nested wrapper functions.
8348
8349 Enabled by default.
8350
8351 -fipa-sra
8352 Perform interprocedural scalar replacement of aggregates, removal
8353 of unused parameters and replacement of parameters passed by
8354 reference by parameters passed by value.
8355
8356 Enabled at levels -O2, -O3 and -Os.
8357
8358 -finline-limit=n
8359 By default, GCC limits the size of functions that can be inlined.
8360 This flag allows coarse control of this limit. n is the size of
8361 functions that can be inlined in number of pseudo instructions.
8362
8363 Inlining is actually controlled by a number of parameters, which
8364 may be specified individually by using --param name=value. The
8365 -finline-limit=n option sets some of these parameters as follows:
8366
8367 max-inline-insns-single
8368 is set to n/2.
8369
8370 max-inline-insns-auto
8371 is set to n/2.
8372
8373 See below for a documentation of the individual parameters
8374 controlling inlining and for the defaults of these parameters.
8375
8376 Note: there may be no value to -finline-limit that results in
8377 default behavior.
8378
8379 Note: pseudo instruction represents, in this particular context, an
8380 abstract measurement of function's size. In no way does it
8381 represent a count of assembly instructions and as such its exact
8382 meaning might change from one release to an another.
8383
8384 -fno-keep-inline-dllexport
8385 This is a more fine-grained version of -fkeep-inline-functions,
8386 which applies only to functions that are declared using the
8387 "dllexport" attribute or declspec.
8388
8389 -fkeep-inline-functions
8390 In C, emit "static" functions that are declared "inline" into the
8391 object file, even if the function has been inlined into all of its
8392 callers. This switch does not affect functions using the "extern
8393 inline" extension in GNU C90. In C++, emit any and all inline
8394 functions into the object file.
8395
8396 -fkeep-static-functions
8397 Emit "static" functions into the object file, even if the function
8398 is never used.
8399
8400 -fkeep-static-consts
8401 Emit variables declared "static const" when optimization isn't
8402 turned on, even if the variables aren't referenced.
8403
8404 GCC enables this option by default. If you want to force the
8405 compiler to check if a variable is referenced, regardless of
8406 whether or not optimization is turned on, use the
8407 -fno-keep-static-consts option.
8408
8409 -fmerge-constants
8410 Attempt to merge identical constants (string constants and
8411 floating-point constants) across compilation units.
8412
8413 This option is the default for optimized compilation if the
8414 assembler and linker support it. Use -fno-merge-constants to
8415 inhibit this behavior.
8416
8417 Enabled at levels -O, -O2, -O3, -Os.
8418
8419 -fmerge-all-constants
8420 Attempt to merge identical constants and identical variables.
8421
8422 This option implies -fmerge-constants. In addition to
8423 -fmerge-constants this considers e.g. even constant initialized
8424 arrays or initialized constant variables with integral or floating-
8425 point types. Languages like C or C++ require each variable,
8426 including multiple instances of the same variable in recursive
8427 calls, to have distinct locations, so using this option results in
8428 non-conforming behavior.
8429
8430 -fmodulo-sched
8431 Perform swing modulo scheduling immediately before the first
8432 scheduling pass. This pass looks at innermost loops and reorders
8433 their instructions by overlapping different iterations.
8434
8435 -fmodulo-sched-allow-regmoves
8436 Perform more aggressive SMS-based modulo scheduling with register
8437 moves allowed. By setting this flag certain anti-dependences edges
8438 are deleted, which triggers the generation of reg-moves based on
8439 the life-range analysis. This option is effective only with
8440 -fmodulo-sched enabled.
8441
8442 -fno-branch-count-reg
8443 Disable the optimization pass that scans for opportunities to use
8444 "decrement and branch" instructions on a count register instead of
8445 instruction sequences that decrement a register, compare it against
8446 zero, and then branch based upon the result. This option is only
8447 meaningful on architectures that support such instructions, which
8448 include x86, PowerPC, IA-64 and S/390. Note that the
8449 -fno-branch-count-reg option doesn't remove the decrement and
8450 branch instructions from the generated instruction stream
8451 introduced by other optimization passes.
8452
8453 The default is -fbranch-count-reg at -O1 and higher, except for
8454 -Og.
8455
8456 -fno-function-cse
8457 Do not put function addresses in registers; make each instruction
8458 that calls a constant function contain the function's address
8459 explicitly.
8460
8461 This option results in less efficient code, but some strange hacks
8462 that alter the assembler output may be confused by the
8463 optimizations performed when this option is not used.
8464
8465 The default is -ffunction-cse
8466
8467 -fno-zero-initialized-in-bss
8468 If the target supports a BSS section, GCC by default puts variables
8469 that are initialized to zero into BSS. This can save space in the
8470 resulting code.
8471
8472 This option turns off this behavior because some programs
8473 explicitly rely on variables going to the data section---e.g., so
8474 that the resulting executable can find the beginning of that
8475 section and/or make assumptions based on that.
8476
8477 The default is -fzero-initialized-in-bss.
8478
8479 -fthread-jumps
8480 Perform optimizations that check to see if a jump branches to a
8481 location where another comparison subsumed by the first is found.
8482 If so, the first branch is redirected to either the destination of
8483 the second branch or a point immediately following it, depending on
8484 whether the condition is known to be true or false.
8485
8486 Enabled at levels -O2, -O3, -Os.
8487
8488 -fsplit-wide-types
8489 When using a type that occupies multiple registers, such as "long
8490 long" on a 32-bit system, split the registers apart and allocate
8491 them independently. This normally generates better code for those
8492 types, but may make debugging more difficult.
8493
8494 Enabled at levels -O, -O2, -O3, -Os.
8495
8496 -fsplit-wide-types-early
8497 Fully split wide types early, instead of very late. This option
8498 has no effect unless -fsplit-wide-types is turned on.
8499
8500 This is the default on some targets.
8501
8502 -fcse-follow-jumps
8503 In common subexpression elimination (CSE), scan through jump
8504 instructions when the target of the jump is not reached by any
8505 other path. For example, when CSE encounters an "if" statement
8506 with an "else" clause, CSE follows the jump when the condition
8507 tested is false.
8508
8509 Enabled at levels -O2, -O3, -Os.
8510
8511 -fcse-skip-blocks
8512 This is similar to -fcse-follow-jumps, but causes CSE to follow
8513 jumps that conditionally skip over blocks. When CSE encounters a
8514 simple "if" statement with no else clause, -fcse-skip-blocks causes
8515 CSE to follow the jump around the body of the "if".
8516
8517 Enabled at levels -O2, -O3, -Os.
8518
8519 -frerun-cse-after-loop
8520 Re-run common subexpression elimination after loop optimizations
8521 are performed.
8522
8523 Enabled at levels -O2, -O3, -Os.
8524
8525 -fgcse
8526 Perform a global common subexpression elimination pass. This pass
8527 also performs global constant and copy propagation.
8528
8529 Note: When compiling a program using computed gotos, a GCC
8530 extension, you may get better run-time performance if you disable
8531 the global common subexpression elimination pass by adding
8532 -fno-gcse to the command line.
8533
8534 Enabled at levels -O2, -O3, -Os.
8535
8536 -fgcse-lm
8537 When -fgcse-lm is enabled, global common subexpression elimination
8538 attempts to move loads that are only killed by stores into
8539 themselves. This allows a loop containing a load/store sequence to
8540 be changed to a load outside the loop, and a copy/store within the
8541 loop.
8542
8543 Enabled by default when -fgcse is enabled.
8544
8545 -fgcse-sm
8546 When -fgcse-sm is enabled, a store motion pass is run after global
8547 common subexpression elimination. This pass attempts to move
8548 stores out of loops. When used in conjunction with -fgcse-lm,
8549 loops containing a load/store sequence can be changed to a load
8550 before the loop and a store after the loop.
8551
8552 Not enabled at any optimization level.
8553
8554 -fgcse-las
8555 When -fgcse-las is enabled, the global common subexpression
8556 elimination pass eliminates redundant loads that come after stores
8557 to the same memory location (both partial and full redundancies).
8558
8559 Not enabled at any optimization level.
8560
8561 -fgcse-after-reload
8562 When -fgcse-after-reload is enabled, a redundant load elimination
8563 pass is performed after reload. The purpose of this pass is to
8564 clean up redundant spilling.
8565
8566 Enabled by -fprofile-use and -fauto-profile.
8567
8568 -faggressive-loop-optimizations
8569 This option tells the loop optimizer to use language constraints to
8570 derive bounds for the number of iterations of a loop. This assumes
8571 that loop code does not invoke undefined behavior by for example
8572 causing signed integer overflows or out-of-bound array accesses.
8573 The bounds for the number of iterations of a loop are used to guide
8574 loop unrolling and peeling and loop exit test optimizations. This
8575 option is enabled by default.
8576
8577 -funconstrained-commons
8578 This option tells the compiler that variables declared in common
8579 blocks (e.g. Fortran) may later be overridden with longer trailing
8580 arrays. This prevents certain optimizations that depend on knowing
8581 the array bounds.
8582
8583 -fcrossjumping
8584 Perform cross-jumping transformation. This transformation unifies
8585 equivalent code and saves code size. The resulting code may or may
8586 not perform better than without cross-jumping.
8587
8588 Enabled at levels -O2, -O3, -Os.
8589
8590 -fauto-inc-dec
8591 Combine increments or decrements of addresses with memory accesses.
8592 This pass is always skipped on architectures that do not have
8593 instructions to support this. Enabled by default at -O and higher
8594 on architectures that support this.
8595
8596 -fdce
8597 Perform dead code elimination (DCE) on RTL. Enabled by default at
8598 -O and higher.
8599
8600 -fdse
8601 Perform dead store elimination (DSE) on RTL. Enabled by default at
8602 -O and higher.
8603
8604 -fif-conversion
8605 Attempt to transform conditional jumps into branch-less
8606 equivalents. This includes use of conditional moves, min, max, set
8607 flags and abs instructions, and some tricks doable by standard
8608 arithmetics. The use of conditional execution on chips where it is
8609 available is controlled by -fif-conversion2.
8610
8611 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8612
8613 -fif-conversion2
8614 Use conditional execution (where available) to transform
8615 conditional jumps into branch-less equivalents.
8616
8617 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
8618
8619 -fdeclone-ctor-dtor
8620 The C++ ABI requires multiple entry points for constructors and
8621 destructors: one for a base subobject, one for a complete object,
8622 and one for a virtual destructor that calls operator delete
8623 afterwards. For a hierarchy with virtual bases, the base and
8624 complete variants are clones, which means two copies of the
8625 function. With this option, the base and complete variants are
8626 changed to be thunks that call a common implementation.
8627
8628 Enabled by -Os.
8629
8630 -fdelete-null-pointer-checks
8631 Assume that programs cannot safely dereference null pointers, and
8632 that no code or data element resides at address zero. This option
8633 enables simple constant folding optimizations at all optimization
8634 levels. In addition, other optimization passes in GCC use this
8635 flag to control global dataflow analyses that eliminate useless
8636 checks for null pointers; these assume that a memory access to
8637 address zero always results in a trap, so that if a pointer is
8638 checked after it has already been dereferenced, it cannot be null.
8639
8640 Note however that in some environments this assumption is not true.
8641 Use -fno-delete-null-pointer-checks to disable this optimization
8642 for programs that depend on that behavior.
8643
8644 This option is enabled by default on most targets. On Nios II ELF,
8645 it defaults to off. On AVR, CR16, and MSP430, this option is
8646 completely disabled.
8647
8648 Passes that use the dataflow information are enabled independently
8649 at different optimization levels.
8650
8651 -fdevirtualize
8652 Attempt to convert calls to virtual functions to direct calls.
8653 This is done both within a procedure and interprocedurally as part
8654 of indirect inlining (-findirect-inlining) and interprocedural
8655 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
8656
8657 -fdevirtualize-speculatively
8658 Attempt to convert calls to virtual functions to speculative direct
8659 calls. Based on the analysis of the type inheritance graph,
8660 determine for a given call the set of likely targets. If the set is
8661 small, preferably of size 1, change the call into a conditional
8662 deciding between direct and indirect calls. The speculative calls
8663 enable more optimizations, such as inlining. When they seem
8664 useless after further optimization, they are converted back into
8665 original form.
8666
8667 -fdevirtualize-at-ltrans
8668 Stream extra information needed for aggressive devirtualization
8669 when running the link-time optimizer in local transformation mode.
8670 This option enables more devirtualization but significantly
8671 increases the size of streamed data. For this reason it is disabled
8672 by default.
8673
8674 -fexpensive-optimizations
8675 Perform a number of minor optimizations that are relatively
8676 expensive.
8677
8678 Enabled at levels -O2, -O3, -Os.
8679
8680 -free
8681 Attempt to remove redundant extension instructions. This is
8682 especially helpful for the x86-64 architecture, which implicitly
8683 zero-extends in 64-bit registers after writing to their lower
8684 32-bit half.
8685
8686 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
8687
8688 -fno-lifetime-dse
8689 In C++ the value of an object is only affected by changes within
8690 its lifetime: when the constructor begins, the object has an
8691 indeterminate value, and any changes during the lifetime of the
8692 object are dead when the object is destroyed. Normally dead store
8693 elimination will take advantage of this; if your code relies on the
8694 value of the object storage persisting beyond the lifetime of the
8695 object, you can use this flag to disable this optimization. To
8696 preserve stores before the constructor starts (e.g. because your
8697 operator new clears the object storage) but still treat the object
8698 as dead after the destructor, you can use -flifetime-dse=1. The
8699 default behavior can be explicitly selected with -flifetime-dse=2.
8700 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
8701
8702 -flive-range-shrinkage
8703 Attempt to decrease register pressure through register live range
8704 shrinkage. This is helpful for fast processors with small or
8705 moderate size register sets.
8706
8707 -fira-algorithm=algorithm
8708 Use the specified coloring algorithm for the integrated register
8709 allocator. The algorithm argument can be priority, which specifies
8710 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
8711 coloring. Chaitin-Briggs coloring is not implemented for all
8712 architectures, but for those targets that do support it, it is the
8713 default because it generates better code.
8714
8715 -fira-region=region
8716 Use specified regions for the integrated register allocator. The
8717 region argument should be one of the following:
8718
8719 all Use all loops as register allocation regions. This can give
8720 the best results for machines with a small and/or irregular
8721 register set.
8722
8723 mixed
8724 Use all loops except for loops with small register pressure as
8725 the regions. This value usually gives the best results in most
8726 cases and for most architectures, and is enabled by default
8727 when compiling with optimization for speed (-O, -O2, ...).
8728
8729 one Use all functions as a single region. This typically results
8730 in the smallest code size, and is enabled by default for -Os or
8731 -O0.
8732
8733 -fira-hoist-pressure
8734 Use IRA to evaluate register pressure in the code hoisting pass for
8735 decisions to hoist expressions. This option usually results in
8736 smaller code, but it can slow the compiler down.
8737
8738 This option is enabled at level -Os for all targets.
8739
8740 -fira-loop-pressure
8741 Use IRA to evaluate register pressure in loops for decisions to
8742 move loop invariants. This option usually results in generation of
8743 faster and smaller code on machines with large register files (>=
8744 32 registers), but it can slow the compiler down.
8745
8746 This option is enabled at level -O3 for some targets.
8747
8748 -fno-ira-share-save-slots
8749 Disable sharing of stack slots used for saving call-used hard
8750 registers living through a call. Each hard register gets a
8751 separate stack slot, and as a result function stack frames are
8752 larger.
8753
8754 -fno-ira-share-spill-slots
8755 Disable sharing of stack slots allocated for pseudo-registers.
8756 Each pseudo-register that does not get a hard register gets a
8757 separate stack slot, and as a result function stack frames are
8758 larger.
8759
8760 -flra-remat
8761 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8762 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8763 values if it is profitable.
8764
8765 Enabled at levels -O2, -O3, -Os.
8766
8767 -fdelayed-branch
8768 If supported for the target machine, attempt to reorder
8769 instructions to exploit instruction slots available after delayed
8770 branch instructions.
8771
8772 Enabled at levels -O, -O2, -O3, -Os, but not at -Og.
8773
8774 -fschedule-insns
8775 If supported for the target machine, attempt to reorder
8776 instructions to eliminate execution stalls due to required data
8777 being unavailable. This helps machines that have slow floating
8778 point or memory load instructions by allowing other instructions to
8779 be issued until the result of the load or floating-point
8780 instruction is required.
8781
8782 Enabled at levels -O2, -O3.
8783
8784 -fschedule-insns2
8785 Similar to -fschedule-insns, but requests an additional pass of
8786 instruction scheduling after register allocation has been done.
8787 This is especially useful on machines with a relatively small
8788 number of registers and where memory load instructions take more
8789 than one cycle.
8790
8791 Enabled at levels -O2, -O3, -Os.
8792
8793 -fno-sched-interblock
8794 Disable instruction scheduling across basic blocks, which is
8795 normally enabled when scheduling before register allocation, i.e.
8796 with -fschedule-insns or at -O2 or higher.
8797
8798 -fno-sched-spec
8799 Disable speculative motion of non-load instructions, which is
8800 normally enabled when scheduling before register allocation, i.e.
8801 with -fschedule-insns or at -O2 or higher.
8802
8803 -fsched-pressure
8804 Enable register pressure sensitive insn scheduling before register
8805 allocation. This only makes sense when scheduling before register
8806 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
8807 higher. Usage of this option can improve the generated code and
8808 decrease its size by preventing register pressure increase above
8809 the number of available hard registers and subsequent spills in
8810 register allocation.
8811
8812 -fsched-spec-load
8813 Allow speculative motion of some load instructions. This only
8814 makes sense when scheduling before register allocation, i.e. with
8815 -fschedule-insns or at -O2 or higher.
8816
8817 -fsched-spec-load-dangerous
8818 Allow speculative motion of more load instructions. This only
8819 makes sense when scheduling before register allocation, i.e. with
8820 -fschedule-insns or at -O2 or higher.
8821
8822 -fsched-stalled-insns
8823 -fsched-stalled-insns=n
8824 Define how many insns (if any) can be moved prematurely from the
8825 queue of stalled insns into the ready list during the second
8826 scheduling pass. -fno-sched-stalled-insns means that no insns are
8827 moved prematurely, -fsched-stalled-insns=0 means there is no limit
8828 on how many queued insns can be moved prematurely.
8829 -fsched-stalled-insns without a value is equivalent to
8830 -fsched-stalled-insns=1.
8831
8832 -fsched-stalled-insns-dep
8833 -fsched-stalled-insns-dep=n
8834 Define how many insn groups (cycles) are examined for a dependency
8835 on a stalled insn that is a candidate for premature removal from
8836 the queue of stalled insns. This has an effect only during the
8837 second scheduling pass, and only if -fsched-stalled-insns is used.
8838 -fno-sched-stalled-insns-dep is equivalent to
8839 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
8840 value is equivalent to -fsched-stalled-insns-dep=1.
8841
8842 -fsched2-use-superblocks
8843 When scheduling after register allocation, use superblock
8844 scheduling. This allows motion across basic block boundaries,
8845 resulting in faster schedules. This option is experimental, as not
8846 all machine descriptions used by GCC model the CPU closely enough
8847 to avoid unreliable results from the algorithm.
8848
8849 This only makes sense when scheduling after register allocation,
8850 i.e. with -fschedule-insns2 or at -O2 or higher.
8851
8852 -fsched-group-heuristic
8853 Enable the group heuristic in the scheduler. This heuristic favors
8854 the instruction that belongs to a schedule group. This is enabled
8855 by default when scheduling is enabled, i.e. with -fschedule-insns
8856 or -fschedule-insns2 or at -O2 or higher.
8857
8858 -fsched-critical-path-heuristic
8859 Enable the critical-path heuristic in the scheduler. This
8860 heuristic favors instructions on the critical path. This is
8861 enabled by default when scheduling is enabled, i.e. with
8862 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
8863
8864 -fsched-spec-insn-heuristic
8865 Enable the speculative instruction heuristic in the scheduler.
8866 This heuristic favors speculative instructions with greater
8867 dependency weakness. This is enabled by default when scheduling is
8868 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8869 or higher.
8870
8871 -fsched-rank-heuristic
8872 Enable the rank heuristic in the scheduler. This heuristic favors
8873 the instruction belonging to a basic block with greater size or
8874 frequency. This is enabled by default when scheduling is enabled,
8875 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
8876 higher.
8877
8878 -fsched-last-insn-heuristic
8879 Enable the last-instruction heuristic in the scheduler. This
8880 heuristic favors the instruction that is less dependent on the last
8881 instruction scheduled. This is enabled by default when scheduling
8882 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
8883 -O2 or higher.
8884
8885 -fsched-dep-count-heuristic
8886 Enable the dependent-count heuristic in the scheduler. This
8887 heuristic favors the instruction that has more instructions
8888 depending on it. This is enabled by default when scheduling is
8889 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8890 or higher.
8891
8892 -freschedule-modulo-scheduled-loops
8893 Modulo scheduling is performed before traditional scheduling. If a
8894 loop is modulo scheduled, later scheduling passes may change its
8895 schedule. Use this option to control that behavior.
8896
8897 -fselective-scheduling
8898 Schedule instructions using selective scheduling algorithm.
8899 Selective scheduling runs instead of the first scheduler pass.
8900
8901 -fselective-scheduling2
8902 Schedule instructions using selective scheduling algorithm.
8903 Selective scheduling runs instead of the second scheduler pass.
8904
8905 -fsel-sched-pipelining
8906 Enable software pipelining of innermost loops during selective
8907 scheduling. This option has no effect unless one of
8908 -fselective-scheduling or -fselective-scheduling2 is turned on.
8909
8910 -fsel-sched-pipelining-outer-loops
8911 When pipelining loops during selective scheduling, also pipeline
8912 outer loops. This option has no effect unless
8913 -fsel-sched-pipelining is turned on.
8914
8915 -fsemantic-interposition
8916 Some object formats, like ELF, allow interposing of symbols by the
8917 dynamic linker. This means that for symbols exported from the DSO,
8918 the compiler cannot perform interprocedural propagation, inlining
8919 and other optimizations in anticipation that the function or
8920 variable in question may change. While this feature is useful, for
8921 example, to rewrite memory allocation functions by a debugging
8922 implementation, it is expensive in the terms of code quality. With
8923 -fno-semantic-interposition the compiler assumes that if
8924 interposition happens for functions the overwriting function will
8925 have precisely the same semantics (and side effects). Similarly if
8926 interposition happens for variables, the constructor of the
8927 variable will be the same. The flag has no effect for functions
8928 explicitly declared inline (where it is never allowed for
8929 interposition to change semantics) and for symbols explicitly
8930 declared weak.
8931
8932 -fshrink-wrap
8933 Emit function prologues only before parts of the function that need
8934 it, rather than at the top of the function. This flag is enabled
8935 by default at -O and higher.
8936
8937 -fshrink-wrap-separate
8938 Shrink-wrap separate parts of the prologue and epilogue separately,
8939 so that those parts are only executed when needed. This option is
8940 on by default, but has no effect unless -fshrink-wrap is also
8941 turned on and the target supports this.
8942
8943 -fcaller-saves
8944 Enable allocation of values to registers that are clobbered by
8945 function calls, by emitting extra instructions to save and restore
8946 the registers around such calls. Such allocation is done only when
8947 it seems to result in better code.
8948
8949 This option is always enabled by default on certain machines,
8950 usually those which have no call-preserved registers to use
8951 instead.
8952
8953 Enabled at levels -O2, -O3, -Os.
8954
8955 -fcombine-stack-adjustments
8956 Tracks stack adjustments (pushes and pops) and stack memory
8957 references and then tries to find ways to combine them.
8958
8959 Enabled by default at -O1 and higher.
8960
8961 -fipa-ra
8962 Use caller save registers for allocation if those registers are not
8963 used by any called function. In that case it is not necessary to
8964 save and restore them around calls. This is only possible if
8965 called functions are part of same compilation unit as current
8966 function and they are compiled before it.
8967
8968 Enabled at levels -O2, -O3, -Os, however the option is disabled if
8969 generated code will be instrumented for profiling (-p, or -pg) or
8970 if callee's register usage cannot be known exactly (this happens on
8971 targets that do not expose prologues and epilogues in RTL).
8972
8973 -fconserve-stack
8974 Attempt to minimize stack usage. The compiler attempts to use less
8975 stack space, even if that makes the program slower. This option
8976 implies setting the large-stack-frame parameter to 100 and the
8977 large-stack-frame-growth parameter to 400.
8978
8979 -ftree-reassoc
8980 Perform reassociation on trees. This flag is enabled by default at
8981 -O and higher.
8982
8983 -fcode-hoisting
8984 Perform code hoisting. Code hoisting tries to move the evaluation
8985 of expressions executed on all paths to the function exit as early
8986 as possible. This is especially useful as a code size
8987 optimization, but it often helps for code speed as well. This flag
8988 is enabled by default at -O2 and higher.
8989
8990 -ftree-pre
8991 Perform partial redundancy elimination (PRE) on trees. This flag
8992 is enabled by default at -O2 and -O3.
8993
8994 -ftree-partial-pre
8995 Make partial redundancy elimination (PRE) more aggressive. This
8996 flag is enabled by default at -O3.
8997
8998 -ftree-forwprop
8999 Perform forward propagation on trees. This flag is enabled by
9000 default at -O and higher.
9001
9002 -ftree-fre
9003 Perform full redundancy elimination (FRE) on trees. The difference
9004 between FRE and PRE is that FRE only considers expressions that are
9005 computed on all paths leading to the redundant computation. This
9006 analysis is faster than PRE, though it exposes fewer redundancies.
9007 This flag is enabled by default at -O and higher.
9008
9009 -ftree-phiprop
9010 Perform hoisting of loads from conditional pointers on trees. This
9011 pass is enabled by default at -O and higher.
9012
9013 -fhoist-adjacent-loads
9014 Speculatively hoist loads from both branches of an if-then-else if
9015 the loads are from adjacent locations in the same structure and the
9016 target architecture has a conditional move instruction. This flag
9017 is enabled by default at -O2 and higher.
9018
9019 -ftree-copy-prop
9020 Perform copy propagation on trees. This pass eliminates
9021 unnecessary copy operations. This flag is enabled by default at -O
9022 and higher.
9023
9024 -fipa-pure-const
9025 Discover which functions are pure or constant. Enabled by default
9026 at -O and higher.
9027
9028 -fipa-reference
9029 Discover which static variables do not escape the compilation unit.
9030 Enabled by default at -O and higher.
9031
9032 -fipa-reference-addressable
9033 Discover read-only, write-only and non-addressable static
9034 variables. Enabled by default at -O and higher.
9035
9036 -fipa-stack-alignment
9037 Reduce stack alignment on call sites if possible. Enabled by
9038 default.
9039
9040 -fipa-pta
9041 Perform interprocedural pointer analysis and interprocedural
9042 modification and reference analysis. This option can cause
9043 excessive memory and compile-time usage on large compilation units.
9044 It is not enabled by default at any optimization level.
9045
9046 -fipa-profile
9047 Perform interprocedural profile propagation. The functions called
9048 only from cold functions are marked as cold. Also functions
9049 executed once (such as "cold", "noreturn", static constructors or
9050 destructors) are identified. Cold functions and loop less parts of
9051 functions executed once are then optimized for size. Enabled by
9052 default at -O and higher.
9053
9054 -fipa-modref
9055 Perform interprocedural mod/ref analysis. This optimization
9056 analyzes the side effects of functions (memory locations that are
9057 modified or referenced) and enables better optimization across the
9058 function call boundary. This flag is enabled by default at -O and
9059 higher.
9060
9061 -fipa-cp
9062 Perform interprocedural constant propagation. This optimization
9063 analyzes the program to determine when values passed to functions
9064 are constants and then optimizes accordingly. This optimization
9065 can substantially increase performance if the application has
9066 constants passed to functions. This flag is enabled by default at
9067 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9068 -fauto-profile.
9069
9070 -fipa-cp-clone
9071 Perform function cloning to make interprocedural constant
9072 propagation stronger. When enabled, interprocedural constant
9073 propagation performs function cloning when externally visible
9074 function can be called with constant arguments. Because this
9075 optimization can create multiple copies of functions, it may
9076 significantly increase code size (see --param
9077 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9078 It is also enabled by -fprofile-use and -fauto-profile.
9079
9080 -fipa-bit-cp
9081 When enabled, perform interprocedural bitwise constant propagation.
9082 This flag is enabled by default at -O2 and by -fprofile-use and
9083 -fauto-profile. It requires that -fipa-cp is enabled.
9084
9085 -fipa-vrp
9086 When enabled, perform interprocedural propagation of value ranges.
9087 This flag is enabled by default at -O2. It requires that -fipa-cp
9088 is enabled.
9089
9090 -fipa-icf
9091 Perform Identical Code Folding for functions and read-only
9092 variables. The optimization reduces code size and may disturb
9093 unwind stacks by replacing a function by equivalent one with a
9094 different name. The optimization works more effectively with link-
9095 time optimization enabled.
9096
9097 Although the behavior is similar to the Gold Linker's ICF
9098 optimization, GCC ICF works on different levels and thus the
9099 optimizations are not same - there are equivalences that are found
9100 only by GCC and equivalences found only by Gold.
9101
9102 This flag is enabled by default at -O2 and -Os.
9103
9104 -flive-patching=level
9105 Control GCC's optimizations to produce output suitable for live-
9106 patching.
9107
9108 If the compiler's optimization uses a function's body or
9109 information extracted from its body to optimize/change another
9110 function, the latter is called an impacted function of the former.
9111 If a function is patched, its impacted functions should be patched
9112 too.
9113
9114 The impacted functions are determined by the compiler's
9115 interprocedural optimizations. For example, a caller is impacted
9116 when inlining a function into its caller, cloning a function and
9117 changing its caller to call this new clone, or extracting a
9118 function's pureness/constness information to optimize its direct or
9119 indirect callers, etc.
9120
9121 Usually, the more IPA optimizations enabled, the larger the number
9122 of impacted functions for each function. In order to control the
9123 number of impacted functions and more easily compute the list of
9124 impacted function, IPA optimizations can be partially enabled at
9125 two different levels.
9126
9127 The level argument should be one of the following:
9128
9129 inline-clone
9130 Only enable inlining and cloning optimizations, which includes
9131 inlining, cloning, interprocedural scalar replacement of
9132 aggregates and partial inlining. As a result, when patching a
9133 function, all its callers and its clones' callers are impacted,
9134 therefore need to be patched as well.
9135
9136 -flive-patching=inline-clone disables the following
9137 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9138 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9139 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9140 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9141
9142 inline-only-static
9143 Only enable inlining of static functions. As a result, when
9144 patching a static function, all its callers are impacted and so
9145 need to be patched as well.
9146
9147 In addition to all the flags that -flive-patching=inline-clone
9148 disables, -flive-patching=inline-only-static disables the
9149 following additional optimization flags: -fipa-cp-clone
9150 -fipa-sra -fpartial-inlining -fipa-cp
9151
9152 When -flive-patching is specified without any value, the default
9153 value is inline-clone.
9154
9155 This flag is disabled by default.
9156
9157 Note that -flive-patching is not supported with link-time
9158 optimization (-flto).
9159
9160 -fisolate-erroneous-paths-dereference
9161 Detect paths that trigger erroneous or undefined behavior due to
9162 dereferencing a null pointer. Isolate those paths from the main
9163 control flow and turn the statement with erroneous or undefined
9164 behavior into a trap. This flag is enabled by default at -O2 and
9165 higher and depends on -fdelete-null-pointer-checks also being
9166 enabled.
9167
9168 -fisolate-erroneous-paths-attribute
9169 Detect paths that trigger erroneous or undefined behavior due to a
9170 null value being used in a way forbidden by a "returns_nonnull" or
9171 "nonnull" attribute. Isolate those paths from the main control
9172 flow and turn the statement with erroneous or undefined behavior
9173 into a trap. This is not currently enabled, but may be enabled by
9174 -O2 in the future.
9175
9176 -ftree-sink
9177 Perform forward store motion on trees. This flag is enabled by
9178 default at -O and higher.
9179
9180 -ftree-bit-ccp
9181 Perform sparse conditional bit constant propagation on trees and
9182 propagate pointer alignment information. This pass only operates
9183 on local scalar variables and is enabled by default at -O1 and
9184 higher, except for -Og. It requires that -ftree-ccp is enabled.
9185
9186 -ftree-ccp
9187 Perform sparse conditional constant propagation (CCP) on trees.
9188 This pass only operates on local scalar variables and is enabled by
9189 default at -O and higher.
9190
9191 -fssa-backprop
9192 Propagate information about uses of a value up the definition chain
9193 in order to simplify the definitions. For example, this pass
9194 strips sign operations if the sign of a value never matters. The
9195 flag is enabled by default at -O and higher.
9196
9197 -fssa-phiopt
9198 Perform pattern matching on SSA PHI nodes to optimize conditional
9199 code. This pass is enabled by default at -O1 and higher, except
9200 for -Og.
9201
9202 -ftree-switch-conversion
9203 Perform conversion of simple initializations in a switch to
9204 initializations from a scalar array. This flag is enabled by
9205 default at -O2 and higher.
9206
9207 -ftree-tail-merge
9208 Look for identical code sequences. When found, replace one with a
9209 jump to the other. This optimization is known as tail merging or
9210 cross jumping. This flag is enabled by default at -O2 and higher.
9211 The compilation time in this pass can be limited using max-tail-
9212 merge-comparisons parameter and max-tail-merge-iterations
9213 parameter.
9214
9215 -ftree-dce
9216 Perform dead code elimination (DCE) on trees. This flag is enabled
9217 by default at -O and higher.
9218
9219 -ftree-builtin-call-dce
9220 Perform conditional dead code elimination (DCE) for calls to built-
9221 in functions that may set "errno" but are otherwise free of side
9222 effects. This flag is enabled by default at -O2 and higher if -Os
9223 is not also specified.
9224
9225 -ffinite-loops
9226 Assume that a loop with an exit will eventually take the exit and
9227 not loop indefinitely. This allows the compiler to remove loops
9228 that otherwise have no side-effects, not considering eventual
9229 endless looping as such.
9230
9231 This option is enabled by default at -O2 for C++ with -std=c++11 or
9232 higher.
9233
9234 -ftree-dominator-opts
9235 Perform a variety of simple scalar cleanups (constant/copy
9236 propagation, redundancy elimination, range propagation and
9237 expression simplification) based on a dominator tree traversal.
9238 This also performs jump threading (to reduce jumps to jumps). This
9239 flag is enabled by default at -O and higher.
9240
9241 -ftree-dse
9242 Perform dead store elimination (DSE) on trees. A dead store is a
9243 store into a memory location that is later overwritten by another
9244 store without any intervening loads. In this case the earlier
9245 store can be deleted. This flag is enabled by default at -O and
9246 higher.
9247
9248 -ftree-ch
9249 Perform loop header copying on trees. This is beneficial since it
9250 increases effectiveness of code motion optimizations. It also
9251 saves one jump. This flag is enabled by default at -O and higher.
9252 It is not enabled for -Os, since it usually increases code size.
9253
9254 -ftree-loop-optimize
9255 Perform loop optimizations on trees. This flag is enabled by
9256 default at -O and higher.
9257
9258 -ftree-loop-linear
9259 -floop-strip-mine
9260 -floop-block
9261 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9262 use this code transformation, GCC has to be configured with
9263 --with-isl to enable the Graphite loop transformation
9264 infrastructure.
9265
9266 -fgraphite-identity
9267 Enable the identity transformation for graphite. For every SCoP we
9268 generate the polyhedral representation and transform it back to
9269 gimple. Using -fgraphite-identity we can check the costs or
9270 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9271 minimal optimizations are also performed by the code generator isl,
9272 like index splitting and dead code elimination in loops.
9273
9274 -floop-nest-optimize
9275 Enable the isl based loop nest optimizer. This is a generic loop
9276 nest optimizer based on the Pluto optimization algorithms. It
9277 calculates a loop structure optimized for data-locality and
9278 parallelism. This option is experimental.
9279
9280 -floop-parallelize-all
9281 Use the Graphite data dependence analysis to identify loops that
9282 can be parallelized. Parallelize all the loops that can be
9283 analyzed to not contain loop carried dependences without checking
9284 that it is profitable to parallelize the loops.
9285
9286 -ftree-coalesce-vars
9287 While transforming the program out of the SSA representation,
9288 attempt to reduce copying by coalescing versions of different user-
9289 defined variables, instead of just compiler temporaries. This may
9290 severely limit the ability to debug an optimized program compiled
9291 with -fno-var-tracking-assignments. In the negated form, this flag
9292 prevents SSA coalescing of user variables. This option is enabled
9293 by default if optimization is enabled, and it does very little
9294 otherwise.
9295
9296 -ftree-loop-if-convert
9297 Attempt to transform conditional jumps in the innermost loops to
9298 branch-less equivalents. The intent is to remove control-flow from
9299 the innermost loops in order to improve the ability of the
9300 vectorization pass to handle these loops. This is enabled by
9301 default if vectorization is enabled.
9302
9303 -ftree-loop-distribution
9304 Perform loop distribution. This flag can improve cache performance
9305 on big loop bodies and allow further loop optimizations, like
9306 parallelization or vectorization, to take place. For example, the
9307 loop
9308
9309 DO I = 1, N
9310 A(I) = B(I) + C
9311 D(I) = E(I) * F
9312 ENDDO
9313
9314 is transformed to
9315
9316 DO I = 1, N
9317 A(I) = B(I) + C
9318 ENDDO
9319 DO I = 1, N
9320 D(I) = E(I) * F
9321 ENDDO
9322
9323 This flag is enabled by default at -O3. It is also enabled by
9324 -fprofile-use and -fauto-profile.
9325
9326 -ftree-loop-distribute-patterns
9327 Perform loop distribution of patterns that can be code generated
9328 with calls to a library. This flag is enabled by default at -O2
9329 and higher, and by -fprofile-use and -fauto-profile.
9330
9331 This pass distributes the initialization loops and generates a call
9332 to memset zero. For example, the loop
9333
9334 DO I = 1, N
9335 A(I) = 0
9336 B(I) = A(I) + I
9337 ENDDO
9338
9339 is transformed to
9340
9341 DO I = 1, N
9342 A(I) = 0
9343 ENDDO
9344 DO I = 1, N
9345 B(I) = A(I) + I
9346 ENDDO
9347
9348 and the initialization loop is transformed into a call to memset
9349 zero. This flag is enabled by default at -O3. It is also enabled
9350 by -fprofile-use and -fauto-profile.
9351
9352 -floop-interchange
9353 Perform loop interchange outside of graphite. This flag can
9354 improve cache performance on loop nest and allow further loop
9355 optimizations, like vectorization, to take place. For example, the
9356 loop
9357
9358 for (int i = 0; i < N; i++)
9359 for (int j = 0; j < N; j++)
9360 for (int k = 0; k < N; k++)
9361 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9362
9363 is transformed to
9364
9365 for (int i = 0; i < N; i++)
9366 for (int k = 0; k < N; k++)
9367 for (int j = 0; j < N; j++)
9368 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9369
9370 This flag is enabled by default at -O3. It is also enabled by
9371 -fprofile-use and -fauto-profile.
9372
9373 -floop-unroll-and-jam
9374 Apply unroll and jam transformations on feasible loops. In a loop
9375 nest this unrolls the outer loop by some factor and fuses the
9376 resulting multiple inner loops. This flag is enabled by default at
9377 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9378
9379 -ftree-loop-im
9380 Perform loop invariant motion on trees. This pass moves only
9381 invariants that are hard to handle at RTL level (function calls,
9382 operations that expand to nontrivial sequences of insns). With
9383 -funswitch-loops it also moves operands of conditions that are
9384 invariant out of the loop, so that we can use just trivial
9385 invariantness analysis in loop unswitching. The pass also includes
9386 store motion.
9387
9388 -ftree-loop-ivcanon
9389 Create a canonical counter for number of iterations in loops for
9390 which determining number of iterations requires complicated
9391 analysis. Later optimizations then may determine the number
9392 easily. Useful especially in connection with unrolling.
9393
9394 -ftree-scev-cprop
9395 Perform final value replacement. If a variable is modified in a
9396 loop in such a way that its value when exiting the loop can be
9397 determined using only its initial value and the number of loop
9398 iterations, replace uses of the final value by such a computation,
9399 provided it is sufficiently cheap. This reduces data dependencies
9400 and may allow further simplifications. Enabled by default at -O
9401 and higher.
9402
9403 -fivopts
9404 Perform induction variable optimizations (strength reduction,
9405 induction variable merging and induction variable elimination) on
9406 trees.
9407
9408 -ftree-parallelize-loops=n
9409 Parallelize loops, i.e., split their iteration space to run in n
9410 threads. This is only possible for loops whose iterations are
9411 independent and can be arbitrarily reordered. The optimization is
9412 only profitable on multiprocessor machines, for loops that are CPU-
9413 intensive, rather than constrained e.g. by memory bandwidth. This
9414 option implies -pthread, and thus is only supported on targets that
9415 have support for -pthread.
9416
9417 -ftree-pta
9418 Perform function-local points-to analysis on trees. This flag is
9419 enabled by default at -O1 and higher, except for -Og.
9420
9421 -ftree-sra
9422 Perform scalar replacement of aggregates. This pass replaces
9423 structure references with scalars to prevent committing structures
9424 to memory too early. This flag is enabled by default at -O1 and
9425 higher, except for -Og.
9426
9427 -fstore-merging
9428 Perform merging of narrow stores to consecutive memory addresses.
9429 This pass merges contiguous stores of immediate values narrower
9430 than a word into fewer wider stores to reduce the number of
9431 instructions. This is enabled by default at -O2 and higher as well
9432 as -Os.
9433
9434 -ftree-ter
9435 Perform temporary expression replacement during the SSA->normal
9436 phase. Single use/single def temporaries are replaced at their use
9437 location with their defining expression. This results in non-
9438 GIMPLE code, but gives the expanders much more complex trees to
9439 work on resulting in better RTL generation. This is enabled by
9440 default at -O and higher.
9441
9442 -ftree-slsr
9443 Perform straight-line strength reduction on trees. This recognizes
9444 related expressions involving multiplications and replaces them by
9445 less expensive calculations when possible. This is enabled by
9446 default at -O and higher.
9447
9448 -ftree-vectorize
9449 Perform vectorization on trees. This flag enables
9450 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
9451 specified.
9452
9453 -ftree-loop-vectorize
9454 Perform loop vectorization on trees. This flag is enabled by
9455 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9456 -fauto-profile.
9457
9458 -ftree-slp-vectorize
9459 Perform basic block vectorization on trees. This flag is enabled by
9460 default at -O3 and by -ftree-vectorize, -fprofile-use, and
9461 -fauto-profile.
9462
9463 -fvect-cost-model=model
9464 Alter the cost model used for vectorization. The model argument
9465 should be one of unlimited, dynamic, cheap or very-cheap. With the
9466 unlimited model the vectorized code-path is assumed to be
9467 profitable while with the dynamic model a runtime check guards the
9468 vectorized code-path to enable it only for iteration counts that
9469 will likely execute faster than when executing the original scalar
9470 loop. The cheap model disables vectorization of loops where doing
9471 so would be cost prohibitive for example due to required runtime
9472 checks for data dependence or alignment but otherwise is equal to
9473 the dynamic model. The very-cheap model only allows vectorization
9474 if the vector code would entirely replace the scalar code that is
9475 being vectorized. For example, if each iteration of a vectorized
9476 loop would only be able to handle exactly four iterations of the
9477 scalar loop, the very-cheap model would only allow vectorization if
9478 the scalar iteration count is known to be a multiple of four.
9479
9480 The default cost model depends on other optimization flags and is
9481 either dynamic or cheap.
9482
9483 -fsimd-cost-model=model
9484 Alter the cost model used for vectorization of loops marked with
9485 the OpenMP simd directive. The model argument should be one of
9486 unlimited, dynamic, cheap. All values of model have the same
9487 meaning as described in -fvect-cost-model and by default a cost
9488 model defined with -fvect-cost-model is used.
9489
9490 -ftree-vrp
9491 Perform Value Range Propagation on trees. This is similar to the
9492 constant propagation pass, but instead of values, ranges of values
9493 are propagated. This allows the optimizers to remove unnecessary
9494 range checks like array bound checks and null pointer checks. This
9495 is enabled by default at -O2 and higher. Null pointer check
9496 elimination is only done if -fdelete-null-pointer-checks is
9497 enabled.
9498
9499 -fsplit-paths
9500 Split paths leading to loop backedges. This can improve dead code
9501 elimination and common subexpression elimination. This is enabled
9502 by default at -O3 and above.
9503
9504 -fsplit-ivs-in-unroller
9505 Enables expression of values of induction variables in later
9506 iterations of the unrolled loop using the value in the first
9507 iteration. This breaks long dependency chains, thus improving
9508 efficiency of the scheduling passes.
9509
9510 A combination of -fweb and CSE is often sufficient to obtain the
9511 same effect. However, that is not reliable in cases where the loop
9512 body is more complicated than a single basic block. It also does
9513 not work at all on some architectures due to restrictions in the
9514 CSE pass.
9515
9516 This optimization is enabled by default.
9517
9518 -fvariable-expansion-in-unroller
9519 With this option, the compiler creates multiple copies of some
9520 local variables when unrolling a loop, which can result in superior
9521 code.
9522
9523 This optimization is enabled by default for PowerPC targets, but
9524 disabled by default otherwise.
9525
9526 -fpartial-inlining
9527 Inline parts of functions. This option has any effect only when
9528 inlining itself is turned on by the -finline-functions or
9529 -finline-small-functions options.
9530
9531 Enabled at levels -O2, -O3, -Os.
9532
9533 -fpredictive-commoning
9534 Perform predictive commoning optimization, i.e., reusing
9535 computations (especially memory loads and stores) performed in
9536 previous iterations of loops.
9537
9538 This option is enabled at level -O3. It is also enabled by
9539 -fprofile-use and -fauto-profile.
9540
9541 -fprefetch-loop-arrays
9542 If supported by the target machine, generate instructions to
9543 prefetch memory to improve the performance of loops that access
9544 large arrays.
9545
9546 This option may generate better or worse code; results are highly
9547 dependent on the structure of loops within the source code.
9548
9549 Disabled at level -Os.
9550
9551 -fno-printf-return-value
9552 Do not substitute constants for known return value of formatted
9553 output functions such as "sprintf", "snprintf", "vsprintf", and
9554 "vsnprintf" (but not "printf" of "fprintf"). This transformation
9555 allows GCC to optimize or even eliminate branches based on the
9556 known return value of these functions called with arguments that
9557 are either constant, or whose values are known to be in a range
9558 that makes determining the exact return value possible. For
9559 example, when -fprintf-return-value is in effect, both the branch
9560 and the body of the "if" statement (but not the call to "snprint")
9561 can be optimized away when "i" is a 32-bit or smaller integer
9562 because the return value is guaranteed to be at most 8.
9563
9564 char buf[9];
9565 if (snprintf (buf, "%08x", i) >= sizeof buf)
9566 ...
9567
9568 The -fprintf-return-value option relies on other optimizations and
9569 yields best results with -O2 and above. It works in tandem with
9570 the -Wformat-overflow and -Wformat-truncation options. The
9571 -fprintf-return-value option is enabled by default.
9572
9573 -fno-peephole
9574 -fno-peephole2
9575 Disable any machine-specific peephole optimizations. The
9576 difference between -fno-peephole and -fno-peephole2 is in how they
9577 are implemented in the compiler; some targets use one, some use the
9578 other, a few use both.
9579
9580 -fpeephole is enabled by default. -fpeephole2 enabled at levels
9581 -O2, -O3, -Os.
9582
9583 -fno-guess-branch-probability
9584 Do not guess branch probabilities using heuristics.
9585
9586 GCC uses heuristics to guess branch probabilities if they are not
9587 provided by profiling feedback (-fprofile-arcs). These heuristics
9588 are based on the control flow graph. If some branch probabilities
9589 are specified by "__builtin_expect", then the heuristics are used
9590 to guess branch probabilities for the rest of the control flow
9591 graph, taking the "__builtin_expect" info into account. The
9592 interactions between the heuristics and "__builtin_expect" can be
9593 complex, and in some cases, it may be useful to disable the
9594 heuristics so that the effects of "__builtin_expect" are easier to
9595 understand.
9596
9597 It is also possible to specify expected probability of the
9598 expression with "__builtin_expect_with_probability" built-in
9599 function.
9600
9601 The default is -fguess-branch-probability at levels -O, -O2, -O3,
9602 -Os.
9603
9604 -freorder-blocks
9605 Reorder basic blocks in the compiled function in order to reduce
9606 number of taken branches and improve code locality.
9607
9608 Enabled at levels -O, -O2, -O3, -Os.
9609
9610 -freorder-blocks-algorithm=algorithm
9611 Use the specified algorithm for basic block reordering. The
9612 algorithm argument can be simple, which does not increase code size
9613 (except sometimes due to secondary effects like alignment), or stc,
9614 the "software trace cache" algorithm, which tries to put all often
9615 executed code together, minimizing the number of branches executed
9616 by making extra copies of code.
9617
9618 The default is simple at levels -O, -Os, and stc at levels -O2,
9619 -O3.
9620
9621 -freorder-blocks-and-partition
9622 In addition to reordering basic blocks in the compiled function, in
9623 order to reduce number of taken branches, partitions hot and cold
9624 basic blocks into separate sections of the assembly and .o files,
9625 to improve paging and cache locality performance.
9626
9627 This optimization is automatically turned off in the presence of
9628 exception handling or unwind tables (on targets using
9629 setjump/longjump or target specific scheme), for linkonce sections,
9630 for functions with a user-defined section attribute and on any
9631 architecture that does not support named sections. When
9632 -fsplit-stack is used this option is not enabled by default (to
9633 avoid linker errors), but may be enabled explicitly (if using a
9634 working linker).
9635
9636 Enabled for x86 at levels -O2, -O3, -Os.
9637
9638 -freorder-functions
9639 Reorder functions in the object file in order to improve code
9640 locality. This is implemented by using special subsections
9641 ".text.hot" for most frequently executed functions and
9642 ".text.unlikely" for unlikely executed functions. Reordering is
9643 done by the linker so object file format must support named
9644 sections and linker must place them in a reasonable way.
9645
9646 This option isn't effective unless you either provide profile
9647 feedback (see -fprofile-arcs for details) or manually annotate
9648 functions with "hot" or "cold" attributes.
9649
9650 Enabled at levels -O2, -O3, -Os.
9651
9652 -fstrict-aliasing
9653 Allow the compiler to assume the strictest aliasing rules
9654 applicable to the language being compiled. For C (and C++), this
9655 activates optimizations based on the type of expressions. In
9656 particular, an object of one type is assumed never to reside at the
9657 same address as an object of a different type, unless the types are
9658 almost the same. For example, an "unsigned int" can alias an
9659 "int", but not a "void*" or a "double". A character type may alias
9660 any other type.
9661
9662 Pay special attention to code like this:
9663
9664 union a_union {
9665 int i;
9666 double d;
9667 };
9668
9669 int f() {
9670 union a_union t;
9671 t.d = 3.0;
9672 return t.i;
9673 }
9674
9675 The practice of reading from a different union member than the one
9676 most recently written to (called "type-punning") is common. Even
9677 with -fstrict-aliasing, type-punning is allowed, provided the
9678 memory is accessed through the union type. So, the code above
9679 works as expected. However, this code might not:
9680
9681 int f() {
9682 union a_union t;
9683 int* ip;
9684 t.d = 3.0;
9685 ip = &t.i;
9686 return *ip;
9687 }
9688
9689 Similarly, access by taking the address, casting the resulting
9690 pointer and dereferencing the result has undefined behavior, even
9691 if the cast uses a union type, e.g.:
9692
9693 int f() {
9694 double d = 3.0;
9695 return ((union a_union *) &d)->i;
9696 }
9697
9698 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
9699
9700 -falign-functions
9701 -falign-functions=n
9702 -falign-functions=n:m
9703 -falign-functions=n:m:n2
9704 -falign-functions=n:m:n2:m2
9705 Align the start of functions to the next power-of-two greater than
9706 or equal to n, skipping up to m-1 bytes. This ensures that at
9707 least the first m bytes of the function can be fetched by the CPU
9708 without crossing an n-byte alignment boundary.
9709
9710 If m is not specified, it defaults to n.
9711
9712 Examples: -falign-functions=32 aligns functions to the next 32-byte
9713 boundary, -falign-functions=24 aligns to the next 32-byte boundary
9714 only if this can be done by skipping 23 bytes or less,
9715 -falign-functions=32:7 aligns to the next 32-byte boundary only if
9716 this can be done by skipping 6 bytes or less.
9717
9718 The second pair of n2:m2 values allows you to specify a secondary
9719 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
9720 boundary if this can be done by skipping 6 bytes or less, otherwise
9721 aligns to the next 32-byte boundary if this can be done by skipping
9722 2 bytes or less. If m2 is not specified, it defaults to n2.
9723
9724 Some assemblers only support this flag when n is a power of two; in
9725 that case, it is rounded up.
9726
9727 -fno-align-functions and -falign-functions=1 are equivalent and
9728 mean that functions are not aligned.
9729
9730 If n is not specified or is zero, use a machine-dependent default.
9731 The maximum allowed n option value is 65536.
9732
9733 Enabled at levels -O2, -O3.
9734
9735 -flimit-function-alignment
9736 If this option is enabled, the compiler tries to avoid
9737 unnecessarily overaligning functions. It attempts to instruct the
9738 assembler to align by the amount specified by -falign-functions,
9739 but not to skip more bytes than the size of the function.
9740
9741 -falign-labels
9742 -falign-labels=n
9743 -falign-labels=n:m
9744 -falign-labels=n:m:n2
9745 -falign-labels=n:m:n2:m2
9746 Align all branch targets to a power-of-two boundary.
9747
9748 Parameters of this option are analogous to the -falign-functions
9749 option. -fno-align-labels and -falign-labels=1 are equivalent and
9750 mean that labels are not aligned.
9751
9752 If -falign-loops or -falign-jumps are applicable and are greater
9753 than this value, then their values are used instead.
9754
9755 If n is not specified or is zero, use a machine-dependent default
9756 which is very likely to be 1, meaning no alignment. The maximum
9757 allowed n option value is 65536.
9758
9759 Enabled at levels -O2, -O3.
9760
9761 -falign-loops
9762 -falign-loops=n
9763 -falign-loops=n:m
9764 -falign-loops=n:m:n2
9765 -falign-loops=n:m:n2:m2
9766 Align loops to a power-of-two boundary. If the loops are executed
9767 many times, this makes up for any execution of the dummy padding
9768 instructions.
9769
9770 If -falign-labels is greater than this value, then its value is
9771 used instead.
9772
9773 Parameters of this option are analogous to the -falign-functions
9774 option. -fno-align-loops and -falign-loops=1 are equivalent and
9775 mean that loops are not aligned. The maximum allowed n option
9776 value is 65536.
9777
9778 If n is not specified or is zero, use a machine-dependent default.
9779
9780 Enabled at levels -O2, -O3.
9781
9782 -falign-jumps
9783 -falign-jumps=n
9784 -falign-jumps=n:m
9785 -falign-jumps=n:m:n2
9786 -falign-jumps=n:m:n2:m2
9787 Align branch targets to a power-of-two boundary, for branch targets
9788 where the targets can only be reached by jumping. In this case, no
9789 dummy operations need be executed.
9790
9791 If -falign-labels is greater than this value, then its value is
9792 used instead.
9793
9794 Parameters of this option are analogous to the -falign-functions
9795 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
9796 mean that loops are not aligned.
9797
9798 If n is not specified or is zero, use a machine-dependent default.
9799 The maximum allowed n option value is 65536.
9800
9801 Enabled at levels -O2, -O3.
9802
9803 -fno-allocation-dce
9804 Do not remove unused C++ allocations in dead code elimination.
9805
9806 -fallow-store-data-races
9807 Allow the compiler to perform optimizations that may introduce new
9808 data races on stores, without proving that the variable cannot be
9809 concurrently accessed by other threads. Does not affect
9810 optimization of local data. It is safe to use this option if it is
9811 known that global data will not be accessed by multiple threads.
9812
9813 Examples of optimizations enabled by -fallow-store-data-races
9814 include hoisting or if-conversions that may cause a value that was
9815 already in memory to be re-written with that same value. Such re-
9816 writing is safe in a single threaded context but may be unsafe in a
9817 multi-threaded context. Note that on some processors, if-
9818 conversions may be required in order to enable vectorization.
9819
9820 Enabled at level -Ofast.
9821
9822 -funit-at-a-time
9823 This option is left for compatibility reasons. -funit-at-a-time has
9824 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
9825 and -fno-section-anchors.
9826
9827 Enabled by default.
9828
9829 -fno-toplevel-reorder
9830 Do not reorder top-level functions, variables, and "asm"
9831 statements. Output them in the same order that they appear in the
9832 input file. When this option is used, unreferenced static
9833 variables are not removed. This option is intended to support
9834 existing code that relies on a particular ordering. For new code,
9835 it is better to use attributes when possible.
9836
9837 -ftoplevel-reorder is the default at -O1 and higher, and also at
9838 -O0 if -fsection-anchors is explicitly requested. Additionally
9839 -fno-toplevel-reorder implies -fno-section-anchors.
9840
9841 -fweb
9842 Constructs webs as commonly used for register allocation purposes
9843 and assign each web individual pseudo register. This allows the
9844 register allocation pass to operate on pseudos directly, but also
9845 strengthens several other optimization passes, such as CSE, loop
9846 optimizer and trivial dead code remover. It can, however, make
9847 debugging impossible, since variables no longer stay in a "home
9848 register".
9849
9850 Enabled by default with -funroll-loops.
9851
9852 -fwhole-program
9853 Assume that the current compilation unit represents the whole
9854 program being compiled. All public functions and variables with
9855 the exception of "main" and those merged by attribute
9856 "externally_visible" become static functions and in effect are
9857 optimized more aggressively by interprocedural optimizers.
9858
9859 This option should not be used in combination with -flto. Instead
9860 relying on a linker plugin should provide safer and more precise
9861 information.
9862
9863 -flto[=n]
9864 This option runs the standard link-time optimizer. When invoked
9865 with source code, it generates GIMPLE (one of GCC's internal
9866 representations) and writes it to special ELF sections in the
9867 object file. When the object files are linked together, all the
9868 function bodies are read from these ELF sections and instantiated
9869 as if they had been part of the same translation unit.
9870
9871 To use the link-time optimizer, -flto and optimization options
9872 should be specified at compile time and during the final link. It
9873 is recommended that you compile all the files participating in the
9874 same link with the same options and also specify those options at
9875 link time. For example:
9876
9877 gcc -c -O2 -flto foo.c
9878 gcc -c -O2 -flto bar.c
9879 gcc -o myprog -flto -O2 foo.o bar.o
9880
9881 The first two invocations to GCC save a bytecode representation of
9882 GIMPLE into special ELF sections inside foo.o and bar.o. The final
9883 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
9884 the two files into a single internal image, and compiles the result
9885 as usual. Since both foo.o and bar.o are merged into a single
9886 image, this causes all the interprocedural analyses and
9887 optimizations in GCC to work across the two files as if they were a
9888 single one. This means, for example, that the inliner is able to
9889 inline functions in bar.o into functions in foo.o and vice-versa.
9890
9891 Another (simpler) way to enable link-time optimization is:
9892
9893 gcc -o myprog -flto -O2 foo.c bar.c
9894
9895 The above generates bytecode for foo.c and bar.c, merges them
9896 together into a single GIMPLE representation and optimizes them as
9897 usual to produce myprog.
9898
9899 The important thing to keep in mind is that to enable link-time
9900 optimizations you need to use the GCC driver to perform the link
9901 step. GCC automatically performs link-time optimization if any of
9902 the objects involved were compiled with the -flto command-line
9903 option. You can always override the automatic decision to do link-
9904 time optimization by passing -fno-lto to the link command.
9905
9906 To make whole program optimization effective, it is necessary to
9907 make certain whole program assumptions. The compiler needs to know
9908 what functions and variables can be accessed by libraries and
9909 runtime outside of the link-time optimized unit. When supported by
9910 the linker, the linker plugin (see -fuse-linker-plugin) passes
9911 information to the compiler about used and externally visible
9912 symbols. When the linker plugin is not available, -fwhole-program
9913 should be used to allow the compiler to make these assumptions,
9914 which leads to more aggressive optimization decisions.
9915
9916 When a file is compiled with -flto without -fuse-linker-plugin, the
9917 generated object file is larger than a regular object file because
9918 it contains GIMPLE bytecodes and the usual final code (see
9919 -ffat-lto-objects). This means that object files with LTO
9920 information can be linked as normal object files; if -fno-lto is
9921 passed to the linker, no interprocedural optimizations are applied.
9922 Note that when -fno-fat-lto-objects is enabled the compile stage is
9923 faster but you cannot perform a regular, non-LTO link on them.
9924
9925 When producing the final binary, GCC only applies link-time
9926 optimizations to those files that contain bytecode. Therefore, you
9927 can mix and match object files and libraries with GIMPLE bytecodes
9928 and final object code. GCC automatically selects which files to
9929 optimize in LTO mode and which files to link without further
9930 processing.
9931
9932 Generally, options specified at link time override those specified
9933 at compile time, although in some cases GCC attempts to infer link-
9934 time options from the settings used to compile the input files.
9935
9936 If you do not specify an optimization level option -O at link time,
9937 then GCC uses the highest optimization level used when compiling
9938 the object files. Note that it is generally ineffective to specify
9939 an optimization level option only at link time and not at compile
9940 time, for two reasons. First, compiling without optimization
9941 suppresses compiler passes that gather information needed for
9942 effective optimization at link time. Second, some early
9943 optimization passes can be performed only at compile time and not
9944 at link time.
9945
9946 There are some code generation flags preserved by GCC when
9947 generating bytecodes, as they need to be used during the final
9948 link. Currently, the following options and their settings are
9949 taken from the first object file that explicitly specifies them:
9950 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
9951 -m target flags.
9952
9953 The following options -fPIC, -fpic, -fpie and -fPIE are combined
9954 based on the following scheme:
9955
9956 B<-fPIC> + B<-fpic> = B<-fpic>
9957 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
9958 B<-fpic/-fPIC> + (no option) = (no option)
9959 B<-fPIC> + B<-fPIE> = B<-fPIE>
9960 B<-fpic> + B<-fPIE> = B<-fpie>
9961 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
9962
9963 Certain ABI-changing flags are required to match in all compilation
9964 units, and trying to override this at link time with a conflicting
9965 value is ignored. This includes options such as
9966 -freg-struct-return and -fpcc-struct-return.
9967
9968 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
9969 -fno-trapv or -fno-strict-aliasing are passed through to the link
9970 stage and merged conservatively for conflicting translation units.
9971 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
9972 precedence; and for example -ffp-contract=off takes precedence over
9973 -ffp-contract=fast. You can override them at link time.
9974
9975 Diagnostic options such as -Wstringop-overflow are passed through
9976 to the link stage and their setting matches that of the compile-
9977 step at function granularity. Note that this matters only for
9978 diagnostics emitted during optimization. Note that code transforms
9979 such as inlining can lead to warnings being enabled or disabled for
9980 regions if code not consistent with the setting at compile time.
9981
9982 When you need to pass options to the assembler via -Wa or
9983 -Xassembler make sure to either compile such translation units with
9984 -fno-lto or consistently use the same assembler options on all
9985 translation units. You can alternatively also specify assembler
9986 options at LTO link time.
9987
9988 To enable debug info generation you need to supply -g at compile
9989 time. If any of the input files at link time were built with debug
9990 info generation enabled the link will enable debug info generation
9991 as well. Any elaborate debug info settings like the dwarf level
9992 -gdwarf-5 need to be explicitly repeated at the linker command line
9993 and mixing different settings in different translation units is
9994 discouraged.
9995
9996 If LTO encounters objects with C linkage declared with incompatible
9997 types in separate translation units to be linked together
9998 (undefined behavior according to ISO C99 6.2.7), a non-fatal
9999 diagnostic may be issued. The behavior is still undefined at run
10000 time. Similar diagnostics may be raised for other languages.
10001
10002 Another feature of LTO is that it is possible to apply
10003 interprocedural optimizations on files written in different
10004 languages:
10005
10006 gcc -c -flto foo.c
10007 g++ -c -flto bar.cc
10008 gfortran -c -flto baz.f90
10009 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10010
10011 Notice that the final link is done with g++ to get the C++ runtime
10012 libraries and -lgfortran is added to get the Fortran runtime
10013 libraries. In general, when mixing languages in LTO mode, you
10014 should use the same link command options as when mixing languages
10015 in a regular (non-LTO) compilation.
10016
10017 If object files containing GIMPLE bytecode are stored in a library
10018 archive, say libfoo.a, it is possible to extract and use them in an
10019 LTO link if you are using a linker with plugin support. To create
10020 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10021 instead of ar and ranlib; to show the symbols of object files with
10022 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10023 ranlib and nm have been compiled with plugin support. At link
10024 time, use the flag -fuse-linker-plugin to ensure that the library
10025 participates in the LTO optimization process:
10026
10027 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10028
10029 With the linker plugin enabled, the linker extracts the needed
10030 GIMPLE files from libfoo.a and passes them on to the running GCC to
10031 make them part of the aggregated GIMPLE image to be optimized.
10032
10033 If you are not using a linker with plugin support and/or do not
10034 enable the linker plugin, then the objects inside libfoo.a are
10035 extracted and linked as usual, but they do not participate in the
10036 LTO optimization process. In order to make a static library
10037 suitable for both LTO optimization and usual linkage, compile its
10038 object files with -flto -ffat-lto-objects.
10039
10040 Link-time optimizations do not require the presence of the whole
10041 program to operate. If the program does not require any symbols to
10042 be exported, it is possible to combine -flto and -fwhole-program to
10043 allow the interprocedural optimizers to use more aggressive
10044 assumptions which may lead to improved optimization opportunities.
10045 Use of -fwhole-program is not needed when linker plugin is active
10046 (see -fuse-linker-plugin).
10047
10048 The current implementation of LTO makes no attempt to generate
10049 bytecode that is portable between different types of hosts. The
10050 bytecode files are versioned and there is a strict version check,
10051 so bytecode files generated in one version of GCC do not work with
10052 an older or newer version of GCC.
10053
10054 Link-time optimization does not work well with generation of
10055 debugging information on systems other than those using a
10056 combination of ELF and DWARF.
10057
10058 If you specify the optional n, the optimization and code generation
10059 done at link time is executed in parallel using n parallel jobs by
10060 utilizing an installed make program. The environment variable MAKE
10061 may be used to override the program used.
10062
10063 You can also specify -flto=jobserver to use GNU make's job server
10064 mode to determine the number of parallel jobs. This is useful when
10065 the Makefile calling GCC is already executing in parallel. You
10066 must prepend a + to the command recipe in the parent Makefile for
10067 this to work. This option likely only works if MAKE is GNU make.
10068 Even without the option value, GCC tries to automatically detect a
10069 running GNU make's job server.
10070
10071 Use -flto=auto to use GNU make's job server, if available, or
10072 otherwise fall back to autodetection of the number of CPU threads
10073 present in your system.
10074
10075 -flto-partition=alg
10076 Specify the partitioning algorithm used by the link-time optimizer.
10077 The value is either 1to1 to specify a partitioning mirroring the
10078 original source files or balanced to specify partitioning into
10079 equally sized chunks (whenever possible) or max to create new
10080 partition for every symbol where possible. Specifying none as an
10081 algorithm disables partitioning and streaming completely. The
10082 default value is balanced. While 1to1 can be used as an workaround
10083 for various code ordering issues, the max partitioning is intended
10084 for internal testing only. The value one specifies that exactly
10085 one partition should be used while the value none bypasses
10086 partitioning and executes the link-time optimization step directly
10087 from the WPA phase.
10088
10089 -flto-compression-level=n
10090 This option specifies the level of compression used for
10091 intermediate language written to LTO object files, and is only
10092 meaningful in conjunction with LTO mode (-flto). GCC currently
10093 supports two LTO compression algorithms. For zstd, valid values are
10094 0 (no compression) to 19 (maximum compression), while zlib supports
10095 values from 0 to 9. Values outside this range are clamped to
10096 either minimum or maximum of the supported values. If the option
10097 is not given, a default balanced compression setting is used.
10098
10099 -fuse-linker-plugin
10100 Enables the use of a linker plugin during link-time optimization.
10101 This option relies on plugin support in the linker, which is
10102 available in gold or in GNU ld 2.21 or newer.
10103
10104 This option enables the extraction of object files with GIMPLE
10105 bytecode out of library archives. This improves the quality of
10106 optimization by exposing more code to the link-time optimizer.
10107 This information specifies what symbols can be accessed externally
10108 (by non-LTO object or during dynamic linking). Resulting code
10109 quality improvements on binaries (and shared libraries that use
10110 hidden visibility) are similar to -fwhole-program. See -flto for a
10111 description of the effect of this flag and how to use it.
10112
10113 This option is enabled by default when LTO support in GCC is
10114 enabled and GCC was configured for use with a linker supporting
10115 plugins (GNU ld 2.21 or newer or gold).
10116
10117 -ffat-lto-objects
10118 Fat LTO objects are object files that contain both the intermediate
10119 language and the object code. This makes them usable for both LTO
10120 linking and normal linking. This option is effective only when
10121 compiling with -flto and is ignored at link time.
10122
10123 -fno-fat-lto-objects improves compilation time over plain LTO, but
10124 requires the complete toolchain to be aware of LTO. It requires a
10125 linker with linker plugin support for basic functionality.
10126 Additionally, nm, ar and ranlib need to support linker plugins to
10127 allow a full-featured build environment (capable of building static
10128 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10129 wrappers to pass the right options to these tools. With non fat LTO
10130 makefiles need to be modified to use them.
10131
10132 Note that modern binutils provide plugin auto-load mechanism.
10133 Installing the linker plugin into $libdir/bfd-plugins has the same
10134 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10135 ranlib).
10136
10137 The default is -fno-fat-lto-objects on targets with linker plugin
10138 support.
10139
10140 -fcompare-elim
10141 After register allocation and post-register allocation instruction
10142 splitting, identify arithmetic instructions that compute processor
10143 flags similar to a comparison operation based on that arithmetic.
10144 If possible, eliminate the explicit comparison operation.
10145
10146 This pass only applies to certain targets that cannot explicitly
10147 represent the comparison operation before register allocation is
10148 complete.
10149
10150 Enabled at levels -O, -O2, -O3, -Os.
10151
10152 -fcprop-registers
10153 After register allocation and post-register allocation instruction
10154 splitting, perform a copy-propagation pass to try to reduce
10155 scheduling dependencies and occasionally eliminate the copy.
10156
10157 Enabled at levels -O, -O2, -O3, -Os.
10158
10159 -fprofile-correction
10160 Profiles collected using an instrumented binary for multi-threaded
10161 programs may be inconsistent due to missed counter updates. When
10162 this option is specified, GCC uses heuristics to correct or smooth
10163 out such inconsistencies. By default, GCC emits an error message
10164 when an inconsistent profile is detected.
10165
10166 This option is enabled by -fauto-profile.
10167
10168 -fprofile-partial-training
10169 With "-fprofile-use" all portions of programs not executed during
10170 train run are optimized agressively for size rather than speed. In
10171 some cases it is not practical to train all possible hot paths in
10172 the program. (For example, program may contain functions specific
10173 for a given hardware and trianing may not cover all hardware
10174 configurations program is run on.) With
10175 "-fprofile-partial-training" profile feedback will be ignored for
10176 all functions not executed during the train run leading them to be
10177 optimized as if they were compiled without profile feedback. This
10178 leads to better performance when train run is not representative
10179 but also leads to significantly bigger code.
10180
10181 -fprofile-use
10182 -fprofile-use=path
10183 Enable profile feedback-directed optimizations, and the following
10184 optimizations, many of which are generally profitable only with
10185 profile feedback available:
10186
10187 -fbranch-probabilities -fprofile-values -funroll-loops
10188 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10189 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10190 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10191 -ftree-slp-vectorize -fvect-cost-model=dynamic
10192 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10193
10194 Before you can use this option, you must first generate profiling
10195 information.
10196
10197 By default, GCC emits an error message if the feedback profiles do
10198 not match the source code. This error can be turned into a warning
10199 by using -Wno-error=coverage-mismatch. Note this may result in
10200 poorly optimized code. Additionally, by default, GCC also emits a
10201 warning message if the feedback profiles do not exist (see
10202 -Wmissing-profile).
10203
10204 If path is specified, GCC looks at the path to find the profile
10205 feedback data files. See -fprofile-dir.
10206
10207 -fauto-profile
10208 -fauto-profile=path
10209 Enable sampling-based feedback-directed optimizations, and the
10210 following optimizations, many of which are generally profitable
10211 only with profile feedback available:
10212
10213 -fbranch-probabilities -fprofile-values -funroll-loops
10214 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10215 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10216 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10217 -ftree-slp-vectorize -fvect-cost-model=dynamic
10218 -ftree-loop-distribute-patterns -fprofile-correction
10219
10220 path is the name of a file containing AutoFDO profile information.
10221 If omitted, it defaults to fbdata.afdo in the current directory.
10222
10223 Producing an AutoFDO profile data file requires running your
10224 program with the perf utility on a supported GNU/Linux target
10225 system. For more information, see <https://perf.wiki.kernel.org/>.
10226
10227 E.g.
10228
10229 perf record -e br_inst_retired:near_taken -b -o perf.data \
10230 -- your_program
10231
10232 Then use the create_gcov tool to convert the raw profile data to a
10233 format that can be used by GCC. You must also supply the
10234 unstripped binary for your program to this tool. See
10235 <https://github.com/google/autofdo>.
10236
10237 E.g.
10238
10239 create_gcov --binary=your_program.unstripped --profile=perf.data \
10240 --gcov=profile.afdo
10241
10242 The following options control compiler behavior regarding floating-
10243 point arithmetic. These options trade off between speed and
10244 correctness. All must be specifically enabled.
10245
10246 -ffloat-store
10247 Do not store floating-point variables in registers, and inhibit
10248 other options that might change whether a floating-point value is
10249 taken from a register or memory.
10250
10251 This option prevents undesirable excess precision on machines such
10252 as the 68000 where the floating registers (of the 68881) keep more
10253 precision than a "double" is supposed to have. Similarly for the
10254 x86 architecture. For most programs, the excess precision does
10255 only good, but a few programs rely on the precise definition of
10256 IEEE floating point. Use -ffloat-store for such programs, after
10257 modifying them to store all pertinent intermediate computations
10258 into variables.
10259
10260 -fexcess-precision=style
10261 This option allows further control over excess precision on
10262 machines where floating-point operations occur in a format with
10263 more precision or range than the IEEE standard and interchange
10264 floating-point types. By default, -fexcess-precision=fast is in
10265 effect; this means that operations may be carried out in a wider
10266 precision than the types specified in the source if that would
10267 result in faster code, and it is unpredictable when rounding to the
10268 types specified in the source code takes place. When compiling C,
10269 if -fexcess-precision=standard is specified then excess precision
10270 follows the rules specified in ISO C99; in particular, both casts
10271 and assignments cause values to be rounded to their semantic types
10272 (whereas -ffloat-store only affects assignments). This option is
10273 enabled by default for C if a strict conformance option such as
10274 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10275 default regardless of whether a strict conformance option is used.
10276
10277 -fexcess-precision=standard is not implemented for languages other
10278 than C. On the x86, it has no effect if -mfpmath=sse or
10279 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10280 apply without excess precision, and in the latter, rounding is
10281 unpredictable.
10282
10283 -ffast-math
10284 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10285 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10286 -fcx-limited-range and -fexcess-precision=fast.
10287
10288 This option causes the preprocessor macro "__FAST_MATH__" to be
10289 defined.
10290
10291 This option is not turned on by any -O option besides -Ofast since
10292 it can result in incorrect output for programs that depend on an
10293 exact implementation of IEEE or ISO rules/specifications for math
10294 functions. It may, however, yield faster code for programs that do
10295 not require the guarantees of these specifications.
10296
10297 -fno-math-errno
10298 Do not set "errno" after calling math functions that are executed
10299 with a single instruction, e.g., "sqrt". A program that relies on
10300 IEEE exceptions for math error handling may want to use this flag
10301 for speed while maintaining IEEE arithmetic compatibility.
10302
10303 This option is not turned on by any -O option since it can result
10304 in incorrect output for programs that depend on an exact
10305 implementation of IEEE or ISO rules/specifications for math
10306 functions. It may, however, yield faster code for programs that do
10307 not require the guarantees of these specifications.
10308
10309 The default is -fmath-errno.
10310
10311 On Darwin systems, the math library never sets "errno". There is
10312 therefore no reason for the compiler to consider the possibility
10313 that it might, and -fno-math-errno is the default.
10314
10315 -funsafe-math-optimizations
10316 Allow optimizations for floating-point arithmetic that (a) assume
10317 that arguments and results are valid and (b) may violate IEEE or
10318 ANSI standards. When used at link time, it may include libraries
10319 or startup files that change the default FPU control word or other
10320 similar optimizations.
10321
10322 This option is not turned on by any -O option since it can result
10323 in incorrect output for programs that depend on an exact
10324 implementation of IEEE or ISO rules/specifications for math
10325 functions. It may, however, yield faster code for programs that do
10326 not require the guarantees of these specifications. Enables
10327 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10328 -freciprocal-math.
10329
10330 The default is -fno-unsafe-math-optimizations.
10331
10332 -fassociative-math
10333 Allow re-association of operands in series of floating-point
10334 operations. This violates the ISO C and C++ language standard by
10335 possibly changing computation result. NOTE: re-ordering may change
10336 the sign of zero as well as ignore NaNs and inhibit or create
10337 underflow or overflow (and thus cannot be used on code that relies
10338 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10339 floating-point comparisons and thus may not be used when ordered
10340 comparisons are required. This option requires that both
10341 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10342 it doesn't make much sense with -frounding-math. For Fortran the
10343 option is automatically enabled when both -fno-signed-zeros and
10344 -fno-trapping-math are in effect.
10345
10346 The default is -fno-associative-math.
10347
10348 -freciprocal-math
10349 Allow the reciprocal of a value to be used instead of dividing by
10350 the value if this enables optimizations. For example "x / y" can
10351 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10352 to common subexpression elimination. Note that this loses
10353 precision and increases the number of flops operating on the value.
10354
10355 The default is -fno-reciprocal-math.
10356
10357 -ffinite-math-only
10358 Allow optimizations for floating-point arithmetic that assume that
10359 arguments and results are not NaNs or +-Infs.
10360
10361 This option is not turned on by any -O option since it can result
10362 in incorrect output for programs that depend on an exact
10363 implementation of IEEE or ISO rules/specifications for math
10364 functions. It may, however, yield faster code for programs that do
10365 not require the guarantees of these specifications.
10366
10367 The default is -fno-finite-math-only.
10368
10369 -fno-signed-zeros
10370 Allow optimizations for floating-point arithmetic that ignore the
10371 signedness of zero. IEEE arithmetic specifies the behavior of
10372 distinct +0.0 and -0.0 values, which then prohibits simplification
10373 of expressions such as x+0.0 or 0.0*x (even with
10374 -ffinite-math-only). This option implies that the sign of a zero
10375 result isn't significant.
10376
10377 The default is -fsigned-zeros.
10378
10379 -fno-trapping-math
10380 Compile code assuming that floating-point operations cannot
10381 generate user-visible traps. These traps include division by zero,
10382 overflow, underflow, inexact result and invalid operation. This
10383 option requires that -fno-signaling-nans be in effect. Setting
10384 this option may allow faster code if one relies on "non-stop" IEEE
10385 arithmetic, for example.
10386
10387 This option should never be turned on by any -O option since it can
10388 result in incorrect output for programs that depend on an exact
10389 implementation of IEEE or ISO rules/specifications for math
10390 functions.
10391
10392 The default is -ftrapping-math.
10393
10394 -frounding-math
10395 Disable transformations and optimizations that assume default
10396 floating-point rounding behavior. This is round-to-zero for all
10397 floating point to integer conversions, and round-to-nearest for all
10398 other arithmetic truncations. This option should be specified for
10399 programs that change the FP rounding mode dynamically, or that may
10400 be executed with a non-default rounding mode. This option disables
10401 constant folding of floating-point expressions at compile time
10402 (which may be affected by rounding mode) and arithmetic
10403 transformations that are unsafe in the presence of sign-dependent
10404 rounding modes.
10405
10406 The default is -fno-rounding-math.
10407
10408 This option is experimental and does not currently guarantee to
10409 disable all GCC optimizations that are affected by rounding mode.
10410 Future versions of GCC may provide finer control of this setting
10411 using C99's "FENV_ACCESS" pragma. This command-line option will be
10412 used to specify the default state for "FENV_ACCESS".
10413
10414 -fsignaling-nans
10415 Compile code assuming that IEEE signaling NaNs may generate user-
10416 visible traps during floating-point operations. Setting this
10417 option disables optimizations that may change the number of
10418 exceptions visible with signaling NaNs. This option implies
10419 -ftrapping-math.
10420
10421 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
10422 defined.
10423
10424 The default is -fno-signaling-nans.
10425
10426 This option is experimental and does not currently guarantee to
10427 disable all GCC optimizations that affect signaling NaN behavior.
10428
10429 -fno-fp-int-builtin-inexact
10430 Do not allow the built-in functions "ceil", "floor", "round" and
10431 "trunc", and their "float" and "long double" variants, to generate
10432 code that raises the "inexact" floating-point exception for
10433 noninteger arguments. ISO C99 and C11 allow these functions to
10434 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
10435 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
10436 allow these functions to do so.
10437
10438 The default is -ffp-int-builtin-inexact, allowing the exception to
10439 be raised, unless C2X or a later C standard is selected. This
10440 option does nothing unless -ftrapping-math is in effect.
10441
10442 Even if -fno-fp-int-builtin-inexact is used, if the functions
10443 generate a call to a library function then the "inexact" exception
10444 may be raised if the library implementation does not follow TS
10445 18661.
10446
10447 -fsingle-precision-constant
10448 Treat floating-point constants as single precision instead of
10449 implicitly converting them to double-precision constants.
10450
10451 -fcx-limited-range
10452 When enabled, this option states that a range reduction step is not
10453 needed when performing complex division. Also, there is no
10454 checking whether the result of a complex multiplication or division
10455 is "NaN + I*NaN", with an attempt to rescue the situation in that
10456 case. The default is -fno-cx-limited-range, but is enabled by
10457 -ffast-math.
10458
10459 This option controls the default setting of the ISO C99
10460 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
10461 languages.
10462
10463 -fcx-fortran-rules
10464 Complex multiplication and division follow Fortran rules. Range
10465 reduction is done as part of complex division, but there is no
10466 checking whether the result of a complex multiplication or division
10467 is "NaN + I*NaN", with an attempt to rescue the situation in that
10468 case.
10469
10470 The default is -fno-cx-fortran-rules.
10471
10472 The following options control optimizations that may improve
10473 performance, but are not enabled by any -O options. This section
10474 includes experimental options that may produce broken code.
10475
10476 -fbranch-probabilities
10477 After running a program compiled with -fprofile-arcs, you can
10478 compile it a second time using -fbranch-probabilities, to improve
10479 optimizations based on the number of times each branch was taken.
10480 When a program compiled with -fprofile-arcs exits, it saves arc
10481 execution counts to a file called sourcename.gcda for each source
10482 file. The information in this data file is very dependent on the
10483 structure of the generated code, so you must use the same source
10484 code and the same optimization options for both compilations.
10485
10486 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
10487 JUMP_INSN and CALL_INSN. These can be used to improve
10488 optimization. Currently, they are only used in one place: in
10489 reorg.c, instead of guessing which path a branch is most likely to
10490 take, the REG_BR_PROB values are used to exactly determine which
10491 path is taken more often.
10492
10493 Enabled by -fprofile-use and -fauto-profile.
10494
10495 -fprofile-values
10496 If combined with -fprofile-arcs, it adds code so that some data
10497 about values of expressions in the program is gathered.
10498
10499 With -fbranch-probabilities, it reads back the data gathered from
10500 profiling values of expressions for usage in optimizations.
10501
10502 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
10503
10504 -fprofile-reorder-functions
10505 Function reordering based on profile instrumentation collects first
10506 time of execution of a function and orders these functions in
10507 ascending order.
10508
10509 Enabled with -fprofile-use.
10510
10511 -fvpt
10512 If combined with -fprofile-arcs, this option instructs the compiler
10513 to add code to gather information about values of expressions.
10514
10515 With -fbranch-probabilities, it reads back the data gathered and
10516 actually performs the optimizations based on them. Currently the
10517 optimizations include specialization of division operations using
10518 the knowledge about the value of the denominator.
10519
10520 Enabled with -fprofile-use and -fauto-profile.
10521
10522 -frename-registers
10523 Attempt to avoid false dependencies in scheduled code by making use
10524 of registers left over after register allocation. This
10525 optimization most benefits processors with lots of registers.
10526 Depending on the debug information format adopted by the target,
10527 however, it can make debugging impossible, since variables no
10528 longer stay in a "home register".
10529
10530 Enabled by default with -funroll-loops.
10531
10532 -fschedule-fusion
10533 Performs a target dependent pass over the instruction stream to
10534 schedule instructions of same type together because target machine
10535 can execute them more efficiently if they are adjacent to each
10536 other in the instruction flow.
10537
10538 Enabled at levels -O2, -O3, -Os.
10539
10540 -ftracer
10541 Perform tail duplication to enlarge superblock size. This
10542 transformation simplifies the control flow of the function allowing
10543 other optimizations to do a better job.
10544
10545 Enabled by -fprofile-use and -fauto-profile.
10546
10547 -funroll-loops
10548 Unroll loops whose number of iterations can be determined at
10549 compile time or upon entry to the loop. -funroll-loops implies
10550 -frerun-cse-after-loop, -fweb and -frename-registers. It also
10551 turns on complete loop peeling (i.e. complete removal of loops with
10552 a small constant number of iterations). This option makes code
10553 larger, and may or may not make it run faster.
10554
10555 Enabled by -fprofile-use and -fauto-profile.
10556
10557 -funroll-all-loops
10558 Unroll all loops, even if their number of iterations is uncertain
10559 when the loop is entered. This usually makes programs run more
10560 slowly. -funroll-all-loops implies the same options as
10561 -funroll-loops.
10562
10563 -fpeel-loops
10564 Peels loops for which there is enough information that they do not
10565 roll much (from profile feedback or static analysis). It also
10566 turns on complete loop peeling (i.e. complete removal of loops with
10567 small constant number of iterations).
10568
10569 Enabled by -O3, -fprofile-use, and -fauto-profile.
10570
10571 -fmove-loop-invariants
10572 Enables the loop invariant motion pass in the RTL loop optimizer.
10573 Enabled at level -O1 and higher, except for -Og.
10574
10575 -fsplit-loops
10576 Split a loop into two if it contains a condition that's always true
10577 for one side of the iteration space and false for the other.
10578
10579 Enabled by -fprofile-use and -fauto-profile.
10580
10581 -funswitch-loops
10582 Move branches with loop invariant conditions out of the loop, with
10583 duplicates of the loop on both branches (modified according to
10584 result of the condition).
10585
10586 Enabled by -fprofile-use and -fauto-profile.
10587
10588 -fversion-loops-for-strides
10589 If a loop iterates over an array with a variable stride, create
10590 another version of the loop that assumes the stride is always one.
10591 For example:
10592
10593 for (int i = 0; i < n; ++i)
10594 x[i * stride] = ...;
10595
10596 becomes:
10597
10598 if (stride == 1)
10599 for (int i = 0; i < n; ++i)
10600 x[i] = ...;
10601 else
10602 for (int i = 0; i < n; ++i)
10603 x[i * stride] = ...;
10604
10605 This is particularly useful for assumed-shape arrays in Fortran
10606 where (for example) it allows better vectorization assuming
10607 contiguous accesses. This flag is enabled by default at -O3. It
10608 is also enabled by -fprofile-use and -fauto-profile.
10609
10610 -ffunction-sections
10611 -fdata-sections
10612 Place each function or data item into its own section in the output
10613 file if the target supports arbitrary sections. The name of the
10614 function or the name of the data item determines the section's name
10615 in the output file.
10616
10617 Use these options on systems where the linker can perform
10618 optimizations to improve locality of reference in the instruction
10619 space. Most systems using the ELF object format have linkers with
10620 such optimizations. On AIX, the linker rearranges sections
10621 (CSECTs) based on the call graph. The performance impact varies.
10622
10623 Together with a linker garbage collection (linker --gc-sections
10624 option) these options may lead to smaller statically-linked
10625 executables (after stripping).
10626
10627 On ELF/DWARF systems these options do not degenerate the quality of
10628 the debug information. There could be issues with other object
10629 files/debug info formats.
10630
10631 Only use these options when there are significant benefits from
10632 doing so. When you specify these options, the assembler and linker
10633 create larger object and executable files and are also slower.
10634 These options affect code generation. They prevent optimizations
10635 by the compiler and assembler using relative locations inside a
10636 translation unit since the locations are unknown until link time.
10637 An example of such an optimization is relaxing calls to short call
10638 instructions.
10639
10640 -fstdarg-opt
10641 Optimize the prologue of variadic argument functions with respect
10642 to usage of those arguments.
10643
10644 -fsection-anchors
10645 Try to reduce the number of symbolic address calculations by using
10646 shared "anchor" symbols to address nearby objects. This
10647 transformation can help to reduce the number of GOT entries and GOT
10648 accesses on some targets.
10649
10650 For example, the implementation of the following function "foo":
10651
10652 static int a, b, c;
10653 int foo (void) { return a + b + c; }
10654
10655 usually calculates the addresses of all three variables, but if you
10656 compile it with -fsection-anchors, it accesses the variables from a
10657 common anchor point instead. The effect is similar to the
10658 following pseudocode (which isn't valid C):
10659
10660 int foo (void)
10661 {
10662 register int *xr = &x;
10663 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10664 }
10665
10666 Not all targets support this option.
10667
10668 -fzero-call-used-regs=choice
10669 Zero call-used registers at function return to increase program
10670 security by either mitigating Return-Oriented Programming (ROP)
10671 attacks or preventing information leakage through registers.
10672
10673 The possible values of choice are the same as for the
10674 "zero_call_used_regs" attribute. The default is skip.
10675
10676 You can control this behavior for a specific function by using the
10677 function attribute "zero_call_used_regs".
10678
10679 --param name=value
10680 In some places, GCC uses various constants to control the amount of
10681 optimization that is done. For example, GCC does not inline
10682 functions that contain more than a certain number of instructions.
10683 You can control some of these constants on the command line using
10684 the --param option.
10685
10686 The names of specific parameters, and the meaning of the values,
10687 are tied to the internals of the compiler, and are subject to
10688 change without notice in future releases.
10689
10690 In order to get minimal, maximal and default value of a parameter,
10691 one can use --help=param -Q options.
10692
10693 In each case, the value is an integer. The following choices of
10694 name are recognized for all targets:
10695
10696 predictable-branch-outcome
10697 When branch is predicted to be taken with probability lower
10698 than this threshold (in percent), then it is considered well
10699 predictable.
10700
10701 max-rtl-if-conversion-insns
10702 RTL if-conversion tries to remove conditional branches around a
10703 block and replace them with conditionally executed
10704 instructions. This parameter gives the maximum number of
10705 instructions in a block which should be considered for if-
10706 conversion. The compiler will also use other heuristics to
10707 decide whether if-conversion is likely to be profitable.
10708
10709 max-rtl-if-conversion-predictable-cost
10710 RTL if-conversion will try to remove conditional branches
10711 around a block and replace them with conditionally executed
10712 instructions. These parameters give the maximum permissible
10713 cost for the sequence that would be generated by if-conversion
10714 depending on whether the branch is statically determined to be
10715 predictable or not. The units for this parameter are the same
10716 as those for the GCC internal seq_cost metric. The compiler
10717 will try to provide a reasonable default for this parameter
10718 using the BRANCH_COST target macro.
10719
10720 max-crossjump-edges
10721 The maximum number of incoming edges to consider for cross-
10722 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
10723 number of edges incoming to each block. Increasing values mean
10724 more aggressive optimization, making the compilation time
10725 increase with probably small improvement in executable size.
10726
10727 min-crossjump-insns
10728 The minimum number of instructions that must be matched at the
10729 end of two blocks before cross-jumping is performed on them.
10730 This value is ignored in the case where all instructions in the
10731 block being cross-jumped from are matched.
10732
10733 max-grow-copy-bb-insns
10734 The maximum code size expansion factor when copying basic
10735 blocks instead of jumping. The expansion is relative to a jump
10736 instruction.
10737
10738 max-goto-duplication-insns
10739 The maximum number of instructions to duplicate to a block that
10740 jumps to a computed goto. To avoid O(N^2) behavior in a number
10741 of passes, GCC factors computed gotos early in the compilation
10742 process, and unfactors them as late as possible. Only computed
10743 jumps at the end of a basic blocks with no more than max-goto-
10744 duplication-insns are unfactored.
10745
10746 max-delay-slot-insn-search
10747 The maximum number of instructions to consider when looking for
10748 an instruction to fill a delay slot. If more than this
10749 arbitrary number of instructions are searched, the time savings
10750 from filling the delay slot are minimal, so stop searching.
10751 Increasing values mean more aggressive optimization, making the
10752 compilation time increase with probably small improvement in
10753 execution time.
10754
10755 max-delay-slot-live-search
10756 When trying to fill delay slots, the maximum number of
10757 instructions to consider when searching for a block with valid
10758 live register information. Increasing this arbitrarily chosen
10759 value means more aggressive optimization, increasing the
10760 compilation time. This parameter should be removed when the
10761 delay slot code is rewritten to maintain the control-flow
10762 graph.
10763
10764 max-gcse-memory
10765 The approximate maximum amount of memory in "kB" that can be
10766 allocated in order to perform the global common subexpression
10767 elimination optimization. If more memory than specified is
10768 required, the optimization is not done.
10769
10770 max-gcse-insertion-ratio
10771 If the ratio of expression insertions to deletions is larger
10772 than this value for any expression, then RTL PRE inserts or
10773 removes the expression and thus leaves partially redundant
10774 computations in the instruction stream.
10775
10776 max-pending-list-length
10777 The maximum number of pending dependencies scheduling allows
10778 before flushing the current state and starting over. Large
10779 functions with few branches or calls can create excessively
10780 large lists which needlessly consume memory and resources.
10781
10782 max-modulo-backtrack-attempts
10783 The maximum number of backtrack attempts the scheduler should
10784 make when modulo scheduling a loop. Larger values can
10785 exponentially increase compilation time.
10786
10787 max-inline-insns-single
10788 Several parameters control the tree inliner used in GCC. This
10789 number sets the maximum number of instructions (counted in
10790 GCC's internal representation) in a single function that the
10791 tree inliner considers for inlining. This only affects
10792 functions declared inline and methods implemented in a class
10793 declaration (C++).
10794
10795 max-inline-insns-auto
10796 When you use -finline-functions (included in -O3), a lot of
10797 functions that would otherwise not be considered for inlining
10798 by the compiler are investigated. To those functions, a
10799 different (more restrictive) limit compared to functions
10800 declared inline can be applied (--param max-inline-insns-auto).
10801
10802 max-inline-insns-small
10803 This is bound applied to calls which are considered relevant
10804 with -finline-small-functions.
10805
10806 max-inline-insns-size
10807 This is bound applied to calls which are optimized for size.
10808 Small growth may be desirable to anticipate optimization
10809 oppurtunities exposed by inlining.
10810
10811 uninlined-function-insns
10812 Number of instructions accounted by inliner for function
10813 overhead such as function prologue and epilogue.
10814
10815 uninlined-function-time
10816 Extra time accounted by inliner for function overhead such as
10817 time needed to execute function prologue and epilogue
10818
10819 inline-heuristics-hint-percent
10820 The scale (in percents) applied to inline-insns-single,
10821 inline-insns-single-O2, inline-insns-auto when inline
10822 heuristics hints that inlining is very profitable (will enable
10823 later optimizations).
10824
10825 uninlined-thunk-insns
10826 uninlined-thunk-time
10827 Same as --param uninlined-function-insns and --param uninlined-
10828 function-time but applied to function thunks
10829
10830 inline-min-speedup
10831 When estimated performance improvement of caller + callee
10832 runtime exceeds this threshold (in percent), the function can
10833 be inlined regardless of the limit on --param max-inline-insns-
10834 single and --param max-inline-insns-auto.
10835
10836 large-function-insns
10837 The limit specifying really large functions. For functions
10838 larger than this limit after inlining, inlining is constrained
10839 by --param large-function-growth. This parameter is useful
10840 primarily to avoid extreme compilation time caused by non-
10841 linear algorithms used by the back end.
10842
10843 large-function-growth
10844 Specifies maximal growth of large function caused by inlining
10845 in percents. For example, parameter value 100 limits large
10846 function growth to 2.0 times the original size.
10847
10848 large-unit-insns
10849 The limit specifying large translation unit. Growth caused by
10850 inlining of units larger than this limit is limited by --param
10851 inline-unit-growth. For small units this might be too tight.
10852 For example, consider a unit consisting of function A that is
10853 inline and B that just calls A three times. If B is small
10854 relative to A, the growth of unit is 300\% and yet such
10855 inlining is very sane. For very large units consisting of
10856 small inlineable functions, however, the overall unit growth
10857 limit is needed to avoid exponential explosion of code size.
10858 Thus for smaller units, the size is increased to --param large-
10859 unit-insns before applying --param inline-unit-growth.
10860
10861 lazy-modules
10862 Maximum number of concurrently open C++ module files when lazy
10863 loading.
10864
10865 inline-unit-growth
10866 Specifies maximal overall growth of the compilation unit caused
10867 by inlining. For example, parameter value 20 limits unit
10868 growth to 1.2 times the original size. Cold functions (either
10869 marked cold via an attribute or by profile feedback) are not
10870 accounted into the unit size.
10871
10872 ipa-cp-unit-growth
10873 Specifies maximal overall growth of the compilation unit caused
10874 by interprocedural constant propagation. For example,
10875 parameter value 10 limits unit growth to 1.1 times the original
10876 size.
10877
10878 ipa-cp-large-unit-insns
10879 The size of translation unit that IPA-CP pass considers large.
10880
10881 large-stack-frame
10882 The limit specifying large stack frames. While inlining the
10883 algorithm is trying to not grow past this limit too much.
10884
10885 large-stack-frame-growth
10886 Specifies maximal growth of large stack frames caused by
10887 inlining in percents. For example, parameter value 1000 limits
10888 large stack frame growth to 11 times the original size.
10889
10890 max-inline-insns-recursive
10891 max-inline-insns-recursive-auto
10892 Specifies the maximum number of instructions an out-of-line
10893 copy of a self-recursive inline function can grow into by
10894 performing recursive inlining.
10895
10896 --param max-inline-insns-recursive applies to functions
10897 declared inline. For functions not declared inline, recursive
10898 inlining happens only when -finline-functions (included in -O3)
10899 is enabled; --param max-inline-insns-recursive-auto applies
10900 instead.
10901
10902 max-inline-recursive-depth
10903 max-inline-recursive-depth-auto
10904 Specifies the maximum recursion depth used for recursive
10905 inlining.
10906
10907 --param max-inline-recursive-depth applies to functions
10908 declared inline. For functions not declared inline, recursive
10909 inlining happens only when -finline-functions (included in -O3)
10910 is enabled; --param max-inline-recursive-depth-auto applies
10911 instead.
10912
10913 min-inline-recursive-probability
10914 Recursive inlining is profitable only for function having deep
10915 recursion in average and can hurt for function having little
10916 recursion depth by increasing the prologue size or complexity
10917 of function body to other optimizers.
10918
10919 When profile feedback is available (see -fprofile-generate) the
10920 actual recursion depth can be guessed from the probability that
10921 function recurses via a given call expression. This parameter
10922 limits inlining only to call expressions whose probability
10923 exceeds the given threshold (in percents).
10924
10925 early-inlining-insns
10926 Specify growth that the early inliner can make. In effect it
10927 increases the amount of inlining for code having a large
10928 abstraction penalty.
10929
10930 max-early-inliner-iterations
10931 Limit of iterations of the early inliner. This basically
10932 bounds the number of nested indirect calls the early inliner
10933 can resolve. Deeper chains are still handled by late inlining.
10934
10935 comdat-sharing-probability
10936 Probability (in percent) that C++ inline function with comdat
10937 visibility are shared across multiple compilation units.
10938
10939 modref-max-bases
10940 modref-max-refs
10941 modref-max-accesses
10942 Specifies the maximal number of base pointers, references and
10943 accesses stored for a single function by mod/ref analysis.
10944
10945 modref-max-tests
10946 Specifies the maxmal number of tests alias oracle can perform
10947 to disambiguate memory locations using the mod/ref information.
10948 This parameter ought to be bigger than --param modref-max-bases
10949 and --param modref-max-refs.
10950
10951 modref-max-depth
10952 Specifies the maximum depth of DFS walk used by modref escape
10953 analysis. Setting to 0 disables the analysis completely.
10954
10955 modref-max-escape-points
10956 Specifies the maximum number of escape points tracked by modref
10957 per SSA-name.
10958
10959 profile-func-internal-id
10960 A parameter to control whether to use function internal id in
10961 profile database lookup. If the value is 0, the compiler uses
10962 an id that is based on function assembler name and filename,
10963 which makes old profile data more tolerant to source changes
10964 such as function reordering etc.
10965
10966 min-vect-loop-bound
10967 The minimum number of iterations under which loops are not
10968 vectorized when -ftree-vectorize is used. The number of
10969 iterations after vectorization needs to be greater than the
10970 value specified by this option to allow vectorization.
10971
10972 gcse-cost-distance-ratio
10973 Scaling factor in calculation of maximum distance an expression
10974 can be moved by GCSE optimizations. This is currently
10975 supported only in the code hoisting pass. The bigger the
10976 ratio, the more aggressive code hoisting is with simple
10977 expressions, i.e., the expressions that have cost less than
10978 gcse-unrestricted-cost. Specifying 0 disables hoisting of
10979 simple expressions.
10980
10981 gcse-unrestricted-cost
10982 Cost, roughly measured as the cost of a single typical machine
10983 instruction, at which GCSE optimizations do not constrain the
10984 distance an expression can travel. This is currently supported
10985 only in the code hoisting pass. The lesser the cost, the more
10986 aggressive code hoisting is. Specifying 0 allows all
10987 expressions to travel unrestricted distances.
10988
10989 max-hoist-depth
10990 The depth of search in the dominator tree for expressions to
10991 hoist. This is used to avoid quadratic behavior in hoisting
10992 algorithm. The value of 0 does not limit on the search, but
10993 may slow down compilation of huge functions.
10994
10995 max-tail-merge-comparisons
10996 The maximum amount of similar bbs to compare a bb with. This
10997 is used to avoid quadratic behavior in tree tail merging.
10998
10999 max-tail-merge-iterations
11000 The maximum amount of iterations of the pass over the function.
11001 This is used to limit compilation time in tree tail merging.
11002
11003 store-merging-allow-unaligned
11004 Allow the store merging pass to introduce unaligned stores if
11005 it is legal to do so.
11006
11007 max-stores-to-merge
11008 The maximum number of stores to attempt to merge into wider
11009 stores in the store merging pass.
11010
11011 max-store-chains-to-track
11012 The maximum number of store chains to track at the same time in
11013 the attempt to merge them into wider stores in the store
11014 merging pass.
11015
11016 max-stores-to-track
11017 The maximum number of stores to track at the same time in the
11018 attemt to to merge them into wider stores in the store merging
11019 pass.
11020
11021 max-unrolled-insns
11022 The maximum number of instructions that a loop may have to be
11023 unrolled. If a loop is unrolled, this parameter also
11024 determines how many times the loop code is unrolled.
11025
11026 max-average-unrolled-insns
11027 The maximum number of instructions biased by probabilities of
11028 their execution that a loop may have to be unrolled. If a loop
11029 is unrolled, this parameter also determines how many times the
11030 loop code is unrolled.
11031
11032 max-unroll-times
11033 The maximum number of unrollings of a single loop.
11034
11035 max-peeled-insns
11036 The maximum number of instructions that a loop may have to be
11037 peeled. If a loop is peeled, this parameter also determines
11038 how many times the loop code is peeled.
11039
11040 max-peel-times
11041 The maximum number of peelings of a single loop.
11042
11043 max-peel-branches
11044 The maximum number of branches on the hot path through the
11045 peeled sequence.
11046
11047 max-completely-peeled-insns
11048 The maximum number of insns of a completely peeled loop.
11049
11050 max-completely-peel-times
11051 The maximum number of iterations of a loop to be suitable for
11052 complete peeling.
11053
11054 max-completely-peel-loop-nest-depth
11055 The maximum depth of a loop nest suitable for complete peeling.
11056
11057 max-unswitch-insns
11058 The maximum number of insns of an unswitched loop.
11059
11060 max-unswitch-level
11061 The maximum number of branches unswitched in a single loop.
11062
11063 lim-expensive
11064 The minimum cost of an expensive expression in the loop
11065 invariant motion.
11066
11067 min-loop-cond-split-prob
11068 When FDO profile information is available, min-loop-cond-split-
11069 prob specifies minimum threshold for probability of semi-
11070 invariant condition statement to trigger loop split.
11071
11072 iv-consider-all-candidates-bound
11073 Bound on number of candidates for induction variables, below
11074 which all candidates are considered for each use in induction
11075 variable optimizations. If there are more candidates than
11076 this, only the most relevant ones are considered to avoid
11077 quadratic time complexity.
11078
11079 iv-max-considered-uses
11080 The induction variable optimizations give up on loops that
11081 contain more induction variable uses.
11082
11083 iv-always-prune-cand-set-bound
11084 If the number of candidates in the set is smaller than this
11085 value, always try to remove unnecessary ivs from the set when
11086 adding a new one.
11087
11088 avg-loop-niter
11089 Average number of iterations of a loop.
11090
11091 dse-max-object-size
11092 Maximum size (in bytes) of objects tracked bytewise by dead
11093 store elimination. Larger values may result in larger
11094 compilation times.
11095
11096 dse-max-alias-queries-per-store
11097 Maximum number of queries into the alias oracle per store.
11098 Larger values result in larger compilation times and may result
11099 in more removed dead stores.
11100
11101 scev-max-expr-size
11102 Bound on size of expressions used in the scalar evolutions
11103 analyzer. Large expressions slow the analyzer.
11104
11105 scev-max-expr-complexity
11106 Bound on the complexity of the expressions in the scalar
11107 evolutions analyzer. Complex expressions slow the analyzer.
11108
11109 max-tree-if-conversion-phi-args
11110 Maximum number of arguments in a PHI supported by TREE if
11111 conversion unless the loop is marked with simd pragma.
11112
11113 vect-max-version-for-alignment-checks
11114 The maximum number of run-time checks that can be performed
11115 when doing loop versioning for alignment in the vectorizer.
11116
11117 vect-max-version-for-alias-checks
11118 The maximum number of run-time checks that can be performed
11119 when doing loop versioning for alias in the vectorizer.
11120
11121 vect-max-peeling-for-alignment
11122 The maximum number of loop peels to enhance access alignment
11123 for vectorizer. Value -1 means no limit.
11124
11125 max-iterations-to-track
11126 The maximum number of iterations of a loop the brute-force
11127 algorithm for analysis of the number of iterations of the loop
11128 tries to evaluate.
11129
11130 hot-bb-count-fraction
11131 The denominator n of fraction 1/n of the maximal execution
11132 count of a basic block in the entire program that a basic block
11133 needs to at least have in order to be considered hot. The
11134 default is 10000, which means that a basic block is considered
11135 hot if its execution count is greater than 1/10000 of the
11136 maximal execution count. 0 means that it is never considered
11137 hot. Used in non-LTO mode.
11138
11139 hot-bb-count-ws-permille
11140 The number of most executed permilles, ranging from 0 to 1000,
11141 of the profiled execution of the entire program to which the
11142 execution count of a basic block must be part of in order to be
11143 considered hot. The default is 990, which means that a basic
11144 block is considered hot if its execution count contributes to
11145 the upper 990 permilles, or 99.0%, of the profiled execution of
11146 the entire program. 0 means that it is never considered hot.
11147 Used in LTO mode.
11148
11149 hot-bb-frequency-fraction
11150 The denominator n of fraction 1/n of the execution frequency of
11151 the entry block of a function that a basic block of this
11152 function needs to at least have in order to be considered hot.
11153 The default is 1000, which means that a basic block is
11154 considered hot in a function if it is executed more frequently
11155 than 1/1000 of the frequency of the entry block of the
11156 function. 0 means that it is never considered hot.
11157
11158 unlikely-bb-count-fraction
11159 The denominator n of fraction 1/n of the number of profiled
11160 runs of the entire program below which the execution count of a
11161 basic block must be in order for the basic block to be
11162 considered unlikely executed. The default is 20, which means
11163 that a basic block is considered unlikely executed if it is
11164 executed in fewer than 1/20, or 5%, of the runs of the program.
11165 0 means that it is always considered unlikely executed.
11166
11167 max-predicted-iterations
11168 The maximum number of loop iterations we predict statically.
11169 This is useful in cases where a function contains a single loop
11170 with known bound and another loop with unknown bound. The
11171 known number of iterations is predicted correctly, while the
11172 unknown number of iterations average to roughly 10. This means
11173 that the loop without bounds appears artificially cold relative
11174 to the other one.
11175
11176 builtin-expect-probability
11177 Control the probability of the expression having the specified
11178 value. This parameter takes a percentage (i.e. 0 ... 100) as
11179 input.
11180
11181 builtin-string-cmp-inline-length
11182 The maximum length of a constant string for a builtin string
11183 cmp call eligible for inlining.
11184
11185 align-threshold
11186 Select fraction of the maximal frequency of executions of a
11187 basic block in a function to align the basic block.
11188
11189 align-loop-iterations
11190 A loop expected to iterate at least the selected number of
11191 iterations is aligned.
11192
11193 tracer-dynamic-coverage
11194 tracer-dynamic-coverage-feedback
11195 This value is used to limit superblock formation once the given
11196 percentage of executed instructions is covered. This limits
11197 unnecessary code size expansion.
11198
11199 The tracer-dynamic-coverage-feedback parameter is used only
11200 when profile feedback is available. The real profiles (as
11201 opposed to statically estimated ones) are much less balanced
11202 allowing the threshold to be larger value.
11203
11204 tracer-max-code-growth
11205 Stop tail duplication once code growth has reached given
11206 percentage. This is a rather artificial limit, as most of the
11207 duplicates are eliminated later in cross jumping, so it may be
11208 set to much higher values than is the desired code growth.
11209
11210 tracer-min-branch-ratio
11211 Stop reverse growth when the reverse probability of best edge
11212 is less than this threshold (in percent).
11213
11214 tracer-min-branch-probability
11215 tracer-min-branch-probability-feedback
11216 Stop forward growth if the best edge has probability lower than
11217 this threshold.
11218
11219 Similarly to tracer-dynamic-coverage two parameters are
11220 provided. tracer-min-branch-probability-feedback is used for
11221 compilation with profile feedback and tracer-min-branch-
11222 probability compilation without. The value for compilation
11223 with profile feedback needs to be more conservative (higher) in
11224 order to make tracer effective.
11225
11226 stack-clash-protection-guard-size
11227 Specify the size of the operating system provided stack guard
11228 as 2 raised to num bytes. Higher values may reduce the number
11229 of explicit probes, but a value larger than the operating
11230 system provided guard will leave code vulnerable to stack clash
11231 style attacks.
11232
11233 stack-clash-protection-probe-interval
11234 Stack clash protection involves probing stack space as it is
11235 allocated. This param controls the maximum distance between
11236 probes into the stack as 2 raised to num bytes. Higher values
11237 may reduce the number of explicit probes, but a value larger
11238 than the operating system provided guard will leave code
11239 vulnerable to stack clash style attacks.
11240
11241 max-cse-path-length
11242 The maximum number of basic blocks on path that CSE considers.
11243
11244 max-cse-insns
11245 The maximum number of instructions CSE processes before
11246 flushing.
11247
11248 ggc-min-expand
11249 GCC uses a garbage collector to manage its own memory
11250 allocation. This parameter specifies the minimum percentage by
11251 which the garbage collector's heap should be allowed to expand
11252 between collections. Tuning this may improve compilation
11253 speed; it has no effect on code generation.
11254
11255 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11256 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11257 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11258 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11259 particular platform, the lower bound of 30% is used. Setting
11260 this parameter and ggc-min-heapsize to zero causes a full
11261 collection to occur at every opportunity. This is extremely
11262 slow, but can be useful for debugging.
11263
11264 ggc-min-heapsize
11265 Minimum size of the garbage collector's heap before it begins
11266 bothering to collect garbage. The first collection occurs
11267 after the heap expands by ggc-min-expand% beyond ggc-min-
11268 heapsize. Again, tuning this may improve compilation speed,
11269 and has no effect on code generation.
11270
11271 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11272 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11273 exceeded, but with a lower bound of 4096 (four megabytes) and
11274 an upper bound of 131072 (128 megabytes). If GCC is not able
11275 to calculate RAM on a particular platform, the lower bound is
11276 used. Setting this parameter very large effectively disables
11277 garbage collection. Setting this parameter and ggc-min-expand
11278 to zero causes a full collection to occur at every opportunity.
11279
11280 max-reload-search-insns
11281 The maximum number of instruction reload should look backward
11282 for equivalent register. Increasing values mean more
11283 aggressive optimization, making the compilation time increase
11284 with probably slightly better performance.
11285
11286 max-cselib-memory-locations
11287 The maximum number of memory locations cselib should take into
11288 account. Increasing values mean more aggressive optimization,
11289 making the compilation time increase with probably slightly
11290 better performance.
11291
11292 max-sched-ready-insns
11293 The maximum number of instructions ready to be issued the
11294 scheduler should consider at any given time during the first
11295 scheduling pass. Increasing values mean more thorough
11296 searches, making the compilation time increase with probably
11297 little benefit.
11298
11299 max-sched-region-blocks
11300 The maximum number of blocks in a region to be considered for
11301 interblock scheduling.
11302
11303 max-pipeline-region-blocks
11304 The maximum number of blocks in a region to be considered for
11305 pipelining in the selective scheduler.
11306
11307 max-sched-region-insns
11308 The maximum number of insns in a region to be considered for
11309 interblock scheduling.
11310
11311 max-pipeline-region-insns
11312 The maximum number of insns in a region to be considered for
11313 pipelining in the selective scheduler.
11314
11315 min-spec-prob
11316 The minimum probability (in percents) of reaching a source
11317 block for interblock speculative scheduling.
11318
11319 max-sched-extend-regions-iters
11320 The maximum number of iterations through CFG to extend regions.
11321 A value of 0 disables region extensions.
11322
11323 max-sched-insn-conflict-delay
11324 The maximum conflict delay for an insn to be considered for
11325 speculative motion.
11326
11327 sched-spec-prob-cutoff
11328 The minimal probability of speculation success (in percents),
11329 so that speculative insns are scheduled.
11330
11331 sched-state-edge-prob-cutoff
11332 The minimum probability an edge must have for the scheduler to
11333 save its state across it.
11334
11335 sched-mem-true-dep-cost
11336 Minimal distance (in CPU cycles) between store and load
11337 targeting same memory locations.
11338
11339 selsched-max-lookahead
11340 The maximum size of the lookahead window of selective
11341 scheduling. It is a depth of search for available
11342 instructions.
11343
11344 selsched-max-sched-times
11345 The maximum number of times that an instruction is scheduled
11346 during selective scheduling. This is the limit on the number
11347 of iterations through which the instruction may be pipelined.
11348
11349 selsched-insns-to-rename
11350 The maximum number of best instructions in the ready list that
11351 are considered for renaming in the selective scheduler.
11352
11353 sms-min-sc
11354 The minimum value of stage count that swing modulo scheduler
11355 generates.
11356
11357 max-last-value-rtl
11358 The maximum size measured as number of RTLs that can be
11359 recorded in an expression in combiner for a pseudo register as
11360 last known value of that register.
11361
11362 max-combine-insns
11363 The maximum number of instructions the RTL combiner tries to
11364 combine.
11365
11366 integer-share-limit
11367 Small integer constants can use a shared data structure,
11368 reducing the compiler's memory usage and increasing its speed.
11369 This sets the maximum value of a shared integer constant.
11370
11371 ssp-buffer-size
11372 The minimum size of buffers (i.e. arrays) that receive stack
11373 smashing protection when -fstack-protection is used.
11374
11375 min-size-for-stack-sharing
11376 The minimum size of variables taking part in stack slot sharing
11377 when not optimizing.
11378
11379 max-jump-thread-duplication-stmts
11380 Maximum number of statements allowed in a block that needs to
11381 be duplicated when threading jumps.
11382
11383 max-fields-for-field-sensitive
11384 Maximum number of fields in a structure treated in a field
11385 sensitive manner during pointer analysis.
11386
11387 prefetch-latency
11388 Estimate on average number of instructions that are executed
11389 before prefetch finishes. The distance prefetched ahead is
11390 proportional to this constant. Increasing this number may also
11391 lead to less streams being prefetched (see simultaneous-
11392 prefetches).
11393
11394 simultaneous-prefetches
11395 Maximum number of prefetches that can run at the same time.
11396
11397 l1-cache-line-size
11398 The size of cache line in L1 data cache, in bytes.
11399
11400 l1-cache-size
11401 The size of L1 data cache, in kilobytes.
11402
11403 l2-cache-size
11404 The size of L2 data cache, in kilobytes.
11405
11406 prefetch-dynamic-strides
11407 Whether the loop array prefetch pass should issue software
11408 prefetch hints for strides that are non-constant. In some
11409 cases this may be beneficial, though the fact the stride is
11410 non-constant may make it hard to predict when there is clear
11411 benefit to issuing these hints.
11412
11413 Set to 1 if the prefetch hints should be issued for non-
11414 constant strides. Set to 0 if prefetch hints should be issued
11415 only for strides that are known to be constant and below
11416 prefetch-minimum-stride.
11417
11418 prefetch-minimum-stride
11419 Minimum constant stride, in bytes, to start using prefetch
11420 hints for. If the stride is less than this threshold, prefetch
11421 hints will not be issued.
11422
11423 This setting is useful for processors that have hardware
11424 prefetchers, in which case there may be conflicts between the
11425 hardware prefetchers and the software prefetchers. If the
11426 hardware prefetchers have a maximum stride they can handle, it
11427 should be used here to improve the use of software prefetchers.
11428
11429 A value of -1 means we don't have a threshold and therefore
11430 prefetch hints can be issued for any constant stride.
11431
11432 This setting is only useful for strides that are known and
11433 constant.
11434
11435 loop-interchange-max-num-stmts
11436 The maximum number of stmts in a loop to be interchanged.
11437
11438 loop-interchange-stride-ratio
11439 The minimum ratio between stride of two loops for interchange
11440 to be profitable.
11441
11442 min-insn-to-prefetch-ratio
11443 The minimum ratio between the number of instructions and the
11444 number of prefetches to enable prefetching in a loop.
11445
11446 prefetch-min-insn-to-mem-ratio
11447 The minimum ratio between the number of instructions and the
11448 number of memory references to enable prefetching in a loop.
11449
11450 use-canonical-types
11451 Whether the compiler should use the "canonical" type system.
11452 Should always be 1, which uses a more efficient internal
11453 mechanism for comparing types in C++ and Objective-C++.
11454 However, if bugs in the canonical type system are causing
11455 compilation failures, set this value to 0 to disable canonical
11456 types.
11457
11458 switch-conversion-max-branch-ratio
11459 Switch initialization conversion refuses to create arrays that
11460 are bigger than switch-conversion-max-branch-ratio times the
11461 number of branches in the switch.
11462
11463 max-partial-antic-length
11464 Maximum length of the partial antic set computed during the
11465 tree partial redundancy elimination optimization (-ftree-pre)
11466 when optimizing at -O3 and above. For some sorts of source
11467 code the enhanced partial redundancy elimination optimization
11468 can run away, consuming all of the memory available on the host
11469 machine. This parameter sets a limit on the length of the sets
11470 that are computed, which prevents the runaway behavior.
11471 Setting a value of 0 for this parameter allows an unlimited set
11472 length.
11473
11474 rpo-vn-max-loop-depth
11475 Maximum loop depth that is value-numbered optimistically. When
11476 the limit hits the innermost rpo-vn-max-loop-depth loops and
11477 the outermost loop in the loop nest are value-numbered
11478 optimistically and the remaining ones not.
11479
11480 sccvn-max-alias-queries-per-access
11481 Maximum number of alias-oracle queries we perform when looking
11482 for redundancies for loads and stores. If this limit is hit
11483 the search is aborted and the load or store is not considered
11484 redundant. The number of queries is algorithmically limited to
11485 the number of stores on all paths from the load to the function
11486 entry.
11487
11488 ira-max-loops-num
11489 IRA uses regional register allocation by default. If a
11490 function contains more loops than the number given by this
11491 parameter, only at most the given number of the most
11492 frequently-executed loops form regions for regional register
11493 allocation.
11494
11495 ira-max-conflict-table-size
11496 Although IRA uses a sophisticated algorithm to compress the
11497 conflict table, the table can still require excessive amounts
11498 of memory for huge functions. If the conflict table for a
11499 function could be more than the size in MB given by this
11500 parameter, the register allocator instead uses a faster,
11501 simpler, and lower-quality algorithm that does not require
11502 building a pseudo-register conflict table.
11503
11504 ira-loop-reserved-regs
11505 IRA can be used to evaluate more accurate register pressure in
11506 loops for decisions to move loop invariants (see -O3). The
11507 number of available registers reserved for some other purposes
11508 is given by this parameter. Default of the parameter is the
11509 best found from numerous experiments.
11510
11511 lra-inheritance-ebb-probability-cutoff
11512 LRA tries to reuse values reloaded in registers in subsequent
11513 insns. This optimization is called inheritance. EBB is used
11514 as a region to do this optimization. The parameter defines a
11515 minimal fall-through edge probability in percentage used to add
11516 BB to inheritance EBB in LRA. The default value was chosen
11517 from numerous runs of SPEC2000 on x86-64.
11518
11519 loop-invariant-max-bbs-in-loop
11520 Loop invariant motion can be very expensive, both in
11521 compilation time and in amount of needed compile-time memory,
11522 with very large loops. Loops with more basic blocks than this
11523 parameter won't have loop invariant motion optimization
11524 performed on them.
11525
11526 loop-max-datarefs-for-datadeps
11527 Building data dependencies is expensive for very large loops.
11528 This parameter limits the number of data references in loops
11529 that are considered for data dependence analysis. These large
11530 loops are no handled by the optimizations using loop data
11531 dependencies.
11532
11533 max-vartrack-size
11534 Sets a maximum number of hash table slots to use during
11535 variable tracking dataflow analysis of any function. If this
11536 limit is exceeded with variable tracking at assignments
11537 enabled, analysis for that function is retried without it,
11538 after removing all debug insns from the function. If the limit
11539 is exceeded even without debug insns, var tracking analysis is
11540 completely disabled for the function. Setting the parameter to
11541 zero makes it unlimited.
11542
11543 max-vartrack-expr-depth
11544 Sets a maximum number of recursion levels when attempting to
11545 map variable names or debug temporaries to value expressions.
11546 This trades compilation time for more complete debug
11547 information. If this is set too low, value expressions that
11548 are available and could be represented in debug information may
11549 end up not being used; setting this higher may enable the
11550 compiler to find more complex debug expressions, but compile
11551 time and memory use may grow.
11552
11553 max-debug-marker-count
11554 Sets a threshold on the number of debug markers (e.g. begin
11555 stmt markers) to avoid complexity explosion at inlining or
11556 expanding to RTL. If a function has more such gimple stmts
11557 than the set limit, such stmts will be dropped from the inlined
11558 copy of a function, and from its RTL expansion.
11559
11560 min-nondebug-insn-uid
11561 Use uids starting at this parameter for nondebug insns. The
11562 range below the parameter is reserved exclusively for debug
11563 insns created by -fvar-tracking-assignments, but debug insns
11564 may get (non-overlapping) uids above it if the reserved range
11565 is exhausted.
11566
11567 ipa-sra-ptr-growth-factor
11568 IPA-SRA replaces a pointer to an aggregate with one or more new
11569 parameters only when their cumulative size is less or equal to
11570 ipa-sra-ptr-growth-factor times the size of the original
11571 pointer parameter.
11572
11573 ipa-sra-max-replacements
11574 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11575 consequence, it is also the maximum number of replacements of a
11576 formal parameter.
11577
11578 sra-max-scalarization-size-Ospeed
11579 sra-max-scalarization-size-Osize
11580 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
11581 aim to replace scalar parts of aggregates with uses of
11582 independent scalar variables. These parameters control the
11583 maximum size, in storage units, of aggregate which is
11584 considered for replacement when compiling for speed (sra-max-
11585 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
11586 Osize) respectively.
11587
11588 sra-max-propagations
11589 The maximum number of artificial accesses that Scalar
11590 Replacement of Aggregates (SRA) will track, per one local
11591 variable, in order to facilitate copy propagation.
11592
11593 tm-max-aggregate-size
11594 When making copies of thread-local variables in a transaction,
11595 this parameter specifies the size in bytes after which
11596 variables are saved with the logging functions as opposed to
11597 save/restore code sequence pairs. This option only applies
11598 when using -fgnu-tm.
11599
11600 graphite-max-nb-scop-params
11601 To avoid exponential effects in the Graphite loop transforms,
11602 the number of parameters in a Static Control Part (SCoP) is
11603 bounded. A value of zero can be used to lift the bound. A
11604 variable whose value is unknown at compilation time and defined
11605 outside a SCoP is a parameter of the SCoP.
11606
11607 loop-block-tile-size
11608 Loop blocking or strip mining transforms, enabled with
11609 -floop-block or -floop-strip-mine, strip mine each loop in the
11610 loop nest by a given number of iterations. The strip length
11611 can be changed using the loop-block-tile-size parameter.
11612
11613 ipa-jump-function-lookups
11614 Specifies number of statements visited during jump function
11615 offset discovery.
11616
11617 ipa-cp-value-list-size
11618 IPA-CP attempts to track all possible values and types passed
11619 to a function's parameter in order to propagate them and
11620 perform devirtualization. ipa-cp-value-list-size is the
11621 maximum number of values and types it stores per one formal
11622 parameter of a function.
11623
11624 ipa-cp-eval-threshold
11625 IPA-CP calculates its own score of cloning profitability
11626 heuristics and performs those cloning opportunities with scores
11627 that exceed ipa-cp-eval-threshold.
11628
11629 ipa-cp-max-recursive-depth
11630 Maximum depth of recursive cloning for self-recursive function.
11631
11632 ipa-cp-min-recursive-probability
11633 Recursive cloning only when the probability of call being
11634 executed exceeds the parameter.
11635
11636 ipa-cp-recursion-penalty
11637 Percentage penalty the recursive functions will receive when
11638 they are evaluated for cloning.
11639
11640 ipa-cp-single-call-penalty
11641 Percentage penalty functions containing a single call to
11642 another function will receive when they are evaluated for
11643 cloning.
11644
11645 ipa-max-agg-items
11646 IPA-CP is also capable to propagate a number of scalar values
11647 passed in an aggregate. ipa-max-agg-items controls the maximum
11648 number of such values per one parameter.
11649
11650 ipa-cp-loop-hint-bonus
11651 When IPA-CP determines that a cloning candidate would make the
11652 number of iterations of a loop known, it adds a bonus of ipa-
11653 cp-loop-hint-bonus to the profitability score of the candidate.
11654
11655 ipa-max-loop-predicates
11656 The maximum number of different predicates IPA will use to
11657 describe when loops in a function have known properties.
11658
11659 ipa-max-aa-steps
11660 During its analysis of function bodies, IPA-CP employs alias
11661 analysis in order to track values pointed to by function
11662 parameters. In order not spend too much time analyzing huge
11663 functions, it gives up and consider all memory clobbered after
11664 examining ipa-max-aa-steps statements modifying memory.
11665
11666 ipa-max-switch-predicate-bounds
11667 Maximal number of boundary endpoints of case ranges of switch
11668 statement. For switch exceeding this limit, IPA-CP will not
11669 construct cloning cost predicate, which is used to estimate
11670 cloning benefit, for default case of the switch statement.
11671
11672 ipa-max-param-expr-ops
11673 IPA-CP will analyze conditional statement that references some
11674 function parameter to estimate benefit for cloning upon certain
11675 constant value. But if number of operations in a parameter
11676 expression exceeds ipa-max-param-expr-ops, the expression is
11677 treated as complicated one, and is not handled by IPA analysis.
11678
11679 lto-partitions
11680 Specify desired number of partitions produced during WHOPR
11681 compilation. The number of partitions should exceed the number
11682 of CPUs used for compilation.
11683
11684 lto-min-partition
11685 Size of minimal partition for WHOPR (in estimated
11686 instructions). This prevents expenses of splitting very small
11687 programs into too many partitions.
11688
11689 lto-max-partition
11690 Size of max partition for WHOPR (in estimated instructions).
11691 to provide an upper bound for individual size of partition.
11692 Meant to be used only with balanced partitioning.
11693
11694 lto-max-streaming-parallelism
11695 Maximal number of parallel processes used for LTO streaming.
11696
11697 cxx-max-namespaces-for-diagnostic-help
11698 The maximum number of namespaces to consult for suggestions
11699 when C++ name lookup fails for an identifier.
11700
11701 sink-frequency-threshold
11702 The maximum relative execution frequency (in percents) of the
11703 target block relative to a statement's original block to allow
11704 statement sinking of a statement. Larger numbers result in
11705 more aggressive statement sinking. A small positive adjustment
11706 is applied for statements with memory operands as those are
11707 even more profitable so sink.
11708
11709 max-stores-to-sink
11710 The maximum number of conditional store pairs that can be sunk.
11711 Set to 0 if either vectorization (-ftree-vectorize) or if-
11712 conversion (-ftree-loop-if-convert) is disabled.
11713
11714 case-values-threshold
11715 The smallest number of different values for which it is best to
11716 use a jump-table instead of a tree of conditional branches. If
11717 the value is 0, use the default for the machine.
11718
11719 jump-table-max-growth-ratio-for-size
11720 The maximum code size growth ratio when expanding into a jump
11721 table (in percent). The parameter is used when optimizing for
11722 size.
11723
11724 jump-table-max-growth-ratio-for-speed
11725 The maximum code size growth ratio when expanding into a jump
11726 table (in percent). The parameter is used when optimizing for
11727 speed.
11728
11729 tree-reassoc-width
11730 Set the maximum number of instructions executed in parallel in
11731 reassociated tree. This parameter overrides target dependent
11732 heuristics used by default if has non zero value.
11733
11734 sched-pressure-algorithm
11735 Choose between the two available implementations of
11736 -fsched-pressure. Algorithm 1 is the original implementation
11737 and is the more likely to prevent instructions from being
11738 reordered. Algorithm 2 was designed to be a compromise between
11739 the relatively conservative approach taken by algorithm 1 and
11740 the rather aggressive approach taken by the default scheduler.
11741 It relies more heavily on having a regular register file and
11742 accurate register pressure classes. See haifa-sched.c in the
11743 GCC sources for more details.
11744
11745 The default choice depends on the target.
11746
11747 max-slsr-cand-scan
11748 Set the maximum number of existing candidates that are
11749 considered when seeking a basis for a new straight-line
11750 strength reduction candidate.
11751
11752 asan-globals
11753 Enable buffer overflow detection for global objects. This kind
11754 of protection is enabled by default if you are using
11755 -fsanitize=address option. To disable global objects
11756 protection use --param asan-globals=0.
11757
11758 asan-stack
11759 Enable buffer overflow detection for stack objects. This kind
11760 of protection is enabled by default when using
11761 -fsanitize=address. To disable stack protection use --param
11762 asan-stack=0 option.
11763
11764 asan-instrument-reads
11765 Enable buffer overflow detection for memory reads. This kind
11766 of protection is enabled by default when using
11767 -fsanitize=address. To disable memory reads protection use
11768 --param asan-instrument-reads=0.
11769
11770 asan-instrument-writes
11771 Enable buffer overflow detection for memory writes. This kind
11772 of protection is enabled by default when using
11773 -fsanitize=address. To disable memory writes protection use
11774 --param asan-instrument-writes=0 option.
11775
11776 asan-memintrin
11777 Enable detection for built-in functions. This kind of
11778 protection is enabled by default when using -fsanitize=address.
11779 To disable built-in functions protection use --param
11780 asan-memintrin=0.
11781
11782 asan-use-after-return
11783 Enable detection of use-after-return. This kind of protection
11784 is enabled by default when using the -fsanitize=address option.
11785 To disable it use --param asan-use-after-return=0.
11786
11787 Note: By default the check is disabled at run time. To enable
11788 it, add "detect_stack_use_after_return=1" to the environment
11789 variable ASAN_OPTIONS.
11790
11791 asan-instrumentation-with-call-threshold
11792 If number of memory accesses in function being instrumented is
11793 greater or equal to this number, use callbacks instead of
11794 inline checks. E.g. to disable inline code use --param
11795 asan-instrumentation-with-call-threshold=0.
11796
11797 hwasan-instrument-stack
11798 Enable hwasan instrumentation of statically sized stack-
11799 allocated variables. This kind of instrumentation is enabled
11800 by default when using -fsanitize=hwaddress and disabled by
11801 default when using -fsanitize=kernel-hwaddress. To disable
11802 stack instrumentation use --param hwasan-instrument-stack=0,
11803 and to enable it use --param hwasan-instrument-stack=1.
11804
11805 hwasan-random-frame-tag
11806 When using stack instrumentation, decide tags for stack
11807 variables using a deterministic sequence beginning at a random
11808 tag for each frame. With this parameter unset tags are chosen
11809 using the same sequence but beginning from 1. This is enabled
11810 by default for -fsanitize=hwaddress and unavailable for
11811 -fsanitize=kernel-hwaddress. To disable it use --param
11812 hwasan-random-frame-tag=0.
11813
11814 hwasan-instrument-allocas
11815 Enable hwasan instrumentation of dynamically sized stack-
11816 allocated variables. This kind of instrumentation is enabled
11817 by default when using -fsanitize=hwaddress and disabled by
11818 default when using -fsanitize=kernel-hwaddress. To disable
11819 instrumentation of such variables use --param
11820 hwasan-instrument-allocas=0, and to enable it use --param
11821 hwasan-instrument-allocas=1.
11822
11823 hwasan-instrument-reads
11824 Enable hwasan checks on memory reads. Instrumentation of reads
11825 is enabled by default for both -fsanitize=hwaddress and
11826 -fsanitize=kernel-hwaddress. To disable checking memory reads
11827 use --param hwasan-instrument-reads=0.
11828
11829 hwasan-instrument-writes
11830 Enable hwasan checks on memory writes. Instrumentation of
11831 writes is enabled by default for both -fsanitize=hwaddress and
11832 -fsanitize=kernel-hwaddress. To disable checking memory writes
11833 use --param hwasan-instrument-writes=0.
11834
11835 hwasan-instrument-mem-intrinsics
11836 Enable hwasan instrumentation of builtin functions.
11837 Instrumentation of these builtin functions is enabled by
11838 default for both -fsanitize=hwaddress and
11839 -fsanitize=kernel-hwaddress. To disable instrumentation of
11840 builtin functions use --param
11841 hwasan-instrument-mem-intrinsics=0.
11842
11843 use-after-scope-direct-emission-threshold
11844 If the size of a local variable in bytes is smaller or equal to
11845 this number, directly poison (or unpoison) shadow memory
11846 instead of using run-time callbacks.
11847
11848 tsan-distinguish-volatile
11849 Emit special instrumentation for accesses to volatiles.
11850
11851 tsan-instrument-func-entry-exit
11852 Emit instrumentation calls to __tsan_func_entry() and
11853 __tsan_func_exit().
11854
11855 max-fsm-thread-path-insns
11856 Maximum number of instructions to copy when duplicating blocks
11857 on a finite state automaton jump thread path.
11858
11859 max-fsm-thread-length
11860 Maximum number of basic blocks on a finite state automaton jump
11861 thread path.
11862
11863 max-fsm-thread-paths
11864 Maximum number of new jump thread paths to create for a finite
11865 state automaton.
11866
11867 parloops-chunk-size
11868 Chunk size of omp schedule for loops parallelized by parloops.
11869
11870 parloops-schedule
11871 Schedule type of omp schedule for loops parallelized by
11872 parloops (static, dynamic, guided, auto, runtime).
11873
11874 parloops-min-per-thread
11875 The minimum number of iterations per thread of an innermost
11876 parallelized loop for which the parallelized variant is
11877 preferred over the single threaded one. Note that for a
11878 parallelized loop nest the minimum number of iterations of the
11879 outermost loop per thread is two.
11880
11881 max-ssa-name-query-depth
11882 Maximum depth of recursion when querying properties of SSA
11883 names in things like fold routines. One level of recursion
11884 corresponds to following a use-def chain.
11885
11886 max-speculative-devirt-maydefs
11887 The maximum number of may-defs we analyze when looking for a
11888 must-def specifying the dynamic type of an object that invokes
11889 a virtual call we may be able to devirtualize speculatively.
11890
11891 max-vrp-switch-assertions
11892 The maximum number of assertions to add along the default edge
11893 of a switch statement during VRP.
11894
11895 evrp-mode
11896 Specifies the mode Early VRP should operate in.
11897
11898 unroll-jam-min-percent
11899 The minimum percentage of memory references that must be
11900 optimized away for the unroll-and-jam transformation to be
11901 considered profitable.
11902
11903 unroll-jam-max-unroll
11904 The maximum number of times the outer loop should be unrolled
11905 by the unroll-and-jam transformation.
11906
11907 max-rtl-if-conversion-unpredictable-cost
11908 Maximum permissible cost for the sequence that would be
11909 generated by the RTL if-conversion pass for a branch that is
11910 considered unpredictable.
11911
11912 max-variable-expansions-in-unroller
11913 If -fvariable-expansion-in-unroller is used, the maximum number
11914 of times that an individual variable will be expanded during
11915 loop unrolling.
11916
11917 tracer-min-branch-probability-feedback
11918 Stop forward growth if the probability of best edge is less
11919 than this threshold (in percent). Used when profile feedback is
11920 available.
11921
11922 partial-inlining-entry-probability
11923 Maximum probability of the entry BB of split region (in percent
11924 relative to entry BB of the function) to make partial inlining
11925 happen.
11926
11927 max-tracked-strlens
11928 Maximum number of strings for which strlen optimization pass
11929 will track string lengths.
11930
11931 gcse-after-reload-partial-fraction
11932 The threshold ratio for performing partial redundancy
11933 elimination after reload.
11934
11935 gcse-after-reload-critical-fraction
11936 The threshold ratio of critical edges execution count that
11937 permit performing redundancy elimination after reload.
11938
11939 max-loop-header-insns
11940 The maximum number of insns in loop header duplicated by the
11941 copy loop headers pass.
11942
11943 vect-epilogues-nomask
11944 Enable loop epilogue vectorization using smaller vector size.
11945
11946 vect-partial-vector-usage
11947 Controls when the loop vectorizer considers using partial
11948 vector loads and stores as an alternative to falling back to
11949 scalar code. 0 stops the vectorizer from ever using partial
11950 vector loads and stores. 1 allows partial vector loads and
11951 stores if vectorization removes the need for the code to
11952 iterate. 2 allows partial vector loads and stores in all
11953 loops. The parameter only has an effect on targets that
11954 support partial vector loads and stores.
11955
11956 avoid-fma-max-bits
11957 Maximum number of bits for which we avoid creating FMAs.
11958
11959 sms-loop-average-count-threshold
11960 A threshold on the average loop count considered by the swing
11961 modulo scheduler.
11962
11963 sms-dfa-history
11964 The number of cycles the swing modulo scheduler considers when
11965 checking conflicts using DFA.
11966
11967 max-inline-insns-recursive-auto
11968 The maximum number of instructions non-inline function can grow
11969 to via recursive inlining.
11970
11971 graphite-allow-codegen-errors
11972 Whether codegen errors should be ICEs when -fchecking.
11973
11974 sms-max-ii-factor
11975 A factor for tuning the upper bound that swing modulo scheduler
11976 uses for scheduling a loop.
11977
11978 lra-max-considered-reload-pseudos
11979 The max number of reload pseudos which are considered during
11980 spilling a non-reload pseudo.
11981
11982 max-pow-sqrt-depth
11983 Maximum depth of sqrt chains to use when synthesizing
11984 exponentiation by a real constant.
11985
11986 max-dse-active-local-stores
11987 Maximum number of active local stores in RTL dead store
11988 elimination.
11989
11990 asan-instrument-allocas
11991 Enable asan allocas/VLAs protection.
11992
11993 max-iterations-computation-cost
11994 Bound on the cost of an expression to compute the number of
11995 iterations.
11996
11997 max-isl-operations
11998 Maximum number of isl operations, 0 means unlimited.
11999
12000 graphite-max-arrays-per-scop
12001 Maximum number of arrays per scop.
12002
12003 max-vartrack-reverse-op-size
12004 Max. size of loc list for which reverse ops should be added.
12005
12006 tracer-dynamic-coverage-feedback
12007 The percentage of function, weighted by execution frequency,
12008 that must be covered by trace formation. Used when profile
12009 feedback is available.
12010
12011 max-inline-recursive-depth-auto
12012 The maximum depth of recursive inlining for non-inline
12013 functions.
12014
12015 fsm-scale-path-stmts
12016 Scale factor to apply to the number of statements in a
12017 threading path when comparing to the number of (scaled) blocks.
12018
12019 fsm-maximum-phi-arguments
12020 Maximum number of arguments a PHI may have before the FSM
12021 threader will not try to thread through its block.
12022
12023 uninit-control-dep-attempts
12024 Maximum number of nested calls to search for control
12025 dependencies during uninitialized variable analysis.
12026
12027 sra-max-scalarization-size-Osize
12028 Maximum size, in storage units, of an aggregate which should be
12029 considered for scalarization when compiling for size.
12030
12031 fsm-scale-path-blocks
12032 Scale factor to apply to the number of blocks in a threading
12033 path when comparing to the number of (scaled) statements.
12034
12035 sched-autopref-queue-depth
12036 Hardware autoprefetcher scheduler model control flag. Number
12037 of lookahead cycles the model looks into; at ' ' only enable
12038 instruction sorting heuristic.
12039
12040 loop-versioning-max-inner-insns
12041 The maximum number of instructions that an inner loop can have
12042 before the loop versioning pass considers it too big to copy.
12043
12044 loop-versioning-max-outer-insns
12045 The maximum number of instructions that an outer loop can have
12046 before the loop versioning pass considers it too big to copy,
12047 discounting any instructions in inner loops that directly
12048 benefit from versioning.
12049
12050 ssa-name-def-chain-limit
12051 The maximum number of SSA_NAME assignments to follow in
12052 determining a property of a variable such as its value. This
12053 limits the number of iterations or recursive calls GCC performs
12054 when optimizing certain statements or when determining their
12055 validity prior to issuing diagnostics.
12056
12057 store-merging-max-size
12058 Maximum size of a single store merging region in bytes.
12059
12060 hash-table-verification-limit
12061 The number of elements for which hash table verification is
12062 done for each searched element.
12063
12064 max-find-base-term-values
12065 Maximum number of VALUEs handled during a single find_base_term
12066 call.
12067
12068 analyzer-max-enodes-per-program-point
12069 The maximum number of exploded nodes per program point within
12070 the analyzer, before terminating analysis of that point.
12071
12072 analyzer-max-constraints
12073 The maximum number of constraints per state.
12074
12075 analyzer-min-snodes-for-call-summary
12076 The minimum number of supernodes within a function for the
12077 analyzer to consider summarizing its effects at call sites.
12078
12079 analyzer-max-enodes-for-full-dump
12080 The maximum depth of exploded nodes that should appear in a dot
12081 dump before switching to a less verbose format.
12082
12083 analyzer-max-recursion-depth
12084 The maximum number of times a callsite can appear in a call
12085 stack within the analyzer, before terminating analysis of a
12086 call that would recurse deeper.
12087
12088 analyzer-max-svalue-depth
12089 The maximum depth of a symbolic value, before approximating the
12090 value as unknown.
12091
12092 analyzer-max-infeasible-edges
12093 The maximum number of infeasible edges to reject before
12094 declaring a diagnostic as infeasible.
12095
12096 gimple-fe-computed-hot-bb-threshold
12097 The number of executions of a basic block which is considered
12098 hot. The parameter is used only in GIMPLE FE.
12099
12100 analyzer-bb-explosion-factor
12101 The maximum number of 'after supernode' exploded nodes within
12102 the analyzer per supernode, before terminating analysis.
12103
12104 ranger-logical-depth
12105 Maximum depth of logical expression evaluation ranger will look
12106 through when evaluating outgoing edge ranges.
12107
12108 openacc-kernels
12109 Specify mode of OpenACC `kernels' constructs handling. With
12110 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12111 are decomposed into parts, a sequence of compute constructs,
12112 each then handled individually. This is work in progress.
12113 With --param=openacc-kernels=parloops, OpenACC `kernels'
12114 constructs are handled by the parloops pass, en bloc. This is
12115 the current default.
12116
12117 The following choices of name are available on AArch64 targets:
12118
12119 aarch64-sve-compare-costs
12120 When vectorizing for SVE, consider using "unpacked" vectors for
12121 smaller elements and use the cost model to pick the cheapest
12122 approach. Also use the cost model to choose between SVE and
12123 Advanced SIMD vectorization.
12124
12125 Using unpacked vectors includes storing smaller elements in
12126 larger containers and accessing elements with extending loads
12127 and truncating stores.
12128
12129 aarch64-float-recp-precision
12130 The number of Newton iterations for calculating the reciprocal
12131 for float type. The precision of division is proportional to
12132 this param when division approximation is enabled. The default
12133 value is 1.
12134
12135 aarch64-double-recp-precision
12136 The number of Newton iterations for calculating the reciprocal
12137 for double type. The precision of division is propotional to
12138 this param when division approximation is enabled. The default
12139 value is 2.
12140
12141 aarch64-autovec-preference
12142 Force an ISA selection strategy for auto-vectorization.
12143 Accepts values from 0 to 4, inclusive.
12144
12145 0 Use the default heuristics.
12146
12147 1 Use only Advanced SIMD for auto-vectorization.
12148
12149 2 Use only SVE for auto-vectorization.
12150
12151 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12152 the costs are deemed equal.
12153
12154 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12155 are deemed equal.
12156
12157 The default value is 0.
12158
12159 aarch64-loop-vect-issue-rate-niters
12160 The tuning for some AArch64 CPUs tries to take both latencies
12161 and issue rates into account when deciding whether a loop
12162 should be vectorized using SVE, vectorized using Advanced SIMD,
12163 or not vectorized at all. If this parameter is set to n, GCC
12164 will not use this heuristic for loops that are known to execute
12165 in fewer than n Advanced SIMD iterations.
12166
12167 Program Instrumentation Options
12168 GCC supports a number of command-line options that control adding run-
12169 time instrumentation to the code it normally generates. For example,
12170 one purpose of instrumentation is collect profiling statistics for use
12171 in finding program hot spots, code coverage analysis, or profile-guided
12172 optimizations. Another class of program instrumentation is adding run-
12173 time checking to detect programming errors like invalid pointer
12174 dereferences or out-of-bounds array accesses, as well as deliberately
12175 hostile attacks such as stack smashing or C++ vtable hijacking. There
12176 is also a general hook which can be used to implement other forms of
12177 tracing or function-level instrumentation for debug or program analysis
12178 purposes.
12179
12180 -p
12181 -pg Generate extra code to write profile information suitable for the
12182 analysis program prof (for -p) or gprof (for -pg). You must use
12183 this option when compiling the source files you want data about,
12184 and you must also use it when linking.
12185
12186 You can use the function attribute "no_instrument_function" to
12187 suppress profiling of individual functions when compiling with
12188 these options.
12189
12190 -fprofile-arcs
12191 Add code so that program flow arcs are instrumented. During
12192 execution the program records how many times each branch and call
12193 is executed and how many times it is taken or returns. On targets
12194 that support constructors with priority support, profiling properly
12195 handles constructors, destructors and C++ constructors (and
12196 destructors) of classes which are used as a type of a global
12197 variable.
12198
12199 When the compiled program exits it saves this data to a file called
12200 auxname.gcda for each source file. The data may be used for
12201 profile-directed optimizations (-fbranch-probabilities), or for
12202 test coverage analysis (-ftest-coverage). Each object file's
12203 auxname is generated from the name of the output file, if
12204 explicitly specified and it is not the final executable, otherwise
12205 it is the basename of the source file. In both cases any suffix is
12206 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12207 for output file specified as -o dir/foo.o).
12208
12209 --coverage
12210 This option is used to compile and link code instrumented for
12211 coverage analysis. The option is a synonym for -fprofile-arcs
12212 -ftest-coverage (when compiling) and -lgcov (when linking). See
12213 the documentation for those options for more details.
12214
12215 * Compile the source files with -fprofile-arcs plus optimization
12216 and code generation options. For test coverage analysis, use
12217 the additional -ftest-coverage option. You do not need to
12218 profile every source file in a program.
12219
12220 * Compile the source files additionally with -fprofile-abs-path
12221 to create absolute path names in the .gcno files. This allows
12222 gcov to find the correct sources in projects where compilations
12223 occur with different working directories.
12224
12225 * Link your object files with -lgcov or -fprofile-arcs (the
12226 latter implies the former).
12227
12228 * Run the program on a representative workload to generate the
12229 arc profile information. This may be repeated any number of
12230 times. You can run concurrent instances of your program, and
12231 provided that the file system supports locking, the data files
12232 will be correctly updated. Unless a strict ISO C dialect
12233 option is in effect, "fork" calls are detected and correctly
12234 handled without double counting.
12235
12236 * For profile-directed optimizations, compile the source files
12237 again with the same optimization and code generation options
12238 plus -fbranch-probabilities.
12239
12240 * For test coverage analysis, use gcov to produce human readable
12241 information from the .gcno and .gcda files. Refer to the gcov
12242 documentation for further information.
12243
12244 With -fprofile-arcs, for each function of your program GCC creates
12245 a program flow graph, then finds a spanning tree for the graph.
12246 Only arcs that are not on the spanning tree have to be
12247 instrumented: the compiler adds code to count the number of times
12248 that these arcs are executed. When an arc is the only exit or only
12249 entrance to a block, the instrumentation code can be added to the
12250 block; otherwise, a new basic block must be created to hold the
12251 instrumentation code.
12252
12253 -ftest-coverage
12254 Produce a notes file that the gcov code-coverage utility can use to
12255 show program coverage. Each source file's note file is called
12256 auxname.gcno. Refer to the -fprofile-arcs option above for a
12257 description of auxname and instructions on how to generate test
12258 coverage data. Coverage data matches the source files more closely
12259 if you do not optimize.
12260
12261 -fprofile-abs-path
12262 Automatically convert relative source file names to absolute path
12263 names in the .gcno files. This allows gcov to find the correct
12264 sources in projects where compilations occur with different working
12265 directories.
12266
12267 -fprofile-dir=path
12268 Set the directory to search for the profile data files in to path.
12269 This option affects only the profile data generated by
12270 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12271 -fprofile-use and -fbranch-probabilities and its related options.
12272 Both absolute and relative paths can be used. By default, GCC uses
12273 the current directory as path, thus the profile data file appears
12274 in the same directory as the object file. In order to prevent the
12275 file name clashing, if the object file name is not an absolute
12276 path, we mangle the absolute path of the sourcename.gcda file and
12277 use it as the file name of a .gcda file. See similar option
12278 -fprofile-note.
12279
12280 When an executable is run in a massive parallel environment, it is
12281 recommended to save profile to different folders. That can be done
12282 with variables in path that are exported during run-time:
12283
12284 %p process ID.
12285
12286 %q{VAR}
12287 value of environment variable VAR
12288
12289 -fprofile-generate
12290 -fprofile-generate=path
12291 Enable options usually used for instrumenting application to
12292 produce profile useful for later recompilation with profile
12293 feedback based optimization. You must use -fprofile-generate both
12294 when compiling and when linking your program.
12295
12296 The following options are enabled: -fprofile-arcs,
12297 -fprofile-values, -finline-functions, and -fipa-bit-cp.
12298
12299 If path is specified, GCC looks at the path to find the profile
12300 feedback data files. See -fprofile-dir.
12301
12302 To optimize the program based on the collected profile information,
12303 use -fprofile-use.
12304
12305 -fprofile-info-section
12306 -fprofile-info-section=name
12307 Register the profile information in the specified section instead
12308 of using a constructor/destructor. The section name is name if it
12309 is specified, otherwise the section name defaults to ".gcov_info".
12310 A pointer to the profile information generated by -fprofile-arcs or
12311 -ftest-coverage is placed in the specified section for each
12312 translation unit. This option disables the profile information
12313 registration through a constructor and it disables the profile
12314 information processing through a destructor. This option is not
12315 intended to be used in hosted environments such as GNU/Linux. It
12316 targets systems with limited resources which do not support
12317 constructors and destructors. The linker could collect the input
12318 sections in a continuous memory block and define start and end
12319 symbols. The runtime support could dump the profiling information
12320 registered in this linker set during program termination to a
12321 serial line for example. A GNU linker script example which defines
12322 a linker output section follows:
12323
12324 .gcov_info :
12325 {
12326 PROVIDE (__gcov_info_start = .);
12327 KEEP (*(.gcov_info))
12328 PROVIDE (__gcov_info_end = .);
12329 }
12330
12331 -fprofile-note=path
12332 If path is specified, GCC saves .gcno file into path location. If
12333 you combine the option with multiple source files, the .gcno file
12334 will be overwritten.
12335
12336 -fprofile-prefix-path=path
12337 This option can be used in combination with
12338 profile-generate=profile_dir and profile-use=profile_dir to inform
12339 GCC where is the base directory of built source tree. By default
12340 profile_dir will contain files with mangled absolute paths of all
12341 object files in the built project. This is not desirable when
12342 directory used to build the instrumented binary differs from the
12343 directory used to build the binary optimized with profile feedback
12344 because the profile data will not be found during the optimized
12345 build. In such setups -fprofile-prefix-path=path with path
12346 pointing to the base directory of the build can be used to strip
12347 the irrelevant part of the path and keep all file names relative to
12348 the main build directory.
12349
12350 -fprofile-update=method
12351 Alter the update method for an application instrumented for profile
12352 feedback based optimization. The method argument should be one of
12353 single, atomic or prefer-atomic. The first one is useful for
12354 single-threaded applications, while the second one prevents profile
12355 corruption by emitting thread-safe code.
12356
12357 Warning: When an application does not properly join all threads (or
12358 creates an detached thread), a profile file can be still corrupted.
12359
12360 Using prefer-atomic would be transformed either to atomic, when
12361 supported by a target, or to single otherwise. The GCC driver
12362 automatically selects prefer-atomic when -pthread is present in the
12363 command line.
12364
12365 -fprofile-filter-files=regex
12366 Instrument only functions from files whose name matches any of the
12367 regular expressions (separated by semi-colons).
12368
12369 For example, -fprofile-filter-files=main\.c;module.*\.c will
12370 instrument only main.c and all C files starting with 'module'.
12371
12372 -fprofile-exclude-files=regex
12373 Instrument only functions from files whose name does not match any
12374 of the regular expressions (separated by semi-colons).
12375
12376 For example, -fprofile-exclude-files=/usr/.* will prevent
12377 instrumentation of all files that are located in the /usr/ folder.
12378
12379 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
12380 Control level of reproducibility of profile gathered by
12381 "-fprofile-generate". This makes it possible to rebuild program
12382 with same outcome which is useful, for example, for distribution
12383 packages.
12384
12385 With -fprofile-reproducible=serial the profile gathered by
12386 -fprofile-generate is reproducible provided the trained program
12387 behaves the same at each invocation of the train run, it is not
12388 multi-threaded and profile data streaming is always done in the
12389 same order. Note that profile streaming happens at the end of
12390 program run but also before "fork" function is invoked.
12391
12392 Note that it is quite common that execution counts of some part of
12393 programs depends, for example, on length of temporary file names or
12394 memory space randomization (that may affect hash-table collision
12395 rate). Such non-reproducible part of programs may be annotated by
12396 "no_instrument_function" function attribute. gcov-dump with -l can
12397 be used to dump gathered data and verify that they are indeed
12398 reproducible.
12399
12400 With -fprofile-reproducible=parallel-runs collected profile stays
12401 reproducible regardless the order of streaming of the data into
12402 gcda files. This setting makes it possible to run multiple
12403 instances of instrumented program in parallel (such as with "make
12404 -j"). This reduces quality of gathered data, in particular of
12405 indirect call profiling.
12406
12407 -fsanitize=address
12408 Enable AddressSanitizer, a fast memory error detector. Memory
12409 access instructions are instrumented to detect out-of-bounds and
12410 use-after-free bugs. The option enables
12411 -fsanitize-address-use-after-scope. See
12412 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
12413 more details. The run-time behavior can be influenced using the
12414 ASAN_OPTIONS environment variable. When set to "help=1", the
12415 available options are shown at startup of the instrumented program.
12416 See
12417 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
12418 for a list of supported options. The option cannot be combined
12419 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
12420 target -fsanitize=hwaddress is currently supported on is AArch64.
12421
12422 -fsanitize=kernel-address
12423 Enable AddressSanitizer for Linux kernel. See
12424 <https://github.com/google/kasan> for more details.
12425
12426 -fsanitize=hwaddress
12427 Enable Hardware-assisted AddressSanitizer, which uses a hardware
12428 ability to ignore the top byte of a pointer to allow the detection
12429 of memory errors with a low memory overhead. Memory access
12430 instructions are instrumented to detect out-of-bounds and use-
12431 after-free bugs. The option enables
12432 -fsanitize-address-use-after-scope. See
12433 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
12434 for more details. The run-time behavior can be influenced using
12435 the HWASAN_OPTIONS environment variable. When set to "help=1", the
12436 available options are shown at startup of the instrumented program.
12437 The option cannot be combined with -fsanitize=thread or
12438 -fsanitize=address, and is currently only available on AArch64.
12439
12440 -fsanitize=kernel-hwaddress
12441 Enable Hardware-assisted AddressSanitizer for compilation of the
12442 Linux kernel. Similar to -fsanitize=kernel-address but using an
12443 alternate instrumentation method, and similar to
12444 -fsanitize=hwaddress but with instrumentation differences necessary
12445 for compiling the Linux kernel. These differences are to avoid
12446 hwasan library initialization calls and to account for the stack
12447 pointer having a different value in its top byte.
12448
12449 Note: This option has different defaults to the
12450 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
12451 not on by default but are still possible by specifying the command-
12452 line options --param hwasan-instrument-stack=1 and --param
12453 hwasan-instrument-allocas=1 respectively. Using a random frame tag
12454 is not implemented for kernel instrumentation.
12455
12456 -fsanitize=pointer-compare
12457 Instrument comparison operation (<, <=, >, >=) with pointer
12458 operands. The option must be combined with either
12459 -fsanitize=kernel-address or -fsanitize=address The option cannot
12460 be combined with -fsanitize=thread. Note: By default the check is
12461 disabled at run time. To enable it, add
12462 "detect_invalid_pointer_pairs=2" to the environment variable
12463 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
12464 invalid operation only when both pointers are non-null.
12465
12466 -fsanitize=pointer-subtract
12467 Instrument subtraction with pointer operands. The option must be
12468 combined with either -fsanitize=kernel-address or
12469 -fsanitize=address The option cannot be combined with
12470 -fsanitize=thread. Note: By default the check is disabled at run
12471 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
12472 environment variable ASAN_OPTIONS. Using
12473 "detect_invalid_pointer_pairs=1" detects invalid operation only
12474 when both pointers are non-null.
12475
12476 -fsanitize=thread
12477 Enable ThreadSanitizer, a fast data race detector. Memory access
12478 instructions are instrumented to detect data race bugs. See
12479 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
12480 more details. The run-time behavior can be influenced using the
12481 TSAN_OPTIONS environment variable; see
12482 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
12483 for a list of supported options. The option cannot be combined
12484 with -fsanitize=address, -fsanitize=leak.
12485
12486 Note that sanitized atomic builtins cannot throw exceptions when
12487 operating on invalid memory addresses with non-call exceptions
12488 (-fnon-call-exceptions).
12489
12490 -fsanitize=leak
12491 Enable LeakSanitizer, a memory leak detector. This option only
12492 matters for linking of executables and the executable is linked
12493 against a library that overrides "malloc" and other allocator
12494 functions. See
12495 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
12496 for more details. The run-time behavior can be influenced using
12497 the LSAN_OPTIONS environment variable. The option cannot be
12498 combined with -fsanitize=thread.
12499
12500 -fsanitize=undefined
12501 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
12502 detector. Various computations are instrumented to detect
12503 undefined behavior at runtime. Current suboptions are:
12504
12505 -fsanitize=shift
12506 This option enables checking that the result of a shift
12507 operation is not undefined. Note that what exactly is
12508 considered undefined differs slightly between C and C++, as
12509 well as between ISO C90 and C99, etc. This option has two
12510 suboptions, -fsanitize=shift-base and
12511 -fsanitize=shift-exponent.
12512
12513 -fsanitize=shift-exponent
12514 This option enables checking that the second argument of a
12515 shift operation is not negative and is smaller than the
12516 precision of the promoted first argument.
12517
12518 -fsanitize=shift-base
12519 If the second argument of a shift operation is within range,
12520 check that the result of a shift operation is not undefined.
12521 Note that what exactly is considered undefined differs slightly
12522 between C and C++, as well as between ISO C90 and C99, etc.
12523
12524 -fsanitize=integer-divide-by-zero
12525 Detect integer division by zero as well as "INT_MIN / -1"
12526 division.
12527
12528 -fsanitize=unreachable
12529 With this option, the compiler turns the
12530 "__builtin_unreachable" call into a diagnostics message call
12531 instead. When reaching the "__builtin_unreachable" call, the
12532 behavior is undefined.
12533
12534 -fsanitize=vla-bound
12535 This option instructs the compiler to check that the size of a
12536 variable length array is positive.
12537
12538 -fsanitize=null
12539 This option enables pointer checking. Particularly, the
12540 application built with this option turned on will issue an
12541 error message when it tries to dereference a NULL pointer, or
12542 if a reference (possibly an rvalue reference) is bound to a
12543 NULL pointer, or if a method is invoked on an object pointed by
12544 a NULL pointer.
12545
12546 -fsanitize=return
12547 This option enables return statement checking. Programs built
12548 with this option turned on will issue an error message when the
12549 end of a non-void function is reached without actually
12550 returning a value. This option works in C++ only.
12551
12552 -fsanitize=signed-integer-overflow
12553 This option enables signed integer overflow checking. We check
12554 that the result of "+", "*", and both unary and binary "-" does
12555 not overflow in the signed arithmetics. Note, integer
12556 promotion rules must be taken into account. That is, the
12557 following is not an overflow:
12558
12559 signed char a = SCHAR_MAX;
12560 a++;
12561
12562 -fsanitize=bounds
12563 This option enables instrumentation of array bounds. Various
12564 out of bounds accesses are detected. Flexible array members,
12565 flexible array member-like arrays, and initializers of
12566 variables with static storage are not instrumented.
12567
12568 -fsanitize=bounds-strict
12569 This option enables strict instrumentation of array bounds.
12570 Most out of bounds accesses are detected, including flexible
12571 array members and flexible array member-like arrays.
12572 Initializers of variables with static storage are not
12573 instrumented.
12574
12575 -fsanitize=alignment
12576 This option enables checking of alignment of pointers when they
12577 are dereferenced, or when a reference is bound to
12578 insufficiently aligned target, or when a method or constructor
12579 is invoked on insufficiently aligned object.
12580
12581 -fsanitize=object-size
12582 This option enables instrumentation of memory references using
12583 the "__builtin_object_size" function. Various out of bounds
12584 pointer accesses are detected.
12585
12586 -fsanitize=float-divide-by-zero
12587 Detect floating-point division by zero. Unlike other similar
12588 options, -fsanitize=float-divide-by-zero is not enabled by
12589 -fsanitize=undefined, since floating-point division by zero can
12590 be a legitimate way of obtaining infinities and NaNs.
12591
12592 -fsanitize=float-cast-overflow
12593 This option enables floating-point type to integer conversion
12594 checking. We check that the result of the conversion does not
12595 overflow. Unlike other similar options,
12596 -fsanitize=float-cast-overflow is not enabled by
12597 -fsanitize=undefined. This option does not work well with
12598 "FE_INVALID" exceptions enabled.
12599
12600 -fsanitize=nonnull-attribute
12601 This option enables instrumentation of calls, checking whether
12602 null values are not passed to arguments marked as requiring a
12603 non-null value by the "nonnull" function attribute.
12604
12605 -fsanitize=returns-nonnull-attribute
12606 This option enables instrumentation of return statements in
12607 functions marked with "returns_nonnull" function attribute, to
12608 detect returning of null values from such functions.
12609
12610 -fsanitize=bool
12611 This option enables instrumentation of loads from bool. If a
12612 value other than 0/1 is loaded, a run-time error is issued.
12613
12614 -fsanitize=enum
12615 This option enables instrumentation of loads from an enum type.
12616 If a value outside the range of values for the enum type is
12617 loaded, a run-time error is issued.
12618
12619 -fsanitize=vptr
12620 This option enables instrumentation of C++ member function
12621 calls, member accesses and some conversions between pointers to
12622 base and derived classes, to verify the referenced object has
12623 the correct dynamic type.
12624
12625 -fsanitize=pointer-overflow
12626 This option enables instrumentation of pointer arithmetics. If
12627 the pointer arithmetics overflows, a run-time error is issued.
12628
12629 -fsanitize=builtin
12630 This option enables instrumentation of arguments to selected
12631 builtin functions. If an invalid value is passed to such
12632 arguments, a run-time error is issued. E.g. passing 0 as the
12633 argument to "__builtin_ctz" or "__builtin_clz" invokes
12634 undefined behavior and is diagnosed by this option.
12635
12636 While -ftrapv causes traps for signed overflows to be emitted,
12637 -fsanitize=undefined gives a diagnostic message. This currently
12638 works only for the C family of languages.
12639
12640 -fno-sanitize=all
12641 This option disables all previously enabled sanitizers.
12642 -fsanitize=all is not allowed, as some sanitizers cannot be used
12643 together.
12644
12645 -fasan-shadow-offset=number
12646 This option forces GCC to use custom shadow offset in
12647 AddressSanitizer checks. It is useful for experimenting with
12648 different shadow memory layouts in Kernel AddressSanitizer.
12649
12650 -fsanitize-sections=s1,s2,...
12651 Sanitize global variables in selected user-defined sections. si
12652 may contain wildcards.
12653
12654 -fsanitize-recover[=opts]
12655 -fsanitize-recover= controls error recovery mode for sanitizers
12656 mentioned in comma-separated list of opts. Enabling this option
12657 for a sanitizer component causes it to attempt to continue running
12658 the program as if no error happened. This means multiple runtime
12659 errors can be reported in a single program run, and the exit code
12660 of the program may indicate success even when errors have been
12661 reported. The -fno-sanitize-recover= option can be used to alter
12662 this behavior: only the first detected error is reported and
12663 program then exits with a non-zero exit code.
12664
12665 Currently this feature only works for -fsanitize=undefined (and its
12666 suboptions except for -fsanitize=unreachable and
12667 -fsanitize=return), -fsanitize=float-cast-overflow,
12668 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
12669 -fsanitize=kernel-address and -fsanitize=address. For these
12670 sanitizers error recovery is turned on by default, except
12671 -fsanitize=address, for which this feature is experimental.
12672 -fsanitize-recover=all and -fno-sanitize-recover=all is also
12673 accepted, the former enables recovery for all sanitizers that
12674 support it, the latter disables recovery for all sanitizers that
12675 support it.
12676
12677 Even if a recovery mode is turned on the compiler side, it needs to
12678 be also enabled on the runtime library side, otherwise the failures
12679 are still fatal. The runtime library defaults to "halt_on_error=0"
12680 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
12681 value for AddressSanitizer is "halt_on_error=1". This can be
12682 overridden through setting the "halt_on_error" flag in the
12683 corresponding environment variable.
12684
12685 Syntax without an explicit opts parameter is deprecated. It is
12686 equivalent to specifying an opts list of:
12687
12688 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12689
12690 -fsanitize-address-use-after-scope
12691 Enable sanitization of local variables to detect use-after-scope
12692 bugs. The option sets -fstack-reuse to none.
12693
12694 -fsanitize-undefined-trap-on-error
12695 The -fsanitize-undefined-trap-on-error option instructs the
12696 compiler to report undefined behavior using "__builtin_trap" rather
12697 than a "libubsan" library routine. The advantage of this is that
12698 the "libubsan" library is not needed and is not linked in, so this
12699 is usable even in freestanding environments.
12700
12701 -fsanitize-coverage=trace-pc
12702 Enable coverage-guided fuzzing code instrumentation. Inserts a
12703 call to "__sanitizer_cov_trace_pc" into every basic block.
12704
12705 -fsanitize-coverage=trace-cmp
12706 Enable dataflow guided fuzzing code instrumentation. Inserts a
12707 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
12708 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
12709 integral comparison with both operands variable or
12710 "__sanitizer_cov_trace_const_cmp1",
12711 "__sanitizer_cov_trace_const_cmp2",
12712 "__sanitizer_cov_trace_const_cmp4" or
12713 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
12714 operand constant, "__sanitizer_cov_trace_cmpf" or
12715 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
12716 "__sanitizer_cov_trace_switch" for switch statements.
12717
12718 -fcf-protection=[full|branch|return|none|check]
12719 Enable code instrumentation of control-flow transfers to increase
12720 program security by checking that target addresses of control-flow
12721 transfer instructions (such as indirect function call, function
12722 return, indirect jump) are valid. This prevents diverting the flow
12723 of control to an unexpected target. This is intended to protect
12724 against such threats as Return-oriented Programming (ROP), and
12725 similarly call/jmp-oriented programming (COP/JOP).
12726
12727 The value "branch" tells the compiler to implement checking of
12728 validity of control-flow transfer at the point of indirect branch
12729 instructions, i.e. call/jmp instructions. The value "return"
12730 implements checking of validity at the point of returning from a
12731 function. The value "full" is an alias for specifying both
12732 "branch" and "return". The value "none" turns off instrumentation.
12733
12734 The value "check" is used for the final link with link-time
12735 optimization (LTO). An error is issued if LTO object files are
12736 compiled with different -fcf-protection values. The value "check"
12737 is ignored at the compile time.
12738
12739 The macro "__CET__" is defined when -fcf-protection is used. The
12740 first bit of "__CET__" is set to 1 for the value "branch" and the
12741 second bit of "__CET__" is set to 1 for the "return".
12742
12743 You can also use the "nocf_check" attribute to identify which
12744 functions and calls should be skipped from instrumentation.
12745
12746 Currently the x86 GNU/Linux target provides an implementation based
12747 on Intel Control-flow Enforcement Technology (CET).
12748
12749 -fstack-protector
12750 Emit extra code to check for buffer overflows, such as stack
12751 smashing attacks. This is done by adding a guard variable to
12752 functions with vulnerable objects. This includes functions that
12753 call "alloca", and functions with buffers larger than or equal to 8
12754 bytes. The guards are initialized when a function is entered and
12755 then checked when the function exits. If a guard check fails, an
12756 error message is printed and the program exits. Only variables
12757 that are actually allocated on the stack are considered, optimized
12758 away variables or variables allocated in registers don't count.
12759
12760 -fstack-protector-all
12761 Like -fstack-protector except that all functions are protected.
12762
12763 -fstack-protector-strong
12764 Like -fstack-protector but includes additional functions to be
12765 protected --- those that have local array definitions, or have
12766 references to local frame addresses. Only variables that are
12767 actually allocated on the stack are considered, optimized away
12768 variables or variables allocated in registers don't count.
12769
12770 -fstack-protector-explicit
12771 Like -fstack-protector but only protects those functions which have
12772 the "stack_protect" attribute.
12773
12774 -fstack-check
12775 Generate code to verify that you do not go beyond the boundary of
12776 the stack. You should specify this flag if you are running in an
12777 environment with multiple threads, but you only rarely need to
12778 specify it in a single-threaded environment since stack overflow is
12779 automatically detected on nearly all systems if there is only one
12780 stack.
12781
12782 Note that this switch does not actually cause checking to be done;
12783 the operating system or the language runtime must do that. The
12784 switch causes generation of code to ensure that they see the stack
12785 being extended.
12786
12787 You can additionally specify a string parameter: no means no
12788 checking, generic means force the use of old-style checking,
12789 specific means use the best checking method and is equivalent to
12790 bare -fstack-check.
12791
12792 Old-style checking is a generic mechanism that requires no specific
12793 target support in the compiler but comes with the following
12794 drawbacks:
12795
12796 1. Modified allocation strategy for large objects: they are always
12797 allocated dynamically if their size exceeds a fixed threshold.
12798 Note this may change the semantics of some code.
12799
12800 2. Fixed limit on the size of the static frame of functions: when
12801 it is topped by a particular function, stack checking is not
12802 reliable and a warning is issued by the compiler.
12803
12804 3. Inefficiency: because of both the modified allocation strategy
12805 and the generic implementation, code performance is hampered.
12806
12807 Note that old-style stack checking is also the fallback method for
12808 specific if no target support has been added in the compiler.
12809
12810 -fstack-check= is designed for Ada's needs to detect infinite
12811 recursion and stack overflows. specific is an excellent choice
12812 when compiling Ada code. It is not generally sufficient to protect
12813 against stack-clash attacks. To protect against those you want
12814 -fstack-clash-protection.
12815
12816 -fstack-clash-protection
12817 Generate code to prevent stack clash style attacks. When this
12818 option is enabled, the compiler will only allocate one page of
12819 stack space at a time and each page is accessed immediately after
12820 allocation. Thus, it prevents allocations from jumping over any
12821 stack guard page provided by the operating system.
12822
12823 Most targets do not fully support stack clash protection. However,
12824 on those targets -fstack-clash-protection will protect dynamic
12825 stack allocations. -fstack-clash-protection may also provide
12826 limited protection for static stack allocations if the target
12827 supports -fstack-check=specific.
12828
12829 -fstack-limit-register=reg
12830 -fstack-limit-symbol=sym
12831 -fno-stack-limit
12832 Generate code to ensure that the stack does not grow beyond a
12833 certain value, either the value of a register or the address of a
12834 symbol. If a larger stack is required, a signal is raised at run
12835 time. For most targets, the signal is raised before the stack
12836 overruns the boundary, so it is possible to catch the signal
12837 without taking special precautions.
12838
12839 For instance, if the stack starts at absolute address 0x80000000
12840 and grows downwards, you can use the flags
12841 -fstack-limit-symbol=__stack_limit and
12842 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
12843 128KB. Note that this may only work with the GNU linker.
12844
12845 You can locally override stack limit checking by using the
12846 "no_stack_limit" function attribute.
12847
12848 -fsplit-stack
12849 Generate code to automatically split the stack before it overflows.
12850 The resulting program has a discontiguous stack which can only
12851 overflow if the program is unable to allocate any more memory.
12852 This is most useful when running threaded programs, as it is no
12853 longer necessary to calculate a good stack size to use for each
12854 thread. This is currently only implemented for the x86 targets
12855 running GNU/Linux.
12856
12857 When code compiled with -fsplit-stack calls code compiled without
12858 -fsplit-stack, there may not be much stack space available for the
12859 latter code to run. If compiling all code, including library code,
12860 with -fsplit-stack is not an option, then the linker can fix up
12861 these calls so that the code compiled without -fsplit-stack always
12862 has a large stack. Support for this is implemented in the gold
12863 linker in GNU binutils release 2.21 and later.
12864
12865 -fvtable-verify=[std|preinit|none]
12866 This option is only available when compiling C++ code. It turns on
12867 (or off, if using -fvtable-verify=none) the security feature that
12868 verifies at run time, for every virtual call, that the vtable
12869 pointer through which the call is made is valid for the type of the
12870 object, and has not been corrupted or overwritten. If an invalid
12871 vtable pointer is detected at run time, an error is reported and
12872 execution of the program is immediately halted.
12873
12874 This option causes run-time data structures to be built at program
12875 startup, which are used for verifying the vtable pointers. The
12876 options std and preinit control the timing of when these data
12877 structures are built. In both cases the data structures are built
12878 before execution reaches "main". Using -fvtable-verify=std causes
12879 the data structures to be built after shared libraries have been
12880 loaded and initialized. -fvtable-verify=preinit causes them to be
12881 built before shared libraries have been loaded and initialized.
12882
12883 If this option appears multiple times in the command line with
12884 different values specified, none takes highest priority over both
12885 std and preinit; preinit takes priority over std.
12886
12887 -fvtv-debug
12888 When used in conjunction with -fvtable-verify=std or
12889 -fvtable-verify=preinit, causes debug versions of the runtime
12890 functions for the vtable verification feature to be called. This
12891 flag also causes the compiler to log information about which vtable
12892 pointers it finds for each class. This information is written to a
12893 file named vtv_set_ptr_data.log in the directory named by the
12894 environment variable VTV_LOGS_DIR if that is defined or the current
12895 working directory otherwise.
12896
12897 Note: This feature appends data to the log file. If you want a
12898 fresh log file, be sure to delete any existing one.
12899
12900 -fvtv-counts
12901 This is a debugging flag. When used in conjunction with
12902 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
12903 compiler to keep track of the total number of virtual calls it
12904 encounters and the number of verifications it inserts. It also
12905 counts the number of calls to certain run-time library functions
12906 that it inserts and logs this information for each compilation
12907 unit. The compiler writes this information to a file named
12908 vtv_count_data.log in the directory named by the environment
12909 variable VTV_LOGS_DIR if that is defined or the current working
12910 directory otherwise. It also counts the size of the vtable pointer
12911 sets for each class, and writes this information to
12912 vtv_class_set_sizes.log in the same directory.
12913
12914 Note: This feature appends data to the log files. To get fresh
12915 log files, be sure to delete any existing ones.
12916
12917 -finstrument-functions
12918 Generate instrumentation calls for entry and exit to functions.
12919 Just after function entry and just before function exit, the
12920 following profiling functions are called with the address of the
12921 current function and its call site. (On some platforms,
12922 "__builtin_return_address" does not work beyond the current
12923 function, so the call site information may not be available to the
12924 profiling functions otherwise.)
12925
12926 void __cyg_profile_func_enter (void *this_fn,
12927 void *call_site);
12928 void __cyg_profile_func_exit (void *this_fn,
12929 void *call_site);
12930
12931 The first argument is the address of the start of the current
12932 function, which may be looked up exactly in the symbol table.
12933
12934 This instrumentation is also done for functions expanded inline in
12935 other functions. The profiling calls indicate where, conceptually,
12936 the inline function is entered and exited. This means that
12937 addressable versions of such functions must be available. If all
12938 your uses of a function are expanded inline, this may mean an
12939 additional expansion of code size. If you use "extern inline" in
12940 your C code, an addressable version of such functions must be
12941 provided. (This is normally the case anyway, but if you get lucky
12942 and the optimizer always expands the functions inline, you might
12943 have gotten away without providing static copies.)
12944
12945 A function may be given the attribute "no_instrument_function", in
12946 which case this instrumentation is not done. This can be used, for
12947 example, for the profiling functions listed above, high-priority
12948 interrupt routines, and any functions from which the profiling
12949 functions cannot safely be called (perhaps signal handlers, if the
12950 profiling routines generate output or allocate memory).
12951
12952 -finstrument-functions-exclude-file-list=file,file,...
12953 Set the list of functions that are excluded from instrumentation
12954 (see the description of -finstrument-functions). If the file that
12955 contains a function definition matches with one of file, then that
12956 function is not instrumented. The match is done on substrings: if
12957 the file parameter is a substring of the file name, it is
12958 considered to be a match.
12959
12960 For example:
12961
12962 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12963
12964 excludes any inline function defined in files whose pathnames
12965 contain /bits/stl or include/sys.
12966
12967 If, for some reason, you want to include letter , in one of sym,
12968 write ,. For example,
12969 -finstrument-functions-exclude-file-list=',,tmp' (note the single
12970 quote surrounding the option).
12971
12972 -finstrument-functions-exclude-function-list=sym,sym,...
12973 This is similar to -finstrument-functions-exclude-file-list, but
12974 this option sets the list of function names to be excluded from
12975 instrumentation. The function name to be matched is its user-
12976 visible name, such as "vector<int> blah(const vector<int> &)", not
12977 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
12978 match is done on substrings: if the sym parameter is a substring of
12979 the function name, it is considered to be a match. For C99 and C++
12980 extended identifiers, the function name must be given in UTF-8, not
12981 using universal character names.
12982
12983 -fpatchable-function-entry=N[,M]
12984 Generate N NOPs right at the beginning of each function, with the
12985 function entry point before the Mth NOP. If M is omitted, it
12986 defaults to 0 so the function entry points to the address just at
12987 the first NOP. The NOP instructions reserve extra space which can
12988 be used to patch in any desired instrumentation at run time,
12989 provided that the code segment is writable. The amount of space is
12990 controllable indirectly via the number of NOPs; the NOP instruction
12991 used corresponds to the instruction emitted by the internal GCC
12992 back-end interface "gen_nop". This behavior is target-specific and
12993 may also depend on the architecture variant and/or other
12994 compilation options.
12995
12996 For run-time identification, the starting addresses of these areas,
12997 which correspond to their respective function entries minus M, are
12998 additionally collected in the "__patchable_function_entries"
12999 section of the resulting binary.
13000
13001 Note that the value of "__attribute__ ((patchable_function_entry
13002 (N,M)))" takes precedence over command-line option
13003 -fpatchable-function-entry=N,M. This can be used to increase the
13004 area size or to remove it completely on a single function. If
13005 "N=0", no pad location is recorded.
13006
13007 The NOP instructions are inserted at---and maybe before, depending
13008 on M---the function entry address, even before the prologue.
13009
13010 The maximum value of N and M is 65535.
13011
13012 Options Controlling the Preprocessor
13013 These options control the C preprocessor, which is run on each C source
13014 file before actual compilation.
13015
13016 If you use the -E option, nothing is done except preprocessing. Some
13017 of these options make sense only together with -E because they cause
13018 the preprocessor output to be unsuitable for actual compilation.
13019
13020 In addition to the options listed here, there are a number of options
13021 to control search paths for include files documented in Directory
13022 Options. Options to control preprocessor diagnostics are listed in
13023 Warning Options.
13024
13025 -D name
13026 Predefine name as a macro, with definition 1.
13027
13028 -D name=definition
13029 The contents of definition are tokenized and processed as if they
13030 appeared during translation phase three in a #define directive. In
13031 particular, the definition is truncated by embedded newline
13032 characters.
13033
13034 If you are invoking the preprocessor from a shell or shell-like
13035 program you may need to use the shell's quoting syntax to protect
13036 characters such as spaces that have a meaning in the shell syntax.
13037
13038 If you wish to define a function-like macro on the command line,
13039 write its argument list with surrounding parentheses before the
13040 equals sign (if any). Parentheses are meaningful to most shells,
13041 so you should quote the option. With sh and csh,
13042 -D'name(args...)=definition' works.
13043
13044 -D and -U options are processed in the order they are given on the
13045 command line. All -imacros file and -include file options are
13046 processed after all -D and -U options.
13047
13048 -U name
13049 Cancel any previous definition of name, either built in or provided
13050 with a -D option.
13051
13052 -include file
13053 Process file as if "#include "file"" appeared as the first line of
13054 the primary source file. However, the first directory searched for
13055 file is the preprocessor's working directory instead of the
13056 directory containing the main source file. If not found there, it
13057 is searched for in the remainder of the "#include "..."" search
13058 chain as normal.
13059
13060 If multiple -include options are given, the files are included in
13061 the order they appear on the command line.
13062
13063 -imacros file
13064 Exactly like -include, except that any output produced by scanning
13065 file is thrown away. Macros it defines remain defined. This
13066 allows you to acquire all the macros from a header without also
13067 processing its declarations.
13068
13069 All files specified by -imacros are processed before all files
13070 specified by -include.
13071
13072 -undef
13073 Do not predefine any system-specific or GCC-specific macros. The
13074 standard predefined macros remain defined.
13075
13076 -pthread
13077 Define additional macros required for using the POSIX threads
13078 library. You should use this option consistently for both
13079 compilation and linking. This option is supported on GNU/Linux
13080 targets, most other Unix derivatives, and also on x86 Cygwin and
13081 MinGW targets.
13082
13083 -M Instead of outputting the result of preprocessing, output a rule
13084 suitable for make describing the dependencies of the main source
13085 file. The preprocessor outputs one make rule containing the object
13086 file name for that source file, a colon, and the names of all the
13087 included files, including those coming from -include or -imacros
13088 command-line options.
13089
13090 Unless specified explicitly (with -MT or -MQ), the object file name
13091 consists of the name of the source file with any suffix replaced
13092 with object file suffix and with any leading directory parts
13093 removed. If there are many included files then the rule is split
13094 into several lines using \-newline. The rule has no commands.
13095
13096 This option does not suppress the preprocessor's debug output, such
13097 as -dM. To avoid mixing such debug output with the dependency
13098 rules you should explicitly specify the dependency output file with
13099 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13100 Debug output is still sent to the regular output stream as normal.
13101
13102 Passing -M to the driver implies -E, and suppresses warnings with
13103 an implicit -w.
13104
13105 -MM Like -M but do not mention header files that are found in system
13106 header directories, nor header files that are included, directly or
13107 indirectly, from such a header.
13108
13109 This implies that the choice of angle brackets or double quotes in
13110 an #include directive does not in itself determine whether that
13111 header appears in -MM dependency output.
13112
13113 -MF file
13114 When used with -M or -MM, specifies a file to write the
13115 dependencies to. If no -MF switch is given the preprocessor sends
13116 the rules to the same place it would send preprocessed output.
13117
13118 When used with the driver options -MD or -MMD, -MF overrides the
13119 default dependency output file.
13120
13121 If file is -, then the dependencies are written to stdout.
13122
13123 -MG In conjunction with an option such as -M requesting dependency
13124 generation, -MG assumes missing header files are generated files
13125 and adds them to the dependency list without raising an error. The
13126 dependency filename is taken directly from the "#include" directive
13127 without prepending any path. -MG also suppresses preprocessed
13128 output, as a missing header file renders this useless.
13129
13130 This feature is used in automatic updating of makefiles.
13131
13132 -Mno-modules
13133 Disable dependency generation for compiled module interfaces.
13134
13135 -MP This option instructs CPP to add a phony target for each dependency
13136 other than the main file, causing each to depend on nothing. These
13137 dummy rules work around errors make gives if you remove header
13138 files without updating the Makefile to match.
13139
13140 This is typical output:
13141
13142 test.o: test.c test.h
13143
13144 test.h:
13145
13146 -MT target
13147 Change the target of the rule emitted by dependency generation. By
13148 default CPP takes the name of the main input file, deletes any
13149 directory components and any file suffix such as .c, and appends
13150 the platform's usual object suffix. The result is the target.
13151
13152 An -MT option sets the target to be exactly the string you specify.
13153 If you want multiple targets, you can specify them as a single
13154 argument to -MT, or use multiple -MT options.
13155
13156 For example, -MT '$(objpfx)foo.o' might give
13157
13158 $(objpfx)foo.o: foo.c
13159
13160 -MQ target
13161 Same as -MT, but it quotes any characters which are special to
13162 Make. -MQ '$(objpfx)foo.o' gives
13163
13164 $$(objpfx)foo.o: foo.c
13165
13166 The default target is automatically quoted, as if it were given
13167 with -MQ.
13168
13169 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
13170 The driver determines file based on whether an -o option is given.
13171 If it is, the driver uses its argument but with a suffix of .d,
13172 otherwise it takes the name of the input file, removes any
13173 directory components and suffix, and applies a .d suffix.
13174
13175 If -MD is used in conjunction with -E, any -o switch is understood
13176 to specify the dependency output file, but if used without -E, each
13177 -o is understood to specify a target object file.
13178
13179 Since -E is not implied, -MD can be used to generate a dependency
13180 output file as a side effect of the compilation process.
13181
13182 -MMD
13183 Like -MD except mention only user header files, not system header
13184 files.
13185
13186 -fpreprocessed
13187 Indicate to the preprocessor that the input file has already been
13188 preprocessed. This suppresses things like macro expansion,
13189 trigraph conversion, escaped newline splicing, and processing of
13190 most directives. The preprocessor still recognizes and removes
13191 comments, so that you can pass a file preprocessed with -C to the
13192 compiler without problems. In this mode the integrated
13193 preprocessor is little more than a tokenizer for the front ends.
13194
13195 -fpreprocessed is implicit if the input file has one of the
13196 extensions .i, .ii or .mi. These are the extensions that GCC uses
13197 for preprocessed files created by -save-temps.
13198
13199 -fdirectives-only
13200 When preprocessing, handle directives, but do not expand macros.
13201
13202 The option's behavior depends on the -E and -fpreprocessed options.
13203
13204 With -E, preprocessing is limited to the handling of directives
13205 such as "#define", "#ifdef", and "#error". Other preprocessor
13206 operations, such as macro expansion and trigraph conversion are not
13207 performed. In addition, the -dD option is implicitly enabled.
13208
13209 With -fpreprocessed, predefinition of command line and most builtin
13210 macros is disabled. Macros such as "__LINE__", which are
13211 contextually dependent, are handled normally. This enables
13212 compilation of files previously preprocessed with "-E
13213 -fdirectives-only".
13214
13215 With both -E and -fpreprocessed, the rules for -fpreprocessed take
13216 precedence. This enables full preprocessing of files previously
13217 preprocessed with "-E -fdirectives-only".
13218
13219 -fdollars-in-identifiers
13220 Accept $ in identifiers.
13221
13222 -fextended-identifiers
13223 Accept universal character names and extended characters in
13224 identifiers. This option is enabled by default for C99 (and later
13225 C standard versions) and C++.
13226
13227 -fno-canonical-system-headers
13228 When preprocessing, do not shorten system header paths with
13229 canonicalization.
13230
13231 -fmax-include-depth=depth
13232 Set the maximum depth of the nested #include. The default is 200.
13233
13234 -ftabstop=width
13235 Set the distance between tab stops. This helps the preprocessor
13236 report correct column numbers in warnings or errors, even if tabs
13237 appear on the line. If the value is less than 1 or greater than
13238 100, the option is ignored. The default is 8.
13239
13240 -ftrack-macro-expansion[=level]
13241 Track locations of tokens across macro expansions. This allows the
13242 compiler to emit diagnostic about the current macro expansion stack
13243 when a compilation error occurs in a macro expansion. Using this
13244 option makes the preprocessor and the compiler consume more memory.
13245 The level parameter can be used to choose the level of precision of
13246 token location tracking thus decreasing the memory consumption if
13247 necessary. Value 0 of level de-activates this option. Value 1
13248 tracks tokens locations in a degraded mode for the sake of minimal
13249 memory overhead. In this mode all tokens resulting from the
13250 expansion of an argument of a function-like macro have the same
13251 location. Value 2 tracks tokens locations completely. This value is
13252 the most memory hungry. When this option is given no argument, the
13253 default parameter value is 2.
13254
13255 Note that "-ftrack-macro-expansion=2" is activated by default.
13256
13257 -fmacro-prefix-map=old=new
13258 When preprocessing files residing in directory old, expand the
13259 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
13260 directory new instead. This can be used to change an absolute path
13261 to a relative path by using . for new which can result in more
13262 reproducible builds that are location independent. This option
13263 also affects "__builtin_FILE()" during compilation. See also
13264 -ffile-prefix-map.
13265
13266 -fexec-charset=charset
13267 Set the execution character set, used for string and character
13268 constants. The default is UTF-8. charset can be any encoding
13269 supported by the system's "iconv" library routine.
13270
13271 -fwide-exec-charset=charset
13272 Set the wide execution character set, used for wide string and
13273 character constants. The default is UTF-32 or UTF-16, whichever
13274 corresponds to the width of "wchar_t". As with -fexec-charset,
13275 charset can be any encoding supported by the system's "iconv"
13276 library routine; however, you will have problems with encodings
13277 that do not fit exactly in "wchar_t".
13278
13279 -finput-charset=charset
13280 Set the input character set, used for translation from the
13281 character set of the input file to the source character set used by
13282 GCC. If the locale does not specify, or GCC cannot get this
13283 information from the locale, the default is UTF-8. This can be
13284 overridden by either the locale or this command-line option.
13285 Currently the command-line option takes precedence if there's a
13286 conflict. charset can be any encoding supported by the system's
13287 "iconv" library routine.
13288
13289 -fpch-deps
13290 When using precompiled headers, this flag causes the dependency-
13291 output flags to also list the files from the precompiled header's
13292 dependencies. If not specified, only the precompiled header are
13293 listed and not the files that were used to create it, because those
13294 files are not consulted when a precompiled header is used.
13295
13296 -fpch-preprocess
13297 This option allows use of a precompiled header together with -E.
13298 It inserts a special "#pragma", "#pragma GCC pch_preprocess
13299 "filename"" in the output to mark the place where the precompiled
13300 header was found, and its filename. When -fpreprocessed is in use,
13301 GCC recognizes this "#pragma" and loads the PCH.
13302
13303 This option is off by default, because the resulting preprocessed
13304 output is only really suitable as input to GCC. It is switched on
13305 by -save-temps.
13306
13307 You should not write this "#pragma" in your own code, but it is
13308 safe to edit the filename if the PCH file is available in a
13309 different location. The filename may be absolute or it may be
13310 relative to GCC's current directory.
13311
13312 -fworking-directory
13313 Enable generation of linemarkers in the preprocessor output that
13314 let the compiler know the current working directory at the time of
13315 preprocessing. When this option is enabled, the preprocessor
13316 emits, after the initial linemarker, a second linemarker with the
13317 current working directory followed by two slashes. GCC uses this
13318 directory, when it's present in the preprocessed input, as the
13319 directory emitted as the current working directory in some
13320 debugging information formats. This option is implicitly enabled
13321 if debugging information is enabled, but this can be inhibited with
13322 the negated form -fno-working-directory. If the -P flag is present
13323 in the command line, this option has no effect, since no "#line"
13324 directives are emitted whatsoever.
13325
13326 -A predicate=answer
13327 Make an assertion with the predicate predicate and answer answer.
13328 This form is preferred to the older form -A predicate(answer),
13329 which is still supported, because it does not use shell special
13330 characters.
13331
13332 -A -predicate=answer
13333 Cancel an assertion with the predicate predicate and answer answer.
13334
13335 -C Do not discard comments. All comments are passed through to the
13336 output file, except for comments in processed directives, which are
13337 deleted along with the directive.
13338
13339 You should be prepared for side effects when using -C; it causes
13340 the preprocessor to treat comments as tokens in their own right.
13341 For example, comments appearing at the start of what would be a
13342 directive line have the effect of turning that line into an
13343 ordinary source line, since the first token on the line is no
13344 longer a #.
13345
13346 -CC Do not discard comments, including during macro expansion. This is
13347 like -C, except that comments contained within macros are also
13348 passed through to the output file where the macro is expanded.
13349
13350 In addition to the side effects of the -C option, the -CC option
13351 causes all C++-style comments inside a macro to be converted to
13352 C-style comments. This is to prevent later use of that macro from
13353 inadvertently commenting out the remainder of the source line.
13354
13355 The -CC option is generally used to support lint comments.
13356
13357 -P Inhibit generation of linemarkers in the output from the
13358 preprocessor. This might be useful when running the preprocessor
13359 on something that is not C code, and will be sent to a program
13360 which might be confused by the linemarkers.
13361
13362 -traditional
13363 -traditional-cpp
13364 Try to imitate the behavior of pre-standard C preprocessors, as
13365 opposed to ISO C preprocessors. See the GNU CPP manual for
13366 details.
13367
13368 Note that GCC does not otherwise attempt to emulate a pre-standard
13369 C compiler, and these options are only supported with the -E
13370 switch, or when invoking CPP explicitly.
13371
13372 -trigraphs
13373 Support ISO C trigraphs. These are three-character sequences, all
13374 starting with ??, that are defined by ISO C to stand for single
13375 characters. For example, ??/ stands for \, so '??/n' is a
13376 character constant for a newline.
13377
13378 The nine trigraphs and their replacements are
13379
13380 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
13381 Replacement: [ ] { } # \ ^ | ~
13382
13383 By default, GCC ignores trigraphs, but in standard-conforming modes
13384 it converts them. See the -std and -ansi options.
13385
13386 -remap
13387 Enable special code to work around file systems which only permit
13388 very short file names, such as MS-DOS.
13389
13390 -H Print the name of each header file used, in addition to other
13391 normal activities. Each name is indented to show how deep in the
13392 #include stack it is. Precompiled header files are also printed,
13393 even if they are found to be invalid; an invalid precompiled header
13394 file is printed with ...x and a valid one with ...! .
13395
13396 -dletters
13397 Says to make debugging dumps during compilation as specified by
13398 letters. The flags documented here are those relevant to the
13399 preprocessor. Other letters are interpreted by the compiler
13400 proper, or reserved for future versions of GCC, and so are silently
13401 ignored. If you specify letters whose behavior conflicts, the
13402 result is undefined.
13403
13404 -dM Instead of the normal output, generate a list of #define
13405 directives for all the macros defined during the execution of
13406 the preprocessor, including predefined macros. This gives you
13407 a way of finding out what is predefined in your version of the
13408 preprocessor. Assuming you have no file foo.h, the command
13409
13410 touch foo.h; cpp -dM foo.h
13411
13412 shows all the predefined macros.
13413
13414 If you use -dM without the -E option, -dM is interpreted as a
13415 synonym for -fdump-rtl-mach.
13416
13417 -dD Like -dM except in two respects: it does not include the
13418 predefined macros, and it outputs both the #define directives
13419 and the result of preprocessing. Both kinds of output go to
13420 the standard output file.
13421
13422 -dN Like -dD, but emit only the macro names, not their expansions.
13423
13424 -dI Output #include directives in addition to the result of
13425 preprocessing.
13426
13427 -dU Like -dD except that only macros that are expanded, or whose
13428 definedness is tested in preprocessor directives, are output;
13429 the output is delayed until the use or test of the macro; and
13430 #undef directives are also output for macros tested but
13431 undefined at the time.
13432
13433 -fdebug-cpp
13434 This option is only useful for debugging GCC. When used from CPP
13435 or with -E, it dumps debugging information about location maps.
13436 Every token in the output is preceded by the dump of the map its
13437 location belongs to.
13438
13439 When used from GCC without -E, this option has no effect.
13440
13441 -Wp,option
13442 You can use -Wp,option to bypass the compiler driver and pass
13443 option directly through to the preprocessor. If option contains
13444 commas, it is split into multiple options at the commas. However,
13445 many options are modified, translated or interpreted by the
13446 compiler driver before being passed to the preprocessor, and -Wp
13447 forcibly bypasses this phase. The preprocessor's direct interface
13448 is undocumented and subject to change, so whenever possible you
13449 should avoid using -Wp and let the driver handle the options
13450 instead.
13451
13452 -Xpreprocessor option
13453 Pass option as an option to the preprocessor. You can use this to
13454 supply system-specific preprocessor options that GCC does not
13455 recognize.
13456
13457 If you want to pass an option that takes an argument, you must use
13458 -Xpreprocessor twice, once for the option and once for the
13459 argument.
13460
13461 -no-integrated-cpp
13462 Perform preprocessing as a separate pass before compilation. By
13463 default, GCC performs preprocessing as an integrated part of input
13464 tokenization and parsing. If this option is provided, the
13465 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
13466 and Objective-C, respectively) is instead invoked twice, once for
13467 preprocessing only and once for actual compilation of the
13468 preprocessed input. This option may be useful in conjunction with
13469 the -B or -wrapper options to specify an alternate preprocessor or
13470 perform additional processing of the program source between normal
13471 preprocessing and compilation.
13472
13473 -flarge-source-files
13474 Adjust GCC to expect large source files, at the expense of slower
13475 compilation and higher memory usage.
13476
13477 Specifically, GCC normally tracks both column numbers and line
13478 numbers within source files and it normally prints both of these
13479 numbers in diagnostics. However, once it has processed a certain
13480 number of source lines, it stops tracking column numbers and only
13481 tracks line numbers. This means that diagnostics for later lines
13482 do not include column numbers. It also means that options like
13483 -Wmisleading-indentation cease to work at that point, although the
13484 compiler prints a note if this happens. Passing
13485 -flarge-source-files significantly increases the number of source
13486 lines that GCC can process before it stops tracking columns.
13487
13488 Passing Options to the Assembler
13489 You can pass options to the assembler.
13490
13491 -Wa,option
13492 Pass option as an option to the assembler. If option contains
13493 commas, it is split into multiple options at the commas.
13494
13495 -Xassembler option
13496 Pass option as an option to the assembler. You can use this to
13497 supply system-specific assembler options that GCC does not
13498 recognize.
13499
13500 If you want to pass an option that takes an argument, you must use
13501 -Xassembler twice, once for the option and once for the argument.
13502
13503 Options for Linking
13504 These options come into play when the compiler links object files into
13505 an executable output file. They are meaningless if the compiler is not
13506 doing a link step.
13507
13508 object-file-name
13509 A file name that does not end in a special recognized suffix is
13510 considered to name an object file or library. (Object files are
13511 distinguished from libraries by the linker according to the file
13512 contents.) If linking is done, these object files are used as
13513 input to the linker.
13514
13515 -c
13516 -S
13517 -E If any of these options is used, then the linker is not run, and
13518 object file names should not be used as arguments.
13519
13520 -flinker-output=type
13521 This option controls code generation of the link-time optimizer.
13522 By default the linker output is automatically determined by the
13523 linker plugin. For debugging the compiler and if incremental
13524 linking with a non-LTO object file is desired, it may be useful to
13525 control the type manually.
13526
13527 If type is exec, code generation produces a static binary. In this
13528 case -fpic and -fpie are both disabled.
13529
13530 If type is dyn, code generation produces a shared library. In this
13531 case -fpic or -fPIC is preserved, but not enabled automatically.
13532 This allows to build shared libraries without position-independent
13533 code on architectures where this is possible, i.e. on x86.
13534
13535 If type is pie, code generation produces an -fpie executable. This
13536 results in similar optimizations as exec except that -fpie is not
13537 disabled if specified at compilation time.
13538
13539 If type is rel, the compiler assumes that incremental linking is
13540 done. The sections containing intermediate code for link-time
13541 optimization are merged, pre-optimized, and output to the resulting
13542 object file. In addition, if -ffat-lto-objects is specified, binary
13543 code is produced for future non-LTO linking. The object file
13544 produced by incremental linking is smaller than a static library
13545 produced from the same object files. At link time the result of
13546 incremental linking also loads faster than a static library
13547 assuming that the majority of objects in the library are used.
13548
13549 Finally nolto-rel configures the compiler for incremental linking
13550 where code generation is forced, a final binary is produced, and
13551 the intermediate code for later link-time optimization is stripped.
13552 When multiple object files are linked together the resulting code
13553 is better optimized than with link-time optimizations disabled (for
13554 example, cross-module inlining happens), but most of benefits of
13555 whole program optimizations are lost.
13556
13557 During the incremental link (by -r) the linker plugin defaults to
13558 rel. With current interfaces to GNU Binutils it is however not
13559 possible to incrementally link LTO objects and non-LTO objects into
13560 a single mixed object file. If any of object files in incremental
13561 link cannot be used for link-time optimization, the linker plugin
13562 issues a warning and uses nolto-rel. To maintain whole program
13563 optimization, it is recommended to link such objects into static
13564 library instead. Alternatively it is possible to use H.J. Lu's
13565 binutils with support for mixed objects.
13566
13567 -fuse-ld=bfd
13568 Use the bfd linker instead of the default linker.
13569
13570 -fuse-ld=gold
13571 Use the gold linker instead of the default linker.
13572
13573 -fuse-ld=lld
13574 Use the LLVM lld linker instead of the default linker.
13575
13576 -llibrary
13577 -l library
13578 Search the library named library when linking. (The second
13579 alternative with the library as a separate argument is only for
13580 POSIX compliance and is not recommended.)
13581
13582 The -l option is passed directly to the linker by GCC. Refer to
13583 your linker documentation for exact details. The general
13584 description below applies to the GNU linker.
13585
13586 The linker searches a standard list of directories for the library.
13587 The directories searched include several standard system
13588 directories plus any that you specify with -L.
13589
13590 Static libraries are archives of object files, and have file names
13591 like liblibrary.a. Some targets also support shared libraries,
13592 which typically have names like liblibrary.so. If both static and
13593 shared libraries are found, the linker gives preference to linking
13594 with the shared library unless the -static option is used.
13595
13596 It makes a difference where in the command you write this option;
13597 the linker searches and processes libraries and object files in the
13598 order they are specified. Thus, foo.o -lz bar.o searches library z
13599 after file foo.o but before bar.o. If bar.o refers to functions in
13600 z, those functions may not be loaded.
13601
13602 -lobjc
13603 You need this special case of the -l option in order to link an
13604 Objective-C or Objective-C++ program.
13605
13606 -nostartfiles
13607 Do not use the standard system startup files when linking. The
13608 standard system libraries are used normally, unless -nostdlib,
13609 -nolibc, or -nodefaultlibs is used.
13610
13611 -nodefaultlibs
13612 Do not use the standard system libraries when linking. Only the
13613 libraries you specify are passed to the linker, and options
13614 specifying linkage of the system libraries, such as -static-libgcc
13615 or -shared-libgcc, are ignored. The standard startup files are
13616 used normally, unless -nostartfiles is used.
13617
13618 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13619 "memmove". These entries are usually resolved by entries in libc.
13620 These entry points should be supplied through some other mechanism
13621 when this option is specified.
13622
13623 -nolibc
13624 Do not use the C library or system libraries tightly coupled with
13625 it when linking. Still link with the startup files, libgcc or
13626 toolchain provided language support libraries such as libgnat,
13627 libgfortran or libstdc++ unless options preventing their inclusion
13628 are used as well. This typically removes -lc from the link command
13629 line, as well as system libraries that normally go with it and
13630 become meaningless when absence of a C library is assumed, for
13631 example -lpthread or -lm in some configurations. This is intended
13632 for bare-board targets when there is indeed no C library available.
13633
13634 -nostdlib
13635 Do not use the standard system startup files or libraries when
13636 linking. No startup files and only the libraries you specify are
13637 passed to the linker, and options specifying linkage of the system
13638 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
13639
13640 The compiler may generate calls to "memcmp", "memset", "memcpy" and
13641 "memmove". These entries are usually resolved by entries in libc.
13642 These entry points should be supplied through some other mechanism
13643 when this option is specified.
13644
13645 One of the standard libraries bypassed by -nostdlib and
13646 -nodefaultlibs is libgcc.a, a library of internal subroutines which
13647 GCC uses to overcome shortcomings of particular machines, or
13648 special needs for some languages.
13649
13650 In most cases, you need libgcc.a even when you want to avoid other
13651 standard libraries. In other words, when you specify -nostdlib or
13652 -nodefaultlibs you should usually specify -lgcc as well. This
13653 ensures that you have no unresolved references to internal GCC
13654 library subroutines. (An example of such an internal subroutine is
13655 "__main", used to ensure C++ constructors are called.)
13656
13657 -e entry
13658 --entry=entry
13659 Specify that the program entry point is entry. The argument is
13660 interpreted by the linker; the GNU linker accepts either a symbol
13661 name or an address.
13662
13663 -pie
13664 Produce a dynamically linked position independent executable on
13665 targets that support it. For predictable results, you must also
13666 specify the same set of options used for compilation (-fpie, -fPIE,
13667 or model suboptions) when you specify this linker option.
13668
13669 -no-pie
13670 Don't produce a dynamically linked position independent executable.
13671
13672 -static-pie
13673 Produce a static position independent executable on targets that
13674 support it. A static position independent executable is similar to
13675 a static executable, but can be loaded at any address without a
13676 dynamic linker. For predictable results, you must also specify the
13677 same set of options used for compilation (-fpie, -fPIE, or model
13678 suboptions) when you specify this linker option.
13679
13680 -pthread
13681 Link with the POSIX threads library. This option is supported on
13682 GNU/Linux targets, most other Unix derivatives, and also on x86
13683 Cygwin and MinGW targets. On some targets this option also sets
13684 flags for the preprocessor, so it should be used consistently for
13685 both compilation and linking.
13686
13687 -r Produce a relocatable object as output. This is also known as
13688 partial linking.
13689
13690 -rdynamic
13691 Pass the flag -export-dynamic to the ELF linker, on targets that
13692 support it. This instructs the linker to add all symbols, not only
13693 used ones, to the dynamic symbol table. This option is needed for
13694 some uses of "dlopen" or to allow obtaining backtraces from within
13695 a program.
13696
13697 -s Remove all symbol table and relocation information from the
13698 executable.
13699
13700 -static
13701 On systems that support dynamic linking, this overrides -pie and
13702 prevents linking with the shared libraries. On other systems, this
13703 option has no effect.
13704
13705 -shared
13706 Produce a shared object which can then be linked with other objects
13707 to form an executable. Not all systems support this option. For
13708 predictable results, you must also specify the same set of options
13709 used for compilation (-fpic, -fPIC, or model suboptions) when you
13710 specify this linker option.[1]
13711
13712 -shared-libgcc
13713 -static-libgcc
13714 On systems that provide libgcc as a shared library, these options
13715 force the use of either the shared or static version, respectively.
13716 If no shared version of libgcc was built when the compiler was
13717 configured, these options have no effect.
13718
13719 There are several situations in which an application should use the
13720 shared libgcc instead of the static version. The most common of
13721 these is when the application wishes to throw and catch exceptions
13722 across different shared libraries. In that case, each of the
13723 libraries as well as the application itself should use the shared
13724 libgcc.
13725
13726 Therefore, the G++ driver automatically adds -shared-libgcc
13727 whenever you build a shared library or a main executable, because
13728 C++ programs typically use exceptions, so this is the right thing
13729 to do.
13730
13731 If, instead, you use the GCC driver to create shared libraries, you
13732 may find that they are not always linked with the shared libgcc.
13733 If GCC finds, at its configuration time, that you have a non-GNU
13734 linker or a GNU linker that does not support option --eh-frame-hdr,
13735 it links the shared version of libgcc into shared libraries by
13736 default. Otherwise, it takes advantage of the linker and optimizes
13737 away the linking with the shared version of libgcc, linking with
13738 the static version of libgcc by default. This allows exceptions to
13739 propagate through such shared libraries, without incurring
13740 relocation costs at library load time.
13741
13742 However, if a library or main executable is supposed to throw or
13743 catch exceptions, you must link it using the G++ driver, or using
13744 the option -shared-libgcc, such that it is linked with the shared
13745 libgcc.
13746
13747 -static-libasan
13748 When the -fsanitize=address option is used to link a program, the
13749 GCC driver automatically links against libasan. If libasan is
13750 available as a shared library, and the -static option is not used,
13751 then this links against the shared version of libasan. The
13752 -static-libasan option directs the GCC driver to link libasan
13753 statically, without necessarily linking other libraries statically.
13754
13755 -static-libtsan
13756 When the -fsanitize=thread option is used to link a program, the
13757 GCC driver automatically links against libtsan. If libtsan is
13758 available as a shared library, and the -static option is not used,
13759 then this links against the shared version of libtsan. The
13760 -static-libtsan option directs the GCC driver to link libtsan
13761 statically, without necessarily linking other libraries statically.
13762
13763 -static-liblsan
13764 When the -fsanitize=leak option is used to link a program, the GCC
13765 driver automatically links against liblsan. If liblsan is
13766 available as a shared library, and the -static option is not used,
13767 then this links against the shared version of liblsan. The
13768 -static-liblsan option directs the GCC driver to link liblsan
13769 statically, without necessarily linking other libraries statically.
13770
13771 -static-libubsan
13772 When the -fsanitize=undefined option is used to link a program, the
13773 GCC driver automatically links against libubsan. If libubsan is
13774 available as a shared library, and the -static option is not used,
13775 then this links against the shared version of libubsan. The
13776 -static-libubsan option directs the GCC driver to link libubsan
13777 statically, without necessarily linking other libraries statically.
13778
13779 -static-libstdc++
13780 When the g++ program is used to link a C++ program, it normally
13781 automatically links against libstdc++. If libstdc++ is available
13782 as a shared library, and the -static option is not used, then this
13783 links against the shared version of libstdc++. That is normally
13784 fine. However, it is sometimes useful to freeze the version of
13785 libstdc++ used by the program without going all the way to a fully
13786 static link. The -static-libstdc++ option directs the g++ driver
13787 to link libstdc++ statically, without necessarily linking other
13788 libraries statically.
13789
13790 -symbolic
13791 Bind references to global symbols when building a shared object.
13792 Warn about any unresolved references (unless overridden by the link
13793 editor option -Xlinker -z -Xlinker defs). Only a few systems
13794 support this option.
13795
13796 -T script
13797 Use script as the linker script. This option is supported by most
13798 systems using the GNU linker. On some targets, such as bare-board
13799 targets without an operating system, the -T option may be required
13800 when linking to avoid references to undefined symbols.
13801
13802 -Xlinker option
13803 Pass option as an option to the linker. You can use this to supply
13804 system-specific linker options that GCC does not recognize.
13805
13806 If you want to pass an option that takes a separate argument, you
13807 must use -Xlinker twice, once for the option and once for the
13808 argument. For example, to pass -assert definitions, you must write
13809 -Xlinker -assert -Xlinker definitions. It does not work to write
13810 -Xlinker "-assert definitions", because this passes the entire
13811 string as a single argument, which is not what the linker expects.
13812
13813 When using the GNU linker, it is usually more convenient to pass
13814 arguments to linker options using the option=value syntax than as
13815 separate arguments. For example, you can specify -Xlinker
13816 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
13817 Other linkers may not support this syntax for command-line options.
13818
13819 -Wl,option
13820 Pass option as an option to the linker. If option contains commas,
13821 it is split into multiple options at the commas. You can use this
13822 syntax to pass an argument to the option. For example,
13823 -Wl,-Map,output.map passes -Map output.map to the linker. When
13824 using the GNU linker, you can also get the same effect with
13825 -Wl,-Map=output.map.
13826
13827 -u symbol
13828 Pretend the symbol symbol is undefined, to force linking of library
13829 modules to define it. You can use -u multiple times with different
13830 symbols to force loading of additional library modules.
13831
13832 -z keyword
13833 -z is passed directly on to the linker along with the keyword
13834 keyword. See the section in the documentation of your linker for
13835 permitted values and their meanings.
13836
13837 Options for Directory Search
13838 These options specify directories to search for header files, for
13839 libraries and for parts of the compiler:
13840
13841 -I dir
13842 -iquote dir
13843 -isystem dir
13844 -idirafter dir
13845 Add the directory dir to the list of directories to be searched for
13846 header files during preprocessing. If dir begins with = or
13847 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
13848 see --sysroot and -isysroot.
13849
13850 Directories specified with -iquote apply only to the quote form of
13851 the directive, "#include "file"". Directories specified with -I,
13852 -isystem, or -idirafter apply to lookup for both the
13853 "#include "file"" and "#include <file>" directives.
13854
13855 You can specify any number or combination of these options on the
13856 command line to search for header files in several directories.
13857 The lookup order is as follows:
13858
13859 1. For the quote form of the include directive, the directory of
13860 the current file is searched first.
13861
13862 2. For the quote form of the include directive, the directories
13863 specified by -iquote options are searched in left-to-right
13864 order, as they appear on the command line.
13865
13866 3. Directories specified with -I options are scanned in left-to-
13867 right order.
13868
13869 4. Directories specified with -isystem options are scanned in
13870 left-to-right order.
13871
13872 5. Standard system directories are scanned.
13873
13874 6. Directories specified with -idirafter options are scanned in
13875 left-to-right order.
13876
13877 You can use -I to override a system header file, substituting your
13878 own version, since these directories are searched before the
13879 standard system header file directories. However, you should not
13880 use this option to add directories that contain vendor-supplied
13881 system header files; use -isystem for that.
13882
13883 The -isystem and -idirafter options also mark the directory as a
13884 system directory, so that it gets the same special treatment that
13885 is applied to the standard system directories.
13886
13887 If a standard system include directory, or a directory specified
13888 with -isystem, is also specified with -I, the -I option is ignored.
13889 The directory is still searched but as a system directory at its
13890 normal position in the system include chain. This is to ensure
13891 that GCC's procedure to fix buggy system headers and the ordering
13892 for the "#include_next" directive are not inadvertently changed.
13893 If you really need to change the search order for system
13894 directories, use the -nostdinc and/or -isystem options.
13895
13896 -I- Split the include path. This option has been deprecated. Please
13897 use -iquote instead for -I directories before the -I- and remove
13898 the -I- option.
13899
13900 Any directories specified with -I options before -I- are searched
13901 only for headers requested with "#include "file""; they are not
13902 searched for "#include <file>". If additional directories are
13903 specified with -I options after the -I-, those directories are
13904 searched for all #include directives.
13905
13906 In addition, -I- inhibits the use of the directory of the current
13907 file directory as the first search directory for "#include "file"".
13908 There is no way to override this effect of -I-.
13909
13910 -iprefix prefix
13911 Specify prefix as the prefix for subsequent -iwithprefix options.
13912 If the prefix represents a directory, you should include the final
13913 /.
13914
13915 -iwithprefix dir
13916 -iwithprefixbefore dir
13917 Append dir to the prefix specified previously with -iprefix, and
13918 add the resulting directory to the include search path.
13919 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
13920 puts it where -idirafter would.
13921
13922 -isysroot dir
13923 This option is like the --sysroot option, but applies only to
13924 header files (except for Darwin targets, where it applies to both
13925 header files and libraries). See the --sysroot option for more
13926 information.
13927
13928 -imultilib dir
13929 Use dir as a subdirectory of the directory containing target-
13930 specific C++ headers.
13931
13932 -nostdinc
13933 Do not search the standard system directories for header files.
13934 Only the directories explicitly specified with -I, -iquote,
13935 -isystem, and/or -idirafter options (and the directory of the
13936 current file, if appropriate) are searched.
13937
13938 -nostdinc++
13939 Do not search for header files in the C++-specific standard
13940 directories, but do still search the other standard directories.
13941 (This option is used when building the C++ library.)
13942
13943 -iplugindir=dir
13944 Set the directory to search for plugins that are passed by
13945 -fplugin=name instead of -fplugin=path/name.so. This option is not
13946 meant to be used by the user, but only passed by the driver.
13947
13948 -Ldir
13949 Add directory dir to the list of directories to be searched for -l.
13950
13951 -Bprefix
13952 This option specifies where to find the executables, libraries,
13953 include files, and data files of the compiler itself.
13954
13955 The compiler driver program runs one or more of the subprograms
13956 cpp, cc1, as and ld. It tries prefix as a prefix for each program
13957 it tries to run, both with and without machine/version/ for the
13958 corresponding target machine and compiler version.
13959
13960 For each subprogram to be run, the compiler driver first tries the
13961 -B prefix, if any. If that name is not found, or if -B is not
13962 specified, the driver tries two standard prefixes, /usr/lib/gcc/
13963 and /usr/local/lib/gcc/. If neither of those results in a file
13964 name that is found, the unmodified program name is searched for
13965 using the directories specified in your PATH environment variable.
13966
13967 The compiler checks to see if the path provided by -B refers to a
13968 directory, and if necessary it adds a directory separator character
13969 at the end of the path.
13970
13971 -B prefixes that effectively specify directory names also apply to
13972 libraries in the linker, because the compiler translates these
13973 options into -L options for the linker. They also apply to include
13974 files in the preprocessor, because the compiler translates these
13975 options into -isystem options for the preprocessor. In this case,
13976 the compiler appends include to the prefix.
13977
13978 The runtime support file libgcc.a can also be searched for using
13979 the -B prefix, if needed. If it is not found there, the two
13980 standard prefixes above are tried, and that is all. The file is
13981 left out of the link if it is not found by those means.
13982
13983 Another way to specify a prefix much like the -B prefix is to use
13984 the environment variable GCC_EXEC_PREFIX.
13985
13986 As a special kludge, if the path provided by -B is [dir/]stageN/,
13987 where N is a number in the range 0 to 9, then it is replaced by
13988 [dir/]include. This is to help with boot-strapping the compiler.
13989
13990 -no-canonical-prefixes
13991 Do not expand any symbolic links, resolve references to /../ or
13992 /./, or make the path absolute when generating a relative prefix.
13993
13994 --sysroot=dir
13995 Use dir as the logical root directory for headers and libraries.
13996 For example, if the compiler normally searches for headers in
13997 /usr/include and libraries in /usr/lib, it instead searches
13998 dir/usr/include and dir/usr/lib.
13999
14000 If you use both this option and the -isysroot option, then the
14001 --sysroot option applies to libraries, but the -isysroot option
14002 applies to header files.
14003
14004 The GNU linker (beginning with version 2.16) has the necessary
14005 support for this option. If your linker does not support this
14006 option, the header file aspect of --sysroot still works, but the
14007 library aspect does not.
14008
14009 --no-sysroot-suffix
14010 For some targets, a suffix is added to the root directory specified
14011 with --sysroot, depending on the other options used, so that
14012 headers may for example be found in dir/suffix/usr/include instead
14013 of dir/usr/include. This option disables the addition of such a
14014 suffix.
14015
14016 Options for Code Generation Conventions
14017 These machine-independent options control the interface conventions
14018 used in code generation.
14019
14020 Most of them have both positive and negative forms; the negative form
14021 of -ffoo is -fno-foo. In the table below, only one of the forms is
14022 listed---the one that is not the default. You can figure out the other
14023 form by either removing no- or adding it.
14024
14025 -fstack-reuse=reuse-level
14026 This option controls stack space reuse for user declared local/auto
14027 variables and compiler generated temporaries. reuse_level can be
14028 all, named_vars, or none. all enables stack reuse for all local
14029 variables and temporaries, named_vars enables the reuse only for
14030 user defined local variables with names, and none disables stack
14031 reuse completely. The default value is all. The option is needed
14032 when the program extends the lifetime of a scoped local variable or
14033 a compiler generated temporary beyond the end point defined by the
14034 language. When a lifetime of a variable ends, and if the variable
14035 lives in memory, the optimizing compiler has the freedom to reuse
14036 its stack space with other temporaries or scoped local variables
14037 whose live range does not overlap with it. Legacy code extending
14038 local lifetime is likely to break with the stack reuse
14039 optimization.
14040
14041 For example,
14042
14043 int *p;
14044 {
14045 int local1;
14046
14047 p = &local1;
14048 local1 = 10;
14049 ....
14050 }
14051 {
14052 int local2;
14053 local2 = 20;
14054 ...
14055 }
14056
14057 if (*p == 10) // out of scope use of local1
14058 {
14059
14060 }
14061
14062 Another example:
14063
14064 struct A
14065 {
14066 A(int k) : i(k), j(k) { }
14067 int i;
14068 int j;
14069 };
14070
14071 A *ap;
14072
14073 void foo(const A& ar)
14074 {
14075 ap = &ar;
14076 }
14077
14078 void bar()
14079 {
14080 foo(A(10)); // temp object's lifetime ends when foo returns
14081
14082 {
14083 A a(20);
14084 ....
14085 }
14086 ap->i+= 10; // ap references out of scope temp whose space
14087 // is reused with a. What is the value of ap->i?
14088 }
14089
14090 The lifetime of a compiler generated temporary is well defined by
14091 the C++ standard. When a lifetime of a temporary ends, and if the
14092 temporary lives in memory, the optimizing compiler has the freedom
14093 to reuse its stack space with other temporaries or scoped local
14094 variables whose live range does not overlap with it. However some
14095 of the legacy code relies on the behavior of older compilers in
14096 which temporaries' stack space is not reused, the aggressive stack
14097 reuse can lead to runtime errors. This option is used to control
14098 the temporary stack reuse optimization.
14099
14100 -ftrapv
14101 This option generates traps for signed overflow on addition,
14102 subtraction, multiplication operations. The options -ftrapv and
14103 -fwrapv override each other, so using -ftrapv -fwrapv on the
14104 command-line results in -fwrapv being effective. Note that only
14105 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14106 command-line results in -ftrapv being effective.
14107
14108 -fwrapv
14109 This option instructs the compiler to assume that signed arithmetic
14110 overflow of addition, subtraction and multiplication wraps around
14111 using twos-complement representation. This flag enables some
14112 optimizations and disables others. The options -ftrapv and -fwrapv
14113 override each other, so using -ftrapv -fwrapv on the command-line
14114 results in -fwrapv being effective. Note that only active options
14115 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14116 results in -ftrapv being effective.
14117
14118 -fwrapv-pointer
14119 This option instructs the compiler to assume that pointer
14120 arithmetic overflow on addition and subtraction wraps around using
14121 twos-complement representation. This flag disables some
14122 optimizations which assume pointer overflow is invalid.
14123
14124 -fstrict-overflow
14125 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14126 implies -fwrapv -fwrapv-pointer.
14127
14128 -fexceptions
14129 Enable exception handling. Generates extra code needed to
14130 propagate exceptions. For some targets, this implies GCC generates
14131 frame unwind information for all functions, which can produce
14132 significant data size overhead, although it does not affect
14133 execution. If you do not specify this option, GCC enables it by
14134 default for languages like C++ that normally require exception
14135 handling, and disables it for languages like C that do not normally
14136 require it. However, you may need to enable this option when
14137 compiling C code that needs to interoperate properly with exception
14138 handlers written in C++. You may also wish to disable this option
14139 if you are compiling older C++ programs that don't use exception
14140 handling.
14141
14142 -fnon-call-exceptions
14143 Generate code that allows trapping instructions to throw
14144 exceptions. Note that this requires platform-specific runtime
14145 support that does not exist everywhere. Moreover, it only allows
14146 trapping instructions to throw exceptions, i.e. memory references
14147 or floating-point instructions. It does not allow exceptions to be
14148 thrown from arbitrary signal handlers such as "SIGALRM".
14149
14150 -fdelete-dead-exceptions
14151 Consider that instructions that may throw exceptions but don't
14152 otherwise contribute to the execution of the program can be
14153 optimized away. This option is enabled by default for the Ada
14154 compiler, as permitted by the Ada language specification.
14155 Optimization passes that cause dead exceptions to be removed are
14156 enabled independently at different optimization levels.
14157
14158 -funwind-tables
14159 Similar to -fexceptions, except that it just generates any needed
14160 static data, but does not affect the generated code in any other
14161 way. You normally do not need to enable this option; instead, a
14162 language processor that needs this handling enables it on your
14163 behalf.
14164
14165 -fasynchronous-unwind-tables
14166 Generate unwind table in DWARF format, if supported by target
14167 machine. The table is exact at each instruction boundary, so it
14168 can be used for stack unwinding from asynchronous events (such as
14169 debugger or garbage collector).
14170
14171 -fno-gnu-unique
14172 On systems with recent GNU assembler and C library, the C++
14173 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
14174 definitions of template static data members and static local
14175 variables in inline functions are unique even in the presence of
14176 "RTLD_LOCAL"; this is necessary to avoid problems with a library
14177 used by two different "RTLD_LOCAL" plugins depending on a
14178 definition in one of them and therefore disagreeing with the other
14179 one about the binding of the symbol. But this causes "dlclose" to
14180 be ignored for affected DSOs; if your program relies on
14181 reinitialization of a DSO via "dlclose" and "dlopen", you can use
14182 -fno-gnu-unique.
14183
14184 -fpcc-struct-return
14185 Return "short" "struct" and "union" values in memory like longer
14186 ones, rather than in registers. This convention is less efficient,
14187 but it has the advantage of allowing intercallability between GCC-
14188 compiled files and files compiled with other compilers,
14189 particularly the Portable C Compiler (pcc).
14190
14191 The precise convention for returning structures in memory depends
14192 on the target configuration macros.
14193
14194 Short structures and unions are those whose size and alignment
14195 match that of some integer type.
14196
14197 Warning: code compiled with the -fpcc-struct-return switch is not
14198 binary compatible with code compiled with the -freg-struct-return
14199 switch. Use it to conform to a non-default application binary
14200 interface.
14201
14202 -freg-struct-return
14203 Return "struct" and "union" values in registers when possible.
14204 This is more efficient for small structures than
14205 -fpcc-struct-return.
14206
14207 If you specify neither -fpcc-struct-return nor -freg-struct-return,
14208 GCC defaults to whichever convention is standard for the target.
14209 If there is no standard convention, GCC defaults to
14210 -fpcc-struct-return, except on targets where GCC is the principal
14211 compiler. In those cases, we can choose the standard, and we chose
14212 the more efficient register return alternative.
14213
14214 Warning: code compiled with the -freg-struct-return switch is not
14215 binary compatible with code compiled with the -fpcc-struct-return
14216 switch. Use it to conform to a non-default application binary
14217 interface.
14218
14219 -fshort-enums
14220 Allocate to an "enum" type only as many bytes as it needs for the
14221 declared range of possible values. Specifically, the "enum" type
14222 is equivalent to the smallest integer type that has enough room.
14223
14224 Warning: the -fshort-enums switch causes GCC to generate code that
14225 is not binary compatible with code generated without that switch.
14226 Use it to conform to a non-default application binary interface.
14227
14228 -fshort-wchar
14229 Override the underlying type for "wchar_t" to be "short unsigned
14230 int" instead of the default for the target. This option is useful
14231 for building programs to run under WINE.
14232
14233 Warning: the -fshort-wchar switch causes GCC to generate code that
14234 is not binary compatible with code generated without that switch.
14235 Use it to conform to a non-default application binary interface.
14236
14237 -fcommon
14238 In C code, this option controls the placement of global variables
14239 defined without an initializer, known as tentative definitions in
14240 the C standard. Tentative definitions are distinct from
14241 declarations of a variable with the "extern" keyword, which do not
14242 allocate storage.
14243
14244 The default is -fno-common, which specifies that the compiler
14245 places uninitialized global variables in the BSS section of the
14246 object file. This inhibits the merging of tentative definitions by
14247 the linker so you get a multiple-definition error if the same
14248 variable is accidentally defined in more than one compilation unit.
14249
14250 The -fcommon places uninitialized global variables in a common
14251 block. This allows the linker to resolve all tentative definitions
14252 of the same variable in different compilation units to the same
14253 object, or to a non-tentative definition. This behavior is
14254 inconsistent with C++, and on many targets implies a speed and code
14255 size penalty on global variable references. It is mainly useful to
14256 enable legacy code to link without errors.
14257
14258 -fno-ident
14259 Ignore the "#ident" directive.
14260
14261 -finhibit-size-directive
14262 Don't output a ".size" assembler directive, or anything else that
14263 would cause trouble if the function is split in the middle, and the
14264 two halves are placed at locations far apart in memory. This
14265 option is used when compiling crtstuff.c; you should not need to
14266 use it for anything else.
14267
14268 -fverbose-asm
14269 Put extra commentary information in the generated assembly code to
14270 make it more readable. This option is generally only of use to
14271 those who actually need to read the generated assembly code
14272 (perhaps while debugging the compiler itself).
14273
14274 -fno-verbose-asm, the default, causes the extra information to be
14275 omitted and is useful when comparing two assembler files.
14276
14277 The added comments include:
14278
14279 * information on the compiler version and command-line options,
14280
14281 * the source code lines associated with the assembly
14282 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14283
14284 * hints on which high-level expressions correspond to the various
14285 assembly instruction operands.
14286
14287 For example, given this C source file:
14288
14289 int test (int n)
14290 {
14291 int i;
14292 int total = 0;
14293
14294 for (i = 0; i < n; i++)
14295 total += i * i;
14296
14297 return total;
14298 }
14299
14300 compiling to (x86_64) assembly via -S and emitting the result
14301 direct to stdout via -o -
14302
14303 gcc -S test.c -fverbose-asm -Os -o -
14304
14305 gives output similar to this:
14306
14307 .file "test.c"
14308 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14309 [...snip...]
14310 # options passed:
14311 [...snip...]
14312
14313 .text
14314 .globl test
14315 .type test, @function
14316 test:
14317 .LFB0:
14318 .cfi_startproc
14319 # test.c:4: int total = 0;
14320 xorl %eax, %eax # <retval>
14321 # test.c:6: for (i = 0; i < n; i++)
14322 xorl %edx, %edx # i
14323 .L2:
14324 # test.c:6: for (i = 0; i < n; i++)
14325 cmpl %edi, %edx # n, i
14326 jge .L5 #,
14327 # test.c:7: total += i * i;
14328 movl %edx, %ecx # i, tmp92
14329 imull %edx, %ecx # i, tmp92
14330 # test.c:6: for (i = 0; i < n; i++)
14331 incl %edx # i
14332 # test.c:7: total += i * i;
14333 addl %ecx, %eax # tmp92, <retval>
14334 jmp .L2 #
14335 .L5:
14336 # test.c:10: }
14337 ret
14338 .cfi_endproc
14339 .LFE0:
14340 .size test, .-test
14341 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14342 .section .note.GNU-stack,"",@progbits
14343
14344 The comments are intended for humans rather than machines and hence
14345 the precise format of the comments is subject to change.
14346
14347 -frecord-gcc-switches
14348 This switch causes the command line used to invoke the compiler to
14349 be recorded into the object file that is being created. This
14350 switch is only implemented on some targets and the exact format of
14351 the recording is target and binary file format dependent, but it
14352 usually takes the form of a section containing ASCII text. This
14353 switch is related to the -fverbose-asm switch, but that switch only
14354 records information in the assembler output file as comments, so it
14355 never reaches the object file. See also -grecord-gcc-switches for
14356 another way of storing compiler options into the object file.
14357
14358 -fpic
14359 Generate position-independent code (PIC) suitable for use in a
14360 shared library, if supported for the target machine. Such code
14361 accesses all constant addresses through a global offset table
14362 (GOT). The dynamic loader resolves the GOT entries when the
14363 program starts (the dynamic loader is not part of GCC; it is part
14364 of the operating system). If the GOT size for the linked
14365 executable exceeds a machine-specific maximum size, you get an
14366 error message from the linker indicating that -fpic does not work;
14367 in that case, recompile with -fPIC instead. (These maximums are 8k
14368 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
14369 x86 has no such limit.)
14370
14371 Position-independent code requires special support, and therefore
14372 works only on certain machines. For the x86, GCC supports PIC for
14373 System V but not for the Sun 386i. Code generated for the IBM
14374 RS/6000 is always position-independent.
14375
14376 When this flag is set, the macros "__pic__" and "__PIC__" are
14377 defined to 1.
14378
14379 -fPIC
14380 If supported for the target machine, emit position-independent
14381 code, suitable for dynamic linking and avoiding any limit on the
14382 size of the global offset table. This option makes a difference on
14383 AArch64, m68k, PowerPC and SPARC.
14384
14385 Position-independent code requires special support, and therefore
14386 works only on certain machines.
14387
14388 When this flag is set, the macros "__pic__" and "__PIC__" are
14389 defined to 2.
14390
14391 -fpie
14392 -fPIE
14393 These options are similar to -fpic and -fPIC, but the generated
14394 position-independent code can be only linked into executables.
14395 Usually these options are used to compile code that will be linked
14396 using the -pie GCC option.
14397
14398 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
14399 The macros have the value 1 for -fpie and 2 for -fPIE.
14400
14401 -fno-plt
14402 Do not use the PLT for external function calls in position-
14403 independent code. Instead, load the callee address at call sites
14404 from the GOT and branch to it. This leads to more efficient code
14405 by eliminating PLT stubs and exposing GOT loads to optimizations.
14406 On architectures such as 32-bit x86 where PLT stubs expect the GOT
14407 pointer in a specific register, this gives more register allocation
14408 freedom to the compiler. Lazy binding requires use of the PLT;
14409 with -fno-plt all external symbols are resolved at load time.
14410
14411 Alternatively, the function attribute "noplt" can be used to avoid
14412 calls through the PLT for specific external functions.
14413
14414 In position-dependent code, a few targets also convert calls to
14415 functions that are marked to not use the PLT to use the GOT
14416 instead.
14417
14418 -fno-jump-tables
14419 Do not use jump tables for switch statements even where it would be
14420 more efficient than other code generation strategies. This option
14421 is of use in conjunction with -fpic or -fPIC for building code that
14422 forms part of a dynamic linker and cannot reference the address of
14423 a jump table. On some targets, jump tables do not require a GOT
14424 and this option is not needed.
14425
14426 -fno-bit-tests
14427 Do not use bit tests for switch statements even where it would be
14428 more efficient than other code generation strategies.
14429
14430 -ffixed-reg
14431 Treat the register named reg as a fixed register; generated code
14432 should never refer to it (except perhaps as a stack pointer, frame
14433 pointer or in some other fixed role).
14434
14435 reg must be the name of a register. The register names accepted
14436 are machine-specific and are defined in the "REGISTER_NAMES" macro
14437 in the machine description macro file.
14438
14439 This flag does not have a negative form, because it specifies a
14440 three-way choice.
14441
14442 -fcall-used-reg
14443 Treat the register named reg as an allocable register that is
14444 clobbered by function calls. It may be allocated for temporaries
14445 or variables that do not live across a call. Functions compiled
14446 this way do not save and restore the register reg.
14447
14448 It is an error to use this flag with the frame pointer or stack
14449 pointer. Use of this flag for other registers that have fixed
14450 pervasive roles in the machine's execution model produces
14451 disastrous results.
14452
14453 This flag does not have a negative form, because it specifies a
14454 three-way choice.
14455
14456 -fcall-saved-reg
14457 Treat the register named reg as an allocable register saved by
14458 functions. It may be allocated even for temporaries or variables
14459 that live across a call. Functions compiled this way save and
14460 restore the register reg if they use it.
14461
14462 It is an error to use this flag with the frame pointer or stack
14463 pointer. Use of this flag for other registers that have fixed
14464 pervasive roles in the machine's execution model produces
14465 disastrous results.
14466
14467 A different sort of disaster results from the use of this flag for
14468 a register in which function values may be returned.
14469
14470 This flag does not have a negative form, because it specifies a
14471 three-way choice.
14472
14473 -fpack-struct[=n]
14474 Without a value specified, pack all structure members together
14475 without holes. When a value is specified (which must be a small
14476 power of two), pack structure members according to this value,
14477 representing the maximum alignment (that is, objects with default
14478 alignment requirements larger than this are output potentially
14479 unaligned at the next fitting location.
14480
14481 Warning: the -fpack-struct switch causes GCC to generate code that
14482 is not binary compatible with code generated without that switch.
14483 Additionally, it makes the code suboptimal. Use it to conform to a
14484 non-default application binary interface.
14485
14486 -fleading-underscore
14487 This option and its counterpart, -fno-leading-underscore, forcibly
14488 change the way C symbols are represented in the object file. One
14489 use is to help link with legacy assembly code.
14490
14491 Warning: the -fleading-underscore switch causes GCC to generate
14492 code that is not binary compatible with code generated without that
14493 switch. Use it to conform to a non-default application binary
14494 interface. Not all targets provide complete support for this
14495 switch.
14496
14497 -ftls-model=model
14498 Alter the thread-local storage model to be used. The model
14499 argument should be one of global-dynamic, local-dynamic, initial-
14500 exec or local-exec. Note that the choice is subject to
14501 optimization: the compiler may use a more efficient model for
14502 symbols not visible outside of the translation unit, or if -fpic is
14503 not given on the command line.
14504
14505 The default without -fpic is initial-exec; with -fpic the default
14506 is global-dynamic.
14507
14508 -ftrampolines
14509 For targets that normally need trampolines for nested functions,
14510 always generate them instead of using descriptors. Otherwise, for
14511 targets that do not need them, like for example HP-PA or IA-64, do
14512 nothing.
14513
14514 A trampoline is a small piece of code that is created at run time
14515 on the stack when the address of a nested function is taken, and is
14516 used to call the nested function indirectly. Therefore, it
14517 requires the stack to be made executable in order for the program
14518 to work properly.
14519
14520 -fno-trampolines is enabled by default on a language by language
14521 basis to let the compiler avoid generating them, if it computes
14522 that this is safe, and replace them with descriptors. Descriptors
14523 are made up of data only, but the generated code must be prepared
14524 to deal with them. As of this writing, -fno-trampolines is enabled
14525 by default only for Ada.
14526
14527 Moreover, code compiled with -ftrampolines and code compiled with
14528 -fno-trampolines are not binary compatible if nested functions are
14529 present. This option must therefore be used on a program-wide
14530 basis and be manipulated with extreme care.
14531
14532 -fvisibility=[default|internal|hidden|protected]
14533 Set the default ELF image symbol visibility to the specified
14534 option---all symbols are marked with this unless overridden within
14535 the code. Using this feature can very substantially improve
14536 linking and load times of shared object libraries, produce more
14537 optimized code, provide near-perfect API export and prevent symbol
14538 clashes. It is strongly recommended that you use this in any
14539 shared objects you distribute.
14540
14541 Despite the nomenclature, default always means public; i.e.,
14542 available to be linked against from outside the shared object.
14543 protected and internal are pretty useless in real-world usage so
14544 the only other commonly used option is hidden. The default if
14545 -fvisibility isn't specified is default, i.e., make every symbol
14546 public.
14547
14548 A good explanation of the benefits offered by ensuring ELF symbols
14549 have the correct visibility is given by "How To Write Shared
14550 Libraries" by Ulrich Drepper (which can be found at
14551 <https://www.akkadia.org/drepper/>)---however a superior solution
14552 made possible by this option to marking things hidden when the
14553 default is public is to make the default hidden and mark things
14554 public. This is the norm with DLLs on Windows and with
14555 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
14556 instead of "__declspec(dllexport)" you get almost identical
14557 semantics with identical syntax. This is a great boon to those
14558 working with cross-platform projects.
14559
14560 For those adding visibility support to existing code, you may find
14561 "#pragma GCC visibility" of use. This works by you enclosing the
14562 declarations you wish to set visibility for with (for example)
14563 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
14564 pop". Bear in mind that symbol visibility should be viewed as part
14565 of the API interface contract and thus all new code should always
14566 specify visibility when it is not the default; i.e., declarations
14567 only for use within the local DSO should always be marked
14568 explicitly as hidden as so to avoid PLT indirection
14569 overheads---making this abundantly clear also aids readability and
14570 self-documentation of the code. Note that due to ISO C++
14571 specification requirements, "operator new" and "operator delete"
14572 must always be of default visibility.
14573
14574 Be aware that headers from outside your project, in particular
14575 system headers and headers from any other library you use, may not
14576 be expecting to be compiled with visibility other than the default.
14577 You may need to explicitly say "#pragma GCC visibility
14578 push(default)" before including any such headers.
14579
14580 "extern" declarations are not affected by -fvisibility, so a lot of
14581 code can be recompiled with -fvisibility=hidden with no
14582 modifications. However, this means that calls to "extern"
14583 functions with no explicit visibility use the PLT, so it is more
14584 effective to use "__attribute ((visibility))" and/or "#pragma GCC
14585 visibility" to tell the compiler which "extern" declarations should
14586 be treated as hidden.
14587
14588 Note that -fvisibility does affect C++ vague linkage entities. This
14589 means that, for instance, an exception class that is be thrown
14590 between DSOs must be explicitly marked with default visibility so
14591 that the type_info nodes are unified between the DSOs.
14592
14593 An overview of these techniques, their benefits and how to use them
14594 is at <http://gcc.gnu.org/wiki/Visibility>.
14595
14596 -fstrict-volatile-bitfields
14597 This option should be used if accesses to volatile bit-fields (or
14598 other structure fields, although the compiler usually honors those
14599 types anyway) should use a single access of the width of the
14600 field's type, aligned to a natural alignment if possible. For
14601 example, targets with memory-mapped peripheral registers might
14602 require all such accesses to be 16 bits wide; with this flag you
14603 can declare all peripheral bit-fields as "unsigned short" (assuming
14604 short is 16 bits on these targets) to force GCC to use 16-bit
14605 accesses instead of, perhaps, a more efficient 32-bit access.
14606
14607 If this option is disabled, the compiler uses the most efficient
14608 instruction. In the previous example, that might be a 32-bit load
14609 instruction, even though that accesses bytes that do not contain
14610 any portion of the bit-field, or memory-mapped registers unrelated
14611 to the one being updated.
14612
14613 In some cases, such as when the "packed" attribute is applied to a
14614 structure field, it may not be possible to access the field with a
14615 single read or write that is correctly aligned for the target
14616 machine. In this case GCC falls back to generating multiple
14617 accesses rather than code that will fault or truncate the result at
14618 run time.
14619
14620 Note: Due to restrictions of the C/C++11 memory model, write
14621 accesses are not allowed to touch non bit-field members. It is
14622 therefore recommended to define all bits of the field's type as
14623 bit-field members.
14624
14625 The default value of this option is determined by the application
14626 binary interface for the target processor.
14627
14628 -fsync-libcalls
14629 This option controls whether any out-of-line instance of the
14630 "__sync" family of functions may be used to implement the C++11
14631 "__atomic" family of functions.
14632
14633 The default value of this option is enabled, thus the only useful
14634 form of the option is -fno-sync-libcalls. This option is used in
14635 the implementation of the libatomic runtime library.
14636
14637 GCC Developer Options
14638 This section describes command-line options that are primarily of
14639 interest to GCC developers, including options to support compiler
14640 testing and investigation of compiler bugs and compile-time performance
14641 problems. This includes options that produce debug dumps at various
14642 points in the compilation; that print statistics such as memory use and
14643 execution time; and that print information about GCC's configuration,
14644 such as where it searches for libraries. You should rarely need to use
14645 any of these options for ordinary compilation and linking tasks.
14646
14647 Many developer options that cause GCC to dump output to a file take an
14648 optional =filename suffix. You can specify stdout or - to dump to
14649 standard output, and stderr for standard error.
14650
14651 If =filename is omitted, a default dump file name is constructed by
14652 concatenating the base dump file name, a pass number, phase letter, and
14653 pass name. The base dump file name is the name of output file produced
14654 by the compiler if explicitly specified and not an executable;
14655 otherwise it is the source file name. The pass number is determined by
14656 the order passes are registered with the compiler's pass manager. This
14657 is generally the same as the order of execution, but passes registered
14658 by plugins, target-specific passes, or passes that are otherwise
14659 registered late are numbered higher than the pass named final, even if
14660 they are executed earlier. The phase letter is one of i (inter-
14661 procedural analysis), l (language-specific), r (RTL), or t (tree). The
14662 files are created in the directory of the output file.
14663
14664 -fcallgraph-info
14665 -fcallgraph-info=MARKERS
14666 Makes the compiler output callgraph information for the program, on
14667 a per-object-file basis. The information is generated in the
14668 common VCG format. It can be decorated with additional, per-node
14669 and/or per-edge information, if a list of comma-separated markers
14670 is additionally specified. When the "su" marker is specified, the
14671 callgraph is decorated with stack usage information; it is
14672 equivalent to -fstack-usage. When the "da" marker is specified,
14673 the callgraph is decorated with information about dynamically
14674 allocated objects.
14675
14676 When compiling with -flto, no callgraph information is output along
14677 with the object file. At LTO link time, -fcallgraph-info may
14678 generate multiple callgraph information files next to intermediate
14679 LTO output files.
14680
14681 -dletters
14682 -fdump-rtl-pass
14683 -fdump-rtl-pass=filename
14684 Says to make debugging dumps during compilation at times specified
14685 by letters. This is used for debugging the RTL-based passes of the
14686 compiler.
14687
14688 Some -dletters switches have different meaning when -E is used for
14689 preprocessing.
14690
14691 Debug dumps can be enabled with a -fdump-rtl switch or some -d
14692 option letters. Here are the possible letters for use in pass and
14693 letters, and their meanings:
14694
14695 -fdump-rtl-alignments
14696 Dump after branch alignments have been computed.
14697
14698 -fdump-rtl-asmcons
14699 Dump after fixing rtl statements that have unsatisfied in/out
14700 constraints.
14701
14702 -fdump-rtl-auto_inc_dec
14703 Dump after auto-inc-dec discovery. This pass is only run on
14704 architectures that have auto inc or auto dec instructions.
14705
14706 -fdump-rtl-barriers
14707 Dump after cleaning up the barrier instructions.
14708
14709 -fdump-rtl-bbpart
14710 Dump after partitioning hot and cold basic blocks.
14711
14712 -fdump-rtl-bbro
14713 Dump after block reordering.
14714
14715 -fdump-rtl-btl1
14716 -fdump-rtl-btl2
14717 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
14718 two branch target load optimization passes.
14719
14720 -fdump-rtl-bypass
14721 Dump after jump bypassing and control flow optimizations.
14722
14723 -fdump-rtl-combine
14724 Dump after the RTL instruction combination pass.
14725
14726 -fdump-rtl-compgotos
14727 Dump after duplicating the computed gotos.
14728
14729 -fdump-rtl-ce1
14730 -fdump-rtl-ce2
14731 -fdump-rtl-ce3
14732 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
14733 dumping after the three if conversion passes.
14734
14735 -fdump-rtl-cprop_hardreg
14736 Dump after hard register copy propagation.
14737
14738 -fdump-rtl-csa
14739 Dump after combining stack adjustments.
14740
14741 -fdump-rtl-cse1
14742 -fdump-rtl-cse2
14743 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
14744 two common subexpression elimination passes.
14745
14746 -fdump-rtl-dce
14747 Dump after the standalone dead code elimination passes.
14748
14749 -fdump-rtl-dbr
14750 Dump after delayed branch scheduling.
14751
14752 -fdump-rtl-dce1
14753 -fdump-rtl-dce2
14754 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
14755 two dead store elimination passes.
14756
14757 -fdump-rtl-eh
14758 Dump after finalization of EH handling code.
14759
14760 -fdump-rtl-eh_ranges
14761 Dump after conversion of EH handling range regions.
14762
14763 -fdump-rtl-expand
14764 Dump after RTL generation.
14765
14766 -fdump-rtl-fwprop1
14767 -fdump-rtl-fwprop2
14768 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
14769 the two forward propagation passes.
14770
14771 -fdump-rtl-gcse1
14772 -fdump-rtl-gcse2
14773 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
14774 global common subexpression elimination.
14775
14776 -fdump-rtl-init-regs
14777 Dump after the initialization of the registers.
14778
14779 -fdump-rtl-initvals
14780 Dump after the computation of the initial value sets.
14781
14782 -fdump-rtl-into_cfglayout
14783 Dump after converting to cfglayout mode.
14784
14785 -fdump-rtl-ira
14786 Dump after iterated register allocation.
14787
14788 -fdump-rtl-jump
14789 Dump after the second jump optimization.
14790
14791 -fdump-rtl-loop2
14792 -fdump-rtl-loop2 enables dumping after the rtl loop
14793 optimization passes.
14794
14795 -fdump-rtl-mach
14796 Dump after performing the machine dependent reorganization
14797 pass, if that pass exists.
14798
14799 -fdump-rtl-mode_sw
14800 Dump after removing redundant mode switches.
14801
14802 -fdump-rtl-rnreg
14803 Dump after register renumbering.
14804
14805 -fdump-rtl-outof_cfglayout
14806 Dump after converting from cfglayout mode.
14807
14808 -fdump-rtl-peephole2
14809 Dump after the peephole pass.
14810
14811 -fdump-rtl-postreload
14812 Dump after post-reload optimizations.
14813
14814 -fdump-rtl-pro_and_epilogue
14815 Dump after generating the function prologues and epilogues.
14816
14817 -fdump-rtl-sched1
14818 -fdump-rtl-sched2
14819 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
14820 the basic block scheduling passes.
14821
14822 -fdump-rtl-ree
14823 Dump after sign/zero extension elimination.
14824
14825 -fdump-rtl-seqabstr
14826 Dump after common sequence discovery.
14827
14828 -fdump-rtl-shorten
14829 Dump after shortening branches.
14830
14831 -fdump-rtl-sibling
14832 Dump after sibling call optimizations.
14833
14834 -fdump-rtl-split1
14835 -fdump-rtl-split2
14836 -fdump-rtl-split3
14837 -fdump-rtl-split4
14838 -fdump-rtl-split5
14839 These options enable dumping after five rounds of instruction
14840 splitting.
14841
14842 -fdump-rtl-sms
14843 Dump after modulo scheduling. This pass is only run on some
14844 architectures.
14845
14846 -fdump-rtl-stack
14847 Dump after conversion from GCC's "flat register file" registers
14848 to the x87's stack-like registers. This pass is only run on
14849 x86 variants.
14850
14851 -fdump-rtl-subreg1
14852 -fdump-rtl-subreg2
14853 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
14854 the two subreg expansion passes.
14855
14856 -fdump-rtl-unshare
14857 Dump after all rtl has been unshared.
14858
14859 -fdump-rtl-vartrack
14860 Dump after variable tracking.
14861
14862 -fdump-rtl-vregs
14863 Dump after converting virtual registers to hard registers.
14864
14865 -fdump-rtl-web
14866 Dump after live range splitting.
14867
14868 -fdump-rtl-regclass
14869 -fdump-rtl-subregs_of_mode_init
14870 -fdump-rtl-subregs_of_mode_finish
14871 -fdump-rtl-dfinit
14872 -fdump-rtl-dfinish
14873 These dumps are defined but always produce empty files.
14874
14875 -da
14876 -fdump-rtl-all
14877 Produce all the dumps listed above.
14878
14879 -dA Annotate the assembler output with miscellaneous debugging
14880 information.
14881
14882 -dD Dump all macro definitions, at the end of preprocessing, in
14883 addition to normal output.
14884
14885 -dH Produce a core dump whenever an error occurs.
14886
14887 -dp Annotate the assembler output with a comment indicating which
14888 pattern and alternative is used. The length and cost of each
14889 instruction are also printed.
14890
14891 -dP Dump the RTL in the assembler output as a comment before each
14892 instruction. Also turns on -dp annotation.
14893
14894 -dx Just generate RTL for a function instead of compiling it.
14895 Usually used with -fdump-rtl-expand.
14896
14897 -fdump-debug
14898 Dump debugging information generated during the debug generation
14899 phase.
14900
14901 -fdump-earlydebug
14902 Dump debugging information generated during the early debug
14903 generation phase.
14904
14905 -fdump-noaddr
14906 When doing debugging dumps, suppress address output. This makes it
14907 more feasible to use diff on debugging dumps for compiler
14908 invocations with different compiler binaries and/or different text
14909 / bss / data / heap / stack / dso start locations.
14910
14911 -freport-bug
14912 Collect and dump debug information into a temporary file if an
14913 internal compiler error (ICE) occurs.
14914
14915 -fdump-unnumbered
14916 When doing debugging dumps, suppress instruction numbers and
14917 address output. This makes it more feasible to use diff on
14918 debugging dumps for compiler invocations with different options, in
14919 particular with and without -g.
14920
14921 -fdump-unnumbered-links
14922 When doing debugging dumps (see -d option above), suppress
14923 instruction numbers for the links to the previous and next
14924 instructions in a sequence.
14925
14926 -fdump-ipa-switch
14927 -fdump-ipa-switch-options
14928 Control the dumping at various stages of inter-procedural analysis
14929 language tree to a file. The file name is generated by appending a
14930 switch specific suffix to the source file name, and the file is
14931 created in the same directory as the output file. The following
14932 dumps are possible:
14933
14934 all Enables all inter-procedural analysis dumps.
14935
14936 cgraph
14937 Dumps information about call-graph optimization, unused
14938 function removal, and inlining decisions.
14939
14940 inline
14941 Dump after function inlining.
14942
14943 Additionally, the options -optimized, -missed, -note, and -all can
14944 be provided, with the same meaning as for -fopt-info, defaulting to
14945 -optimized.
14946
14947 For example, -fdump-ipa-inline-optimized-missed will emit
14948 information on callsites that were inlined, along with callsites
14949 that were not inlined.
14950
14951 By default, the dump will contain messages about successful
14952 optimizations (equivalent to -optimized) together with low-level
14953 details about the analysis.
14954
14955 -fdump-lang
14956 Dump language-specific information. The file name is made by
14957 appending .lang to the source file name.
14958
14959 -fdump-lang-all
14960 -fdump-lang-switch
14961 -fdump-lang-switch-options
14962 -fdump-lang-switch-options=filename
14963 Control the dumping of language-specific information. The options
14964 and filename portions behave as described in the -fdump-tree
14965 option. The following switch values are accepted:
14966
14967 all Enable all language-specific dumps.
14968
14969 class
14970 Dump class hierarchy information. Virtual table information is
14971 emitted unless 'slim' is specified. This option is applicable
14972 to C++ only.
14973
14974 module
14975 Dump module information. Options lineno (locations), graph
14976 (reachability), blocks (clusters), uid (serialization), alias
14977 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
14978 provide additional information. This option is applicable to
14979 C++ only.
14980
14981 raw Dump the raw internal tree data. This option is applicable to
14982 C++ only.
14983
14984 -fdump-passes
14985 Print on stderr the list of optimization passes that are turned on
14986 and off by the current command-line options.
14987
14988 -fdump-statistics-option
14989 Enable and control dumping of pass statistics in a separate file.
14990 The file name is generated by appending a suffix ending in
14991 .statistics to the source file name, and the file is created in the
14992 same directory as the output file. If the -option form is used,
14993 -stats causes counters to be summed over the whole compilation unit
14994 while -details dumps every event as the passes generate them. The
14995 default with no option is to sum counters for each function
14996 compiled.
14997
14998 -fdump-tree-all
14999 -fdump-tree-switch
15000 -fdump-tree-switch-options
15001 -fdump-tree-switch-options=filename
15002 Control the dumping at various stages of processing the
15003 intermediate language tree to a file. If the -options form is
15004 used, options is a list of - separated options which control the
15005 details of the dump. Not all options are applicable to all dumps;
15006 those that are not meaningful are ignored. The following options
15007 are available
15008
15009 address
15010 Print the address of each node. Usually this is not meaningful
15011 as it changes according to the environment and source file.
15012 Its primary use is for tying up a dump file with a debug
15013 environment.
15014
15015 asmname
15016 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15017 that in the dump instead of "DECL_NAME". Its primary use is
15018 ease of use working backward from mangled names in the assembly
15019 file.
15020
15021 slim
15022 When dumping front-end intermediate representations, inhibit
15023 dumping of members of a scope or body of a function merely
15024 because that scope has been reached. Only dump such items when
15025 they are directly reachable by some other path.
15026
15027 When dumping pretty-printed trees, this option inhibits dumping
15028 the bodies of control structures.
15029
15030 When dumping RTL, print the RTL in slim (condensed) form
15031 instead of the default LISP-like representation.
15032
15033 raw Print a raw representation of the tree. By default, trees are
15034 pretty-printed into a C-like representation.
15035
15036 details
15037 Enable more detailed dumps (not honored by every dump option).
15038 Also include information from the optimization passes.
15039
15040 stats
15041 Enable dumping various statistics about the pass (not honored
15042 by every dump option).
15043
15044 blocks
15045 Enable showing basic block boundaries (disabled in raw dumps).
15046
15047 graph
15048 For each of the other indicated dump files (-fdump-rtl-pass),
15049 dump a representation of the control flow graph suitable for
15050 viewing with GraphViz to file.passid.pass.dot. Each function
15051 in the file is pretty-printed as a subgraph, so that GraphViz
15052 can render them all in a single plot.
15053
15054 This option currently only works for RTL dumps, and the RTL is
15055 always dumped in slim form.
15056
15057 vops
15058 Enable showing virtual operands for every statement.
15059
15060 lineno
15061 Enable showing line numbers for statements.
15062
15063 uid Enable showing the unique ID ("DECL_UID") for each variable.
15064
15065 verbose
15066 Enable showing the tree dump for each statement.
15067
15068 eh Enable showing the EH region number holding each statement.
15069
15070 scev
15071 Enable showing scalar evolution analysis details.
15072
15073 optimized
15074 Enable showing optimization information (only available in
15075 certain passes).
15076
15077 missed
15078 Enable showing missed optimization information (only available
15079 in certain passes).
15080
15081 note
15082 Enable other detailed optimization information (only available
15083 in certain passes).
15084
15085 all Turn on all options, except raw, slim, verbose and lineno.
15086
15087 optall
15088 Turn on all optimization options, i.e., optimized, missed, and
15089 note.
15090
15091 To determine what tree dumps are available or find the dump for a
15092 pass of interest follow the steps below.
15093
15094 1. Invoke GCC with -fdump-passes and in the stderr output look for
15095 a code that corresponds to the pass you are interested in. For
15096 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15097 correspond to the three Value Range Propagation passes. The
15098 number at the end distinguishes distinct invocations of the
15099 same pass.
15100
15101 2. To enable the creation of the dump file, append the pass code
15102 to the -fdump- option prefix and invoke GCC with it. For
15103 example, to enable the dump from the Early Value Range
15104 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15105 Optionally, you may specify the name of the dump file. If you
15106 don't specify one, GCC creates as described below.
15107
15108 3. Find the pass dump in a file whose name is composed of three
15109 components separated by a period: the name of the source file
15110 GCC was invoked to compile, a numeric suffix indicating the
15111 pass number followed by the letter t for tree passes (and the
15112 letter r for RTL passes), and finally the pass code. For
15113 example, the Early VRP pass dump might be in a file named
15114 myfile.c.038t.evrp in the current working directory. Note that
15115 the numeric codes are not stable and may change from one
15116 version of GCC to another.
15117
15118 -fopt-info
15119 -fopt-info-options
15120 -fopt-info-options=filename
15121 Controls optimization dumps from various optimization passes. If
15122 the -options form is used, options is a list of - separated option
15123 keywords to select the dump details and optimizations.
15124
15125 The options can be divided into three groups:
15126
15127 1. options describing what kinds of messages should be emitted,
15128
15129 2. options describing the verbosity of the dump, and
15130
15131 3. options describing which optimizations should be included.
15132
15133 The options from each group can be freely mixed as they are non-
15134 overlapping. However, in case of any conflicts, the later options
15135 override the earlier options on the command line.
15136
15137 The following options control which kinds of messages should be
15138 emitted:
15139
15140 optimized
15141 Print information when an optimization is successfully applied.
15142 It is up to a pass to decide which information is relevant. For
15143 example, the vectorizer passes print the source location of
15144 loops which are successfully vectorized.
15145
15146 missed
15147 Print information about missed optimizations. Individual passes
15148 control which information to include in the output.
15149
15150 note
15151 Print verbose information about optimizations, such as certain
15152 transformations, more detailed messages about decisions etc.
15153
15154 all Print detailed optimization information. This includes
15155 optimized, missed, and note.
15156
15157 The following option controls the dump verbosity:
15158
15159 internals
15160 By default, only "high-level" messages are emitted. This option
15161 enables additional, more detailed, messages, which are likely
15162 to only be of interest to GCC developers.
15163
15164 One or more of the following option keywords can be used to
15165 describe a group of optimizations:
15166
15167 ipa Enable dumps from all interprocedural optimizations.
15168
15169 loop
15170 Enable dumps from all loop optimizations.
15171
15172 inline
15173 Enable dumps from all inlining optimizations.
15174
15175 omp Enable dumps from all OMP (Offloading and Multi Processing)
15176 optimizations.
15177
15178 vec Enable dumps from all vectorization optimizations.
15179
15180 optall
15181 Enable dumps from all optimizations. This is a superset of the
15182 optimization groups listed above.
15183
15184 If options is omitted, it defaults to optimized-optall, which means
15185 to dump messages about successful optimizations from all the
15186 passes, omitting messages that are treated as "internals".
15187
15188 If the filename is provided, then the dumps from all the applicable
15189 optimizations are concatenated into the filename. Otherwise the
15190 dump is output onto stderr. Though multiple -fopt-info options are
15191 accepted, only one of them can include a filename. If other
15192 filenames are provided then all but the first such option are
15193 ignored.
15194
15195 Note that the output filename is overwritten in case of multiple
15196 translation units. If a combined output from multiple translation
15197 units is desired, stderr should be used instead.
15198
15199 In the following example, the optimization info is output to
15200 stderr:
15201
15202 gcc -O3 -fopt-info
15203
15204 This example:
15205
15206 gcc -O3 -fopt-info-missed=missed.all
15207
15208 outputs missed optimization report from all the passes into
15209 missed.all, and this one:
15210
15211 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15212
15213 prints information about missed optimization opportunities from
15214 vectorization passes on stderr. Note that -fopt-info-vec-missed is
15215 equivalent to -fopt-info-missed-vec. The order of the optimization
15216 group names and message types listed after -fopt-info does not
15217 matter.
15218
15219 As another example,
15220
15221 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15222
15223 outputs information about missed optimizations as well as optimized
15224 locations from all the inlining passes into inline.txt.
15225
15226 Finally, consider:
15227
15228 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15229
15230 Here the two output filenames vec.miss and loop.opt are in conflict
15231 since only one output file is allowed. In this case, only the first
15232 option takes effect and the subsequent options are ignored. Thus
15233 only vec.miss is produced which contains dumps from the vectorizer
15234 about missed opportunities.
15235
15236 -fsave-optimization-record
15237 Write a SRCFILE.opt-record.json.gz file detailing what
15238 optimizations were performed, for those optimizations that support
15239 -fopt-info.
15240
15241 This option is experimental and the format of the data within the
15242 compressed JSON file is subject to change.
15243
15244 It is roughly equivalent to a machine-readable version of
15245 -fopt-info-all, as a collection of messages with source file, line
15246 number and column number, with the following additional data for
15247 each message:
15248
15249 * the execution count of the code being optimized, along with
15250 metadata about whether this was from actual profile data, or
15251 just an estimate, allowing consumers to prioritize messages by
15252 code hotness,
15253
15254 * the function name of the code being optimized, where
15255 applicable,
15256
15257 * the "inlining chain" for the code being optimized, so that when
15258 a function is inlined into several different places (which
15259 might themselves be inlined), the reader can distinguish
15260 between the copies,
15261
15262 * objects identifying those parts of the message that refer to
15263 expressions, statements or symbol-table nodes, which of these
15264 categories they are, and, when available, their source code
15265 location,
15266
15267 * the GCC pass that emitted the message, and
15268
15269 * the location in GCC's own code from which the message was
15270 emitted
15271
15272 Additionally, some messages are logically nested within other
15273 messages, reflecting implementation details of the optimization
15274 passes.
15275
15276 -fsched-verbose=n
15277 On targets that use instruction scheduling, this option controls
15278 the amount of debugging output the scheduler prints to the dump
15279 files.
15280
15281 For n greater than zero, -fsched-verbose outputs the same
15282 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
15283 greater than one, it also output basic block probabilities,
15284 detailed ready list information and unit/insn info. For n greater
15285 than two, it includes RTL at abort point, control-flow and regions
15286 info. And for n over four, -fsched-verbose also includes
15287 dependence info.
15288
15289 -fenable-kind-pass
15290 -fdisable-kind-pass=range-list
15291 This is a set of options that are used to explicitly disable/enable
15292 optimization passes. These options are intended for use for
15293 debugging GCC. Compiler users should use regular options for
15294 enabling/disabling passes instead.
15295
15296 -fdisable-ipa-pass
15297 Disable IPA pass pass. pass is the pass name. If the same pass
15298 is statically invoked in the compiler multiple times, the pass
15299 name should be appended with a sequential number starting from
15300 1.
15301
15302 -fdisable-rtl-pass
15303 -fdisable-rtl-pass=range-list
15304 Disable RTL pass pass. pass is the pass name. If the same
15305 pass is statically invoked in the compiler multiple times, the
15306 pass name should be appended with a sequential number starting
15307 from 1. range-list is a comma-separated list of function
15308 ranges or assembler names. Each range is a number pair
15309 separated by a colon. The range is inclusive in both ends. If
15310 the range is trivial, the number pair can be simplified as a
15311 single number. If the function's call graph node's uid falls
15312 within one of the specified ranges, the pass is disabled for
15313 that function. The uid is shown in the function header of a
15314 dump file, and the pass names can be dumped by using option
15315 -fdump-passes.
15316
15317 -fdisable-tree-pass
15318 -fdisable-tree-pass=range-list
15319 Disable tree pass pass. See -fdisable-rtl for the description
15320 of option arguments.
15321
15322 -fenable-ipa-pass
15323 Enable IPA pass pass. pass is the pass name. If the same pass
15324 is statically invoked in the compiler multiple times, the pass
15325 name should be appended with a sequential number starting from
15326 1.
15327
15328 -fenable-rtl-pass
15329 -fenable-rtl-pass=range-list
15330 Enable RTL pass pass. See -fdisable-rtl for option argument
15331 description and examples.
15332
15333 -fenable-tree-pass
15334 -fenable-tree-pass=range-list
15335 Enable tree pass pass. See -fdisable-rtl for the description
15336 of option arguments.
15337
15338 Here are some examples showing uses of these options.
15339
15340 # disable ccp1 for all functions
15341 -fdisable-tree-ccp1
15342 # disable complete unroll for function whose cgraph node uid is 1
15343 -fenable-tree-cunroll=1
15344 # disable gcse2 for functions at the following ranges [1,1],
15345 # [300,400], and [400,1000]
15346 # disable gcse2 for functions foo and foo2
15347 -fdisable-rtl-gcse2=foo,foo2
15348 # disable early inlining
15349 -fdisable-tree-einline
15350 # disable ipa inlining
15351 -fdisable-ipa-inline
15352 # enable tree full unroll
15353 -fenable-tree-unroll
15354
15355 -fchecking
15356 -fchecking=n
15357 Enable internal consistency checking. The default depends on the
15358 compiler configuration. -fchecking=2 enables further internal
15359 consistency checking that might affect code generation.
15360
15361 -frandom-seed=string
15362 This option provides a seed that GCC uses in place of random
15363 numbers in generating certain symbol names that have to be
15364 different in every compiled file. It is also used to place unique
15365 stamps in coverage data files and the object files that produce
15366 them. You can use the -frandom-seed option to produce reproducibly
15367 identical object files.
15368
15369 The string can either be a number (decimal, octal or hex) or an
15370 arbitrary string (in which case it's converted to a number by
15371 computing CRC32).
15372
15373 The string should be different for every file you compile.
15374
15375 -save-temps
15376 Store the usual "temporary" intermediate files permanently; name
15377 them as auxiliary output files, as specified described under
15378 -dumpbase and -dumpdir.
15379
15380 When used in combination with the -x command-line option,
15381 -save-temps is sensible enough to avoid overwriting an input source
15382 file with the same extension as an intermediate file. The
15383 corresponding intermediate file may be obtained by renaming the
15384 source file before using -save-temps.
15385
15386 -save-temps=cwd
15387 Equivalent to -save-temps -dumpdir ./.
15388
15389 -save-temps=obj
15390 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
15391 directory of the output file specified after the -o option,
15392 including any directory separators. If the -o option is not used,
15393 the -save-temps=obj switch behaves like -save-temps=cwd.
15394
15395 -time[=file]
15396 Report the CPU time taken by each subprocess in the compilation
15397 sequence. For C source files, this is the compiler proper and
15398 assembler (plus the linker if linking is done).
15399
15400 Without the specification of an output file, the output looks like
15401 this:
15402
15403 # cc1 0.12 0.01
15404 # as 0.00 0.01
15405
15406 The first number on each line is the "user time", that is time
15407 spent executing the program itself. The second number is "system
15408 time", time spent executing operating system routines on behalf of
15409 the program. Both numbers are in seconds.
15410
15411 With the specification of an output file, the output is appended to
15412 the named file, and it looks like this:
15413
15414 0.12 0.01 cc1 <options>
15415 0.00 0.01 as <options>
15416
15417 The "user time" and the "system time" are moved before the program
15418 name, and the options passed to the program are displayed, so that
15419 one can later tell what file was being compiled, and with which
15420 options.
15421
15422 -fdump-final-insns[=file]
15423 Dump the final internal representation (RTL) to file. If the
15424 optional argument is omitted (or if file is "."), the name of the
15425 dump file is determined by appending ".gkd" to the dump base name,
15426 see -dumpbase.
15427
15428 -fcompare-debug[=opts]
15429 If no error occurs during compilation, run the compiler a second
15430 time, adding opts and -fcompare-debug-second to the arguments
15431 passed to the second compilation. Dump the final internal
15432 representation in both compilations, and print an error if they
15433 differ.
15434
15435 If the equal sign is omitted, the default -gtoggle is used.
15436
15437 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
15438 and nonzero, implicitly enables -fcompare-debug. If
15439 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
15440 it is used for opts, otherwise the default -gtoggle is used.
15441
15442 -fcompare-debug=, with the equal sign but without opts, is
15443 equivalent to -fno-compare-debug, which disables the dumping of the
15444 final representation and the second compilation, preventing even
15445 GCC_COMPARE_DEBUG from taking effect.
15446
15447 To verify full coverage during -fcompare-debug testing, set
15448 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
15449 rejects as an invalid option in any actual compilation (rather than
15450 preprocessing, assembly or linking). To get just a warning,
15451 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
15452 will do.
15453
15454 -fcompare-debug-second
15455 This option is implicitly passed to the compiler for the second
15456 compilation requested by -fcompare-debug, along with options to
15457 silence warnings, and omitting other options that would cause the
15458 compiler to produce output to files or to standard output as a side
15459 effect. Dump files and preserved temporary files are renamed so as
15460 to contain the ".gk" additional extension during the second
15461 compilation, to avoid overwriting those generated by the first.
15462
15463 When this option is passed to the compiler driver, it causes the
15464 first compilation to be skipped, which makes it useful for little
15465 other than debugging the compiler proper.
15466
15467 -gtoggle
15468 Turn off generation of debug info, if leaving out this option
15469 generates it, or turn it on at level 2 otherwise. The position of
15470 this argument in the command line does not matter; it takes effect
15471 after all other options are processed, and it does so only once, no
15472 matter how many times it is given. This is mainly intended to be
15473 used with -fcompare-debug.
15474
15475 -fvar-tracking-assignments-toggle
15476 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
15477 toggles -g.
15478
15479 -Q Makes the compiler print out each function name as it is compiled,
15480 and print some statistics about each pass when it finishes.
15481
15482 -ftime-report
15483 Makes the compiler print some statistics about the time consumed by
15484 each pass when it finishes.
15485
15486 -ftime-report-details
15487 Record the time consumed by infrastructure parts separately for
15488 each pass.
15489
15490 -fira-verbose=n
15491 Control the verbosity of the dump file for the integrated register
15492 allocator. The default value is 5. If the value n is greater or
15493 equal to 10, the dump output is sent to stderr using the same
15494 format as n minus 10.
15495
15496 -flto-report
15497 Prints a report with internal details on the workings of the link-
15498 time optimizer. The contents of this report vary from version to
15499 version. It is meant to be useful to GCC developers when
15500 processing object files in LTO mode (via -flto).
15501
15502 Disabled by default.
15503
15504 -flto-report-wpa
15505 Like -flto-report, but only print for the WPA phase of link-time
15506 optimization.
15507
15508 -fmem-report
15509 Makes the compiler print some statistics about permanent memory
15510 allocation when it finishes.
15511
15512 -fmem-report-wpa
15513 Makes the compiler print some statistics about permanent memory
15514 allocation for the WPA phase only.
15515
15516 -fpre-ipa-mem-report
15517 -fpost-ipa-mem-report
15518 Makes the compiler print some statistics about permanent memory
15519 allocation before or after interprocedural optimization.
15520
15521 -fprofile-report
15522 Makes the compiler print some statistics about consistency of the
15523 (estimated) profile and effect of individual passes.
15524
15525 -fstack-usage
15526 Makes the compiler output stack usage information for the program,
15527 on a per-function basis. The filename for the dump is made by
15528 appending .su to the auxname. auxname is generated from the name
15529 of the output file, if explicitly specified and it is not an
15530 executable, otherwise it is the basename of the source file. An
15531 entry is made up of three fields:
15532
15533 * The name of the function.
15534
15535 * A number of bytes.
15536
15537 * One or more qualifiers: "static", "dynamic", "bounded".
15538
15539 The qualifier "static" means that the function manipulates the
15540 stack statically: a fixed number of bytes are allocated for the
15541 frame on function entry and released on function exit; no stack
15542 adjustments are otherwise made in the function. The second field
15543 is this fixed number of bytes.
15544
15545 The qualifier "dynamic" means that the function manipulates the
15546 stack dynamically: in addition to the static allocation described
15547 above, stack adjustments are made in the body of the function, for
15548 example to push/pop arguments around function calls. If the
15549 qualifier "bounded" is also present, the amount of these
15550 adjustments is bounded at compile time and the second field is an
15551 upper bound of the total amount of stack used by the function. If
15552 it is not present, the amount of these adjustments is not bounded
15553 at compile time and the second field only represents the bounded
15554 part.
15555
15556 -fstats
15557 Emit statistics about front-end processing at the end of the
15558 compilation. This option is supported only by the C++ front end,
15559 and the information is generally only useful to the G++ development
15560 team.
15561
15562 -fdbg-cnt-list
15563 Print the name and the counter upper bound for all debug counters.
15564
15565 -fdbg-cnt=counter-value-list
15566 Set the internal debug counter lower and upper bound. counter-
15567 value-list is a comma-separated list of
15568 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
15569 tuples which sets the name of the counter and list of closed
15570 intervals. The lower_bound is optional and is zero initialized if
15571 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
15572 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
15573 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
15574 for first 10 invocations.
15575
15576 -print-file-name=library
15577 Print the full absolute name of the library file library that would
15578 be used when linking---and don't do anything else. With this
15579 option, GCC does not compile or link anything; it just prints the
15580 file name.
15581
15582 -print-multi-directory
15583 Print the directory name corresponding to the multilib selected by
15584 any other switches present in the command line. This directory is
15585 supposed to exist in GCC_EXEC_PREFIX.
15586
15587 -print-multi-lib
15588 Print the mapping from multilib directory names to compiler
15589 switches that enable them. The directory name is separated from
15590 the switches by ;, and each switch starts with an @ instead of the
15591 -, without spaces between multiple switches. This is supposed to
15592 ease shell processing.
15593
15594 -print-multi-os-directory
15595 Print the path to OS libraries for the selected multilib, relative
15596 to some lib subdirectory. If OS libraries are present in the lib
15597 subdirectory and no multilibs are used, this is usually just ., if
15598 OS libraries are present in libsuffix sibling directories this
15599 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
15600 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
15601 or ev6.
15602
15603 -print-multiarch
15604 Print the path to OS libraries for the selected multiarch, relative
15605 to some lib subdirectory.
15606
15607 -print-prog-name=program
15608 Like -print-file-name, but searches for a program such as cpp.
15609
15610 -print-libgcc-file-name
15611 Same as -print-file-name=libgcc.a.
15612
15613 This is useful when you use -nostdlib or -nodefaultlibs but you do
15614 want to link with libgcc.a. You can do:
15615
15616 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
15617
15618 -print-search-dirs
15619 Print the name of the configured installation directory and a list
15620 of program and library directories gcc searches---and don't do
15621 anything else.
15622
15623 This is useful when gcc prints the error message installation
15624 problem, cannot exec cpp0: No such file or directory. To resolve
15625 this you either need to put cpp0 and the other compiler components
15626 where gcc expects to find them, or you can set the environment
15627 variable GCC_EXEC_PREFIX to the directory where you installed them.
15628 Don't forget the trailing /.
15629
15630 -print-sysroot
15631 Print the target sysroot directory that is used during compilation.
15632 This is the target sysroot specified either at configure time or
15633 using the --sysroot option, possibly with an extra suffix that
15634 depends on compilation options. If no target sysroot is specified,
15635 the option prints nothing.
15636
15637 -print-sysroot-headers-suffix
15638 Print the suffix added to the target sysroot when searching for
15639 headers, or give an error if the compiler is not configured with
15640 such a suffix---and don't do anything else.
15641
15642 -dumpmachine
15643 Print the compiler's target machine (for example,
15644 i686-pc-linux-gnu)---and don't do anything else.
15645
15646 -dumpversion
15647 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
15648 don't do anything else. This is the compiler version used in
15649 filesystem paths and specs. Depending on how the compiler has been
15650 configured it can be just a single number (major version), two
15651 numbers separated by a dot (major and minor version) or three
15652 numbers separated by dots (major, minor and patchlevel version).
15653
15654 -dumpfullversion
15655 Print the full compiler version---and don't do anything else. The
15656 output is always three numbers separated by dots, major, minor and
15657 patchlevel version.
15658
15659 -dumpspecs
15660 Print the compiler's built-in specs---and don't do anything else.
15661 (This is used when GCC itself is being built.)
15662
15663 Machine-Dependent Options
15664 Each target machine supported by GCC can have its own options---for
15665 example, to allow you to compile for a particular processor variant or
15666 ABI, or to control optimizations specific to that machine. By
15667 convention, the names of machine-specific options start with -m.
15668
15669 Some configurations of the compiler also support additional target-
15670 specific options, usually for compatibility with other compilers on the
15671 same platform.
15672
15673 AArch64 Options
15674
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
16116 These -m options are defined for Adapteva Epiphany:
16117
16118 -mhalf-reg-file
16119 Don't allocate any register in the range "r32"..."r63". That
16120 allows code to run on hardware variants that lack these registers.
16121
16122 -mprefer-short-insn-regs
16123 Preferentially allocate registers that allow short instruction
16124 generation. This can result in increased instruction count, so
16125 this may either reduce or increase overall code size.
16126
16127 -mbranch-cost=num
16128 Set the cost of branches to roughly num "simple" instructions.
16129 This cost is only a heuristic and is not guaranteed to produce
16130 consistent results across releases.
16131
16132 -mcmove
16133 Enable the generation of conditional moves.
16134
16135 -mnops=num
16136 Emit num NOPs before every other generated instruction.
16137
16138 -mno-soft-cmpsf
16139 For single-precision floating-point comparisons, emit an "fsub"
16140 instruction and test the flags. This is faster than a software
16141 comparison, but can get incorrect results in the presence of NaNs,
16142 or when two different small numbers are compared such that their
16143 difference is calculated as zero. The default is -msoft-cmpsf,
16144 which uses slower, but IEEE-compliant, software comparisons.
16145
16146 -mstack-offset=num
16147 Set the offset between the top of the stack and the stack pointer.
16148 E.g., a value of 8 means that the eight bytes in the range
16149 "sp+0...sp+7" can be used by leaf functions without stack
16150 allocation. Values other than 8 or 16 are untested and unlikely to
16151 work. Note also that this option changes the ABI; compiling a
16152 program with a different stack offset than the libraries have been
16153 compiled with generally does not work. This option can be useful
16154 if you want to evaluate if a different stack offset would give you
16155 better code, but to actually use a different stack offset to build
16156 working programs, it is recommended to configure the toolchain with
16157 the appropriate --with-stack-offset=num option.
16158
16159 -mno-round-nearest
16160 Make the scheduler assume that the rounding mode has been set to
16161 truncating. The default is -mround-nearest.
16162
16163 -mlong-calls
16164 If not otherwise specified by an attribute, assume all calls might
16165 be beyond the offset range of the "b" / "bl" instructions, and
16166 therefore load the function address into a register before
16167 performing a (otherwise direct) call. This is the default.
16168
16169 -mshort-calls
16170 If not otherwise specified by an attribute, assume all direct calls
16171 are in the range of the "b" / "bl" instructions, so use these
16172 instructions for direct calls. The default is -mlong-calls.
16173
16174 -msmall16
16175 Assume addresses can be loaded as 16-bit unsigned values. This
16176 does not apply to function addresses for which -mlong-calls
16177 semantics are in effect.
16178
16179 -mfp-mode=mode
16180 Set the prevailing mode of the floating-point unit. This
16181 determines the floating-point mode that is provided and expected at
16182 function call and return time. Making this mode match the mode you
16183 predominantly need at function start can make your programs smaller
16184 and faster by avoiding unnecessary mode switches.
16185
16186 mode can be set to one the following values:
16187
16188 caller
16189 Any mode at function entry is valid, and retained or restored
16190 when the function returns, and when it calls other functions.
16191 This mode is useful for compiling libraries or other
16192 compilation units you might want to incorporate into different
16193 programs with different prevailing FPU modes, and the
16194 convenience of being able to use a single object file outweighs
16195 the size and speed overhead for any extra mode switching that
16196 might be needed, compared with what would be needed with a more
16197 specific choice of prevailing FPU mode.
16198
16199 truncate
16200 This is the mode used for floating-point calculations with
16201 truncating (i.e. round towards zero) rounding mode. That
16202 includes conversion from floating point to integer.
16203
16204 round-nearest
16205 This is the mode used for floating-point calculations with
16206 round-to-nearest-or-even rounding mode.
16207
16208 int This is the mode used to perform integer calculations in the
16209 FPU, e.g. integer multiply, or integer multiply-and-
16210 accumulate.
16211
16212 The default is -mfp-mode=caller
16213
16214 -mno-split-lohi
16215 -mno-postinc
16216 -mno-postmodify
16217 Code generation tweaks that disable, respectively, splitting of
16218 32-bit loads, generation of post-increment addresses, and
16219 generation of post-modify addresses. The defaults are msplit-lohi,
16220 -mpost-inc, and -mpost-modify.
16221
16222 -mnovect-double
16223 Change the preferred SIMD mode to SImode. The default is
16224 -mvect-double, which uses DImode as preferred SIMD mode.
16225
16226 -max-vect-align=num
16227 The maximum alignment for SIMD vector mode types. num may be 4 or
16228 8. The default is 8. Note that this is an ABI change, even though
16229 many library function interfaces are unaffected if they don't use
16230 SIMD vector modes in places that affect size and/or alignment of
16231 relevant types.
16232
16233 -msplit-vecmove-early
16234 Split vector moves into single word moves before reload. In theory
16235 this can give better register allocation, but so far the reverse
16236 seems to be generally the case.
16237
16238 -m1reg-reg
16239 Specify a register to hold the constant -1, which makes loading
16240 small negative constants and certain bitmasks faster. Allowable
16241 values for reg are r43 and r63, which specify use of that register
16242 as a fixed register, and none, which means that no register is used
16243 for this purpose. The default is -m1reg-none.
16244
16245 AMD GCN Options
16246
16247 These options are defined specifically for the AMD GCN port.
16248
16249 -march=gpu
16250 -mtune=gpu
16251 Set architecture type or tuning for gpu. Supported values for gpu
16252 are
16253
16254 fiji
16255 Compile for GCN3 Fiji devices (gfx803).
16256
16257 gfx900
16258 Compile for GCN5 Vega 10 devices (gfx900).
16259
16260 gfx906
16261 Compile for GCN5 Vega 20 devices (gfx906).
16262
16263 -mstack-size=bytes
16264 Specify how many bytes of stack space will be requested for each
16265 GPU thread (wave-front). Beware that there may be many threads and
16266 limited memory available. The size of the stack allocation may
16267 also have an impact on run-time performance. The default is 32KB
16268 when using OpenACC or OpenMP, and 1MB otherwise.
16269
16270 ARC Options
16271
16272 The following options control the architecture variant for which code
16273 is being compiled:
16274
16275 -mbarrel-shifter
16276 Generate instructions supported by barrel shifter. This is the
16277 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
16278
16279 -mjli-always
16280 Force to call a function using jli_s instruction. This option is
16281 valid only for ARCv2 architecture.
16282
16283 -mcpu=cpu
16284 Set architecture type, register usage, and instruction scheduling
16285 parameters for cpu. There are also shortcut alias options
16286 available for backward compatibility and convenience. Supported
16287 values for cpu are
16288
16289 arc600
16290 Compile for ARC600. Aliases: -mA6, -mARC600.
16291
16292 arc601
16293 Compile for ARC601. Alias: -mARC601.
16294
16295 arc700
16296 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
16297 default when configured with --with-cpu=arc700.
16298
16299 arcem
16300 Compile for ARC EM.
16301
16302 archs
16303 Compile for ARC HS.
16304
16305 em Compile for ARC EM CPU with no hardware extensions.
16306
16307 em4 Compile for ARC EM4 CPU.
16308
16309 em4_dmips
16310 Compile for ARC EM4 DMIPS CPU.
16311
16312 em4_fpus
16313 Compile for ARC EM4 DMIPS CPU with the single-precision
16314 floating-point extension.
16315
16316 em4_fpuda
16317 Compile for ARC EM4 DMIPS CPU with single-precision floating-
16318 point and double assist instructions.
16319
16320 hs Compile for ARC HS CPU with no hardware extensions except the
16321 atomic instructions.
16322
16323 hs34
16324 Compile for ARC HS34 CPU.
16325
16326 hs38
16327 Compile for ARC HS38 CPU.
16328
16329 hs38_linux
16330 Compile for ARC HS38 CPU with all hardware extensions on.
16331
16332 arc600_norm
16333 Compile for ARC 600 CPU with "norm" instructions enabled.
16334
16335 arc600_mul32x16
16336 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
16337 instructions enabled.
16338
16339 arc600_mul64
16340 Compile for ARC 600 CPU with "norm" and "mul64"-family
16341 instructions enabled.
16342
16343 arc601_norm
16344 Compile for ARC 601 CPU with "norm" instructions enabled.
16345
16346 arc601_mul32x16
16347 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
16348 instructions enabled.
16349
16350 arc601_mul64
16351 Compile for ARC 601 CPU with "norm" and "mul64"-family
16352 instructions enabled.
16353
16354 nps400
16355 Compile for ARC 700 on NPS400 chip.
16356
16357 em_mini
16358 Compile for ARC EM minimalist configuration featuring reduced
16359 register set.
16360
16361 -mdpfp
16362 -mdpfp-compact
16363 Generate double-precision FPX instructions, tuned for the compact
16364 implementation.
16365
16366 -mdpfp-fast
16367 Generate double-precision FPX instructions, tuned for the fast
16368 implementation.
16369
16370 -mno-dpfp-lrsr
16371 Disable "lr" and "sr" instructions from using FPX extension aux
16372 registers.
16373
16374 -mea
16375 Generate extended arithmetic instructions. Currently only "divaw",
16376 "adds", "subs", and "sat16" are supported. Only valid for
16377 -mcpu=ARC700.
16378
16379 -mno-mpy
16380 Do not generate "mpy"-family instructions for ARC700. This option
16381 is deprecated.
16382
16383 -mmul32x16
16384 Generate 32x16-bit multiply and multiply-accumulate instructions.
16385
16386 -mmul64
16387 Generate "mul64" and "mulu64" instructions. Only valid for
16388 -mcpu=ARC600.
16389
16390 -mnorm
16391 Generate "norm" instructions. This is the default if -mcpu=ARC700
16392 is in effect.
16393
16394 -mspfp
16395 -mspfp-compact
16396 Generate single-precision FPX instructions, tuned for the compact
16397 implementation.
16398
16399 -mspfp-fast
16400 Generate single-precision FPX instructions, tuned for the fast
16401 implementation.
16402
16403 -msimd
16404 Enable generation of ARC SIMD instructions via target-specific
16405 builtins. Only valid for -mcpu=ARC700.
16406
16407 -msoft-float
16408 This option ignored; it is provided for compatibility purposes
16409 only. Software floating-point code is emitted by default, and this
16410 default can overridden by FPX options; -mspfp, -mspfp-compact, or
16411 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
16412 -mdpfp-fast for double precision.
16413
16414 -mswap
16415 Generate "swap" instructions.
16416
16417 -matomic
16418 This enables use of the locked load/store conditional extension to
16419 implement atomic memory built-in functions. Not available for ARC
16420 6xx or ARC EM cores.
16421
16422 -mdiv-rem
16423 Enable "div" and "rem" instructions for ARCv2 cores.
16424
16425 -mcode-density
16426 Enable code density instructions for ARC EM. This option is on by
16427 default for ARC HS.
16428
16429 -mll64
16430 Enable double load/store operations for ARC HS cores.
16431
16432 -mtp-regno=regno
16433 Specify thread pointer register number.
16434
16435 -mmpy-option=multo
16436 Compile ARCv2 code with a multiplier design option. You can
16437 specify the option using either a string or numeric value for
16438 multo. wlh1 is the default value. The recognized values are:
16439
16440 0
16441 none
16442 No multiplier available.
16443
16444 1
16445 w 16x16 multiplier, fully pipelined. The following instructions
16446 are enabled: "mpyw" and "mpyuw".
16447
16448 2
16449 wlh1
16450 32x32 multiplier, fully pipelined (1 stage). The following
16451 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16452 "mpymu", and "mpy_s".
16453
16454 3
16455 wlh2
16456 32x32 multiplier, fully pipelined (2 stages). The following
16457 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16458 "mpymu", and "mpy_s".
16459
16460 4
16461 wlh3
16462 Two 16x16 multipliers, blocking, sequential. The following
16463 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16464 "mpymu", and "mpy_s".
16465
16466 5
16467 wlh4
16468 One 16x16 multiplier, blocking, sequential. The following
16469 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16470 "mpymu", and "mpy_s".
16471
16472 6
16473 wlh5
16474 One 32x4 multiplier, blocking, sequential. The following
16475 instructions are additionally enabled: "mpy", "mpyu", "mpym",
16476 "mpymu", and "mpy_s".
16477
16478 7
16479 plus_dmpy
16480 ARC HS SIMD support.
16481
16482 8
16483 plus_macd
16484 ARC HS SIMD support.
16485
16486 9
16487 plus_qmacw
16488 ARC HS SIMD support.
16489
16490 This option is only available for ARCv2 cores.
16491
16492 -mfpu=fpu
16493 Enables support for specific floating-point hardware extensions for
16494 ARCv2 cores. Supported values for fpu are:
16495
16496 fpus
16497 Enables support for single-precision floating-point hardware
16498 extensions.
16499
16500 fpud
16501 Enables support for double-precision floating-point hardware
16502 extensions. The single-precision floating-point extension is
16503 also enabled. Not available for ARC EM.
16504
16505 fpuda
16506 Enables support for double-precision floating-point hardware
16507 extensions using double-precision assist instructions. The
16508 single-precision floating-point extension is also enabled.
16509 This option is only available for ARC EM.
16510
16511 fpuda_div
16512 Enables support for double-precision floating-point hardware
16513 extensions using double-precision assist instructions. The
16514 single-precision floating-point, square-root, and divide
16515 extensions are also enabled. This option is only available for
16516 ARC EM.
16517
16518 fpuda_fma
16519 Enables support for double-precision floating-point hardware
16520 extensions using double-precision assist instructions. The
16521 single-precision floating-point and fused multiply and add
16522 hardware extensions are also enabled. This option is only
16523 available for ARC EM.
16524
16525 fpuda_all
16526 Enables support for double-precision floating-point hardware
16527 extensions using double-precision assist instructions. All
16528 single-precision floating-point hardware extensions are also
16529 enabled. This option is only available for ARC EM.
16530
16531 fpus_div
16532 Enables support for single-precision floating-point, square-
16533 root and divide hardware extensions.
16534
16535 fpud_div
16536 Enables support for double-precision floating-point, square-
16537 root and divide hardware extensions. This option includes
16538 option fpus_div. Not available for ARC EM.
16539
16540 fpus_fma
16541 Enables support for single-precision floating-point and fused
16542 multiply and add hardware extensions.
16543
16544 fpud_fma
16545 Enables support for double-precision floating-point and fused
16546 multiply and add hardware extensions. This option includes
16547 option fpus_fma. Not available for ARC EM.
16548
16549 fpus_all
16550 Enables support for all single-precision floating-point
16551 hardware extensions.
16552
16553 fpud_all
16554 Enables support for all single- and double-precision floating-
16555 point hardware extensions. Not available for ARC EM.
16556
16557 -mirq-ctrl-saved=register-range, blink, lp_count
16558 Specifies general-purposes registers that the processor
16559 automatically saves/restores on interrupt entry and exit.
16560 register-range is specified as two registers separated by a dash.
16561 The register range always starts with "r0", the upper limit is "fp"
16562 register. blink and lp_count are optional. This option is only
16563 valid for ARC EM and ARC HS cores.
16564
16565 -mrgf-banked-regs=number
16566 Specifies the number of registers replicated in second register
16567 bank on entry to fast interrupt. Fast interrupts are interrupts
16568 with the highest priority level P0. These interrupts save only PC
16569 and STATUS32 registers to avoid memory transactions during
16570 interrupt entry and exit sequences. Use this option when you are
16571 using fast interrupts in an ARC V2 family processor. Permitted
16572 values are 4, 8, 16, and 32.
16573
16574 -mlpc-width=width
16575 Specify the width of the "lp_count" register. Valid values for
16576 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
16577 fixed to 32 bits. If the width is less than 32, the compiler does
16578 not attempt to transform loops in your program to use the zero-
16579 delay loop mechanism unless it is known that the "lp_count"
16580 register can hold the required loop-counter value. Depending on
16581 the width specified, the compiler and run-time library might
16582 continue to use the loop mechanism for various needs. This option
16583 defines macro "__ARC_LPC_WIDTH__" with the value of width.
16584
16585 -mrf16
16586 This option instructs the compiler to generate code for a 16-entry
16587 register file. This option defines the "__ARC_RF16__" preprocessor
16588 macro.
16589
16590 -mbranch-index
16591 Enable use of "bi" or "bih" instructions to implement jump tables.
16592
16593 The following options are passed through to the assembler, and also
16594 define preprocessor macro symbols.
16595
16596 -mdsp-packa
16597 Passed down to the assembler to enable the DSP Pack A extensions.
16598 Also sets the preprocessor symbol "__Xdsp_packa". This option is
16599 deprecated.
16600
16601 -mdvbf
16602 Passed down to the assembler to enable the dual Viterbi butterfly
16603 extension. Also sets the preprocessor symbol "__Xdvbf". This
16604 option is deprecated.
16605
16606 -mlock
16607 Passed down to the assembler to enable the locked load/store
16608 conditional extension. Also sets the preprocessor symbol
16609 "__Xlock".
16610
16611 -mmac-d16
16612 Passed down to the assembler. Also sets the preprocessor symbol
16613 "__Xxmac_d16". This option is deprecated.
16614
16615 -mmac-24
16616 Passed down to the assembler. Also sets the preprocessor symbol
16617 "__Xxmac_24". This option is deprecated.
16618
16619 -mrtsc
16620 Passed down to the assembler to enable the 64-bit time-stamp
16621 counter extension instruction. Also sets the preprocessor symbol
16622 "__Xrtsc". This option is deprecated.
16623
16624 -mswape
16625 Passed down to the assembler to enable the swap byte ordering
16626 extension instruction. Also sets the preprocessor symbol
16627 "__Xswape".
16628
16629 -mtelephony
16630 Passed down to the assembler to enable dual- and single-operand
16631 instructions for telephony. Also sets the preprocessor symbol
16632 "__Xtelephony". This option is deprecated.
16633
16634 -mxy
16635 Passed down to the assembler to enable the XY memory extension.
16636 Also sets the preprocessor symbol "__Xxy".
16637
16638 The following options control how the assembly code is annotated:
16639
16640 -misize
16641 Annotate assembler instructions with estimated addresses.
16642
16643 -mannotate-align
16644 Explain what alignment considerations lead to the decision to make
16645 an instruction short or long.
16646
16647 The following options are passed through to the linker:
16648
16649 -marclinux
16650 Passed through to the linker, to specify use of the "arclinux"
16651 emulation. This option is enabled by default in tool chains built
16652 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16653 profiling is not requested.
16654
16655 -marclinux_prof
16656 Passed through to the linker, to specify use of the "arclinux_prof"
16657 emulation. This option is enabled by default in tool chains built
16658 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
16659 profiling is requested.
16660
16661 The following options control the semantics of generated code:
16662
16663 -mlong-calls
16664 Generate calls as register indirect calls, thus providing access to
16665 the full 32-bit address range.
16666
16667 -mmedium-calls
16668 Don't use less than 25-bit addressing range for calls, which is the
16669 offset available for an unconditional branch-and-link instruction.
16670 Conditional execution of function calls is suppressed, to allow use
16671 of the 25-bit range, rather than the 21-bit range with conditional
16672 branch-and-link. This is the default for tool chains built for
16673 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
16674
16675 -G num
16676 Put definitions of externally-visible data in a small data section
16677 if that data is no bigger than num bytes. The default value of num
16678 is 4 for any ARC configuration, or 8 when we have double load/store
16679 operations.
16680
16681 -mno-sdata
16682 Do not generate sdata references. This is the default for tool
16683 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
16684 targets.
16685
16686 -mvolatile-cache
16687 Use ordinarily cached memory accesses for volatile references.
16688 This is the default.
16689
16690 -mno-volatile-cache
16691 Enable cache bypass for volatile references.
16692
16693 The following options fine tune code generation:
16694
16695 -malign-call
16696 Do alignment optimizations for call instructions.
16697
16698 -mauto-modify-reg
16699 Enable the use of pre/post modify with register displacement.
16700
16701 -mbbit-peephole
16702 Enable bbit peephole2.
16703
16704 -mno-brcc
16705 This option disables a target-specific pass in arc_reorg to
16706 generate compare-and-branch ("brcc") instructions. It has no
16707 effect on generation of these instructions driven by the combiner
16708 pass.
16709
16710 -mcase-vector-pcrel
16711 Use PC-relative switch case tables to enable case table shortening.
16712 This is the default for -Os.
16713
16714 -mcompact-casesi
16715 Enable compact "casesi" pattern. This is the default for -Os, and
16716 only available for ARCv1 cores. This option is deprecated.
16717
16718 -mno-cond-exec
16719 Disable the ARCompact-specific pass to generate conditional
16720 execution instructions.
16721
16722 Due to delay slot scheduling and interactions between operand
16723 numbers, literal sizes, instruction lengths, and the support for
16724 conditional execution, the target-independent pass to generate
16725 conditional execution is often lacking, so the ARC port has kept a
16726 special pass around that tries to find more conditional execution
16727 generation opportunities after register allocation, branch
16728 shortening, and delay slot scheduling have been done. This pass
16729 generally, but not always, improves performance and code size, at
16730 the cost of extra compilation time, which is why there is an option
16731 to switch it off. If you have a problem with call instructions
16732 exceeding their allowable offset range because they are
16733 conditionalized, you should consider using -mmedium-calls instead.
16734
16735 -mearly-cbranchsi
16736 Enable pre-reload use of the "cbranchsi" pattern.
16737
16738 -mexpand-adddi
16739 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
16740 "adc" etc. This option is deprecated.
16741
16742 -mindexed-loads
16743 Enable the use of indexed loads. This can be problematic because
16744 some optimizers then assume that indexed stores exist, which is not
16745 the case.
16746
16747 -mlra
16748 Enable Local Register Allocation. This is still experimental for
16749 ARC, so by default the compiler uses standard reload (i.e.
16750 -mno-lra).
16751
16752 -mlra-priority-none
16753 Don't indicate any priority for target registers.
16754
16755 -mlra-priority-compact
16756 Indicate target register priority for r0..r3 / r12..r15.
16757
16758 -mlra-priority-noncompact
16759 Reduce target register priority for r0..r3 / r12..r15.
16760
16761 -mmillicode
16762 When optimizing for size (using -Os), prologues and epilogues that
16763 have to save or restore a large number of registers are often
16764 shortened by using call to a special function in libgcc; this is
16765 referred to as a millicode call. As these calls can pose
16766 performance issues, and/or cause linking issues when linking in a
16767 nonstandard way, this option is provided to turn on or off
16768 millicode call generation.
16769
16770 -mcode-density-frame
16771 This option enable the compiler to emit "enter" and "leave"
16772 instructions. These instructions are only valid for CPUs with
16773 code-density feature.
16774
16775 -mmixed-code
16776 Tweak register allocation to help 16-bit instruction generation.
16777 This generally has the effect of decreasing the average instruction
16778 size while increasing the instruction count.
16779
16780 -mq-class
16781 Ths option is deprecated. Enable q instruction alternatives. This
16782 is the default for -Os.
16783
16784 -mRcq
16785 Enable Rcq constraint handling. Most short code generation depends
16786 on this. This is the default.
16787
16788 -mRcw
16789 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
16790 on this. This is the default.
16791
16792 -msize-level=level
16793 Fine-tune size optimization with regards to instruction lengths and
16794 alignment. The recognized values for level are:
16795
16796 0 No size optimization. This level is deprecated and treated
16797 like 1.
16798
16799 1 Short instructions are used opportunistically.
16800
16801 2 In addition, alignment of loops and of code after barriers are
16802 dropped.
16803
16804 3 In addition, optional data alignment is dropped, and the option
16805 Os is enabled.
16806
16807 This defaults to 3 when -Os is in effect. Otherwise, the behavior
16808 when this is not set is equivalent to level 1.
16809
16810 -mtune=cpu
16811 Set instruction scheduling parameters for cpu, overriding any
16812 implied by -mcpu=.
16813
16814 Supported values for cpu are
16815
16816 ARC600
16817 Tune for ARC600 CPU.
16818
16819 ARC601
16820 Tune for ARC601 CPU.
16821
16822 ARC700
16823 Tune for ARC700 CPU with standard multiplier block.
16824
16825 ARC700-xmac
16826 Tune for ARC700 CPU with XMAC block.
16827
16828 ARC725D
16829 Tune for ARC725D CPU.
16830
16831 ARC750D
16832 Tune for ARC750D CPU.
16833
16834 -mmultcost=num
16835 Cost to assume for a multiply instruction, with 4 being equal to a
16836 normal instruction.
16837
16838 -munalign-prob-threshold=probability
16839 Set probability threshold for unaligning branches. When tuning for
16840 ARC700 and optimizing for speed, branches without filled delay slot
16841 are preferably emitted unaligned and long, unless profiling
16842 indicates that the probability for the branch to be taken is below
16843 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
16844
16845 The following options are maintained for backward compatibility, but
16846 are now deprecated and will be removed in a future release:
16847
16848 -margonaut
16849 Obsolete FPX.
16850
16851 -mbig-endian
16852 -EB Compile code for big-endian targets. Use of these options is now
16853 deprecated. Big-endian code is supported by configuring GCC to
16854 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
16855 endian is the default.
16856
16857 -mlittle-endian
16858 -EL Compile code for little-endian targets. Use of these options is
16859 now deprecated. Little-endian code is supported by configuring GCC
16860 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
16861 little endian is the default.
16862
16863 -mbarrel_shifter
16864 Replaced by -mbarrel-shifter.
16865
16866 -mdpfp_compact
16867 Replaced by -mdpfp-compact.
16868
16869 -mdpfp_fast
16870 Replaced by -mdpfp-fast.
16871
16872 -mdsp_packa
16873 Replaced by -mdsp-packa.
16874
16875 -mEA
16876 Replaced by -mea.
16877
16878 -mmac_24
16879 Replaced by -mmac-24.
16880
16881 -mmac_d16
16882 Replaced by -mmac-d16.
16883
16884 -mspfp_compact
16885 Replaced by -mspfp-compact.
16886
16887 -mspfp_fast
16888 Replaced by -mspfp-fast.
16889
16890 -mtune=cpu
16891 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
16892 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
16893
16894 -multcost=num
16895 Replaced by -mmultcost.
16896
16897 ARM Options
16898
16899 These -m options are defined for the ARM port:
16900
16901 -mabi=name
16902 Generate code for the specified ABI. Permissible values are: apcs-
16903 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
16904
16905 -mapcs-frame
16906 Generate a stack frame that is compliant with the ARM Procedure
16907 Call Standard for all functions, even if this is not strictly
16908 necessary for correct execution of the code. Specifying
16909 -fomit-frame-pointer with this option causes the stack frames not
16910 to be generated for leaf functions. The default is
16911 -mno-apcs-frame. This option is deprecated.
16912
16913 -mapcs
16914 This is a synonym for -mapcs-frame and is deprecated.
16915
16916 -mthumb-interwork
16917 Generate code that supports calling between the ARM and Thumb
16918 instruction sets. Without this option, on pre-v5 architectures,
16919 the two instruction sets cannot be reliably used inside one
16920 program. The default is -mno-thumb-interwork, since slightly
16921 larger code is generated when -mthumb-interwork is specified. In
16922 AAPCS configurations this option is meaningless.
16923
16924 -mno-sched-prolog
16925 Prevent the reordering of instructions in the function prologue, or
16926 the merging of those instruction with the instructions in the
16927 function's body. This means that all functions start with a
16928 recognizable set of instructions (or in fact one of a choice from a
16929 small set of different function prologues), and this information
16930 can be used to locate the start of functions inside an executable
16931 piece of code. The default is -msched-prolog.
16932
16933 -mfloat-abi=name
16934 Specifies which floating-point ABI to use. Permissible values are:
16935 soft, softfp and hard.
16936
16937 Specifying soft causes GCC to generate output containing library
16938 calls for floating-point operations. softfp allows the generation
16939 of code using hardware floating-point instructions, but still uses
16940 the soft-float calling conventions. hard allows generation of
16941 floating-point instructions and uses FPU-specific calling
16942 conventions.
16943
16944 The default depends on the specific target configuration. Note
16945 that the hard-float and soft-float ABIs are not link-compatible;
16946 you must compile your entire program with the same ABI, and link
16947 with a compatible set of libraries.
16948
16949 -mgeneral-regs-only
16950 Generate code which uses only the general-purpose registers. This
16951 will prevent the compiler from using floating-point and Advanced
16952 SIMD registers but will not impose any restrictions on the
16953 assembler.
16954
16955 -mlittle-endian
16956 Generate code for a processor running in little-endian mode. This
16957 is the default for all standard configurations.
16958
16959 -mbig-endian
16960 Generate code for a processor running in big-endian mode; the
16961 default is to compile code for a little-endian processor.
16962
16963 -mbe8
16964 -mbe32
16965 When linking a big-endian image select between BE8 and BE32
16966 formats. The option has no effect for little-endian images and is
16967 ignored. The default is dependent on the selected target
16968 architecture. For ARMv6 and later architectures the default is
16969 BE8, for older architectures the default is BE32. BE32 format has
16970 been deprecated by ARM.
16971
16972 -march=name[+extension...]
16973 This specifies the name of the target ARM architecture. GCC uses
16974 this name to determine what kind of instructions it can emit when
16975 generating assembly code. This option can be used in conjunction
16976 with or instead of the -mcpu= option.
16977
16978 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
16979 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
16980 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
16981 armv8.6-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
16982 armv8-m.base, armv8-m.main, armv8.1-m.main, iwmmxt and iwmmxt2.
16983
16984 Additionally, the following architectures, which lack support for
16985 the Thumb execution state, are recognized but support is
16986 deprecated: armv4.
16987
16988 Many of the architectures support extensions. These can be added
16989 by appending +extension to the architecture name. Extension
16990 options are processed in order and capabilities accumulate. An
16991 extension will also enable any necessary base extensions upon which
16992 it depends. For example, the +crypto extension will always enable
16993 the +simd extension. The exception to the additive construction is
16994 for extensions that are prefixed with +no...: these extensions
16995 disable the specified option and any other extensions that may
16996 depend on the presence of that extension.
16997
16998 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
16999 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17000 disabled by the +nofp option that follows it.
17001
17002 Most extension names are generically named, but have an effect that
17003 is dependent upon the architecture to which it is applied. For
17004 example, the +simd option can be applied to both armv7-a and
17005 armv8-a architectures, but will enable the original ARMv7-A
17006 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17007 for armv8-a.
17008
17009 The table below lists the supported extensions for each
17010 architecture. Architectures not mentioned do not support any
17011 extensions.
17012
17013 armv5te
17014 armv6
17015 armv6j
17016 armv6k
17017 armv6kz
17018 armv6t2
17019 armv6z
17020 armv6zk
17021 +fp The VFPv2 floating-point instructions. The extension
17022 +vfpv2 can be used as an alias for this extension.
17023
17024 +nofp
17025 Disable the floating-point instructions.
17026
17027 armv7
17028 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17029 architectures.
17030
17031 +fp The VFPv3 floating-point instructions, with 16 double-
17032 precision registers. The extension +vfpv3-d16 can be used
17033 as an alias for this extension. Note that floating-point
17034 is not supported by the base ARMv7-M architecture, but is
17035 compatible with both the ARMv7-A and ARMv7-R architectures.
17036
17037 +nofp
17038 Disable the floating-point instructions.
17039
17040 armv7-a
17041 +mp The multiprocessing extension.
17042
17043 +sec
17044 The security extension.
17045
17046 +fp The VFPv3 floating-point instructions, with 16 double-
17047 precision registers. The extension +vfpv3-d16 can be used
17048 as an alias for this extension.
17049
17050 +simd
17051 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17052 instructions. The extensions +neon and +neon-vfpv3 can be
17053 used as aliases for this extension.
17054
17055 +vfpv3
17056 The VFPv3 floating-point instructions, with 32 double-
17057 precision registers.
17058
17059 +vfpv3-d16-fp16
17060 The VFPv3 floating-point instructions, with 16 double-
17061 precision registers and the half-precision floating-point
17062 conversion operations.
17063
17064 +vfpv3-fp16
17065 The VFPv3 floating-point instructions, with 32 double-
17066 precision registers and the half-precision floating-point
17067 conversion operations.
17068
17069 +vfpv4-d16
17070 The VFPv4 floating-point instructions, with 16 double-
17071 precision registers.
17072
17073 +vfpv4
17074 The VFPv4 floating-point instructions, with 32 double-
17075 precision registers.
17076
17077 +neon-fp16
17078 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17079 instructions, with the half-precision floating-point
17080 conversion operations.
17081
17082 +neon-vfpv4
17083 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17084 instructions.
17085
17086 +nosimd
17087 Disable the Advanced SIMD instructions (does not disable
17088 floating point).
17089
17090 +nofp
17091 Disable the floating-point and Advanced SIMD instructions.
17092
17093 armv7ve
17094 The extended version of the ARMv7-A architecture with support
17095 for virtualization.
17096
17097 +fp The VFPv4 floating-point instructions, with 16 double-
17098 precision registers. The extension +vfpv4-d16 can be used
17099 as an alias for this extension.
17100
17101 +simd
17102 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17103 instructions. The extension +neon-vfpv4 can be used as an
17104 alias for this extension.
17105
17106 +vfpv3-d16
17107 The VFPv3 floating-point instructions, with 16 double-
17108 precision registers.
17109
17110 +vfpv3
17111 The VFPv3 floating-point instructions, with 32 double-
17112 precision registers.
17113
17114 +vfpv3-d16-fp16
17115 The VFPv3 floating-point instructions, with 16 double-
17116 precision registers and the half-precision floating-point
17117 conversion operations.
17118
17119 +vfpv3-fp16
17120 The VFPv3 floating-point instructions, with 32 double-
17121 precision registers and the half-precision floating-point
17122 conversion operations.
17123
17124 +vfpv4-d16
17125 The VFPv4 floating-point instructions, with 16 double-
17126 precision registers.
17127
17128 +vfpv4
17129 The VFPv4 floating-point instructions, with 32 double-
17130 precision registers.
17131
17132 +neon
17133 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17134 instructions. The extension +neon-vfpv3 can be used as an
17135 alias for this extension.
17136
17137 +neon-fp16
17138 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17139 instructions, with the half-precision floating-point
17140 conversion operations.
17141
17142 +nosimd
17143 Disable the Advanced SIMD instructions (does not disable
17144 floating point).
17145
17146 +nofp
17147 Disable the floating-point and Advanced SIMD instructions.
17148
17149 armv8-a
17150 +crc
17151 The Cyclic Redundancy Check (CRC) instructions.
17152
17153 +simd
17154 The ARMv8-A Advanced SIMD and floating-point instructions.
17155
17156 +crypto
17157 The cryptographic instructions.
17158
17159 +nocrypto
17160 Disable the cryptographic instructions.
17161
17162 +nofp
17163 Disable the floating-point, Advanced SIMD and cryptographic
17164 instructions.
17165
17166 +sb Speculation Barrier Instruction.
17167
17168 +predres
17169 Execution and Data Prediction Restriction Instructions.
17170
17171 armv8.1-a
17172 +simd
17173 The ARMv8.1-A Advanced SIMD and floating-point
17174 instructions.
17175
17176 +crypto
17177 The cryptographic instructions. This also enables the
17178 Advanced SIMD and floating-point instructions.
17179
17180 +nocrypto
17181 Disable the cryptographic instructions.
17182
17183 +nofp
17184 Disable the floating-point, Advanced SIMD and cryptographic
17185 instructions.
17186
17187 +sb Speculation Barrier Instruction.
17188
17189 +predres
17190 Execution and Data Prediction Restriction Instructions.
17191
17192 armv8.2-a
17193 armv8.3-a
17194 +fp16
17195 The half-precision floating-point data processing
17196 instructions. This also enables the Advanced SIMD and
17197 floating-point instructions.
17198
17199 +fp16fml
17200 The half-precision floating-point fmla extension. This
17201 also enables the half-precision floating-point extension
17202 and Advanced SIMD and floating-point instructions.
17203
17204 +simd
17205 The ARMv8.1-A Advanced SIMD and floating-point
17206 instructions.
17207
17208 +crypto
17209 The cryptographic instructions. This also enables the
17210 Advanced SIMD and floating-point instructions.
17211
17212 +dotprod
17213 Enable the Dot Product extension. This also enables
17214 Advanced SIMD instructions.
17215
17216 +nocrypto
17217 Disable the cryptographic extension.
17218
17219 +nofp
17220 Disable the floating-point, Advanced SIMD and cryptographic
17221 instructions.
17222
17223 +sb Speculation Barrier Instruction.
17224
17225 +predres
17226 Execution and Data Prediction Restriction Instructions.
17227
17228 +i8mm
17229 8-bit Integer Matrix Multiply instructions. This also
17230 enables Advanced SIMD and floating-point instructions.
17231
17232 +bf16
17233 Brain half-precision floating-point instructions. This
17234 also enables Advanced SIMD and floating-point instructions.
17235
17236 armv8.4-a
17237 +fp16
17238 The half-precision floating-point data processing
17239 instructions. This also enables the Advanced SIMD and
17240 floating-point instructions as well as the Dot Product
17241 extension and the half-precision floating-point fmla
17242 extension.
17243
17244 +simd
17245 The ARMv8.3-A Advanced SIMD and floating-point instructions
17246 as well as the Dot Product extension.
17247
17248 +crypto
17249 The cryptographic instructions. This also enables the
17250 Advanced SIMD and floating-point instructions as well as
17251 the Dot Product extension.
17252
17253 +nocrypto
17254 Disable the cryptographic extension.
17255
17256 +nofp
17257 Disable the floating-point, Advanced SIMD and cryptographic
17258 instructions.
17259
17260 +sb Speculation Barrier Instruction.
17261
17262 +predres
17263 Execution and Data Prediction Restriction Instructions.
17264
17265 +i8mm
17266 8-bit Integer Matrix Multiply instructions. This also
17267 enables Advanced SIMD and floating-point instructions.
17268
17269 +bf16
17270 Brain half-precision floating-point instructions. This
17271 also enables Advanced SIMD and floating-point instructions.
17272
17273 armv8.5-a
17274 +fp16
17275 The half-precision floating-point data processing
17276 instructions. This also enables the Advanced SIMD and
17277 floating-point instructions as well as the Dot Product
17278 extension and the half-precision floating-point fmla
17279 extension.
17280
17281 +simd
17282 The ARMv8.3-A Advanced SIMD and floating-point instructions
17283 as well as the Dot Product extension.
17284
17285 +crypto
17286 The cryptographic instructions. This also enables the
17287 Advanced SIMD and floating-point instructions as well as
17288 the Dot Product extension.
17289
17290 +nocrypto
17291 Disable the cryptographic extension.
17292
17293 +nofp
17294 Disable the floating-point, Advanced SIMD and cryptographic
17295 instructions.
17296
17297 +i8mm
17298 8-bit Integer Matrix Multiply instructions. This also
17299 enables Advanced SIMD and floating-point instructions.
17300
17301 +bf16
17302 Brain half-precision floating-point instructions. This
17303 also enables Advanced SIMD and floating-point instructions.
17304
17305 armv8.6-a
17306 +fp16
17307 The half-precision floating-point data processing
17308 instructions. This also enables the Advanced SIMD and
17309 floating-point instructions as well as the Dot Product
17310 extension and the half-precision floating-point fmla
17311 extension.
17312
17313 +simd
17314 The ARMv8.3-A Advanced SIMD and floating-point instructions
17315 as well as the Dot Product extension.
17316
17317 +crypto
17318 The cryptographic instructions. This also enables the
17319 Advanced SIMD and floating-point instructions as well as
17320 the Dot Product extension.
17321
17322 +nocrypto
17323 Disable the cryptographic extension.
17324
17325 +nofp
17326 Disable the floating-point, Advanced SIMD and cryptographic
17327 instructions.
17328
17329 +i8mm
17330 8-bit Integer Matrix Multiply instructions. This also
17331 enables Advanced SIMD and floating-point instructions.
17332
17333 +bf16
17334 Brain half-precision floating-point instructions. This
17335 also enables Advanced SIMD and floating-point instructions.
17336
17337 armv7-r
17338 +fp.sp
17339 The single-precision VFPv3 floating-point instructions.
17340 The extension +vfpv3xd can be used as an alias for this
17341 extension.
17342
17343 +fp The VFPv3 floating-point instructions with 16 double-
17344 precision registers. The extension +vfpv3-d16 can be used
17345 as an alias for this extension.
17346
17347 +vfpv3xd-d16-fp16
17348 The single-precision VFPv3 floating-point instructions with
17349 16 double-precision registers and the half-precision
17350 floating-point conversion operations.
17351
17352 +vfpv3-d16-fp16
17353 The VFPv3 floating-point instructions with 16 double-
17354 precision registers and the half-precision floating-point
17355 conversion operations.
17356
17357 +nofp
17358 Disable the floating-point extension.
17359
17360 +idiv
17361 The ARM-state integer division instructions.
17362
17363 +noidiv
17364 Disable the ARM-state integer division extension.
17365
17366 armv7e-m
17367 +fp The single-precision VFPv4 floating-point instructions.
17368
17369 +fpv5
17370 The single-precision FPv5 floating-point instructions.
17371
17372 +fp.dp
17373 The single- and double-precision FPv5 floating-point
17374 instructions.
17375
17376 +nofp
17377 Disable the floating-point extensions.
17378
17379 armv8.1-m.main
17380 +dsp
17381 The DSP instructions.
17382
17383 +mve
17384 The M-Profile Vector Extension (MVE) integer instructions.
17385
17386 +mve.fp
17387 The M-Profile Vector Extension (MVE) integer and single
17388 precision floating-point instructions.
17389
17390 +fp The single-precision floating-point instructions.
17391
17392 +fp.dp
17393 The single- and double-precision floating-point
17394 instructions.
17395
17396 +nofp
17397 Disable the floating-point extension.
17398
17399 +cdecp0, +cdecp1, ... , +cdecp7
17400 Enable the Custom Datapath Extension (CDE) on selected
17401 coprocessors according to the numbers given in the options
17402 in the range 0 to 7.
17403
17404 armv8-m.main
17405 +dsp
17406 The DSP instructions.
17407
17408 +nodsp
17409 Disable the DSP extension.
17410
17411 +fp The single-precision floating-point instructions.
17412
17413 +fp.dp
17414 The single- and double-precision floating-point
17415 instructions.
17416
17417 +nofp
17418 Disable the floating-point extension.
17419
17420 +cdecp0, +cdecp1, ... , +cdecp7
17421 Enable the Custom Datapath Extension (CDE) on selected
17422 coprocessors according to the numbers given in the options
17423 in the range 0 to 7.
17424
17425 armv8-r
17426 +crc
17427 The Cyclic Redundancy Check (CRC) instructions.
17428
17429 +fp.sp
17430 The single-precision FPv5 floating-point instructions.
17431
17432 +simd
17433 The ARMv8-A Advanced SIMD and floating-point instructions.
17434
17435 +crypto
17436 The cryptographic instructions.
17437
17438 +nocrypto
17439 Disable the cryptographic instructions.
17440
17441 +nofp
17442 Disable the floating-point, Advanced SIMD and cryptographic
17443 instructions.
17444
17445 -march=native causes the compiler to auto-detect the architecture
17446 of the build computer. At present, this feature is only supported
17447 on GNU/Linux, and not all architectures are recognized. If the
17448 auto-detect is unsuccessful the option has no effect.
17449
17450 -mtune=name
17451 This option specifies the name of the target ARM processor for
17452 which GCC should tune the performance of the code. For some ARM
17453 implementations better performance can be obtained by using this
17454 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
17455 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
17456 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
17457 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
17458 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
17459 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
17460 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
17461 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
17462 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
17463 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
17464 cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, cortex-a78,
17465 cortex-a78ae, cortex-a78c, ares, cortex-r4, cortex-r4f, cortex-r5,
17466 cortex-r7, cortex-r8, cortex-r52, cortex-m0, cortex-m0plus,
17467 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
17468 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
17469 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
17470 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
17471 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
17472 xgene1.
17473
17474 Additionally, this option can specify that GCC should tune the
17475 performance of the code for a big.LITTLE system. Permissible names
17476 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17477 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17478 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
17479 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
17480
17481 -mtune=generic-arch specifies that GCC should tune the performance
17482 for a blend of processors within architecture arch. The aim is to
17483 generate code that run well on the current most popular processors,
17484 balancing between optimizations that benefit some CPUs in the
17485 range, and avoiding performance pitfalls of other CPUs. The
17486 effects of this option may change in future GCC versions as CPU
17487 models come and go.
17488
17489 -mtune permits the same extension options as -mcpu, but the
17490 extension options do not affect the tuning of the generated code.
17491
17492 -mtune=native causes the compiler to auto-detect the CPU of the
17493 build computer. At present, this feature is only supported on
17494 GNU/Linux, and not all architectures are recognized. If the auto-
17495 detect is unsuccessful the option has no effect.
17496
17497 -mcpu=name[+extension...]
17498 This specifies the name of the target ARM processor. GCC uses this
17499 name to derive the name of the target ARM architecture (as if
17500 specified by -march) and the ARM processor type for which to tune
17501 for performance (as if specified by -mtune). Where this option is
17502 used in conjunction with -march or -mtune, those options take
17503 precedence over the appropriate part of this option.
17504
17505 Many of the supported CPUs implement optional architectural
17506 extensions. Where this is so the architectural extensions are
17507 normally enabled by default. If implementations that lack the
17508 extension exist, then the extension syntax can be used to disable
17509 those extensions that have been omitted. For floating-point and
17510 Advanced SIMD (Neon) instructions, the settings of the options
17511 -mfloat-abi and -mfpu must also be considered: floating-point and
17512 Advanced SIMD instructions will only be used if -mfloat-abi is not
17513 set to soft; and any setting of -mfpu other than auto will override
17514 the available floating-point and SIMD extension instructions.
17515
17516 For example, cortex-a9 can be found in three major configurations:
17517 integer only, with just a floating-point unit or with floating-
17518 point and Advanced SIMD. The default is to enable all the
17519 instructions, but the extensions +nosimd and +nofp can be used to
17520 disable just the SIMD or both the SIMD and floating-point
17521 instructions respectively.
17522
17523 Permissible names for this option are the same as those for -mtune.
17524
17525 The following extension options are common to the listed CPUs:
17526
17527 +nodsp
17528 Disable the DSP instructions on cortex-m33, cortex-m35p.
17529
17530 +nofp
17531 Disables the floating-point instructions on arm9e, arm946e-s,
17532 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
17533 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
17534 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
17535 point and SIMD instructions on generic-armv7-a, cortex-a5,
17536 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
17537 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
17538 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
17539
17540 +nofp.dp
17541 Disables the double-precision component of the floating-point
17542 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
17543 cortex-m7.
17544
17545 +nosimd
17546 Disables the SIMD (but not floating-point) instructions on
17547 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
17548
17549 +crypto
17550 Enables the cryptographic instructions on cortex-a32,
17551 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
17552 cortex-a73, cortex-a75, exynos-m1, xgene1,
17553 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17554 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
17555 cortex-a75.cortex-a55.
17556
17557 Additionally the generic-armv7-a pseudo target defaults to VFPv3
17558 with 16 double-precision registers. It supports the following
17559 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
17560 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
17561 neon-vfpv4. The meanings are the same as for the extensions to
17562 -march=armv7-a.
17563
17564 -mcpu=generic-arch is also permissible, and is equivalent to
17565 -march=arch -mtune=generic-arch. See -mtune for more information.
17566
17567 -mcpu=native causes the compiler to auto-detect the CPU of the
17568 build computer. At present, this feature is only supported on
17569 GNU/Linux, and not all architectures are recognized. If the auto-
17570 detect is unsuccessful the option has no effect.
17571
17572 -mfpu=name
17573 This specifies what floating-point hardware (or hardware emulation)
17574 is available on the target. Permissible names are: auto, vfpv2,
17575 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
17576 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
17577 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
17578 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
17579 and vfp is an alias for vfpv2.
17580
17581 The setting auto is the default and is special. It causes the
17582 compiler to select the floating-point and Advanced SIMD
17583 instructions based on the settings of -mcpu and -march.
17584
17585 If the selected floating-point hardware includes the NEON extension
17586 (e.g. -mfpu=neon), note that floating-point operations are not
17587 generated by GCC's auto-vectorization pass unless
17588 -funsafe-math-optimizations is also specified. This is because
17589 NEON hardware does not fully implement the IEEE 754 standard for
17590 floating-point arithmetic (in particular denormal values are
17591 treated as zero), so the use of NEON instructions may lead to a
17592 loss of precision.
17593
17594 You can also set the fpu name at function level by using the
17595 "target("fpu=")" function attributes or pragmas.
17596
17597 -mfp16-format=name
17598 Specify the format of the "__fp16" half-precision floating-point
17599 type. Permissible names are none, ieee, and alternative; the
17600 default is none, in which case the "__fp16" type is not defined.
17601
17602 -mstructure-size-boundary=n
17603 The sizes of all structures and unions are rounded up to a multiple
17604 of the number of bits set by this option. Permissible values are
17605 8, 32 and 64. The default value varies for different toolchains.
17606 For the COFF targeted toolchain the default value is 8. A value of
17607 64 is only allowed if the underlying ABI supports it.
17608
17609 Specifying a larger number can produce faster, more efficient code,
17610 but can also increase the size of the program. Different values
17611 are potentially incompatible. Code compiled with one value cannot
17612 necessarily expect to work with code or libraries compiled with
17613 another value, if they exchange information using structures or
17614 unions.
17615
17616 This option is deprecated.
17617
17618 -mabort-on-noreturn
17619 Generate a call to the function "abort" at the end of a "noreturn"
17620 function. It is executed if the function tries to return.
17621
17622 -mlong-calls
17623 -mno-long-calls
17624 Tells the compiler to perform function calls by first loading the
17625 address of the function into a register and then performing a
17626 subroutine call on this register. This switch is needed if the
17627 target function lies outside of the 64-megabyte addressing range of
17628 the offset-based version of subroutine call instruction.
17629
17630 Even if this switch is enabled, not all function calls are turned
17631 into long calls. The heuristic is that static functions, functions
17632 that have the "short_call" attribute, functions that are inside the
17633 scope of a "#pragma no_long_calls" directive, and functions whose
17634 definitions have already been compiled within the current
17635 compilation unit are not turned into long calls. The exceptions to
17636 this rule are that weak function definitions, functions with the
17637 "long_call" attribute or the "section" attribute, and functions
17638 that are within the scope of a "#pragma long_calls" directive are
17639 always turned into long calls.
17640
17641 This feature is not enabled by default. Specifying -mno-long-calls
17642 restores the default behavior, as does placing the function calls
17643 within the scope of a "#pragma long_calls_off" directive. Note
17644 these switches have no effect on how the compiler generates code to
17645 handle function calls via function pointers.
17646
17647 -msingle-pic-base
17648 Treat the register used for PIC addressing as read-only, rather
17649 than loading it in the prologue for each function. The runtime
17650 system is responsible for initializing this register with an
17651 appropriate value before execution begins.
17652
17653 -mpic-register=reg
17654 Specify the register to be used for PIC addressing. For standard
17655 PIC base case, the default is any suitable register determined by
17656 compiler. For single PIC base case, the default is R9 if target is
17657 EABI based or stack-checking is enabled, otherwise the default is
17658 R10.
17659
17660 -mpic-data-is-text-relative
17661 Assume that the displacement between the text and data segments is
17662 fixed at static link time. This permits using PC-relative
17663 addressing operations to access data known to be in the data
17664 segment. For non-VxWorks RTP targets, this option is enabled by
17665 default. When disabled on such targets, it will enable
17666 -msingle-pic-base by default.
17667
17668 -mpoke-function-name
17669 Write the name of each function into the text section, directly
17670 preceding the function prologue. The generated code is similar to
17671 this:
17672
17673 t0
17674 .ascii "arm_poke_function_name", 0
17675 .align
17676 t1
17677 .word 0xff000000 + (t1 - t0)
17678 arm_poke_function_name
17679 mov ip, sp
17680 stmfd sp!, {fp, ip, lr, pc}
17681 sub fp, ip, #4
17682
17683 When performing a stack backtrace, code can inspect the value of
17684 "pc" stored at "fp + 0". If the trace function then looks at
17685 location "pc - 12" and the top 8 bits are set, then we know that
17686 there is a function name embedded immediately preceding this
17687 location and has length "((pc[-3]) & 0xff000000)".
17688
17689 -mthumb
17690 -marm
17691 Select between generating code that executes in ARM and Thumb
17692 states. The default for most configurations is to generate code
17693 that executes in ARM state, but the default can be changed by
17694 configuring GCC with the --with-mode=state configure option.
17695
17696 You can also override the ARM and Thumb mode for each function by
17697 using the "target("thumb")" and "target("arm")" function attributes
17698 or pragmas.
17699
17700 -mflip-thumb
17701 Switch ARM/Thumb modes on alternating functions. This option is
17702 provided for regression testing of mixed Thumb/ARM code generation,
17703 and is not intended for ordinary use in compiling code.
17704
17705 -mtpcs-frame
17706 Generate a stack frame that is compliant with the Thumb Procedure
17707 Call Standard for all non-leaf functions. (A leaf function is one
17708 that does not call any other functions.) The default is
17709 -mno-tpcs-frame.
17710
17711 -mtpcs-leaf-frame
17712 Generate a stack frame that is compliant with the Thumb Procedure
17713 Call Standard for all leaf functions. (A leaf function is one that
17714 does not call any other functions.) The default is
17715 -mno-apcs-leaf-frame.
17716
17717 -mcallee-super-interworking
17718 Gives all externally visible functions in the file being compiled
17719 an ARM instruction set header which switches to Thumb mode before
17720 executing the rest of the function. This allows these functions to
17721 be called from non-interworking code. This option is not valid in
17722 AAPCS configurations because interworking is enabled by default.
17723
17724 -mcaller-super-interworking
17725 Allows calls via function pointers (including virtual functions) to
17726 execute correctly regardless of whether the target code has been
17727 compiled for interworking or not. There is a small overhead in the
17728 cost of executing a function pointer if this option is enabled.
17729 This option is not valid in AAPCS configurations because
17730 interworking is enabled by default.
17731
17732 -mtp=name
17733 Specify the access model for the thread local storage pointer. The
17734 valid models are soft, which generates calls to "__aeabi_read_tp",
17735 cp15, which fetches the thread pointer from "cp15" directly
17736 (supported in the arm6k architecture), and auto, which uses the
17737 best available method for the selected processor. The default
17738 setting is auto.
17739
17740 -mtls-dialect=dialect
17741 Specify the dialect to use for accessing thread local storage. Two
17742 dialects are supported---gnu and gnu2. The gnu dialect selects the
17743 original GNU scheme for supporting local and global dynamic TLS
17744 models. The gnu2 dialect selects the GNU descriptor scheme, which
17745 provides better performance for shared libraries. The GNU
17746 descriptor scheme is compatible with the original scheme, but does
17747 require new assembler, linker and library support. Initial and
17748 local exec TLS models are unaffected by this option and always use
17749 the original scheme.
17750
17751 -mword-relocations
17752 Only generate absolute relocations on word-sized values (i.e.
17753 R_ARM_ABS32). This is enabled by default on targets (uClinux,
17754 SymbianOS) where the runtime loader imposes this restriction, and
17755 when -fpic or -fPIC is specified. This option conflicts with
17756 -mslow-flash-data.
17757
17758 -mfix-cortex-m3-ldrd
17759 Some Cortex-M3 cores can cause data corruption when "ldrd"
17760 instructions with overlapping destination and base registers are
17761 used. This option avoids generating these instructions. This
17762 option is enabled by default when -mcpu=cortex-m3 is specified.
17763
17764 -munaligned-access
17765 -mno-unaligned-access
17766 Enables (or disables) reading and writing of 16- and 32- bit values
17767 from addresses that are not 16- or 32- bit aligned. By default
17768 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17769 ARMv8-M Baseline architectures, and enabled for all other
17770 architectures. If unaligned access is not enabled then words in
17771 packed data structures are accessed a byte at a time.
17772
17773 The ARM attribute "Tag_CPU_unaligned_access" is set in the
17774 generated object file to either true or false, depending upon the
17775 setting of this option. If unaligned access is enabled then the
17776 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
17777
17778 -mneon-for-64bits
17779 This option is deprecated and has no effect.
17780
17781 -mslow-flash-data
17782 Assume loading data from flash is slower than fetching instruction.
17783 Therefore literal load is minimized for better performance. This
17784 option is only supported when compiling for ARMv7 M-profile and off
17785 by default. It conflicts with -mword-relocations.
17786
17787 -masm-syntax-unified
17788 Assume inline assembler is using unified asm syntax. The default
17789 is currently off which implies divided syntax. This option has no
17790 impact on Thumb2. However, this may change in future releases of
17791 GCC. Divided syntax should be considered deprecated.
17792
17793 -mrestrict-it
17794 Restricts generation of IT blocks to conform to the rules of
17795 ARMv8-A. IT blocks can only contain a single 16-bit instruction
17796 from a select set of instructions. This option is on by default for
17797 ARMv8-A Thumb mode.
17798
17799 -mprint-tune-info
17800 Print CPU tuning information as comment in assembler file. This is
17801 an option used only for regression testing of the compiler and not
17802 intended for ordinary use in compiling code. This option is
17803 disabled by default.
17804
17805 -mverbose-cost-dump
17806 Enable verbose cost model dumping in the debug dump files. This
17807 option is provided for use in debugging the compiler.
17808
17809 -mpure-code
17810 Do not allow constant data to be placed in code sections.
17811 Additionally, when compiling for ELF object format give all text
17812 sections the ELF processor-specific section attribute
17813 "SHF_ARM_PURECODE". This option is only available when generating
17814 non-pic code for M-profile targets.
17815
17816 -mcmse
17817 Generate secure code as per the "ARMv8-M Security Extensions:
17818 Requirements on Development Tools Engineering Specification", which
17819 can be found on
17820 <https://developer.arm.com/documentation/ecm0359818/latest/>.
17821
17822 -mfdpic
17823 -mno-fdpic
17824 Select the FDPIC ABI, which uses 64-bit function descriptors to
17825 represent pointers to functions. When the compiler is configured
17826 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
17827 and implies -fPIE if none of the PIC/PIE-related options is
17828 provided. On other targets, it only enables the FDPIC-specific
17829 code generation features, and the user should explicitly provide
17830 the PIC/PIE-related options as needed.
17831
17832 Note that static linking is not supported because it would still
17833 involve the dynamic linker when the program self-relocates. If
17834 such behavior is acceptable, use -static and -Wl,-dynamic-linker
17835 options.
17836
17837 The opposite -mno-fdpic option is useful (and required) to build
17838 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
17839 toolchain as the one used to build the userland programs.
17840
17841 AVR Options
17842
17843 These options are defined for AVR implementations:
17844
17845 -mmcu=mcu
17846 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17847
17848 The default for this option is avr2.
17849
17850 GCC supports the following AVR devices and ISAs:
17851
17852 "avr2"
17853 "Classic" devices with up to 8 KiB of program memory. mcu =
17854 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
17855 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
17856 "at90c8534", "at90s8515", "at90s8535".
17857
17858 "avr25"
17859 "Classic" devices with up to 8 KiB of program memory and with
17860 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
17861 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
17862 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
17863 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
17864 "attiny461a", "attiny4313", "attiny84", "attiny84a",
17865 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
17866 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
17867
17868 "avr3"
17869 "Classic" devices with 16 KiB up to 64 KiB of program memory.
17870 mcu = "at76c711", "at43usb355".
17871
17872 "avr31"
17873 "Classic" devices with 128 KiB of program memory. mcu =
17874 "atmega103", "at43usb320".
17875
17876 "avr35"
17877 "Classic" devices with 16 KiB up to 64 KiB of program memory
17878 and with the "MOVW" instruction. mcu = "attiny167",
17879 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
17880 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
17881
17882 "avr4"
17883 "Enhanced" devices with up to 8 KiB of program memory. mcu =
17884 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
17885 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
17886 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
17887 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
17888 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
17889 "at90pwm3b", "at90pwm81".
17890
17891 "avr5"
17892 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
17893 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
17894 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
17895 "atmega161", "atmega162", "atmega163", "atmega164a",
17896 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
17897 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
17898 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
17899 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
17900 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
17901 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
17902 "atmega324a", "atmega324p", "atmega324pa", "atmega325",
17903 "atmega325a", "atmega325p", "atmega325pa", "atmega328",
17904 "atmega328p", "atmega328pb", "atmega329", "atmega329a",
17905 "atmega329p", "atmega329pa", "atmega3250", "atmega3250a",
17906 "atmega3250p", "atmega3250pa", "atmega3290", "atmega3290a",
17907 "atmega3290p", "atmega3290pa", "atmega406", "atmega64",
17908 "atmega64a", "atmega64c1", "atmega64hve", "atmega64hve2",
17909 "atmega64m1", "atmega64rfr2", "atmega640", "atmega644",
17910 "atmega644a", "atmega644p", "atmega644pa", "atmega644rfr2",
17911 "atmega645", "atmega645a", "atmega645p", "atmega649",
17912 "atmega649a", "atmega649p", "atmega6450", "atmega6450a",
17913 "atmega6450p", "atmega6490", "atmega6490a", "atmega6490p",
17914 "ata5795", "ata5790", "ata5790n", "ata5791", "ata6613c",
17915 "ata6614q", "ata5782", "ata5831", "ata8210", "ata8510",
17916 "ata5702m322", "at90pwm161", "at90pwm216", "at90pwm316",
17917 "at90can32", "at90can64", "at90scr100", "at90usb646",
17918 "at90usb647", "at94k", "m3000".
17919
17920 "avr51"
17921 "Enhanced" devices with 128 KiB of program memory. mcu =
17922 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
17923 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
17924 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
17925
17926 "avr6"
17927 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
17928 of program memory. mcu = "atmega256rfr2", "atmega2560",
17929 "atmega2561", "atmega2564rfr2".
17930
17931 "avrxmega2"
17932 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
17933 program memory. mcu = "atxmega8e5", "atxmega16a4",
17934 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
17935 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
17936 "atxmega32d3", "atxmega32d4", "atxmega32e5".
17937
17938 "avrxmega3"
17939 "XMEGA" devices with up to 64 KiB of combined program memory
17940 and RAM, and with program memory visible in the RAM address
17941 space. mcu = "attiny202", "attiny204", "attiny212",
17942 "attiny214", "attiny402", "attiny404", "attiny406",
17943 "attiny412", "attiny414", "attiny416", "attiny417",
17944 "attiny804", "attiny806", "attiny807", "attiny814",
17945 "attiny816", "attiny817", "attiny1604", "attiny1606",
17946 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
17947 "attiny3214", "attiny3216", "attiny3217", "atmega808",
17948 "atmega809", "atmega1608", "atmega1609", "atmega3208",
17949 "atmega3209", "atmega4808", "atmega4809".
17950
17951 "avrxmega4"
17952 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
17953 program memory. mcu = "atxmega64a3", "atxmega64a3u",
17954 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
17955 "atxmega64d3", "atxmega64d4".
17956
17957 "avrxmega5"
17958 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
17959 program memory and more than 64 KiB of RAM. mcu =
17960 "atxmega64a1", "atxmega64a1u".
17961
17962 "avrxmega6"
17963 "XMEGA" devices with more than 128 KiB of program memory. mcu
17964 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
17965 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
17966 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
17967 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
17968 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
17969 "atxmega256d3", "atxmega384c3", "atxmega384d3".
17970
17971 "avrxmega7"
17972 "XMEGA" devices with more than 128 KiB of program memory and
17973 more than 64 KiB of RAM. mcu = "atxmega128a1",
17974 "atxmega128a1u", "atxmega128a4u".
17975
17976 "avrtiny"
17977 "TINY" Tiny core devices with 512 B up to 4 KiB of program
17978 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
17979 "attiny20", "attiny40".
17980
17981 "avr1"
17982 This ISA is implemented by the minimal AVR core and supported
17983 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
17984 "attiny28", "at90s1200".
17985
17986 -mabsdata
17987 Assume that all data in static storage can be accessed by LDS / STS
17988 instructions. This option has only an effect on reduced Tiny
17989 devices like ATtiny40. See also the "absdata" AVR Variable
17990 Attributes,variable attribute.
17991
17992 -maccumulate-args
17993 Accumulate outgoing function arguments and acquire/release the
17994 needed stack space for outgoing function arguments once in function
17995 prologue/epilogue. Without this option, outgoing arguments are
17996 pushed before calling a function and popped afterwards.
17997
17998 Popping the arguments after the function call can be expensive on
17999 AVR so that accumulating the stack space might lead to smaller
18000 executables because arguments need not be removed from the stack
18001 after such a function call.
18002
18003 This option can lead to reduced code size for functions that
18004 perform several calls to functions that get their arguments on the
18005 stack like calls to printf-like functions.
18006
18007 -mbranch-cost=cost
18008 Set the branch costs for conditional branch instructions to cost.
18009 Reasonable values for cost are small, non-negative integers. The
18010 default branch cost is 0.
18011
18012 -mcall-prologues
18013 Functions prologues/epilogues are expanded as calls to appropriate
18014 subroutines. Code size is smaller.
18015
18016 -mdouble=bits
18017 -mlong-double=bits
18018 Set the size (in bits) of the "double" or "long double" type,
18019 respectively. Possible values for bits are 32 and 64. Whether or
18020 not a specific value for bits is allowed depends on the
18021 "--with-double=" and "--with-long-double=" configure options
18022 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18023 applies for the default values of the options.
18024
18025 -mgas-isr-prologues
18026 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18027 instruction supported by GNU Binutils. If this option is on, the
18028 feature can still be disabled for individual ISRs by means of the
18029 AVR Function Attributes,,"no_gccisr" function attribute. This
18030 feature is activated per default if optimization is on (but not
18031 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18032 PR21683 ("https://sourceware.org/PR21683").
18033
18034 -mint8
18035 Assume "int" to be 8-bit integer. This affects the sizes of all
18036 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18037 and "long long" is 4 bytes. Please note that this option does not
18038 conform to the C standards, but it results in smaller code size.
18039
18040 -mmain-is-OS_task
18041 Do not save registers in "main". The effect is the same like
18042 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18043 It is activated per default if optimization is on.
18044
18045 -mn-flash=num
18046 Assume that the flash memory has a size of num times 64 KiB.
18047
18048 -mno-interrupts
18049 Generated code is not compatible with hardware interrupts. Code
18050 size is smaller.
18051
18052 -mrelax
18053 Try to replace "CALL" resp. "JMP" instruction by the shorter
18054 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18055 just adds the --mlink-relax option to the assembler's command line
18056 and the --relax option to the linker's command line.
18057
18058 Jump relaxing is performed by the linker because jump offsets are
18059 not known before code is located. Therefore, the assembler code
18060 generated by the compiler is the same, but the instructions in the
18061 executable may differ from instructions in the assembler code.
18062
18063 Relaxing must be turned on if linker stubs are needed, see the
18064 section on "EIND" and linker stubs below.
18065
18066 -mrmw
18067 Assume that the device supports the Read-Modify-Write instructions
18068 "XCH", "LAC", "LAS" and "LAT".
18069
18070 -mshort-calls
18071 Assume that "RJMP" and "RCALL" can target the whole program memory.
18072
18073 This option is used internally for multilib selection. It is not
18074 an optimization option, and you don't need to set it by hand.
18075
18076 -msp8
18077 Treat the stack pointer register as an 8-bit register, i.e. assume
18078 the high byte of the stack pointer is zero. In general, you don't
18079 need to set this option by hand.
18080
18081 This option is used internally by the compiler to select and build
18082 multilibs for architectures "avr2" and "avr25". These
18083 architectures mix devices with and without "SPH". For any setting
18084 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
18085 removes this option from the compiler proper's command line,
18086 because the compiler then knows if the device or architecture has
18087 an 8-bit stack pointer and thus no "SPH" register or not.
18088
18089 -mstrict-X
18090 Use address register "X" in a way proposed by the hardware. This
18091 means that "X" is only used in indirect, post-increment or pre-
18092 decrement addressing.
18093
18094 Without this option, the "X" register may be used in the same way
18095 as "Y" or "Z" which then is emulated by additional instructions.
18096 For example, loading a value with "X+const" addressing with a small
18097 non-negative "const < 64" to a register Rn is performed as
18098
18099 adiw r26, const ; X += const
18100 ld <Rn>, X ; <Rn> = *X
18101 sbiw r26, const ; X -= const
18102
18103 -mtiny-stack
18104 Only change the lower 8 bits of the stack pointer.
18105
18106 -mfract-convert-truncate
18107 Allow to use truncation instead of rounding towards zero for
18108 fractional fixed-point types.
18109
18110 -nodevicelib
18111 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
18112
18113 -nodevicespecs
18114 Don't add -specs=device-specs/specs-mcu to the compiler driver's
18115 command line. The user takes responsibility for supplying the sub-
18116 processes like compiler proper, assembler and linker with
18117 appropriate command line options. This means that the user has to
18118 supply her private device specs file by means of -specs=path-to-
18119 specs-file. There is no more need for option -mmcu=mcu.
18120
18121 This option can also serve as a replacement for the older way of
18122 specifying custom device-specs files that needed -B some-path to
18123 point to a directory which contains a folder named "device-specs"
18124 which contains a specs file named "specs-mcu", where mcu was
18125 specified by -mmcu=mcu.
18126
18127 -Waddr-space-convert
18128 Warn about conversions between address spaces in the case where the
18129 resulting address space is not contained in the incoming address
18130 space.
18131
18132 -Wmisspelled-isr
18133 Warn if the ISR is misspelled, i.e. without __vector prefix.
18134 Enabled by default.
18135
18136 "EIND" and Devices with More Than 128 Ki Bytes of Flash
18137
18138 Pointers in the implementation are 16 bits wide. The address of a
18139 function or label is represented as word address so that indirect jumps
18140 and calls can target any code address in the range of 64 Ki words.
18141
18142 In order to facilitate indirect jump on devices with more than 128 Ki
18143 bytes of program memory space, there is a special function register
18144 called "EIND" that serves as most significant part of the target
18145 address when "EICALL" or "EIJMP" instructions are used.
18146
18147 Indirect jumps and calls on these devices are handled as follows by the
18148 compiler and are subject to some limitations:
18149
18150 * The compiler never sets "EIND".
18151
18152 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
18153 instructions or might read "EIND" directly in order to emulate an
18154 indirect call/jump by means of a "RET" instruction.
18155
18156 * The compiler assumes that "EIND" never changes during the startup
18157 code or during the application. In particular, "EIND" is not
18158 saved/restored in function or interrupt service routine
18159 prologue/epilogue.
18160
18161 * For indirect calls to functions and computed goto, the linker
18162 generates stubs. Stubs are jump pads sometimes also called
18163 trampolines. Thus, the indirect call/jump jumps to such a stub.
18164 The stub contains a direct jump to the desired address.
18165
18166 * Linker relaxation must be turned on so that the linker generates
18167 the stubs correctly in all situations. See the compiler option
18168 -mrelax and the linker option --relax. There are corner cases
18169 where the linker is supposed to generate stubs but aborts without
18170 relaxation and without a helpful error message.
18171
18172 * The default linker script is arranged for code with "EIND = 0". If
18173 code is supposed to work for a setup with "EIND != 0", a custom
18174 linker script has to be used in order to place the sections whose
18175 name start with ".trampolines" into the segment where "EIND" points
18176 to.
18177
18178 * The startup code from libgcc never sets "EIND". Notice that
18179 startup code is a blend of code from libgcc and AVR-LibC. For the
18180 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
18181 ("http://nongnu.org/avr-libc/user-manual/").
18182
18183 * It is legitimate for user-specific startup code to set up "EIND"
18184 early, for example by means of initialization code located in
18185 section ".init3". Such code runs prior to general startup code that
18186 initializes RAM and calls constructors, but after the bit of
18187 startup code from AVR-LibC that sets "EIND" to the segment where
18188 the vector table is located.
18189
18190 #include <avr/io.h>
18191
18192 static void
18193 __attribute__((section(".init3"),naked,used,no_instrument_function))
18194 init3_set_eind (void)
18195 {
18196 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18197 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18198 }
18199
18200 The "__trampolines_start" symbol is defined in the linker script.
18201
18202 * Stubs are generated automatically by the linker if the following
18203 two conditions are met:
18204
18205 -<The address of a label is taken by means of the "gs" modifier>
18206 (short for generate stubs) like so:
18207
18208 LDI r24, lo8(gs(<func>))
18209 LDI r25, hi8(gs(<func>))
18210
18211 -<The final location of that label is in a code segment>
18212 outside the segment where the stubs are located.
18213
18214 * The compiler emits such "gs" modifiers for code labels in the
18215 following situations:
18216
18217 -<Taking address of a function or code label.>
18218 -<Computed goto.>
18219 -<If prologue-save function is used, see -mcall-prologues>
18220 command-line option.
18221
18222 -<Switch/case dispatch tables. If you do not want such dispatch>
18223 tables you can specify the -fno-jump-tables command-line
18224 option.
18225
18226 -<C and C++ constructors/destructors called during
18227 startup/shutdown.>
18228 -<If the tools hit a "gs()" modifier explained above.>
18229 * Jumping to non-symbolic addresses like so is not supported:
18230
18231 int main (void)
18232 {
18233 /* Call function at word address 0x2 */
18234 return ((int(*)(void)) 0x2)();
18235 }
18236
18237 Instead, a stub has to be set up, i.e. the function has to be
18238 called through a symbol ("func_4" in the example):
18239
18240 int main (void)
18241 {
18242 extern int func_4 (void);
18243
18244 /* Call function at byte address 0x4 */
18245 return func_4();
18246 }
18247
18248 and the application be linked with -Wl,--defsym,func_4=0x4.
18249 Alternatively, "func_4" can be defined in the linker script.
18250
18251 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
18252 Registers
18253
18254 Some AVR devices support memories larger than the 64 KiB range that can
18255 be accessed with 16-bit pointers. To access memory locations outside
18256 this 64 KiB range, the content of a "RAMP" register is used as high
18257 part of the address: The "X", "Y", "Z" address register is concatenated
18258 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
18259 respectively, to get a wide address. Similarly, "RAMPD" is used
18260 together with direct addressing.
18261
18262 * The startup code initializes the "RAMP" special function registers
18263 with zero.
18264
18265 * If a AVR Named Address Spaces,named address space other than
18266 generic or "__flash" is used, then "RAMPZ" is set as needed before
18267 the operation.
18268
18269 * If the device supports RAM larger than 64 KiB and the compiler
18270 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
18271 reset to zero after the operation.
18272
18273 * If the device comes with a specific "RAMP" register, the ISR
18274 prologue/epilogue saves/restores that SFR and initializes it with
18275 zero in case the ISR code might (implicitly) use it.
18276
18277 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
18278 you use inline assembler to read from locations outside the 16-bit
18279 address range and change one of the "RAMP" registers, you must
18280 reset it to zero after the access.
18281
18282 AVR Built-in Macros
18283
18284 GCC defines several built-in macros so that the user code can test for
18285 the presence or absence of features. Almost any of the following
18286 built-in macros are deduced from device capabilities and thus triggered
18287 by the -mmcu= command-line option.
18288
18289 For even more AVR-specific built-in macros see AVR Named Address Spaces
18290 and AVR Built-in Functions.
18291
18292 "__AVR_ARCH__"
18293 Build-in macro that resolves to a decimal number that identifies
18294 the architecture and depends on the -mmcu=mcu option. Possible
18295 values are:
18296
18297 2, 25, 3, 31, 35, 4, 5, 51, 6
18298
18299 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
18300 "avr51", "avr6",
18301
18302 respectively and
18303
18304 100, 102, 103, 104, 105, 106, 107
18305
18306 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
18307 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
18308 specifies a device, this built-in macro is set accordingly. For
18309 example, with -mmcu=atmega8 the macro is defined to 4.
18310
18311 "__AVR_Device__"
18312 Setting -mmcu=device defines this built-in macro which reflects the
18313 device's name. For example, -mmcu=atmega8 defines the built-in
18314 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
18315 "__AVR_ATtiny261A__", etc.
18316
18317 The built-in macros' names follow the scheme "__AVR_Device__" where
18318 Device is the device name as from the AVR user manual. The
18319 difference between Device in the built-in macro and device in
18320 -mmcu=device is that the latter is always lowercase.
18321
18322 If device is not a device but only a core architecture like avr51,
18323 this macro is not defined.
18324
18325 "__AVR_DEVICE_NAME__"
18326 Setting -mmcu=device defines this built-in macro to the device's
18327 name. For example, with -mmcu=atmega8 the macro is defined to
18328 "atmega8".
18329
18330 If device is not a device but only a core architecture like avr51,
18331 this macro is not defined.
18332
18333 "__AVR_XMEGA__"
18334 The device / architecture belongs to the XMEGA family of devices.
18335
18336 "__AVR_HAVE_ELPM__"
18337 The device has the "ELPM" instruction.
18338
18339 "__AVR_HAVE_ELPMX__"
18340 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
18341
18342 "__AVR_HAVE_MOVW__"
18343 The device has the "MOVW" instruction to perform 16-bit register-
18344 register moves.
18345
18346 "__AVR_HAVE_LPMX__"
18347 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
18348
18349 "__AVR_HAVE_MUL__"
18350 The device has a hardware multiplier.
18351
18352 "__AVR_HAVE_JMP_CALL__"
18353 The device has the "JMP" and "CALL" instructions. This is the case
18354 for devices with more than 8 KiB of program memory.
18355
18356 "__AVR_HAVE_EIJMP_EICALL__"
18357 "__AVR_3_BYTE_PC__"
18358 The device has the "EIJMP" and "EICALL" instructions. This is the
18359 case for devices with more than 128 KiB of program memory. This
18360 also means that the program counter (PC) is 3 bytes wide.
18361
18362 "__AVR_2_BYTE_PC__"
18363 The program counter (PC) is 2 bytes wide. This is the case for
18364 devices with up to 128 KiB of program memory.
18365
18366 "__AVR_HAVE_8BIT_SP__"
18367 "__AVR_HAVE_16BIT_SP__"
18368 The stack pointer (SP) register is treated as 8-bit respectively
18369 16-bit register by the compiler. The definition of these macros is
18370 affected by -mtiny-stack.
18371
18372 "__AVR_HAVE_SPH__"
18373 "__AVR_SP8__"
18374 The device has the SPH (high part of stack pointer) special
18375 function register or has an 8-bit stack pointer, respectively. The
18376 definition of these macros is affected by -mmcu= and in the cases
18377 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
18378
18379 "__AVR_HAVE_RAMPD__"
18380 "__AVR_HAVE_RAMPX__"
18381 "__AVR_HAVE_RAMPY__"
18382 "__AVR_HAVE_RAMPZ__"
18383 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
18384 function register, respectively.
18385
18386 "__NO_INTERRUPTS__"
18387 This macro reflects the -mno-interrupts command-line option.
18388
18389 "__AVR_ERRATA_SKIP__"
18390 "__AVR_ERRATA_SKIP_JMP_CALL__"
18391 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18392 instructions because of a hardware erratum. Skip instructions are
18393 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
18394 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
18395
18396 "__AVR_ISA_RMW__"
18397 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
18398 LAT).
18399
18400 "__AVR_SFR_OFFSET__=offset"
18401 Instructions that can address I/O special function registers
18402 directly like "IN", "OUT", "SBI", etc. may use a different address
18403 as if addressed by an instruction to access RAM like "LD" or "STS".
18404 This offset depends on the device architecture and has to be
18405 subtracted from the RAM address in order to get the respective I/O
18406 address.
18407
18408 "__AVR_SHORT_CALLS__"
18409 The -mshort-calls command line option is set.
18410
18411 "__AVR_PM_BASE_ADDRESS__=addr"
18412 Some devices support reading from flash memory by means of "LD*"
18413 instructions. The flash memory is seen in the data address space
18414 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
18415 defined, this feature is not available. If defined, the address
18416 space is linear and there is no need to put ".rodata" into RAM.
18417 This is handled by the default linker description file, and is
18418 currently available for "avrtiny" and "avrxmega3". Even more
18419 convenient, there is no need to use address spaces like "__flash"
18420 or features like attribute "progmem" and "pgm_read_*".
18421
18422 "__WITH_AVRLIBC__"
18423 The compiler is configured to be used together with AVR-Libc. See
18424 the --with-avrlibc configure option.
18425
18426 "__HAVE_DOUBLE_MULTILIB__"
18427 Defined if -mdouble= acts as a multilib option.
18428
18429 "__HAVE_DOUBLE32__"
18430 "__HAVE_DOUBLE64__"
18431 Defined if the compiler supports 32-bit double resp. 64-bit double.
18432 The actual layout is specified by option -mdouble=.
18433
18434 "__DEFAULT_DOUBLE__"
18435 The size in bits of "double" if -mdouble= is not set. To test the
18436 layout of "double" in a program, use the built-in macro
18437 "__SIZEOF_DOUBLE__".
18438
18439 "__HAVE_LONG_DOUBLE32__"
18440 "__HAVE_LONG_DOUBLE64__"
18441 "__HAVE_LONG_DOUBLE_MULTILIB__"
18442 "__DEFAULT_LONG_DOUBLE__"
18443 Same as above, but for "long double" instead of "double".
18444
18445 "__WITH_DOUBLE_COMPARISON__"
18446 Reflects the "--with-double-comparison={tristate|bool|libf7}"
18447 configure option ("https://gcc.gnu.org/install/configure.html#avr")
18448 and is defined to 2 or 3.
18449
18450 "__WITH_LIBF7_LIBGCC__"
18451 "__WITH_LIBF7_MATH__"
18452 "__WITH_LIBF7_MATH_SYMBOLS__"
18453 Reflects the "--with-libf7={libgcc|math|math-symbols}"
18454 configure option
18455 ("https://gcc.gnu.org/install/configure.html#avr").
18456
18457 Blackfin Options
18458
18459 -mcpu=cpu[-sirevision]
18460 Specifies the name of the target Blackfin processor. Currently,
18461 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
18462 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
18463 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
18464 bf547m, bf548m, bf549m, bf561, bf592.
18465
18466 The optional sirevision specifies the silicon revision of the
18467 target Blackfin processor. Any workarounds available for the
18468 targeted silicon revision are enabled. If sirevision is none, no
18469 workarounds are enabled. If sirevision is any, all workarounds for
18470 the targeted processor are enabled. The "__SILICON_REVISION__"
18471 macro is defined to two hexadecimal digits representing the major
18472 and minor numbers in the silicon revision. If sirevision is none,
18473 the "__SILICON_REVISION__" is not defined. If sirevision is any,
18474 the "__SILICON_REVISION__" is defined to be 0xffff. If this
18475 optional sirevision is not used, GCC assumes the latest known
18476 silicon revision of the targeted Blackfin processor.
18477
18478 GCC defines a preprocessor macro for the specified cpu. For the
18479 bfin-elf toolchain, this option causes the hardware BSP provided by
18480 libgloss to be linked in if -msim is not given.
18481
18482 Without this option, bf532 is used as the processor by default.
18483
18484 Note that support for bf561 is incomplete. For bf561, only the
18485 preprocessor macro is defined.
18486
18487 -msim
18488 Specifies that the program will be run on the simulator. This
18489 causes the simulator BSP provided by libgloss to be linked in.
18490 This option has effect only for bfin-elf toolchain. Certain other
18491 options, such as -mid-shared-library and -mfdpic, imply -msim.
18492
18493 -momit-leaf-frame-pointer
18494 Don't keep the frame pointer in a register for leaf functions.
18495 This avoids the instructions to save, set up and restore frame
18496 pointers and makes an extra register available in leaf functions.
18497
18498 -mspecld-anomaly
18499 When enabled, the compiler ensures that the generated code does not
18500 contain speculative loads after jump instructions. If this option
18501 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
18502
18503 -mno-specld-anomaly
18504 Don't generate extra code to prevent speculative loads from
18505 occurring.
18506
18507 -mcsync-anomaly
18508 When enabled, the compiler ensures that the generated code does not
18509 contain CSYNC or SSYNC instructions too soon after conditional
18510 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
18511 is defined.
18512
18513 -mno-csync-anomaly
18514 Don't generate extra code to prevent CSYNC or SSYNC instructions
18515 from occurring too soon after a conditional branch.
18516
18517 -mlow64k
18518 When enabled, the compiler is free to take advantage of the
18519 knowledge that the entire program fits into the low 64k of memory.
18520
18521 -mno-low64k
18522 Assume that the program is arbitrarily large. This is the default.
18523
18524 -mstack-check-l1
18525 Do stack checking using information placed into L1 scratchpad
18526 memory by the uClinux kernel.
18527
18528 -mid-shared-library
18529 Generate code that supports shared libraries via the library ID
18530 method. This allows for execute in place and shared libraries in
18531 an environment without virtual memory management. This option
18532 implies -fPIC. With a bfin-elf target, this option implies -msim.
18533
18534 -mno-id-shared-library
18535 Generate code that doesn't assume ID-based shared libraries are
18536 being used. This is the default.
18537
18538 -mleaf-id-shared-library
18539 Generate code that supports shared libraries via the library ID
18540 method, but assumes that this library or executable won't link
18541 against any other ID shared libraries. That allows the compiler to
18542 use faster code for jumps and calls.
18543
18544 -mno-leaf-id-shared-library
18545 Do not assume that the code being compiled won't link against any
18546 ID shared libraries. Slower code is generated for jump and call
18547 insns.
18548
18549 -mshared-library-id=n
18550 Specifies the identification number of the ID-based shared library
18551 being compiled. Specifying a value of 0 generates more compact
18552 code; specifying other values forces the allocation of that number
18553 to the current library but is no more space- or time-efficient than
18554 omitting this option.
18555
18556 -msep-data
18557 Generate code that allows the data segment to be located in a
18558 different area of memory from the text segment. This allows for
18559 execute in place in an environment without virtual memory
18560 management by eliminating relocations against the text section.
18561
18562 -mno-sep-data
18563 Generate code that assumes that the data segment follows the text
18564 segment. This is the default.
18565
18566 -mlong-calls
18567 -mno-long-calls
18568 Tells the compiler to perform function calls by first loading the
18569 address of the function into a register and then performing a
18570 subroutine call on this register. This switch is needed if the
18571 target function lies outside of the 24-bit addressing range of the
18572 offset-based version of subroutine call instruction.
18573
18574 This feature is not enabled by default. Specifying -mno-long-calls
18575 restores the default behavior. Note these switches have no effect
18576 on how the compiler generates code to handle function calls via
18577 function pointers.
18578
18579 -mfast-fp
18580 Link with the fast floating-point library. This library relaxes
18581 some of the IEEE floating-point standard's rules for checking
18582 inputs against Not-a-Number (NAN), in the interest of performance.
18583
18584 -minline-plt
18585 Enable inlining of PLT entries in function calls to functions that
18586 are not known to bind locally. It has no effect without -mfdpic.
18587
18588 -mmulticore
18589 Build a standalone application for multicore Blackfin processors.
18590 This option causes proper start files and link scripts supporting
18591 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
18592 can only be used with -mcpu=bf561[-sirevision].
18593
18594 This option can be used with -mcorea or -mcoreb, which selects the
18595 one-application-per-core programming model. Without -mcorea or
18596 -mcoreb, the single-application/dual-core programming model is
18597 used. In this model, the main function of Core B should be named as
18598 "coreb_main".
18599
18600 If this option is not used, the single-core application programming
18601 model is used.
18602
18603 -mcorea
18604 Build a standalone application for Core A of BF561 when using the
18605 one-application-per-core programming model. Proper start files and
18606 link scripts are used to support Core A, and the macro
18607 "__BFIN_COREA" is defined. This option can only be used in
18608 conjunction with -mmulticore.
18609
18610 -mcoreb
18611 Build a standalone application for Core B of BF561 when using the
18612 one-application-per-core programming model. Proper start files and
18613 link scripts are used to support Core B, and the macro
18614 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
18615 should be used instead of "main". This option can only be used in
18616 conjunction with -mmulticore.
18617
18618 -msdram
18619 Build a standalone application for SDRAM. Proper start files and
18620 link scripts are used to put the application into SDRAM, and the
18621 macro "__BFIN_SDRAM" is defined. The loader should initialize
18622 SDRAM before loading the application.
18623
18624 -micplb
18625 Assume that ICPLBs are enabled at run time. This has an effect on
18626 certain anomaly workarounds. For Linux targets, the default is to
18627 assume ICPLBs are enabled; for standalone applications the default
18628 is off.
18629
18630 C6X Options
18631
18632 -march=name
18633 This specifies the name of the target architecture. GCC uses this
18634 name to determine what kind of instructions it can emit when
18635 generating assembly code. Permissible names are: c62x, c64x,
18636 c64x+, c67x, c67x+, c674x.
18637
18638 -mbig-endian
18639 Generate code for a big-endian target.
18640
18641 -mlittle-endian
18642 Generate code for a little-endian target. This is the default.
18643
18644 -msim
18645 Choose startup files and linker script suitable for the simulator.
18646
18647 -msdata=default
18648 Put small global and static data in the ".neardata" section, which
18649 is pointed to by register "B14". Put small uninitialized global
18650 and static data in the ".bss" section, which is adjacent to the
18651 ".neardata" section. Put small read-only data into the ".rodata"
18652 section. The corresponding sections used for large pieces of data
18653 are ".fardata", ".far" and ".const".
18654
18655 -msdata=all
18656 Put all data, not just small objects, into the sections reserved
18657 for small data, and use addressing relative to the "B14" register
18658 to access them.
18659
18660 -msdata=none
18661 Make no use of the sections reserved for small data, and use
18662 absolute addresses to access all data. Put all initialized global
18663 and static data in the ".fardata" section, and all uninitialized
18664 data in the ".far" section. Put all constant data into the
18665 ".const" section.
18666
18667 CRIS Options
18668
18669 These options are defined specifically for the CRIS ports.
18670
18671 -march=architecture-type
18672 -mcpu=architecture-type
18673 Generate code for the specified architecture. The choices for
18674 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
18675 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
18676 linux-gnu, where the default is v10.
18677
18678 -mtune=architecture-type
18679 Tune to architecture-type everything applicable about the generated
18680 code, except for the ABI and the set of available instructions.
18681 The choices for architecture-type are the same as for
18682 -march=architecture-type.
18683
18684 -mmax-stack-frame=n
18685 Warn when the stack frame of a function exceeds n bytes.
18686
18687 -metrax4
18688 -metrax100
18689 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
18690 -march=v8 respectively.
18691
18692 -mmul-bug-workaround
18693 -mno-mul-bug-workaround
18694 Work around a bug in the "muls" and "mulu" instructions for CPU
18695 models where it applies. This option is active by default.
18696
18697 -mpdebug
18698 Enable CRIS-specific verbose debug-related information in the
18699 assembly code. This option also has the effect of turning off the
18700 #NO_APP formatted-code indicator to the assembler at the beginning
18701 of the assembly file.
18702
18703 -mcc-init
18704 Do not use condition-code results from previous instruction; always
18705 emit compare and test instructions before use of condition codes.
18706
18707 -mno-side-effects
18708 Do not emit instructions with side effects in addressing modes
18709 other than post-increment.
18710
18711 -mstack-align
18712 -mno-stack-align
18713 -mdata-align
18714 -mno-data-align
18715 -mconst-align
18716 -mno-const-align
18717 These options (no- options) arrange (eliminate arrangements) for
18718 the stack frame, individual data and constants to be aligned for
18719 the maximum single data access size for the chosen CPU model. The
18720 default is to arrange for 32-bit alignment. ABI details such as
18721 structure layout are not affected by these options.
18722
18723 -m32-bit
18724 -m16-bit
18725 -m8-bit
18726 Similar to the stack- data- and const-align options above, these
18727 options arrange for stack frame, writable data and constants to all
18728 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
18729 alignment.
18730
18731 -mno-prologue-epilogue
18732 -mprologue-epilogue
18733 With -mno-prologue-epilogue, the normal function prologue and
18734 epilogue which set up the stack frame are omitted and no return
18735 instructions or return sequences are generated in the code. Use
18736 this option only together with visual inspection of the compiled
18737 code: no warnings or errors are generated when call-saved registers
18738 must be saved, or storage for local variables needs to be
18739 allocated.
18740
18741 -mno-gotplt
18742 -mgotplt
18743 With -fpic and -fPIC, don't generate (do generate) instruction
18744 sequences that load addresses for functions from the PLT part of
18745 the GOT rather than (traditional on other architectures) calls to
18746 the PLT. The default is -mgotplt.
18747
18748 -melf
18749 Legacy no-op option only recognized with the cris-axis-elf and
18750 cris-axis-linux-gnu targets.
18751
18752 -mlinux
18753 Legacy no-op option only recognized with the cris-axis-linux-gnu
18754 target.
18755
18756 -sim
18757 This option, recognized for the cris-axis-elf, arranges to link
18758 with input-output functions from a simulator library. Code,
18759 initialized data and zero-initialized data are allocated
18760 consecutively.
18761
18762 -sim2
18763 Like -sim, but pass linker options to locate initialized data at
18764 0x40000000 and zero-initialized data at 0x80000000.
18765
18766 CR16 Options
18767
18768 These options are defined specifically for the CR16 ports.
18769
18770 -mmac
18771 Enable the use of multiply-accumulate instructions. Disabled by
18772 default.
18773
18774 -mcr16cplus
18775 -mcr16c
18776 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18777 is default.
18778
18779 -msim
18780 Links the library libsim.a which is in compatible with simulator.
18781 Applicable to ELF compiler only.
18782
18783 -mint32
18784 Choose integer type as 32-bit wide.
18785
18786 -mbit-ops
18787 Generates "sbit"/"cbit" instructions for bit manipulations.
18788
18789 -mdata-model=model
18790 Choose a data model. The choices for model are near, far or medium.
18791 medium is default. However, far is not valid with -mcr16c, as the
18792 CR16C architecture does not support the far data model.
18793
18794 C-SKY Options
18795
18796 GCC supports these options when compiling for C-SKY V2 processors.
18797
18798 -march=arch
18799 Specify the C-SKY target architecture. Valid values for arch are:
18800 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
18801
18802 -mcpu=cpu
18803 Specify the C-SKY target processor. Valid values for cpu are:
18804 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
18805 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
18806 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
18807 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
18808 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
18809 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
18810 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
18811 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
18812 ck810tv, ck810ft, and ck810ftv.
18813
18814 -mbig-endian
18815 -EB
18816 -mlittle-endian
18817 -EL Select big- or little-endian code. The default is little-endian.
18818
18819 -mfloat-abi=name
18820 Specifies which floating-point ABI to use. Permissible values are:
18821 soft, softfp and hard.
18822
18823 Specifying soft causes GCC to generate output containing library
18824 calls for floating-point operations. softfp allows the generation
18825 of code using hardware floating-point instructions, but still uses
18826 the soft-float calling conventions. hard allows generation of
18827 floating-point instructions and uses FPU-specific calling
18828 conventions.
18829
18830 The default depends on the specific target configuration. Note
18831 that the hard-float and soft-float ABIs are not link-compatible;
18832 you must compile your entire program with the same ABI, and link
18833 with a compatible set of libraries.
18834
18835 -mhard-float
18836 -msoft-float
18837 Select hardware or software floating-point implementations. The
18838 default is soft float.
18839
18840 -mdouble-float
18841 -mno-double-float
18842 When -mhard-float is in effect, enable generation of double-
18843 precision float instructions. This is the default except when
18844 compiling for CK803.
18845
18846 -mfdivdu
18847 -mno-fdivdu
18848 When -mhard-float is in effect, enable generation of "frecipd",
18849 "fsqrtd", and "fdivd" instructions. This is the default except
18850 when compiling for CK803.
18851
18852 -mfpu=fpu
18853 Select the floating-point processor. This option can only be used
18854 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
18855 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
18856 and fpv2_divd (-mdouble-float -mdivdu).
18857
18858 -melrw
18859 -mno-elrw
18860 Enable the extended "lrw" instruction. This option defaults to on
18861 for CK801 and off otherwise.
18862
18863 -mistack
18864 -mno-istack
18865 Enable interrupt stack instructions; the default is off.
18866
18867 The -mistack option is required to handle the "interrupt" and "isr"
18868 function attributes.
18869
18870 -mmp
18871 Enable multiprocessor instructions; the default is off.
18872
18873 -mcp
18874 Enable coprocessor instructions; the default is off.
18875
18876 -mcache
18877 Enable coprocessor instructions; the default is off.
18878
18879 -msecurity
18880 Enable C-SKY security instructions; the default is off.
18881
18882 -mtrust
18883 Enable C-SKY trust instructions; the default is off.
18884
18885 -mdsp
18886 -medsp
18887 -mvdsp
18888 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
18889 respectively. All of these options default to off.
18890
18891 -mdiv
18892 -mno-div
18893 Generate divide instructions. Default is off.
18894
18895 -msmart
18896 -mno-smart
18897 Generate code for Smart Mode, using only registers numbered 0-7 to
18898 allow use of 16-bit instructions. This option is ignored for CK801
18899 where this is the required behavior, and it defaults to on for
18900 CK802. For other targets, the default is off.
18901
18902 -mhigh-registers
18903 -mno-high-registers
18904 Generate code using the high registers numbered 16-31. This option
18905 is not supported on CK801, CK802, or CK803, and is enabled by
18906 default for other processors.
18907
18908 -manchor
18909 -mno-anchor
18910 Generate code using global anchor symbol addresses.
18911
18912 -mpushpop
18913 -mno-pushpop
18914 Generate code using "push" and "pop" instructions. This option
18915 defaults to on.
18916
18917 -mmultiple-stld
18918 -mstm
18919 -mno-multiple-stld
18920 -mno-stm
18921 Generate code using "stm" and "ldm" instructions. This option
18922 isn't supported on CK801 but is enabled by default on other
18923 processors.
18924
18925 -mconstpool
18926 -mno-constpool
18927 Create constant pools in the compiler instead of deferring it to
18928 the assembler. This option is the default and required for correct
18929 code generation on CK801 and CK802, and is optional on other
18930 processors.
18931
18932 -mstack-size
18933 -mno-stack-size
18934 Emit ".stack_size" directives for each function in the assembly
18935 output. This option defaults to off.
18936
18937 -mccrt
18938 -mno-ccrt
18939 Generate code for the C-SKY compiler runtime instead of libgcc.
18940 This option defaults to off.
18941
18942 -mbranch-cost=n
18943 Set the branch costs to roughly "n" instructions. The default is
18944 1.
18945
18946 -msched-prolog
18947 -mno-sched-prolog
18948 Permit scheduling of function prologue and epilogue sequences.
18949 Using this option can result in code that is not compliant with the
18950 C-SKY V2 ABI prologue requirements and that cannot be debugged or
18951 backtraced. It is disabled by default.
18952
18953 -msim
18954 Links the library libsemi.a which is in compatible with simulator.
18955 Applicable to ELF compiler only.
18956
18957 Darwin Options
18958
18959 These options are defined for all architectures running the Darwin
18960 operating system.
18961
18962 FSF GCC on Darwin does not create "fat" object files; it creates an
18963 object file for the single architecture that GCC was built to target.
18964 Apple's GCC on Darwin does create "fat" files if multiple -arch options
18965 are used; it does so by running the compiler or linker multiple times
18966 and joining the results together with lipo.
18967
18968 The subtype of the file created (like ppc7400 or ppc970 or i686) is
18969 determined by the flags that specify the ISA that GCC is targeting,
18970 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
18971 override this.
18972
18973 The Darwin tools vary in their behavior when presented with an ISA
18974 mismatch. The assembler, as, only permits instructions to be used that
18975 are valid for the subtype of the file it is generating, so you cannot
18976 put 64-bit instructions in a ppc750 object file. The linker for shared
18977 libraries, /usr/bin/libtool, fails and prints an error if asked to
18978 create a shared library with a less restrictive subtype than its input
18979 files (for instance, trying to put a ppc970 object file in a ppc7400
18980 library). The linker for executables, ld, quietly gives the executable
18981 the most restrictive subtype of any of its input files.
18982
18983 -Fdir
18984 Add the framework directory dir to the head of the list of
18985 directories to be searched for header files. These directories are
18986 interleaved with those specified by -I options and are scanned in a
18987 left-to-right order.
18988
18989 A framework directory is a directory with frameworks in it. A
18990 framework is a directory with a Headers and/or PrivateHeaders
18991 directory contained directly in it that ends in .framework. The
18992 name of a framework is the name of this directory excluding the
18993 .framework. Headers associated with the framework are found in one
18994 of those two directories, with Headers being searched first. A
18995 subframework is a framework directory that is in a framework's
18996 Frameworks directory. Includes of subframework headers can only
18997 appear in a header of a framework that contains the subframework,
18998 or in a sibling subframework header. Two subframeworks are
18999 siblings if they occur in the same framework. A subframework
19000 should not have the same name as a framework; a warning is issued
19001 if this is violated. Currently a subframework cannot have
19002 subframeworks; in the future, the mechanism may be extended to
19003 support this. The standard frameworks can be found in
19004 /System/Library/Frameworks and /Library/Frameworks. An example
19005 include looks like "#include <Framework/header.h>", where Framework
19006 denotes the name of the framework and header.h is found in the
19007 PrivateHeaders or Headers directory.
19008
19009 -iframeworkdir
19010 Like -F except the directory is a treated as a system directory.
19011 The main difference between this -iframework and -F is that with
19012 -iframework the compiler does not warn about constructs contained
19013 within header files found via dir. This option is valid only for
19014 the C family of languages.
19015
19016 -gused
19017 Emit debugging information for symbols that are used. For stabs
19018 debugging format, this enables -feliminate-unused-debug-symbols.
19019 This is by default ON.
19020
19021 -gfull
19022 Emit debugging information for all symbols and types.
19023
19024 -mmacosx-version-min=version
19025 The earliest version of MacOS X that this executable will run on is
19026 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19027
19028 If the compiler was built to use the system's headers by default,
19029 then the default for this option is the system version on which the
19030 compiler is running, otherwise the default is to make choices that
19031 are compatible with as many systems and code bases as possible.
19032
19033 -mkernel
19034 Enable kernel development mode. The -mkernel option sets -static,
19035 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19036 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19037 where applicable. This mode also sets -mno-altivec, -msoft-float,
19038 -fno-builtin and -mlong-branch for PowerPC targets.
19039
19040 -mone-byte-bool
19041 Override the defaults for "bool" so that "sizeof(bool)==1". By
19042 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19043 when compiling for Darwin/x86, so this option has no effect on x86.
19044
19045 Warning: The -mone-byte-bool switch causes GCC to generate code
19046 that is not binary compatible with code generated without that
19047 switch. Using this switch may require recompiling all other
19048 modules in a program, including system libraries. Use this switch
19049 to conform to a non-default data model.
19050
19051 -mfix-and-continue
19052 -ffix-and-continue
19053 -findirect-data
19054 Generate code suitable for fast turnaround development, such as to
19055 allow GDB to dynamically load .o files into already-running
19056 programs. -findirect-data and -ffix-and-continue are provided for
19057 backwards compatibility.
19058
19059 -all_load
19060 Loads all members of static archive libraries. See man ld(1) for
19061 more information.
19062
19063 -arch_errors_fatal
19064 Cause the errors having to do with files that have the wrong
19065 architecture to be fatal.
19066
19067 -bind_at_load
19068 Causes the output file to be marked such that the dynamic linker
19069 will bind all undefined references when the file is loaded or
19070 launched.
19071
19072 -bundle
19073 Produce a Mach-o bundle format file. See man ld(1) for more
19074 information.
19075
19076 -bundle_loader executable
19077 This option specifies the executable that will load the build
19078 output file being linked. See man ld(1) for more information.
19079
19080 -dynamiclib
19081 When passed this option, GCC produces a dynamic library instead of
19082 an executable when linking, using the Darwin libtool command.
19083
19084 -force_cpusubtype_ALL
19085 This causes GCC's output file to have the ALL subtype, instead of
19086 one controlled by the -mcpu or -march option.
19087
19088 -allowable_client client_name
19089 -client_name
19090 -compatibility_version
19091 -current_version
19092 -dead_strip
19093 -dependency-file
19094 -dylib_file
19095 -dylinker_install_name
19096 -dynamic
19097 -exported_symbols_list
19098 -filelist
19099 -flat_namespace
19100 -force_flat_namespace
19101 -headerpad_max_install_names
19102 -image_base
19103 -init
19104 -install_name
19105 -keep_private_externs
19106 -multi_module
19107 -multiply_defined
19108 -multiply_defined_unused
19109 -noall_load
19110 -no_dead_strip_inits_and_terms
19111 -nofixprebinding
19112 -nomultidefs
19113 -noprebind
19114 -noseglinkedit
19115 -pagezero_size
19116 -prebind
19117 -prebind_all_twolevel_modules
19118 -private_bundle
19119 -read_only_relocs
19120 -sectalign
19121 -sectobjectsymbols
19122 -whyload
19123 -seg1addr
19124 -sectcreate
19125 -sectobjectsymbols
19126 -sectorder
19127 -segaddr
19128 -segs_read_only_addr
19129 -segs_read_write_addr
19130 -seg_addr_table
19131 -seg_addr_table_filename
19132 -seglinkedit
19133 -segprot
19134 -segs_read_only_addr
19135 -segs_read_write_addr
19136 -single_module
19137 -static
19138 -sub_library
19139 -sub_umbrella
19140 -twolevel_namespace
19141 -umbrella
19142 -undefined
19143 -unexported_symbols_list
19144 -weak_reference_mismatches
19145 -whatsloaded
19146 These options are passed to the Darwin linker. The Darwin linker
19147 man page describes them in detail.
19148
19149 DEC Alpha Options
19150
19151 These -m options are defined for the DEC Alpha implementations:
19152
19153 -mno-soft-float
19154 -msoft-float
19155 Use (do not use) the hardware floating-point instructions for
19156 floating-point operations. When -msoft-float is specified,
19157 functions in libgcc.a are used to perform floating-point
19158 operations. Unless they are replaced by routines that emulate the
19159 floating-point operations, or compiled in such a way as to call
19160 such emulations routines, these routines issue floating-point
19161 operations. If you are compiling for an Alpha without floating-
19162 point operations, you must ensure that the library is built so as
19163 not to call them.
19164
19165 Note that Alpha implementations without floating-point operations
19166 are required to have floating-point registers.
19167
19168 -mfp-reg
19169 -mno-fp-regs
19170 Generate code that uses (does not use) the floating-point register
19171 set. -mno-fp-regs implies -msoft-float. If the floating-point
19172 register set is not used, floating-point operands are passed in
19173 integer registers as if they were integers and floating-point
19174 results are passed in $0 instead of $f0. This is a non-standard
19175 calling sequence, so any function with a floating-point argument or
19176 return value called by code compiled with -mno-fp-regs must also be
19177 compiled with that option.
19178
19179 A typical use of this option is building a kernel that does not
19180 use, and hence need not save and restore, any floating-point
19181 registers.
19182
19183 -mieee
19184 The Alpha architecture implements floating-point hardware optimized
19185 for maximum performance. It is mostly compliant with the IEEE
19186 floating-point standard. However, for full compliance, software
19187 assistance is required. This option generates code fully IEEE-
19188 compliant code except that the inexact-flag is not maintained (see
19189 below). If this option is turned on, the preprocessor macro
19190 "_IEEE_FP" is defined during compilation. The resulting code is
19191 less efficient but is able to correctly support denormalized
19192 numbers and exceptional IEEE values such as not-a-number and
19193 plus/minus infinity. Other Alpha compilers call this option
19194 -ieee_with_no_inexact.
19195
19196 -mieee-with-inexact
19197 This is like -mieee except the generated code also maintains the
19198 IEEE inexact-flag. Turning on this option causes the generated
19199 code to implement fully-compliant IEEE math. In addition to
19200 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
19201 On some Alpha implementations the resulting code may execute
19202 significantly slower than the code generated by default. Since
19203 there is very little code that depends on the inexact-flag, you
19204 should normally not specify this option. Other Alpha compilers
19205 call this option -ieee_with_inexact.
19206
19207 -mfp-trap-mode=trap-mode
19208 This option controls what floating-point related traps are enabled.
19209 Other Alpha compilers call this option -fptm trap-mode. The trap
19210 mode can be set to one of four values:
19211
19212 n This is the default (normal) setting. The only traps that are
19213 enabled are the ones that cannot be disabled in software (e.g.,
19214 division by zero trap).
19215
19216 u In addition to the traps enabled by n, underflow traps are
19217 enabled as well.
19218
19219 su Like u, but the instructions are marked to be safe for software
19220 completion (see Alpha architecture manual for details).
19221
19222 sui Like su, but inexact traps are enabled as well.
19223
19224 -mfp-rounding-mode=rounding-mode
19225 Selects the IEEE rounding mode. Other Alpha compilers call this
19226 option -fprm rounding-mode. The rounding-mode can be one of:
19227
19228 n Normal IEEE rounding mode. Floating-point numbers are rounded
19229 towards the nearest machine number or towards the even machine
19230 number in case of a tie.
19231
19232 m Round towards minus infinity.
19233
19234 c Chopped rounding mode. Floating-point numbers are rounded
19235 towards zero.
19236
19237 d Dynamic rounding mode. A field in the floating-point control
19238 register (fpcr, see Alpha architecture reference manual)
19239 controls the rounding mode in effect. The C library
19240 initializes this register for rounding towards plus infinity.
19241 Thus, unless your program modifies the fpcr, d corresponds to
19242 round towards plus infinity.
19243
19244 -mtrap-precision=trap-precision
19245 In the Alpha architecture, floating-point traps are imprecise.
19246 This means without software assistance it is impossible to recover
19247 from a floating trap and program execution normally needs to be
19248 terminated. GCC can generate code that can assist operating system
19249 trap handlers in determining the exact location that caused a
19250 floating-point trap. Depending on the requirements of an
19251 application, different levels of precisions can be selected:
19252
19253 p Program precision. This option is the default and means a trap
19254 handler can only identify which program caused a floating-point
19255 exception.
19256
19257 f Function precision. The trap handler can determine the
19258 function that caused a floating-point exception.
19259
19260 i Instruction precision. The trap handler can determine the
19261 exact instruction that caused a floating-point exception.
19262
19263 Other Alpha compilers provide the equivalent options called
19264 -scope_safe and -resumption_safe.
19265
19266 -mieee-conformant
19267 This option marks the generated code as IEEE conformant. You must
19268 not use this option unless you also specify -mtrap-precision=i and
19269 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
19270 to emit the line .eflag 48 in the function prologue of the
19271 generated assembly file.
19272
19273 -mbuild-constants
19274 Normally GCC examines a 32- or 64-bit integer constant to see if it
19275 can construct it from smaller constants in two or three
19276 instructions. If it cannot, it outputs the constant as a literal
19277 and generates code to load it from the data segment at run time.
19278
19279 Use this option to require GCC to construct all integer constants
19280 using code, even if it takes more instructions (the maximum is
19281 six).
19282
19283 You typically use this option to build a shared library dynamic
19284 loader. Itself a shared library, it must relocate itself in memory
19285 before it can find the variables and constants in its own data
19286 segment.
19287
19288 -mbwx
19289 -mno-bwx
19290 -mcix
19291 -mno-cix
19292 -mfix
19293 -mno-fix
19294 -mmax
19295 -mno-max
19296 Indicate whether GCC should generate code to use the optional BWX,
19297 CIX, FIX and MAX instruction sets. The default is to use the
19298 instruction sets supported by the CPU type specified via -mcpu=
19299 option or that of the CPU on which GCC was built if none is
19300 specified.
19301
19302 -mfloat-vax
19303 -mfloat-ieee
19304 Generate code that uses (does not use) VAX F and G floating-point
19305 arithmetic instead of IEEE single and double precision.
19306
19307 -mexplicit-relocs
19308 -mno-explicit-relocs
19309 Older Alpha assemblers provided no way to generate symbol
19310 relocations except via assembler macros. Use of these macros does
19311 not allow optimal instruction scheduling. GNU binutils as of
19312 version 2.12 supports a new syntax that allows the compiler to
19313 explicitly mark which relocations should apply to which
19314 instructions. This option is mostly useful for debugging, as GCC
19315 detects the capabilities of the assembler when it is built and sets
19316 the default accordingly.
19317
19318 -msmall-data
19319 -mlarge-data
19320 When -mexplicit-relocs is in effect, static data is accessed via
19321 gp-relative relocations. When -msmall-data is used, objects 8
19322 bytes long or smaller are placed in a small data area (the ".sdata"
19323 and ".sbss" sections) and are accessed via 16-bit relocations off
19324 of the $gp register. This limits the size of the small data area
19325 to 64KB, but allows the variables to be directly accessed via a
19326 single instruction.
19327
19328 The default is -mlarge-data. With this option the data area is
19329 limited to just below 2GB. Programs that require more than 2GB of
19330 data must use "malloc" or "mmap" to allocate the data in the heap
19331 instead of in the program's data segment.
19332
19333 When generating code for shared libraries, -fpic implies
19334 -msmall-data and -fPIC implies -mlarge-data.
19335
19336 -msmall-text
19337 -mlarge-text
19338 When -msmall-text is used, the compiler assumes that the code of
19339 the entire program (or shared library) fits in 4MB, and is thus
19340 reachable with a branch instruction. When -msmall-data is used,
19341 the compiler can assume that all local symbols share the same $gp
19342 value, and thus reduce the number of instructions required for a
19343 function call from 4 to 1.
19344
19345 The default is -mlarge-text.
19346
19347 -mcpu=cpu_type
19348 Set the instruction set and instruction scheduling parameters for
19349 machine type cpu_type. You can specify either the EV style name or
19350 the corresponding chip number. GCC supports scheduling parameters
19351 for the EV4, EV5 and EV6 family of processors and chooses the
19352 default values for the instruction set from the processor you
19353 specify. If you do not specify a processor type, GCC defaults to
19354 the processor on which the compiler was built.
19355
19356 Supported values for cpu_type are
19357
19358 ev4
19359 ev45
19360 21064
19361 Schedules as an EV4 and has no instruction set extensions.
19362
19363 ev5
19364 21164
19365 Schedules as an EV5 and has no instruction set extensions.
19366
19367 ev56
19368 21164a
19369 Schedules as an EV5 and supports the BWX extension.
19370
19371 pca56
19372 21164pc
19373 21164PC
19374 Schedules as an EV5 and supports the BWX and MAX extensions.
19375
19376 ev6
19377 21264
19378 Schedules as an EV6 and supports the BWX, FIX, and MAX
19379 extensions.
19380
19381 ev67
19382 21264a
19383 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
19384 extensions.
19385
19386 Native toolchains also support the value native, which selects the
19387 best architecture option for the host processor. -mcpu=native has
19388 no effect if GCC does not recognize the processor.
19389
19390 -mtune=cpu_type
19391 Set only the instruction scheduling parameters for machine type
19392 cpu_type. The instruction set is not changed.
19393
19394 Native toolchains also support the value native, which selects the
19395 best architecture option for the host processor. -mtune=native has
19396 no effect if GCC does not recognize the processor.
19397
19398 -mmemory-latency=time
19399 Sets the latency the scheduler should assume for typical memory
19400 references as seen by the application. This number is highly
19401 dependent on the memory access patterns used by the application and
19402 the size of the external cache on the machine.
19403
19404 Valid options for time are
19405
19406 number
19407 A decimal number representing clock cycles.
19408
19409 L1
19410 L2
19411 L3
19412 main
19413 The compiler contains estimates of the number of clock cycles
19414 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19415 (also called Dcache, Scache, and Bcache), as well as to main
19416 memory. Note that L3 is only valid for EV5.
19417
19418 eBPF Options
19419
19420 -mframe-limit=bytes
19421 This specifies the hard limit for frame sizes, in bytes.
19422 Currently, the value that can be specified should be less than or
19423 equal to 32767. Defaults to whatever limit is imposed by the
19424 version of the Linux kernel targeted.
19425
19426 -mkernel=version
19427 This specifies the minimum version of the kernel that will run the
19428 compiled program. GCC uses this version to determine which
19429 instructions to use, what kernel helpers to allow, etc. Currently,
19430 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
19431 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
19432 4.20, 5.0, 5.1, 5.2, latest and native.
19433
19434 -mbig-endian
19435 Generate code for a big-endian target.
19436
19437 -mlittle-endian
19438 Generate code for a little-endian target. This is the default.
19439
19440 -mxbpf
19441 Generate code for an expanded version of BPF, which relaxes some of
19442 the restrictions imposed by the BPF architecture:
19443
19444 -<Save and restore callee-saved registers at function entry and>
19445 exit, respectively.
19446
19447 FR30 Options
19448
19449 These options are defined specifically for the FR30 port.
19450
19451 -msmall-model
19452 Use the small address space model. This can produce smaller code,
19453 but it does assume that all symbolic values and addresses fit into
19454 a 20-bit range.
19455
19456 -mno-lsim
19457 Assume that runtime support has been provided and so there is no
19458 need to include the simulator library (libsim.a) on the linker
19459 command line.
19460
19461 FT32 Options
19462
19463 These options are defined specifically for the FT32 port.
19464
19465 -msim
19466 Specifies that the program will be run on the simulator. This
19467 causes an alternate runtime startup and library to be linked. You
19468 must not use this option when generating programs that will run on
19469 real hardware; you must provide your own runtime library for
19470 whatever I/O functions are needed.
19471
19472 -mlra
19473 Enable Local Register Allocation. This is still experimental for
19474 FT32, so by default the compiler uses standard reload.
19475
19476 -mnodiv
19477 Do not use div and mod instructions.
19478
19479 -mft32b
19480 Enable use of the extended instructions of the FT32B processor.
19481
19482 -mcompress
19483 Compress all code using the Ft32B code compression scheme.
19484
19485 -mnopm
19486 Do not generate code that reads program memory.
19487
19488 FRV Options
19489
19490 -mgpr-32
19491 Only use the first 32 general-purpose registers.
19492
19493 -mgpr-64
19494 Use all 64 general-purpose registers.
19495
19496 -mfpr-32
19497 Use only the first 32 floating-point registers.
19498
19499 -mfpr-64
19500 Use all 64 floating-point registers.
19501
19502 -mhard-float
19503 Use hardware instructions for floating-point operations.
19504
19505 -msoft-float
19506 Use library routines for floating-point operations.
19507
19508 -malloc-cc
19509 Dynamically allocate condition code registers.
19510
19511 -mfixed-cc
19512 Do not try to dynamically allocate condition code registers, only
19513 use "icc0" and "fcc0".
19514
19515 -mdword
19516 Change ABI to use double word insns.
19517
19518 -mno-dword
19519 Do not use double word instructions.
19520
19521 -mdouble
19522 Use floating-point double instructions.
19523
19524 -mno-double
19525 Do not use floating-point double instructions.
19526
19527 -mmedia
19528 Use media instructions.
19529
19530 -mno-media
19531 Do not use media instructions.
19532
19533 -mmuladd
19534 Use multiply and add/subtract instructions.
19535
19536 -mno-muladd
19537 Do not use multiply and add/subtract instructions.
19538
19539 -mfdpic
19540 Select the FDPIC ABI, which uses function descriptors to represent
19541 pointers to functions. Without any PIC/PIE-related options, it
19542 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
19543 small data are within a 12-bit range from the GOT base address;
19544 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
19545 bfin-elf target, this option implies -msim.
19546
19547 -minline-plt
19548 Enable inlining of PLT entries in function calls to functions that
19549 are not known to bind locally. It has no effect without -mfdpic.
19550 It's enabled by default if optimizing for speed and compiling for
19551 shared libraries (i.e., -fPIC or -fpic), or when an optimization
19552 option such as -O3 or above is present in the command line.
19553
19554 -mTLS
19555 Assume a large TLS segment when generating thread-local code.
19556
19557 -mtls
19558 Do not assume a large TLS segment when generating thread-local
19559 code.
19560
19561 -mgprel-ro
19562 Enable the use of "GPREL" relocations in the FDPIC ABI for data
19563 that is known to be in read-only sections. It's enabled by
19564 default, except for -fpic or -fpie: even though it may help make
19565 the global offset table smaller, it trades 1 instruction for 4.
19566 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
19567 may be shared by multiple symbols, and it avoids the need for a GOT
19568 entry for the referenced symbol, so it's more likely to be a win.
19569 If it is not, -mno-gprel-ro can be used to disable it.
19570
19571 -multilib-library-pic
19572 Link with the (library, not FD) pic libraries. It's implied by
19573 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
19574 should never have to use it explicitly.
19575
19576 -mlinked-fp
19577 Follow the EABI requirement of always creating a frame pointer
19578 whenever a stack frame is allocated. This option is enabled by
19579 default and can be disabled with -mno-linked-fp.
19580
19581 -mlong-calls
19582 Use indirect addressing to call functions outside the current
19583 compilation unit. This allows the functions to be placed anywhere
19584 within the 32-bit address space.
19585
19586 -malign-labels
19587 Try to align labels to an 8-byte boundary by inserting NOPs into
19588 the previous packet. This option only has an effect when VLIW
19589 packing is enabled. It doesn't create new packets; it merely adds
19590 NOPs to existing ones.
19591
19592 -mlibrary-pic
19593 Generate position-independent EABI code.
19594
19595 -macc-4
19596 Use only the first four media accumulator registers.
19597
19598 -macc-8
19599 Use all eight media accumulator registers.
19600
19601 -mpack
19602 Pack VLIW instructions.
19603
19604 -mno-pack
19605 Do not pack VLIW instructions.
19606
19607 -mno-eflags
19608 Do not mark ABI switches in e_flags.
19609
19610 -mcond-move
19611 Enable the use of conditional-move instructions (default).
19612
19613 This switch is mainly for debugging the compiler and will likely be
19614 removed in a future version.
19615
19616 -mno-cond-move
19617 Disable the use of conditional-move instructions.
19618
19619 This switch is mainly for debugging the compiler and will likely be
19620 removed in a future version.
19621
19622 -mscc
19623 Enable the use of conditional set instructions (default).
19624
19625 This switch is mainly for debugging the compiler and will likely be
19626 removed in a future version.
19627
19628 -mno-scc
19629 Disable the use of conditional set instructions.
19630
19631 This switch is mainly for debugging the compiler and will likely be
19632 removed in a future version.
19633
19634 -mcond-exec
19635 Enable the use of conditional execution (default).
19636
19637 This switch is mainly for debugging the compiler and will likely be
19638 removed in a future version.
19639
19640 -mno-cond-exec
19641 Disable the use of conditional execution.
19642
19643 This switch is mainly for debugging the compiler and will likely be
19644 removed in a future version.
19645
19646 -mvliw-branch
19647 Run a pass to pack branches into VLIW instructions (default).
19648
19649 This switch is mainly for debugging the compiler and will likely be
19650 removed in a future version.
19651
19652 -mno-vliw-branch
19653 Do not run a pass to pack branches into VLIW instructions.
19654
19655 This switch is mainly for debugging the compiler and will likely be
19656 removed in a future version.
19657
19658 -mmulti-cond-exec
19659 Enable optimization of "&&" and "||" in conditional execution
19660 (default).
19661
19662 This switch is mainly for debugging the compiler and will likely be
19663 removed in a future version.
19664
19665 -mno-multi-cond-exec
19666 Disable optimization of "&&" and "||" in conditional execution.
19667
19668 This switch is mainly for debugging the compiler and will likely be
19669 removed in a future version.
19670
19671 -mnested-cond-exec
19672 Enable nested conditional execution optimizations (default).
19673
19674 This switch is mainly for debugging the compiler and will likely be
19675 removed in a future version.
19676
19677 -mno-nested-cond-exec
19678 Disable nested conditional execution optimizations.
19679
19680 This switch is mainly for debugging the compiler and will likely be
19681 removed in a future version.
19682
19683 -moptimize-membar
19684 This switch removes redundant "membar" instructions from the
19685 compiler-generated code. It is enabled by default.
19686
19687 -mno-optimize-membar
19688 This switch disables the automatic removal of redundant "membar"
19689 instructions from the generated code.
19690
19691 -mtomcat-stats
19692 Cause gas to print out tomcat statistics.
19693
19694 -mcpu=cpu
19695 Select the processor type for which to generate code. Possible
19696 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
19697 and simple.
19698
19699 GNU/Linux Options
19700
19701 These -m options are defined for GNU/Linux targets:
19702
19703 -mglibc
19704 Use the GNU C library. This is the default except on
19705 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
19706 targets.
19707
19708 -muclibc
19709 Use uClibc C library. This is the default on *-*-linux-*uclibc*
19710 targets.
19711
19712 -mmusl
19713 Use the musl C library. This is the default on *-*-linux-*musl*
19714 targets.
19715
19716 -mbionic
19717 Use Bionic C library. This is the default on *-*-linux-*android*
19718 targets.
19719
19720 -mandroid
19721 Compile code compatible with Android platform. This is the default
19722 on *-*-linux-*android* targets.
19723
19724 When compiling, this option enables -mbionic, -fPIC,
19725 -fno-exceptions and -fno-rtti by default. When linking, this
19726 option makes the GCC driver pass Android-specific options to the
19727 linker. Finally, this option causes the preprocessor macro
19728 "__ANDROID__" to be defined.
19729
19730 -tno-android-cc
19731 Disable compilation effects of -mandroid, i.e., do not enable
19732 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
19733
19734 -tno-android-ld
19735 Disable linking effects of -mandroid, i.e., pass standard Linux
19736 linking options to the linker.
19737
19738 H8/300 Options
19739
19740 These -m options are defined for the H8/300 implementations:
19741
19742 -mrelax
19743 Shorten some address references at link time, when possible; uses
19744 the linker option -relax.
19745
19746 -mh Generate code for the H8/300H.
19747
19748 -ms Generate code for the H8S.
19749
19750 -mn Generate code for the H8S and H8/300H in the normal mode. This
19751 switch must be used either with -mh or -ms.
19752
19753 -ms2600
19754 Generate code for the H8S/2600. This switch must be used with -ms.
19755
19756 -mexr
19757 Extended registers are stored on stack before execution of function
19758 with monitor attribute. Default option is -mexr. This option is
19759 valid only for H8S targets.
19760
19761 -mno-exr
19762 Extended registers are not stored on stack before execution of
19763 function with monitor attribute. Default option is -mno-exr. This
19764 option is valid only for H8S targets.
19765
19766 -mint32
19767 Make "int" data 32 bits by default.
19768
19769 -malign-300
19770 On the H8/300H and H8S, use the same alignment rules as for the
19771 H8/300. The default for the H8/300H and H8S is to align longs and
19772 floats on 4-byte boundaries. -malign-300 causes them to be aligned
19773 on 2-byte boundaries. This option has no effect on the H8/300.
19774
19775 HPPA Options
19776
19777 These -m options are defined for the HPPA family of computers:
19778
19779 -march=architecture-type
19780 Generate code for the specified architecture. The choices for
19781 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
19782 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
19783 system to determine the proper architecture option for your
19784 machine. Code compiled for lower numbered architectures runs on
19785 higher numbered architectures, but not the other way around.
19786
19787 -mpa-risc-1-0
19788 -mpa-risc-1-1
19789 -mpa-risc-2-0
19790 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
19791
19792 -mcaller-copies
19793 The caller copies function arguments passed by hidden reference.
19794 This option should be used with care as it is not compatible with
19795 the default 32-bit runtime. However, only aggregates larger than
19796 eight bytes are passed by hidden reference and the option provides
19797 better compatibility with OpenMP.
19798
19799 -mjump-in-delay
19800 This option is ignored and provided for compatibility purposes
19801 only.
19802
19803 -mdisable-fpregs
19804 Prevent floating-point registers from being used in any manner.
19805 This is necessary for compiling kernels that perform lazy context
19806 switching of floating-point registers. If you use this option and
19807 attempt to perform floating-point operations, the compiler aborts.
19808
19809 -mdisable-indexing
19810 Prevent the compiler from using indexing address modes. This
19811 avoids some rather obscure problems when compiling MIG generated
19812 code under MACH.
19813
19814 -mno-space-regs
19815 Generate code that assumes the target has no space registers. This
19816 allows GCC to generate faster indirect calls and use unscaled index
19817 address modes.
19818
19819 Such code is suitable for level 0 PA systems and kernels.
19820
19821 -mfast-indirect-calls
19822 Generate code that assumes calls never cross space boundaries.
19823 This allows GCC to emit code that performs faster indirect calls.
19824
19825 This option does not work in the presence of shared libraries or
19826 nested functions.
19827
19828 -mfixed-range=register-range
19829 Generate code treating the given register range as fixed registers.
19830 A fixed register is one that the register allocator cannot use.
19831 This is useful when compiling kernel code. A register range is
19832 specified as two registers separated by a dash. Multiple register
19833 ranges can be specified separated by a comma.
19834
19835 -mlong-load-store
19836 Generate 3-instruction load and store sequences as sometimes
19837 required by the HP-UX 10 linker. This is equivalent to the +k
19838 option to the HP compilers.
19839
19840 -mportable-runtime
19841 Use the portable calling conventions proposed by HP for ELF
19842 systems.
19843
19844 -mgas
19845 Enable the use of assembler directives only GAS understands.
19846
19847 -mschedule=cpu-type
19848 Schedule code according to the constraints for the machine type
19849 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
19850 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
19851 to determine the proper scheduling option for your machine. The
19852 default scheduling is 8000.
19853
19854 -mlinker-opt
19855 Enable the optimization pass in the HP-UX linker. Note this makes
19856 symbolic debugging impossible. It also triggers a bug in the HP-UX
19857 8 and HP-UX 9 linkers in which they give bogus error messages when
19858 linking some programs.
19859
19860 -msoft-float
19861 Generate output containing library calls for floating point.
19862 Warning: the requisite libraries are not available for all HPPA
19863 targets. Normally the facilities of the machine's usual C compiler
19864 are used, but this cannot be done directly in cross-compilation.
19865 You must make your own arrangements to provide suitable library
19866 functions for cross-compilation.
19867
19868 -msoft-float changes the calling convention in the output file;
19869 therefore, it is only useful if you compile all of a program with
19870 this option. In particular, you need to compile libgcc.a, the
19871 library that comes with GCC, with -msoft-float in order for this to
19872 work.
19873
19874 -msio
19875 Generate the predefine, "_SIO", for server IO. The default is
19876 -mwsio. This generates the predefines, "__hp9000s700",
19877 "__hp9000s700__" and "_WSIO", for workstation IO. These options
19878 are available under HP-UX and HI-UX.
19879
19880 -mgnu-ld
19881 Use options specific to GNU ld. This passes -shared to ld when
19882 building a shared library. It is the default when GCC is
19883 configured, explicitly or implicitly, with the GNU linker. This
19884 option does not affect which ld is called; it only changes what
19885 parameters are passed to that ld. The ld that is called is
19886 determined by the --with-ld configure option, GCC's program search
19887 path, and finally by the user's PATH. The linker used by GCC can
19888 be printed using which `gcc -print-prog-name=ld`. This option is
19889 only available on the 64-bit HP-UX GCC, i.e. configured with
19890 hppa*64*-*-hpux*.
19891
19892 -mhp-ld
19893 Use options specific to HP ld. This passes -b to ld when building
19894 a shared library and passes +Accept TypeMismatch to ld on all
19895 links. It is the default when GCC is configured, explicitly or
19896 implicitly, with the HP linker. This option does not affect which
19897 ld is called; it only changes what parameters are passed to that
19898 ld. The ld that is called is determined by the --with-ld configure
19899 option, GCC's program search path, and finally by the user's PATH.
19900 The linker used by GCC can be printed using which `gcc
19901 -print-prog-name=ld`. This option is only available on the 64-bit
19902 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
19903
19904 -mlong-calls
19905 Generate code that uses long call sequences. This ensures that a
19906 call is always able to reach linker generated stubs. The default
19907 is to generate long calls only when the distance from the call site
19908 to the beginning of the function or translation unit, as the case
19909 may be, exceeds a predefined limit set by the branch type being
19910 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
19911 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
19912 always limited at 240,000 bytes.
19913
19914 Distances are measured from the beginning of functions when using
19915 the -ffunction-sections option, or when using the -mgas and
19916 -mno-portable-runtime options together under HP-UX with the SOM
19917 linker.
19918
19919 It is normally not desirable to use this option as it degrades
19920 performance. However, it may be useful in large applications,
19921 particularly when partial linking is used to build the application.
19922
19923 The types of long calls used depends on the capabilities of the
19924 assembler and linker, and the type of code being generated. The
19925 impact on systems that support long absolute calls, and long pic
19926 symbol-difference or pc-relative calls should be relatively small.
19927 However, an indirect call is used on 32-bit ELF systems in pic code
19928 and it is quite long.
19929
19930 -munix=unix-std
19931 Generate compiler predefines and select a startfile for the
19932 specified UNIX standard. The choices for unix-std are 93, 95 and
19933 98. 93 is supported on all HP-UX versions. 95 is available on HP-
19934 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
19935 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
19936 11.00, and 98 for HP-UX 11.11 and later.
19937
19938 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
19939 -munix=95 provides additional predefines for "XOPEN_UNIX" and
19940 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
19941 provides additional predefines for "_XOPEN_UNIX",
19942 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
19943 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
19944
19945 It is important to note that this option changes the interfaces for
19946 various library routines. It also affects the operational behavior
19947 of the C library. Thus, extreme care is needed in using this
19948 option.
19949
19950 Library code that is intended to operate with more than one UNIX
19951 standard must test, set and restore the variable
19952 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
19953 provide this capability.
19954
19955 -nolibdld
19956 Suppress the generation of link options to search libdld.sl when
19957 the -static option is specified on HP-UX 10 and later.
19958
19959 -static
19960 The HP-UX implementation of setlocale in libc has a dependency on
19961 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19962 when the -static option is specified, special link options are
19963 needed to resolve this dependency.
19964
19965 On HP-UX 10 and later, the GCC driver adds the necessary options to
19966 link with libdld.sl when the -static option is specified. This
19967 causes the resulting binary to be dynamic. On the 64-bit port, the
19968 linkers generate dynamic binaries by default in any case. The
19969 -nolibdld option can be used to prevent the GCC driver from adding
19970 these link options.
19971
19972 -threads
19973 Add support for multithreading with the dce thread library under
19974 HP-UX. This option sets flags for both the preprocessor and
19975 linker.
19976
19977 IA-64 Options
19978
19979 These are the -m options defined for the Intel IA-64 architecture.
19980
19981 -mbig-endian
19982 Generate code for a big-endian target. This is the default for HP-
19983 UX.
19984
19985 -mlittle-endian
19986 Generate code for a little-endian target. This is the default for
19987 AIX5 and GNU/Linux.
19988
19989 -mgnu-as
19990 -mno-gnu-as
19991 Generate (or don't) code for the GNU assembler. This is the
19992 default.
19993
19994 -mgnu-ld
19995 -mno-gnu-ld
19996 Generate (or don't) code for the GNU linker. This is the default.
19997
19998 -mno-pic
19999 Generate code that does not use a global pointer register. The
20000 result is not position independent code, and violates the IA-64
20001 ABI.
20002
20003 -mvolatile-asm-stop
20004 -mno-volatile-asm-stop
20005 Generate (or don't) a stop bit immediately before and after
20006 volatile asm statements.
20007
20008 -mregister-names
20009 -mno-register-names
20010 Generate (or don't) in, loc, and out register names for the stacked
20011 registers. This may make assembler output more readable.
20012
20013 -mno-sdata
20014 -msdata
20015 Disable (or enable) optimizations that use the small data section.
20016 This may be useful for working around optimizer bugs.
20017
20018 -mconstant-gp
20019 Generate code that uses a single constant global pointer value.
20020 This is useful when compiling kernel code.
20021
20022 -mauto-pic
20023 Generate code that is self-relocatable. This implies
20024 -mconstant-gp. This is useful when compiling firmware code.
20025
20026 -minline-float-divide-min-latency
20027 Generate code for inline divides of floating-point values using the
20028 minimum latency algorithm.
20029
20030 -minline-float-divide-max-throughput
20031 Generate code for inline divides of floating-point values using the
20032 maximum throughput algorithm.
20033
20034 -mno-inline-float-divide
20035 Do not generate inline code for divides of floating-point values.
20036
20037 -minline-int-divide-min-latency
20038 Generate code for inline divides of integer values using the
20039 minimum latency algorithm.
20040
20041 -minline-int-divide-max-throughput
20042 Generate code for inline divides of integer values using the
20043 maximum throughput algorithm.
20044
20045 -mno-inline-int-divide
20046 Do not generate inline code for divides of integer values.
20047
20048 -minline-sqrt-min-latency
20049 Generate code for inline square roots using the minimum latency
20050 algorithm.
20051
20052 -minline-sqrt-max-throughput
20053 Generate code for inline square roots using the maximum throughput
20054 algorithm.
20055
20056 -mno-inline-sqrt
20057 Do not generate inline code for "sqrt".
20058
20059 -mfused-madd
20060 -mno-fused-madd
20061 Do (don't) generate code that uses the fused multiply/add or
20062 multiply/subtract instructions. The default is to use these
20063 instructions.
20064
20065 -mno-dwarf2-asm
20066 -mdwarf2-asm
20067 Don't (or do) generate assembler code for the DWARF line number
20068 debugging info. This may be useful when not using the GNU
20069 assembler.
20070
20071 -mearly-stop-bits
20072 -mno-early-stop-bits
20073 Allow stop bits to be placed earlier than immediately preceding the
20074 instruction that triggered the stop bit. This can improve
20075 instruction scheduling, but does not always do so.
20076
20077 -mfixed-range=register-range
20078 Generate code treating the given register range as fixed registers.
20079 A fixed register is one that the register allocator cannot use.
20080 This is useful when compiling kernel code. A register range is
20081 specified as two registers separated by a dash. Multiple register
20082 ranges can be specified separated by a comma.
20083
20084 -mtls-size=tls-size
20085 Specify bit size of immediate TLS offsets. Valid values are 14,
20086 22, and 64.
20087
20088 -mtune=cpu-type
20089 Tune the instruction scheduling for a particular CPU, Valid values
20090 are itanium, itanium1, merced, itanium2, and mckinley.
20091
20092 -milp32
20093 -mlp64
20094 Generate code for a 32-bit or 64-bit environment. The 32-bit
20095 environment sets int, long and pointer to 32 bits. The 64-bit
20096 environment sets int to 32 bits and long and pointer to 64 bits.
20097 These are HP-UX specific flags.
20098
20099 -mno-sched-br-data-spec
20100 -msched-br-data-spec
20101 (Dis/En)able data speculative scheduling before reload. This
20102 results in generation of "ld.a" instructions and the corresponding
20103 check instructions ("ld.c" / "chk.a"). The default setting is
20104 disabled.
20105
20106 -msched-ar-data-spec
20107 -mno-sched-ar-data-spec
20108 (En/Dis)able data speculative scheduling after reload. This
20109 results in generation of "ld.a" instructions and the corresponding
20110 check instructions ("ld.c" / "chk.a"). The default setting is
20111 enabled.
20112
20113 -mno-sched-control-spec
20114 -msched-control-spec
20115 (Dis/En)able control speculative scheduling. This feature is
20116 available only during region scheduling (i.e. before reload). This
20117 results in generation of the "ld.s" instructions and the
20118 corresponding check instructions "chk.s". The default setting is
20119 disabled.
20120
20121 -msched-br-in-data-spec
20122 -mno-sched-br-in-data-spec
20123 (En/Dis)able speculative scheduling of the instructions that are
20124 dependent on the data speculative loads before reload. This is
20125 effective only with -msched-br-data-spec enabled. The default
20126 setting is enabled.
20127
20128 -msched-ar-in-data-spec
20129 -mno-sched-ar-in-data-spec
20130 (En/Dis)able speculative scheduling of the instructions that are
20131 dependent on the data speculative loads after reload. This is
20132 effective only with -msched-ar-data-spec enabled. The default
20133 setting is enabled.
20134
20135 -msched-in-control-spec
20136 -mno-sched-in-control-spec
20137 (En/Dis)able speculative scheduling of the instructions that are
20138 dependent on the control speculative loads. This is effective only
20139 with -msched-control-spec enabled. The default setting is enabled.
20140
20141 -mno-sched-prefer-non-data-spec-insns
20142 -msched-prefer-non-data-spec-insns
20143 If enabled, data-speculative instructions are chosen for schedule
20144 only if there are no other choices at the moment. This makes the
20145 use of the data speculation much more conservative. The default
20146 setting is disabled.
20147
20148 -mno-sched-prefer-non-control-spec-insns
20149 -msched-prefer-non-control-spec-insns
20150 If enabled, control-speculative instructions are chosen for
20151 schedule only if there are no other choices at the moment. This
20152 makes the use of the control speculation much more conservative.
20153 The default setting is disabled.
20154
20155 -mno-sched-count-spec-in-critical-path
20156 -msched-count-spec-in-critical-path
20157 If enabled, speculative dependencies are considered during
20158 computation of the instructions priorities. This makes the use of
20159 the speculation a bit more conservative. The default setting is
20160 disabled.
20161
20162 -msched-spec-ldc
20163 Use a simple data speculation check. This option is on by default.
20164
20165 -msched-control-spec-ldc
20166 Use a simple check for control speculation. This option is on by
20167 default.
20168
20169 -msched-stop-bits-after-every-cycle
20170 Place a stop bit after every cycle when scheduling. This option is
20171 on by default.
20172
20173 -msched-fp-mem-deps-zero-cost
20174 Assume that floating-point stores and loads are not likely to cause
20175 a conflict when placed into the same instruction group. This
20176 option is disabled by default.
20177
20178 -msel-sched-dont-check-control-spec
20179 Generate checks for control speculation in selective scheduling.
20180 This flag is disabled by default.
20181
20182 -msched-max-memory-insns=max-insns
20183 Limit on the number of memory insns per instruction group, giving
20184 lower priority to subsequent memory insns attempting to schedule in
20185 the same instruction group. Frequently useful to prevent cache bank
20186 conflicts. The default value is 1.
20187
20188 -msched-max-memory-insns-hard-limit
20189 Makes the limit specified by msched-max-memory-insns a hard limit,
20190 disallowing more than that number in an instruction group.
20191 Otherwise, the limit is "soft", meaning that non-memory operations
20192 are preferred when the limit is reached, but memory operations may
20193 still be scheduled.
20194
20195 LM32 Options
20196
20197 These -m options are defined for the LatticeMico32 architecture:
20198
20199 -mbarrel-shift-enabled
20200 Enable barrel-shift instructions.
20201
20202 -mdivide-enabled
20203 Enable divide and modulus instructions.
20204
20205 -mmultiply-enabled
20206 Enable multiply instructions.
20207
20208 -msign-extend-enabled
20209 Enable sign extend instructions.
20210
20211 -muser-enabled
20212 Enable user-defined instructions.
20213
20214 M32C Options
20215
20216 -mcpu=name
20217 Select the CPU for which code is generated. name may be one of r8c
20218 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
20219 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
20220
20221 -msim
20222 Specifies that the program will be run on the simulator. This
20223 causes an alternate runtime library to be linked in which supports,
20224 for example, file I/O. You must not use this option when
20225 generating programs that will run on real hardware; you must
20226 provide your own runtime library for whatever I/O functions are
20227 needed.
20228
20229 -memregs=number
20230 Specifies the number of memory-based pseudo-registers GCC uses
20231 during code generation. These pseudo-registers are used like real
20232 registers, so there is a tradeoff between GCC's ability to fit the
20233 code into available registers, and the performance penalty of using
20234 memory instead of registers. Note that all modules in a program
20235 must be compiled with the same value for this option. Because of
20236 that, you must not use this option with GCC's default runtime
20237 libraries.
20238
20239 M32R/D Options
20240
20241 These -m options are defined for Renesas M32R/D architectures:
20242
20243 -m32r2
20244 Generate code for the M32R/2.
20245
20246 -m32rx
20247 Generate code for the M32R/X.
20248
20249 -m32r
20250 Generate code for the M32R. This is the default.
20251
20252 -mmodel=small
20253 Assume all objects live in the lower 16MB of memory (so that their
20254 addresses can be loaded with the "ld24" instruction), and assume
20255 all subroutines are reachable with the "bl" instruction. This is
20256 the default.
20257
20258 The addressability of a particular object can be set with the
20259 "model" attribute.
20260
20261 -mmodel=medium
20262 Assume objects may be anywhere in the 32-bit address space (the
20263 compiler generates "seth/add3" instructions to load their
20264 addresses), and assume all subroutines are reachable with the "bl"
20265 instruction.
20266
20267 -mmodel=large
20268 Assume objects may be anywhere in the 32-bit address space (the
20269 compiler generates "seth/add3" instructions to load their
20270 addresses), and assume subroutines may not be reachable with the
20271 "bl" instruction (the compiler generates the much slower
20272 "seth/add3/jl" instruction sequence).
20273
20274 -msdata=none
20275 Disable use of the small data area. Variables are put into one of
20276 ".data", ".bss", or ".rodata" (unless the "section" attribute has
20277 been specified). This is the default.
20278
20279 The small data area consists of sections ".sdata" and ".sbss".
20280 Objects may be explicitly put in the small data area with the
20281 "section" attribute using one of these sections.
20282
20283 -msdata=sdata
20284 Put small global and static data in the small data area, but do not
20285 generate special code to reference them.
20286
20287 -msdata=use
20288 Put small global and static data in the small data area, and
20289 generate special instructions to reference them.
20290
20291 -G num
20292 Put global and static objects less than or equal to num bytes into
20293 the small data or BSS sections instead of the normal data or BSS
20294 sections. The default value of num is 8. The -msdata option must
20295 be set to one of sdata or use for this option to have any effect.
20296
20297 All modules should be compiled with the same -G num value.
20298 Compiling with different values of num may or may not work; if it
20299 doesn't the linker gives an error message---incorrect code is not
20300 generated.
20301
20302 -mdebug
20303 Makes the M32R-specific code in the compiler display some
20304 statistics that might help in debugging programs.
20305
20306 -malign-loops
20307 Align all loops to a 32-byte boundary.
20308
20309 -mno-align-loops
20310 Do not enforce a 32-byte alignment for loops. This is the default.
20311
20312 -missue-rate=number
20313 Issue number instructions per cycle. number can only be 1 or 2.
20314
20315 -mbranch-cost=number
20316 number can only be 1 or 2. If it is 1 then branches are preferred
20317 over conditional code, if it is 2, then the opposite applies.
20318
20319 -mflush-trap=number
20320 Specifies the trap number to use to flush the cache. The default
20321 is 12. Valid numbers are between 0 and 15 inclusive.
20322
20323 -mno-flush-trap
20324 Specifies that the cache cannot be flushed by using a trap.
20325
20326 -mflush-func=name
20327 Specifies the name of the operating system function to call to
20328 flush the cache. The default is _flush_cache, but a function call
20329 is only used if a trap is not available.
20330
20331 -mno-flush-func
20332 Indicates that there is no OS function for flushing the cache.
20333
20334 M680x0 Options
20335
20336 These are the -m options defined for M680x0 and ColdFire processors.
20337 The default settings depend on which architecture was selected when the
20338 compiler was configured; the defaults for the most common choices are
20339 given below.
20340
20341 -march=arch
20342 Generate code for a specific M680x0 or ColdFire instruction set
20343 architecture. Permissible values of arch for M680x0 architectures
20344 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
20345 architectures are selected according to Freescale's ISA
20346 classification and the permissible values are: isaa, isaaplus, isab
20347 and isac.
20348
20349 GCC defines a macro "__mcfarch__" whenever it is generating code
20350 for a ColdFire target. The arch in this macro is one of the -march
20351 arguments given above.
20352
20353 When used together, -march and -mtune select code that runs on a
20354 family of similar processors but that is optimized for a particular
20355 microarchitecture.
20356
20357 -mcpu=cpu
20358 Generate code for a specific M680x0 or ColdFire processor. The
20359 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
20360 68332 and cpu32. The ColdFire cpus are given by the table below,
20361 which also classifies the CPUs into families:
20362
20363 Family : -mcpu arguments
20364 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
20365 5206 : 5202 5204 5206
20366 5206e : 5206e
20367 5208 : 5207 5208
20368 5211a : 5210a 5211a
20369 5213 : 5211 5212 5213
20370 5216 : 5214 5216
20371 52235 : 52230 52231 52232 52233 52234 52235
20372 5225 : 5224 5225
20373 52259 : 52252 52254 52255 52256 52258 52259
20374 5235 : 5232 5233 5234 5235 523x
20375 5249 : 5249
20376 5250 : 5250
20377 5271 : 5270 5271
20378 5272 : 5272
20379 5275 : 5274 5275
20380 5282 : 5280 5281 5282 528x
20381 53017 : 53011 53012 53013 53014 53015 53016 53017
20382 5307 : 5307
20383 5329 : 5327 5328 5329 532x
20384 5373 : 5372 5373 537x
20385 5407 : 5407
20386 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
20387 5485
20388
20389 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
20390 Other combinations of -mcpu and -march are rejected.
20391
20392 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
20393 selected. It also defines "__mcf_family_family", where the value
20394 of family is given by the table above.
20395
20396 -mtune=tune
20397 Tune the code for a particular microarchitecture within the
20398 constraints set by -march and -mcpu. The M680x0 microarchitectures
20399 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
20400 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
20401
20402 You can also use -mtune=68020-40 for code that needs to run
20403 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
20404 is similar but includes 68060 targets as well. These two options
20405 select the same tuning decisions as -m68020-40 and -m68020-60
20406 respectively.
20407
20408 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
20409 680x0 architecture arch. It also defines "mcarch" unless either
20410 -ansi or a non-GNU -std option is used. If GCC is tuning for a
20411 range of architectures, as selected by -mtune=68020-40 or
20412 -mtune=68020-60, it defines the macros for every architecture in
20413 the range.
20414
20415 GCC also defines the macro "__muarch__" when tuning for ColdFire
20416 microarchitecture uarch, where uarch is one of the arguments given
20417 above.
20418
20419 -m68000
20420 -mc68000
20421 Generate output for a 68000. This is the default when the compiler
20422 is configured for 68000-based systems. It is equivalent to
20423 -march=68000.
20424
20425 Use this option for microcontrollers with a 68000 or EC000 core,
20426 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20427
20428 -m68010
20429 Generate output for a 68010. This is the default when the compiler
20430 is configured for 68010-based systems. It is equivalent to
20431 -march=68010.
20432
20433 -m68020
20434 -mc68020
20435 Generate output for a 68020. This is the default when the compiler
20436 is configured for 68020-based systems. It is equivalent to
20437 -march=68020.
20438
20439 -m68030
20440 Generate output for a 68030. This is the default when the compiler
20441 is configured for 68030-based systems. It is equivalent to
20442 -march=68030.
20443
20444 -m68040
20445 Generate output for a 68040. This is the default when the compiler
20446 is configured for 68040-based systems. It is equivalent to
20447 -march=68040.
20448
20449 This option inhibits the use of 68881/68882 instructions that have
20450 to be emulated by software on the 68040. Use this option if your
20451 68040 does not have code to emulate those instructions.
20452
20453 -m68060
20454 Generate output for a 68060. This is the default when the compiler
20455 is configured for 68060-based systems. It is equivalent to
20456 -march=68060.
20457
20458 This option inhibits the use of 68020 and 68881/68882 instructions
20459 that have to be emulated by software on the 68060. Use this option
20460 if your 68060 does not have code to emulate those instructions.
20461
20462 -mcpu32
20463 Generate output for a CPU32. This is the default when the compiler
20464 is configured for CPU32-based systems. It is equivalent to
20465 -march=cpu32.
20466
20467 Use this option for microcontrollers with a CPU32 or CPU32+ core,
20468 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
20469 68341, 68349 and 68360.
20470
20471 -m5200
20472 Generate output for a 520X ColdFire CPU. This is the default when
20473 the compiler is configured for 520X-based systems. It is
20474 equivalent to -mcpu=5206, and is now deprecated in favor of that
20475 option.
20476
20477 Use this option for microcontroller with a 5200 core, including the
20478 MCF5202, MCF5203, MCF5204 and MCF5206.
20479
20480 -m5206e
20481 Generate output for a 5206e ColdFire CPU. The option is now
20482 deprecated in favor of the equivalent -mcpu=5206e.
20483
20484 -m528x
20485 Generate output for a member of the ColdFire 528X family. The
20486 option is now deprecated in favor of the equivalent -mcpu=528x.
20487
20488 -m5307
20489 Generate output for a ColdFire 5307 CPU. The option is now
20490 deprecated in favor of the equivalent -mcpu=5307.
20491
20492 -m5407
20493 Generate output for a ColdFire 5407 CPU. The option is now
20494 deprecated in favor of the equivalent -mcpu=5407.
20495
20496 -mcfv4e
20497 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
20498 This includes use of hardware floating-point instructions. The
20499 option is equivalent to -mcpu=547x, and is now deprecated in favor
20500 of that option.
20501
20502 -m68020-40
20503 Generate output for a 68040, without using any of the new
20504 instructions. This results in code that can run relatively
20505 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20506 generated code does use the 68881 instructions that are emulated on
20507 the 68040.
20508
20509 The option is equivalent to -march=68020 -mtune=68020-40.
20510
20511 -m68020-60
20512 Generate output for a 68060, without using any of the new
20513 instructions. This results in code that can run relatively
20514 efficiently on either a 68020/68881 or a 68030 or a 68040. The
20515 generated code does use the 68881 instructions that are emulated on
20516 the 68060.
20517
20518 The option is equivalent to -march=68020 -mtune=68020-60.
20519
20520 -mhard-float
20521 -m68881
20522 Generate floating-point instructions. This is the default for
20523 68020 and above, and for ColdFire devices that have an FPU. It
20524 defines the macro "__HAVE_68881__" on M680x0 targets and
20525 "__mcffpu__" on ColdFire targets.
20526
20527 -msoft-float
20528 Do not generate floating-point instructions; use library calls
20529 instead. This is the default for 68000, 68010, and 68832 targets.
20530 It is also the default for ColdFire devices that have no FPU.
20531
20532 -mdiv
20533 -mno-div
20534 Generate (do not generate) ColdFire hardware divide and remainder
20535 instructions. If -march is used without -mcpu, the default is "on"
20536 for ColdFire architectures and "off" for M680x0 architectures.
20537 Otherwise, the default is taken from the target CPU (either the
20538 default CPU, or the one specified by -mcpu). For example, the
20539 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
20540
20541 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
20542
20543 -mshort
20544 Consider type "int" to be 16 bits wide, like "short int".
20545 Additionally, parameters passed on the stack are also aligned to a
20546 16-bit boundary even on targets whose API mandates promotion to
20547 32-bit.
20548
20549 -mno-short
20550 Do not consider type "int" to be 16 bits wide. This is the
20551 default.
20552
20553 -mnobitfield
20554 -mno-bitfield
20555 Do not use the bit-field instructions. The -m68000, -mcpu32 and
20556 -m5200 options imply -mnobitfield.
20557
20558 -mbitfield
20559 Do use the bit-field instructions. The -m68020 option implies
20560 -mbitfield. This is the default if you use a configuration
20561 designed for a 68020.
20562
20563 -mrtd
20564 Use a different function-calling convention, in which functions
20565 that take a fixed number of arguments return with the "rtd"
20566 instruction, which pops their arguments while returning. This
20567 saves one instruction in the caller since there is no need to pop
20568 the arguments there.
20569
20570 This calling convention is incompatible with the one normally used
20571 on Unix, so you cannot use it if you need to call libraries
20572 compiled with the Unix compiler.
20573
20574 Also, you must provide function prototypes for all functions that
20575 take variable numbers of arguments (including "printf"); otherwise
20576 incorrect code is generated for calls to those functions.
20577
20578 In addition, seriously incorrect code results if you call a
20579 function with too many arguments. (Normally, extra arguments are
20580 harmlessly ignored.)
20581
20582 The "rtd" instruction is supported by the 68010, 68020, 68030,
20583 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20584
20585 The default is -mno-rtd.
20586
20587 -malign-int
20588 -mno-align-int
20589 Control whether GCC aligns "int", "long", "long long", "float",
20590 "double", and "long double" variables on a 32-bit boundary
20591 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
20592 variables on 32-bit boundaries produces code that runs somewhat
20593 faster on processors with 32-bit busses at the expense of more
20594 memory.
20595
20596 Warning: if you use the -malign-int switch, GCC aligns structures
20597 containing the above types differently than most published
20598 application binary interface specifications for the m68k.
20599
20600 Use the pc-relative addressing mode of the 68000 directly, instead
20601 of using a global offset table. At present, this option implies
20602 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
20603 -fPIC is not presently supported with -mpcrel, though this could be
20604 supported for 68020 and higher processors.
20605
20606 -mno-strict-align
20607 -mstrict-align
20608 Do not (do) assume that unaligned memory references are handled by
20609 the system.
20610
20611 -msep-data
20612 Generate code that allows the data segment to be located in a
20613 different area of memory from the text segment. This allows for
20614 execute-in-place in an environment without virtual memory
20615 management. This option implies -fPIC.
20616
20617 -mno-sep-data
20618 Generate code that assumes that the data segment follows the text
20619 segment. This is the default.
20620
20621 -mid-shared-library
20622 Generate code that supports shared libraries via the library ID
20623 method. This allows for execute-in-place and shared libraries in
20624 an environment without virtual memory management. This option
20625 implies -fPIC.
20626
20627 -mno-id-shared-library
20628 Generate code that doesn't assume ID-based shared libraries are
20629 being used. This is the default.
20630
20631 -mshared-library-id=n
20632 Specifies the identification number of the ID-based shared library
20633 being compiled. Specifying a value of 0 generates more compact
20634 code; specifying other values forces the allocation of that number
20635 to the current library, but is no more space- or time-efficient
20636 than omitting this option.
20637
20638 -mxgot
20639 -mno-xgot
20640 When generating position-independent code for ColdFire, generate
20641 code that works if the GOT has more than 8192 entries. This code
20642 is larger and slower than code generated without this option. On
20643 M680x0 processors, this option is not needed; -fPIC suffices.
20644
20645 GCC normally uses a single instruction to load values from the GOT.
20646 While this is relatively efficient, it only works if the GOT is
20647 smaller than about 64k. Anything larger causes the linker to
20648 report an error such as:
20649
20650 relocation truncated to fit: R_68K_GOT16O foobar
20651
20652 If this happens, you should recompile your code with -mxgot. It
20653 should then work with very large GOTs. However, code generated
20654 with -mxgot is less efficient, since it takes 4 instructions to
20655 fetch the value of a global symbol.
20656
20657 Note that some linkers, including newer versions of the GNU linker,
20658 can create multiple GOTs and sort GOT entries. If you have such a
20659 linker, you should only need to use -mxgot when compiling a single
20660 object file that accesses more than 8192 GOT entries. Very few do.
20661
20662 These options have no effect unless GCC is generating position-
20663 independent code.
20664
20665 -mlong-jump-table-offsets
20666 Use 32-bit offsets in "switch" tables. The default is to use
20667 16-bit offsets.
20668
20669 MCore Options
20670
20671 These are the -m options defined for the Motorola M*Core processors.
20672
20673 -mhardlit
20674 -mno-hardlit
20675 Inline constants into the code stream if it can be done in two
20676 instructions or less.
20677
20678 -mdiv
20679 -mno-div
20680 Use the divide instruction. (Enabled by default).
20681
20682 -mrelax-immediate
20683 -mno-relax-immediate
20684 Allow arbitrary-sized immediates in bit operations.
20685
20686 -mwide-bitfields
20687 -mno-wide-bitfields
20688 Always treat bit-fields as "int"-sized.
20689
20690 -m4byte-functions
20691 -mno-4byte-functions
20692 Force all functions to be aligned to a 4-byte boundary.
20693
20694 -mcallgraph-data
20695 -mno-callgraph-data
20696 Emit callgraph information.
20697
20698 -mslow-bytes
20699 -mno-slow-bytes
20700 Prefer word access when reading byte quantities.
20701
20702 -mlittle-endian
20703 -mbig-endian
20704 Generate code for a little-endian target.
20705
20706 -m210
20707 -m340
20708 Generate code for the 210 processor.
20709
20710 -mno-lsim
20711 Assume that runtime support has been provided and so omit the
20712 simulator library (libsim.a) from the linker command line.
20713
20714 -mstack-increment=size
20715 Set the maximum amount for a single stack increment operation.
20716 Large values can increase the speed of programs that contain
20717 functions that need a large amount of stack space, but they can
20718 also trigger a segmentation fault if the stack is extended too
20719 much. The default value is 0x1000.
20720
20721 MeP Options
20722
20723 -mabsdiff
20724 Enables the "abs" instruction, which is the absolute difference
20725 between two registers.
20726
20727 -mall-opts
20728 Enables all the optional instructions---average, multiply, divide,
20729 bit operations, leading zero, absolute difference, min/max, clip,
20730 and saturation.
20731
20732 -maverage
20733 Enables the "ave" instruction, which computes the average of two
20734 registers.
20735
20736 -mbased=n
20737 Variables of size n bytes or smaller are placed in the ".based"
20738 section by default. Based variables use the $tp register as a base
20739 register, and there is a 128-byte limit to the ".based" section.
20740
20741 -mbitops
20742 Enables the bit operation instructions---bit test ("btstm"), set
20743 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
20744 ("tas").
20745
20746 -mc=name
20747 Selects which section constant data is placed in. name may be
20748 tiny, near, or far.
20749
20750 -mclip
20751 Enables the "clip" instruction. Note that -mclip is not useful
20752 unless you also provide -mminmax.
20753
20754 -mconfig=name
20755 Selects one of the built-in core configurations. Each MeP chip has
20756 one or more modules in it; each module has a core CPU and a variety
20757 of coprocessors, optional instructions, and peripherals. The
20758 "MeP-Integrator" tool, not part of GCC, provides these
20759 configurations through this option; using this option is the same
20760 as using all the corresponding command-line options. The default
20761 configuration is default.
20762
20763 -mcop
20764 Enables the coprocessor instructions. By default, this is a 32-bit
20765 coprocessor. Note that the coprocessor is normally enabled via the
20766 -mconfig= option.
20767
20768 -mcop32
20769 Enables the 32-bit coprocessor's instructions.
20770
20771 -mcop64
20772 Enables the 64-bit coprocessor's instructions.
20773
20774 -mivc2
20775 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20776
20777 -mdc
20778 Causes constant variables to be placed in the ".near" section.
20779
20780 -mdiv
20781 Enables the "div" and "divu" instructions.
20782
20783 -meb
20784 Generate big-endian code.
20785
20786 -mel
20787 Generate little-endian code.
20788
20789 -mio-volatile
20790 Tells the compiler that any variable marked with the "io" attribute
20791 is to be considered volatile.
20792
20793 -ml Causes variables to be assigned to the ".far" section by default.
20794
20795 -mleadz
20796 Enables the "leadz" (leading zero) instruction.
20797
20798 -mm Causes variables to be assigned to the ".near" section by default.
20799
20800 -mminmax
20801 Enables the "min" and "max" instructions.
20802
20803 -mmult
20804 Enables the multiplication and multiply-accumulate instructions.
20805
20806 -mno-opts
20807 Disables all the optional instructions enabled by -mall-opts.
20808
20809 -mrepeat
20810 Enables the "repeat" and "erepeat" instructions, used for low-
20811 overhead looping.
20812
20813 -ms Causes all variables to default to the ".tiny" section. Note that
20814 there is a 65536-byte limit to this section. Accesses to these
20815 variables use the %gp base register.
20816
20817 -msatur
20818 Enables the saturation instructions. Note that the compiler does
20819 not currently generate these itself, but this option is included
20820 for compatibility with other tools, like "as".
20821
20822 -msdram
20823 Link the SDRAM-based runtime instead of the default ROM-based
20824 runtime.
20825
20826 -msim
20827 Link the simulator run-time libraries.
20828
20829 -msimnovec
20830 Link the simulator runtime libraries, excluding built-in support
20831 for reset and exception vectors and tables.
20832
20833 -mtf
20834 Causes all functions to default to the ".far" section. Without
20835 this option, functions default to the ".near" section.
20836
20837 -mtiny=n
20838 Variables that are n bytes or smaller are allocated to the ".tiny"
20839 section. These variables use the $gp base register. The default
20840 for this option is 4, but note that there's a 65536-byte limit to
20841 the ".tiny" section.
20842
20843 MicroBlaze Options
20844
20845 -msoft-float
20846 Use software emulation for floating point (default).
20847
20848 -mhard-float
20849 Use hardware floating-point instructions.
20850
20851 -mmemcpy
20852 Do not optimize block moves, use "memcpy".
20853
20854 -mno-clearbss
20855 This option is deprecated. Use -fno-zero-initialized-in-bss
20856 instead.
20857
20858 -mcpu=cpu-type
20859 Use features of, and schedule code for, the given CPU. Supported
20860 values are in the format vX.YY.Z, where X is a major version, YY is
20861 the minor version, and Z is compatibility code. Example values are
20862 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
20863
20864 -mxl-soft-mul
20865 Use software multiply emulation (default).
20866
20867 -mxl-soft-div
20868 Use software emulation for divides (default).
20869
20870 -mxl-barrel-shift
20871 Use the hardware barrel shifter.
20872
20873 -mxl-pattern-compare
20874 Use pattern compare instructions.
20875
20876 -msmall-divides
20877 Use table lookup optimization for small signed integer divisions.
20878
20879 -mxl-stack-check
20880 This option is deprecated. Use -fstack-check instead.
20881
20882 -mxl-gp-opt
20883 Use GP-relative ".sdata"/".sbss" sections.
20884
20885 -mxl-multiply-high
20886 Use multiply high instructions for high part of 32x32 multiply.
20887
20888 -mxl-float-convert
20889 Use hardware floating-point conversion instructions.
20890
20891 -mxl-float-sqrt
20892 Use hardware floating-point square root instruction.
20893
20894 -mbig-endian
20895 Generate code for a big-endian target.
20896
20897 -mlittle-endian
20898 Generate code for a little-endian target.
20899
20900 -mxl-reorder
20901 Use reorder instructions (swap and byte reversed load/store).
20902
20903 -mxl-mode-app-model
20904 Select application model app-model. Valid models are
20905
20906 executable
20907 normal executable (default), uses startup code crt0.o.
20908
20909 -mpic-data-is-text-relative
20910 Assume that the displacement between the text and data segments
20911 is fixed at static link time. This allows data to be
20912 referenced by offset from start of text address instead of GOT
20913 since PC-relative addressing is not supported.
20914
20915 xmdstub
20916 for use with Xilinx Microprocessor Debugger (XMD) based
20917 software intrusive debug agent called xmdstub. This uses
20918 startup file crt1.o and sets the start address of the program
20919 to 0x800.
20920
20921 bootstrap
20922 for applications that are loaded using a bootloader. This
20923 model uses startup file crt2.o which does not contain a
20924 processor reset vector handler. This is suitable for
20925 transferring control on a processor reset to the bootloader
20926 rather than the application.
20927
20928 novectors
20929 for applications that do not require any of the MicroBlaze
20930 vectors. This option may be useful for applications running
20931 within a monitoring application. This model uses crt3.o as a
20932 startup file.
20933
20934 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
20935 model.
20936
20937 MIPS Options
20938
20939 -EB Generate big-endian code.
20940
20941 -EL Generate little-endian code. This is the default for mips*el-*-*
20942 configurations.
20943
20944 -march=arch
20945 Generate code that runs on arch, which can be the name of a generic
20946 MIPS ISA, or the name of a particular processor. The ISA names
20947 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
20948 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
20949 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
20950 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
20951 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
20952 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
20953 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
20954 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
20955 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
20956 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
20957 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
20958 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
20959 and xlp. The special value from-abi selects the most compatible
20960 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
20961 and mips3 for 64-bit ABIs).
20962
20963 The native Linux/GNU toolchain also supports the value native,
20964 which selects the best architecture option for the host processor.
20965 -march=native has no effect if GCC does not recognize the
20966 processor.
20967
20968 In processor names, a final 000 can be abbreviated as k (for
20969 example, -march=r2k). Prefixes are optional, and vr may be written
20970 r.
20971
20972 Names of the form nf2_1 refer to processors with FPUs clocked at
20973 half the rate of the core, names of the form nf1_1 refer to
20974 processors with FPUs clocked at the same rate as the core, and
20975 names of the form nf3_2 refer to processors with FPUs clocked a
20976 ratio of 3:2 with respect to the core. For compatibility reasons,
20977 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
20978 as synonyms for nf1_1.
20979
20980 GCC defines two macros based on the value of this option. The
20981 first is "_MIPS_ARCH", which gives the name of target architecture,
20982 as a string. The second has the form "_MIPS_ARCH_foo", where foo
20983 is the capitalized value of "_MIPS_ARCH". For example,
20984 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
20985 "_MIPS_ARCH_R2000".
20986
20987 Note that the "_MIPS_ARCH" macro uses the processor names given
20988 above. In other words, it has the full prefix and does not
20989 abbreviate 000 as k. In the case of from-abi, the macro names the
20990 resolved architecture (either "mips1" or "mips3"). It names the
20991 default architecture when no -march option is given.
20992
20993 -mtune=arch
20994 Optimize for arch. Among other things, this option controls the
20995 way instructions are scheduled, and the perceived cost of
20996 arithmetic operations. The list of arch values is the same as for
20997 -march.
20998
20999 When this option is not used, GCC optimizes for the processor
21000 specified by -march. By using -march and -mtune together, it is
21001 possible to generate code that runs on a family of processors, but
21002 optimize the code for one particular member of that family.
21003
21004 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
21005 work in the same way as the -march ones described above.
21006
21007 -mips1
21008 Equivalent to -march=mips1.
21009
21010 -mips2
21011 Equivalent to -march=mips2.
21012
21013 -mips3
21014 Equivalent to -march=mips3.
21015
21016 -mips4
21017 Equivalent to -march=mips4.
21018
21019 -mips32
21020 Equivalent to -march=mips32.
21021
21022 -mips32r3
21023 Equivalent to -march=mips32r3.
21024
21025 -mips32r5
21026 Equivalent to -march=mips32r5.
21027
21028 -mips32r6
21029 Equivalent to -march=mips32r6.
21030
21031 -mips64
21032 Equivalent to -march=mips64.
21033
21034 -mips64r2
21035 Equivalent to -march=mips64r2.
21036
21037 -mips64r3
21038 Equivalent to -march=mips64r3.
21039
21040 -mips64r5
21041 Equivalent to -march=mips64r5.
21042
21043 -mips64r6
21044 Equivalent to -march=mips64r6.
21045
21046 -mips16
21047 -mno-mips16
21048 Generate (do not generate) MIPS16 code. If GCC is targeting a
21049 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
21050
21051 MIPS16 code generation can also be controlled on a per-function
21052 basis by means of "mips16" and "nomips16" attributes.
21053
21054 -mflip-mips16
21055 Generate MIPS16 code on alternating functions. This option is
21056 provided for regression testing of mixed MIPS16/non-MIPS16 code
21057 generation, and is not intended for ordinary use in compiling user
21058 code.
21059
21060 -minterlink-compressed
21061 -mno-interlink-compressed
21062 Require (do not require) that code using the standard
21063 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
21064 microMIPS code, and vice versa.
21065
21066 For example, code using the standard ISA encoding cannot jump
21067 directly to MIPS16 or microMIPS code; it must either use a call or
21068 an indirect jump. -minterlink-compressed therefore disables direct
21069 jumps unless GCC knows that the target of the jump is not
21070 compressed.
21071
21072 -minterlink-mips16
21073 -mno-interlink-mips16
21074 Aliases of -minterlink-compressed and -mno-interlink-compressed.
21075 These options predate the microMIPS ASE and are retained for
21076 backwards compatibility.
21077
21078 -mabi=32
21079 -mabi=o64
21080 -mabi=n32
21081 -mabi=64
21082 -mabi=eabi
21083 Generate code for the given ABI.
21084
21085 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21086 generates 64-bit code when you select a 64-bit architecture, but
21087 you can use -mgp32 to get 32-bit code instead.
21088
21089 For information about the O64 ABI, see
21090 <http://gcc.gnu.org/projects/mipso64-abi.html>.
21091
21092 GCC supports a variant of the o32 ABI in which floating-point
21093 registers are 64 rather than 32 bits wide. You can select this
21094 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
21095 and "mfhc1" instructions and is therefore only supported for
21096 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21097
21098 The register assignments for arguments and return values remain the
21099 same, but each scalar value is passed in a single 64-bit register
21100 rather than a pair of 32-bit registers. For example, scalar
21101 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
21102 The set of call-saved registers also remains the same in that the
21103 even-numbered double-precision registers are saved.
21104
21105 Two additional variants of the o32 ABI are supported to enable a
21106 transition from 32-bit to 64-bit registers. These are FPXX
21107 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
21108 mandates that all code must execute correctly when run using 32-bit
21109 or 64-bit registers. The code can be interlinked with either FP32
21110 or FP64, but not both. The FP64A extension is similar to the FP64
21111 extension but forbids the use of odd-numbered single-precision
21112 registers. This can be used in conjunction with the "FRE" mode of
21113 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
21114 interlink and run in the same process without changing FPU modes.
21115
21116 -mabicalls
21117 -mno-abicalls
21118 Generate (do not generate) code that is suitable for SVR4-style
21119 dynamic objects. -mabicalls is the default for SVR4-based systems.
21120
21121 -mshared
21122 -mno-shared
21123 Generate (do not generate) code that is fully position-independent,
21124 and that can therefore be linked into shared libraries. This
21125 option only affects -mabicalls.
21126
21127 All -mabicalls code has traditionally been position-independent,
21128 regardless of options like -fPIC and -fpic. However, as an
21129 extension, the GNU toolchain allows executables to use absolute
21130 accesses for locally-binding symbols. It can also use shorter GP
21131 initialization sequences and generate direct calls to locally-
21132 defined functions. This mode is selected by -mno-shared.
21133
21134 -mno-shared depends on binutils 2.16 or higher and generates
21135 objects that can only be linked by the GNU linker. However, the
21136 option does not affect the ABI of the final executable; it only
21137 affects the ABI of relocatable objects. Using -mno-shared
21138 generally makes executables both smaller and quicker.
21139
21140 -mshared is the default.
21141
21142 -mplt
21143 -mno-plt
21144 Assume (do not assume) that the static and dynamic linkers support
21145 PLTs and copy relocations. This option only affects -mno-shared
21146 -mabicalls. For the n64 ABI, this option has no effect without
21147 -msym32.
21148
21149 You can make -mplt the default by configuring GCC with
21150 --with-mips-plt. The default is -mno-plt otherwise.
21151
21152 -mxgot
21153 -mno-xgot
21154 Lift (do not lift) the usual restrictions on the size of the global
21155 offset table.
21156
21157 GCC normally uses a single instruction to load values from the GOT.
21158 While this is relatively efficient, it only works if the GOT is
21159 smaller than about 64k. Anything larger causes the linker to
21160 report an error such as:
21161
21162 relocation truncated to fit: R_MIPS_GOT16 foobar
21163
21164 If this happens, you should recompile your code with -mxgot. This
21165 works with very large GOTs, although the code is also less
21166 efficient, since it takes three instructions to fetch the value of
21167 a global symbol.
21168
21169 Note that some linkers can create multiple GOTs. If you have such
21170 a linker, you should only need to use -mxgot when a single object
21171 file accesses more than 64k's worth of GOT entries. Very few do.
21172
21173 These options have no effect unless GCC is generating position
21174 independent code.
21175
21176 -mgp32
21177 Assume that general-purpose registers are 32 bits wide.
21178
21179 -mgp64
21180 Assume that general-purpose registers are 64 bits wide.
21181
21182 -mfp32
21183 Assume that floating-point registers are 32 bits wide.
21184
21185 -mfp64
21186 Assume that floating-point registers are 64 bits wide.
21187
21188 -mfpxx
21189 Do not assume the width of floating-point registers.
21190
21191 -mhard-float
21192 Use floating-point coprocessor instructions.
21193
21194 -msoft-float
21195 Do not use floating-point coprocessor instructions. Implement
21196 floating-point calculations using library calls instead.
21197
21198 -mno-float
21199 Equivalent to -msoft-float, but additionally asserts that the
21200 program being compiled does not perform any floating-point
21201 operations. This option is presently supported only by some bare-
21202 metal MIPS configurations, where it may select a special set of
21203 libraries that lack all floating-point support (including, for
21204 example, the floating-point "printf" formats). If code compiled
21205 with -mno-float accidentally contains floating-point operations, it
21206 is likely to suffer a link-time or run-time failure.
21207
21208 -msingle-float
21209 Assume that the floating-point coprocessor only supports single-
21210 precision operations.
21211
21212 -mdouble-float
21213 Assume that the floating-point coprocessor supports double-
21214 precision operations. This is the default.
21215
21216 -modd-spreg
21217 -mno-odd-spreg
21218 Enable the use of odd-numbered single-precision floating-point
21219 registers for the o32 ABI. This is the default for processors that
21220 are known to support these registers. When using the o32 FPXX ABI,
21221 -mno-odd-spreg is set by default.
21222
21223 -mabs=2008
21224 -mabs=legacy
21225 These options control the treatment of the special not-a-number
21226 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
21227 machine instructions.
21228
21229 By default or when -mabs=legacy is used the legacy treatment is
21230 selected. In this case these instructions are considered
21231 arithmetic and avoided where correct operation is required and the
21232 input operand might be a NaN. A longer sequence of instructions
21233 that manipulate the sign bit of floating-point datum manually is
21234 used instead unless the -ffinite-math-only option has also been
21235 specified.
21236
21237 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
21238 case these instructions are considered non-arithmetic and therefore
21239 operating correctly in all cases, including in particular where the
21240 input operand is a NaN. These instructions are therefore always
21241 used for the respective operations.
21242
21243 -mnan=2008
21244 -mnan=legacy
21245 These options control the encoding of the special not-a-number
21246 (NaN) IEEE 754 floating-point data.
21247
21248 The -mnan=legacy option selects the legacy encoding. In this case
21249 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21250 significand field being 0, whereas signaling NaNs (sNaNs) are
21251 denoted by the first bit of their trailing significand field being
21252 1.
21253
21254 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
21255 case qNaNs are denoted by the first bit of their trailing
21256 significand field being 1, whereas sNaNs are denoted by the first
21257 bit of their trailing significand field being 0.
21258
21259 The default is -mnan=legacy unless GCC has been configured with
21260 --with-nan=2008.
21261
21262 -mllsc
21263 -mno-llsc
21264 Use (do not use) ll, sc, and sync instructions to implement atomic
21265 memory built-in functions. When neither option is specified, GCC
21266 uses the instructions if the target architecture supports them.
21267
21268 -mllsc is useful if the runtime environment can emulate the
21269 instructions and -mno-llsc can be useful when compiling for
21270 nonstandard ISAs. You can make either option the default by
21271 configuring GCC with --with-llsc and --without-llsc respectively.
21272 --with-llsc is the default for some configurations; see the
21273 installation documentation for details.
21274
21275 -mdsp
21276 -mno-dsp
21277 Use (do not use) revision 1 of the MIPS DSP ASE.
21278 This option defines the preprocessor macro "__mips_dsp". It also
21279 defines "__mips_dsp_rev" to 1.
21280
21281 -mdspr2
21282 -mno-dspr2
21283 Use (do not use) revision 2 of the MIPS DSP ASE.
21284 This option defines the preprocessor macros "__mips_dsp" and
21285 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
21286
21287 -msmartmips
21288 -mno-smartmips
21289 Use (do not use) the MIPS SmartMIPS ASE.
21290
21291 -mpaired-single
21292 -mno-paired-single
21293 Use (do not use) paired-single floating-point instructions.
21294 This option requires hardware floating-point support to be
21295 enabled.
21296
21297 -mdmx
21298 -mno-mdmx
21299 Use (do not use) MIPS Digital Media Extension instructions. This
21300 option can only be used when generating 64-bit code and requires
21301 hardware floating-point support to be enabled.
21302
21303 -mips3d
21304 -mno-mips3d
21305 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
21306 -mpaired-single.
21307
21308 -mmicromips
21309 -mno-micromips
21310 Generate (do not generate) microMIPS code.
21311
21312 MicroMIPS code generation can also be controlled on a per-function
21313 basis by means of "micromips" and "nomicromips" attributes.
21314
21315 -mmt
21316 -mno-mt
21317 Use (do not use) MT Multithreading instructions.
21318
21319 -mmcu
21320 -mno-mcu
21321 Use (do not use) the MIPS MCU ASE instructions.
21322
21323 -meva
21324 -mno-eva
21325 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21326
21327 -mvirt
21328 -mno-virt
21329 Use (do not use) the MIPS Virtualization (VZ) instructions.
21330
21331 -mxpa
21332 -mno-xpa
21333 Use (do not use) the MIPS eXtended Physical Address (XPA)
21334 instructions.
21335
21336 -mcrc
21337 -mno-crc
21338 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
21339 instructions.
21340
21341 -mginv
21342 -mno-ginv
21343 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21344
21345 -mloongson-mmi
21346 -mno-loongson-mmi
21347 Use (do not use) the MIPS Loongson MultiMedia extensions
21348 Instructions (MMI).
21349
21350 -mloongson-ext
21351 -mno-loongson-ext
21352 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21353
21354 -mloongson-ext2
21355 -mno-loongson-ext2
21356 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
21357 instructions.
21358
21359 -mlong64
21360 Force "long" types to be 64 bits wide. See -mlong32 for an
21361 explanation of the default and the way that the pointer size is
21362 determined.
21363
21364 -mlong32
21365 Force "long", "int", and pointer types to be 32 bits wide.
21366
21367 The default size of "int"s, "long"s and pointers depends on the
21368 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
21369 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
21370 "long"s. Pointers are the same size as "long"s, or the same size
21371 as integer registers, whichever is smaller.
21372
21373 -msym32
21374 -mno-sym32
21375 Assume (do not assume) that all symbols have 32-bit values,
21376 regardless of the selected ABI. This option is useful in
21377 combination with -mabi=64 and -mno-abicalls because it allows GCC
21378 to generate shorter and faster references to symbolic addresses.
21379
21380 -G num
21381 Put definitions of externally-visible data in a small data section
21382 if that data is no bigger than num bytes. GCC can then generate
21383 more efficient accesses to the data; see -mgpopt for details.
21384
21385 The default -G option depends on the configuration.
21386
21387 -mlocal-sdata
21388 -mno-local-sdata
21389 Extend (do not extend) the -G behavior to local data too, such as
21390 to static variables in C. -mlocal-sdata is the default for all
21391 configurations.
21392
21393 If the linker complains that an application is using too much small
21394 data, you might want to try rebuilding the less performance-
21395 critical parts with -mno-local-sdata. You might also want to build
21396 large libraries with -mno-local-sdata, so that the libraries leave
21397 more room for the main program.
21398
21399 -mextern-sdata
21400 -mno-extern-sdata
21401 Assume (do not assume) that externally-defined data is in a small
21402 data section if the size of that data is within the -G limit.
21403 -mextern-sdata is the default for all configurations.
21404
21405 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
21406 Mod references a variable Var that is no bigger than num bytes, you
21407 must make sure that Var is placed in a small data section. If Var
21408 is defined by another module, you must either compile that module
21409 with a high-enough -G setting or attach a "section" attribute to
21410 Var's definition. If Var is common, you must link the application
21411 with a high-enough -G setting.
21412
21413 The easiest way of satisfying these restrictions is to compile and
21414 link every module with the same -G option. However, you may wish
21415 to build a library that supports several different small data
21416 limits. You can do this by compiling the library with the highest
21417 supported -G setting and additionally using -mno-extern-sdata to
21418 stop the library from making assumptions about externally-defined
21419 data.
21420
21421 -mgpopt
21422 -mno-gpopt
21423 Use (do not use) GP-relative accesses for symbols that are known to
21424 be in a small data section; see -G, -mlocal-sdata and
21425 -mextern-sdata. -mgpopt is the default for all configurations.
21426
21427 -mno-gpopt is useful for cases where the $gp register might not
21428 hold the value of "_gp". For example, if the code is part of a
21429 library that might be used in a boot monitor, programs that call
21430 boot monitor routines pass an unknown value in $gp. (In such
21431 situations, the boot monitor itself is usually compiled with -G0.)
21432
21433 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
21434
21435 -membedded-data
21436 -mno-embedded-data
21437 Allocate variables to the read-only data section first if possible,
21438 then next in the small data section if possible, otherwise in data.
21439 This gives slightly slower code than the default, but reduces the
21440 amount of RAM required when executing, and thus may be preferred
21441 for some embedded systems.
21442
21443 -muninit-const-in-rodata
21444 -mno-uninit-const-in-rodata
21445 Put uninitialized "const" variables in the read-only data section.
21446 This option is only meaningful in conjunction with -membedded-data.
21447
21448 -mcode-readable=setting
21449 Specify whether GCC may generate code that reads from executable
21450 sections. There are three possible settings:
21451
21452 -mcode-readable=yes
21453 Instructions may freely access executable sections. This is
21454 the default setting.
21455
21456 -mcode-readable=pcrel
21457 MIPS16 PC-relative load instructions can access executable
21458 sections, but other instructions must not do so. This option
21459 is useful on 4KSc and 4KSd processors when the code TLBs have
21460 the Read Inhibit bit set. It is also useful on processors that
21461 can be configured to have a dual instruction/data SRAM
21462 interface and that, like the M4K, automatically redirect PC-
21463 relative loads to the instruction RAM.
21464
21465 -mcode-readable=no
21466 Instructions must not access executable sections. This option
21467 can be useful on targets that are configured to have a dual
21468 instruction/data SRAM interface but that (unlike the M4K) do
21469 not automatically redirect PC-relative loads to the instruction
21470 RAM.
21471
21472 -msplit-addresses
21473 -mno-split-addresses
21474 Enable (disable) use of the "%hi()" and "%lo()" assembler
21475 relocation operators. This option has been superseded by
21476 -mexplicit-relocs but is retained for backwards compatibility.
21477
21478 -mexplicit-relocs
21479 -mno-explicit-relocs
21480 Use (do not use) assembler relocation operators when dealing with
21481 symbolic addresses. The alternative, selected by
21482 -mno-explicit-relocs, is to use assembler macros instead.
21483
21484 -mexplicit-relocs is the default if GCC was configured to use an
21485 assembler that supports relocation operators.
21486
21487 -mcheck-zero-division
21488 -mno-check-zero-division
21489 Trap (do not trap) on integer division by zero.
21490
21491 The default is -mcheck-zero-division.
21492
21493 -mdivide-traps
21494 -mdivide-breaks
21495 MIPS systems check for division by zero by generating either a
21496 conditional trap or a break instruction. Using traps results in
21497 smaller code, but is only supported on MIPS II and later. Also,
21498 some versions of the Linux kernel have a bug that prevents trap
21499 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
21500 to allow conditional traps on architectures that support them and
21501 -mdivide-breaks to force the use of breaks.
21502
21503 The default is usually -mdivide-traps, but this can be overridden
21504 at configure time using --with-divide=breaks. Divide-by-zero
21505 checks can be completely disabled using -mno-check-zero-division.
21506
21507 -mload-store-pairs
21508 -mno-load-store-pairs
21509 Enable (disable) an optimization that pairs consecutive load or
21510 store instructions to enable load/store bonding. This option is
21511 enabled by default but only takes effect when the selected
21512 architecture is known to support bonding.
21513
21514 -mmemcpy
21515 -mno-memcpy
21516 Force (do not force) the use of "memcpy" for non-trivial block
21517 moves. The default is -mno-memcpy, which allows GCC to inline most
21518 constant-sized copies.
21519
21520 -mlong-calls
21521 -mno-long-calls
21522 Disable (do not disable) use of the "jal" instruction. Calling
21523 functions using "jal" is more efficient but requires the caller and
21524 callee to be in the same 256 megabyte segment.
21525
21526 This option has no effect on abicalls code. The default is
21527 -mno-long-calls.
21528
21529 -mmad
21530 -mno-mad
21531 Enable (disable) use of the "mad", "madu" and "mul" instructions,
21532 as provided by the R4650 ISA.
21533
21534 -mimadd
21535 -mno-imadd
21536 Enable (disable) use of the "madd" and "msub" integer instructions.
21537 The default is -mimadd on architectures that support "madd" and
21538 "msub" except for the 74k architecture where it was found to
21539 generate slower code.
21540
21541 -mfused-madd
21542 -mno-fused-madd
21543 Enable (disable) use of the floating-point multiply-accumulate
21544 instructions, when they are available. The default is
21545 -mfused-madd.
21546
21547 On the R8000 CPU when multiply-accumulate instructions are used,
21548 the intermediate product is calculated to infinite precision and is
21549 not subject to the FCSR Flush to Zero bit. This may be undesirable
21550 in some circumstances. On other processors the result is
21551 numerically identical to the equivalent computation using separate
21552 multiply, add, subtract and negate instructions.
21553
21554 -nocpp
21555 Tell the MIPS assembler to not run its preprocessor over user
21556 assembler files (with a .s suffix) when assembling them.
21557
21558 -mfix-24k
21559 -mno-fix-24k
21560 Work around the 24K E48 (lost data on stores during refill) errata.
21561 The workarounds are implemented by the assembler rather than by
21562 GCC.
21563
21564 -mfix-r4000
21565 -mno-fix-r4000
21566 Work around certain R4000 CPU errata:
21567
21568 - A double-word or a variable shift may give an incorrect result
21569 if executed immediately after starting an integer division.
21570
21571 - A double-word or a variable shift may give an incorrect result
21572 if executed while an integer multiplication is in progress.
21573
21574 - An integer division may give an incorrect result if started in
21575 a delay slot of a taken branch or a jump.
21576
21577 -mfix-r4400
21578 -mno-fix-r4400
21579 Work around certain R4400 CPU errata:
21580
21581 - A double-word or a variable shift may give an incorrect result
21582 if executed immediately after starting an integer division.
21583
21584 -mfix-r10000
21585 -mno-fix-r10000
21586 Work around certain R10000 errata:
21587
21588 - "ll"/"sc" sequences may not behave atomically on revisions
21589 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21590
21591 This option can only be used if the target architecture supports
21592 branch-likely instructions. -mfix-r10000 is the default when
21593 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
21594
21595 -mfix-r5900
21596 -mno-fix-r5900
21597 Do not attempt to schedule the preceding instruction into the delay
21598 slot of a branch instruction placed at the end of a short loop of
21599 six instructions or fewer and always schedule a "nop" instruction
21600 there instead. The short loop bug under certain conditions causes
21601 loops to execute only once or twice, due to a hardware bug in the
21602 R5900 chip. The workaround is implemented by the assembler rather
21603 than by GCC.
21604
21605 -mfix-rm7000
21606 -mno-fix-rm7000
21607 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
21608 are implemented by the assembler rather than by GCC.
21609
21610 -mfix-vr4120
21611 -mno-fix-vr4120
21612 Work around certain VR4120 errata:
21613
21614 - "dmultu" does not always produce the correct result.
21615
21616 - "div" and "ddiv" do not always produce the correct result if
21617 one of the operands is negative.
21618
21619 The workarounds for the division errata rely on special functions
21620 in libgcc.a. At present, these functions are only provided by the
21621 "mips64vr*-elf" configurations.
21622
21623 Other VR4120 errata require a NOP to be inserted between certain
21624 pairs of instructions. These errata are handled by the assembler,
21625 not by GCC itself.
21626
21627 -mfix-vr4130
21628 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
21629 implemented by the assembler rather than by GCC, although GCC
21630 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
21631 "dmacc" and "dmacchi" instructions are available instead.
21632
21633 -mfix-sb1
21634 -mno-fix-sb1
21635 Work around certain SB-1 CPU core errata. (This flag currently
21636 works around the SB-1 revision 2 "F1" and "F2" floating-point
21637 errata.)
21638
21639 -mr10k-cache-barrier=setting
21640 Specify whether GCC should insert cache barriers to avoid the side
21641 effects of speculation on R10K processors.
21642
21643 In common with many processors, the R10K tries to predict the
21644 outcome of a conditional branch and speculatively executes
21645 instructions from the "taken" branch. It later aborts these
21646 instructions if the predicted outcome is wrong. However, on the
21647 R10K, even aborted instructions can have side effects.
21648
21649 This problem only affects kernel stores and, depending on the
21650 system, kernel loads. As an example, a speculatively-executed
21651 store may load the target memory into cache and mark the cache line
21652 as dirty, even if the store itself is later aborted. If a DMA
21653 operation writes to the same area of memory before the "dirty" line
21654 is flushed, the cached data overwrites the DMA-ed data. See the
21655 R10K processor manual for a full description, including other
21656 potential problems.
21657
21658 One workaround is to insert cache barrier instructions before every
21659 memory access that might be speculatively executed and that might
21660 have side effects even if aborted. -mr10k-cache-barrier=setting
21661 controls GCC's implementation of this workaround. It assumes that
21662 aborted accesses to any byte in the following regions does not have
21663 side effects:
21664
21665 1. the memory occupied by the current function's stack frame;
21666
21667 2. the memory occupied by an incoming stack argument;
21668
21669 3. the memory occupied by an object with a link-time-constant
21670 address.
21671
21672 It is the kernel's responsibility to ensure that speculative
21673 accesses to these regions are indeed safe.
21674
21675 If the input program contains a function declaration such as:
21676
21677 void foo (void);
21678
21679 then the implementation of "foo" must allow "j foo" and "jal foo"
21680 to be executed speculatively. GCC honors this restriction for
21681 functions it compiles itself. It expects non-GCC functions (such
21682 as hand-written assembly code) to do the same.
21683
21684 The option has three forms:
21685
21686 -mr10k-cache-barrier=load-store
21687 Insert a cache barrier before a load or store that might be
21688 speculatively executed and that might have side effects even if
21689 aborted.
21690
21691 -mr10k-cache-barrier=store
21692 Insert a cache barrier before a store that might be
21693 speculatively executed and that might have side effects even if
21694 aborted.
21695
21696 -mr10k-cache-barrier=none
21697 Disable the insertion of cache barriers. This is the default
21698 setting.
21699
21700 -mflush-func=func
21701 -mno-flush-func
21702 Specifies the function to call to flush the I and D caches, or to
21703 not call any such function. If called, the function must take the
21704 same arguments as the common "_flush_func", that is, the address of
21705 the memory range for which the cache is being flushed, the size of
21706 the memory range, and the number 3 (to flush both caches). The
21707 default depends on the target GCC was configured for, but commonly
21708 is either "_flush_func" or "__cpu_flush".
21709
21710 mbranch-cost=num
21711 Set the cost of branches to roughly num "simple" instructions.
21712 This cost is only a heuristic and is not guaranteed to produce
21713 consistent results across releases. A zero cost redundantly
21714 selects the default, which is based on the -mtune setting.
21715
21716 -mbranch-likely
21717 -mno-branch-likely
21718 Enable or disable use of Branch Likely instructions, regardless of
21719 the default for the selected architecture. By default, Branch
21720 Likely instructions may be generated if they are supported by the
21721 selected architecture. An exception is for the MIPS32 and MIPS64
21722 architectures and processors that implement those architectures;
21723 for those, Branch Likely instructions are not be generated by
21724 default because the MIPS32 and MIPS64 architectures specifically
21725 deprecate their use.
21726
21727 -mcompact-branches=never
21728 -mcompact-branches=optimal
21729 -mcompact-branches=always
21730 These options control which form of branches will be generated.
21731 The default is -mcompact-branches=optimal.
21732
21733 The -mcompact-branches=never option ensures that compact branch
21734 instructions will never be generated.
21735
21736 The -mcompact-branches=always option ensures that a compact branch
21737 instruction will be generated if available. If a compact branch
21738 instruction is not available, a delay slot form of the branch will
21739 be used instead.
21740
21741 This option is supported from MIPS Release 6 onwards.
21742
21743 The -mcompact-branches=optimal option will cause a delay slot
21744 branch to be used if one is available in the current ISA and the
21745 delay slot is successfully filled. If the delay slot is not
21746 filled, a compact branch will be chosen if one is available.
21747
21748 -mfp-exceptions
21749 -mno-fp-exceptions
21750 Specifies whether FP exceptions are enabled. This affects how FP
21751 instructions are scheduled for some processors. The default is
21752 that FP exceptions are enabled.
21753
21754 For instance, on the SB-1, if FP exceptions are disabled, and we
21755 are emitting 64-bit code, then we can use both FP pipes.
21756 Otherwise, we can only use one FP pipe.
21757
21758 -mvr4130-align
21759 -mno-vr4130-align
21760 The VR4130 pipeline is two-way superscalar, but can only issue two
21761 instructions together if the first one is 8-byte aligned. When
21762 this option is enabled, GCC aligns pairs of instructions that it
21763 thinks should execute in parallel.
21764
21765 This option only has an effect when optimizing for the VR4130. It
21766 normally makes code faster, but at the expense of making it bigger.
21767 It is enabled by default at optimization level -O3.
21768
21769 -msynci
21770 -mno-synci
21771 Enable (disable) generation of "synci" instructions on
21772 architectures that support it. The "synci" instructions (if
21773 enabled) are generated when "__builtin___clear_cache" is compiled.
21774
21775 This option defaults to -mno-synci, but the default can be
21776 overridden by configuring GCC with --with-synci.
21777
21778 When compiling code for single processor systems, it is generally
21779 safe to use "synci". However, on many multi-core (SMP) systems, it
21780 does not invalidate the instruction caches on all cores and may
21781 lead to undefined behavior.
21782
21783 -mrelax-pic-calls
21784 -mno-relax-pic-calls
21785 Try to turn PIC calls that are normally dispatched via register $25
21786 into direct calls. This is only possible if the linker can resolve
21787 the destination at link time and if the destination is within range
21788 for a direct call.
21789
21790 -mrelax-pic-calls is the default if GCC was configured to use an
21791 assembler and a linker that support the ".reloc" assembly directive
21792 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
21793 this optimization can be performed by the assembler and the linker
21794 alone without help from the compiler.
21795
21796 -mmcount-ra-address
21797 -mno-mcount-ra-address
21798 Emit (do not emit) code that allows "_mcount" to modify the calling
21799 function's return address. When enabled, this option extends the
21800 usual "_mcount" interface with a new ra-address parameter, which
21801 has type "intptr_t *" and is passed in register $12. "_mcount" can
21802 then modify the return address by doing both of the following:
21803
21804 * Returning the new address in register $31.
21805
21806 * Storing the new address in "*ra-address", if ra-address is
21807 nonnull.
21808
21809 The default is -mno-mcount-ra-address.
21810
21811 -mframe-header-opt
21812 -mno-frame-header-opt
21813 Enable (disable) frame header optimization in the o32 ABI. When
21814 using the o32 ABI, calling functions will allocate 16 bytes on the
21815 stack for the called function to write out register arguments.
21816 When enabled, this optimization will suppress the allocation of the
21817 frame header if it can be determined that it is unused.
21818
21819 This optimization is off by default at all optimization levels.
21820
21821 -mlxc1-sxc1
21822 -mno-lxc1-sxc1
21823 When applicable, enable (disable) the generation of "lwxc1",
21824 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
21825
21826 -mmadd4
21827 -mno-madd4
21828 When applicable, enable (disable) the generation of 4-operand
21829 "madd.s", "madd.d" and related instructions. Enabled by default.
21830
21831 MMIX Options
21832
21833 These options are defined for the MMIX:
21834
21835 -mlibfuncs
21836 -mno-libfuncs
21837 Specify that intrinsic library functions are being compiled,
21838 passing all values in registers, no matter the size.
21839
21840 -mepsilon
21841 -mno-epsilon
21842 Generate floating-point comparison instructions that compare with
21843 respect to the "rE" epsilon register.
21844
21845 -mabi=mmixware
21846 -mabi=gnu
21847 Generate code that passes function parameters and return values
21848 that (in the called function) are seen as registers $0 and up, as
21849 opposed to the GNU ABI which uses global registers $231 and up.
21850
21851 -mzero-extend
21852 -mno-zero-extend
21853 When reading data from memory in sizes shorter than 64 bits, use
21854 (do not use) zero-extending load instructions by default, rather
21855 than sign-extending ones.
21856
21857 -mknuthdiv
21858 -mno-knuthdiv
21859 Make the result of a division yielding a remainder have the same
21860 sign as the divisor. With the default, -mno-knuthdiv, the sign of
21861 the remainder follows the sign of the dividend. Both methods are
21862 arithmetically valid, the latter being almost exclusively used.
21863
21864 -mtoplevel-symbols
21865 -mno-toplevel-symbols
21866 Prepend (do not prepend) a : to all global symbols, so the assembly
21867 code can be used with the "PREFIX" assembly directive.
21868
21869 -melf
21870 Generate an executable in the ELF format, rather than the default
21871 mmo format used by the mmix simulator.
21872
21873 -mbranch-predict
21874 -mno-branch-predict
21875 Use (do not use) the probable-branch instructions, when static
21876 branch prediction indicates a probable branch.
21877
21878 -mbase-addresses
21879 -mno-base-addresses
21880 Generate (do not generate) code that uses base addresses. Using a
21881 base address automatically generates a request (handled by the
21882 assembler and the linker) for a constant to be set up in a global
21883 register. The register is used for one or more base address
21884 requests within the range 0 to 255 from the value held in the
21885 register. The generally leads to short and fast code, but the
21886 number of different data items that can be addressed is limited.
21887 This means that a program that uses lots of static data may require
21888 -mno-base-addresses.
21889
21890 -msingle-exit
21891 -mno-single-exit
21892 Force (do not force) generated code to have a single exit point in
21893 each function.
21894
21895 MN10300 Options
21896
21897 These -m options are defined for Matsushita MN10300 architectures:
21898
21899 -mmult-bug
21900 Generate code to avoid bugs in the multiply instructions for the
21901 MN10300 processors. This is the default.
21902
21903 -mno-mult-bug
21904 Do not generate code to avoid bugs in the multiply instructions for
21905 the MN10300 processors.
21906
21907 -mam33
21908 Generate code using features specific to the AM33 processor.
21909
21910 -mno-am33
21911 Do not generate code using features specific to the AM33 processor.
21912 This is the default.
21913
21914 -mam33-2
21915 Generate code using features specific to the AM33/2.0 processor.
21916
21917 -mam34
21918 Generate code using features specific to the AM34 processor.
21919
21920 -mtune=cpu-type
21921 Use the timing characteristics of the indicated CPU type when
21922 scheduling instructions. This does not change the targeted
21923 processor type. The CPU type must be one of mn10300, am33, am33-2
21924 or am34.
21925
21926 -mreturn-pointer-on-d0
21927 When generating a function that returns a pointer, return the
21928 pointer in both "a0" and "d0". Otherwise, the pointer is returned
21929 only in "a0", and attempts to call such functions without a
21930 prototype result in errors. Note that this option is on by
21931 default; use -mno-return-pointer-on-d0 to disable it.
21932
21933 -mno-crt0
21934 Do not link in the C run-time initialization object file.
21935
21936 -mrelax
21937 Indicate to the linker that it should perform a relaxation
21938 optimization pass to shorten branches, calls and absolute memory
21939 addresses. This option only has an effect when used on the command
21940 line for the final link step.
21941
21942 This option makes symbolic debugging impossible.
21943
21944 -mliw
21945 Allow the compiler to generate Long Instruction Word instructions
21946 if the target is the AM33 or later. This is the default. This
21947 option defines the preprocessor macro "__LIW__".
21948
21949 -mno-liw
21950 Do not allow the compiler to generate Long Instruction Word
21951 instructions. This option defines the preprocessor macro
21952 "__NO_LIW__".
21953
21954 -msetlb
21955 Allow the compiler to generate the SETLB and Lcc instructions if
21956 the target is the AM33 or later. This is the default. This option
21957 defines the preprocessor macro "__SETLB__".
21958
21959 -mno-setlb
21960 Do not allow the compiler to generate SETLB or Lcc instructions.
21961 This option defines the preprocessor macro "__NO_SETLB__".
21962
21963 Moxie Options
21964
21965 -meb
21966 Generate big-endian code. This is the default for moxie-*-*
21967 configurations.
21968
21969 -mel
21970 Generate little-endian code.
21971
21972 -mmul.x
21973 Generate mul.x and umul.x instructions. This is the default for
21974 moxiebox-*-* configurations.
21975
21976 -mno-crt0
21977 Do not link in the C run-time initialization object file.
21978
21979 MSP430 Options
21980
21981 These options are defined for the MSP430:
21982
21983 -masm-hex
21984 Force assembly output to always use hex constants. Normally such
21985 constants are signed decimals, but this option is available for
21986 testsuite and/or aesthetic purposes.
21987
21988 -mmcu=
21989 Select the MCU to target. This is used to create a C preprocessor
21990 symbol based upon the MCU name, converted to upper case and pre-
21991 and post-fixed with __. This in turn is used by the msp430.h
21992 header file to select an MCU-specific supplementary header file.
21993
21994 The option also sets the ISA to use. If the MCU name is one that
21995 is known to only support the 430 ISA then that is selected,
21996 otherwise the 430X ISA is selected. A generic MCU name of msp430
21997 can also be used to select the 430 ISA. Similarly the generic
21998 msp430x MCU name selects the 430X ISA.
21999
22000 In addition an MCU-specific linker script is added to the linker
22001 command line. The script's name is the name of the MCU with .ld
22002 appended. Thus specifying -mmcu=xxx on the gcc command line
22003 defines the C preprocessor symbol "__XXX__" and cause the linker to
22004 search for a script called xxx.ld.
22005
22006 The ISA and hardware multiply supported for the different MCUs is
22007 hard-coded into GCC. However, an external devices.csv file can be
22008 used to extend device support beyond those that have been hard-
22009 coded.
22010
22011 GCC searches for the devices.csv file using the following methods
22012 in the given precedence order, where the first method takes
22013 precendence over the second which takes precedence over the third.
22014
22015 Include path specified with "-I" and "-L"
22016 devices.csv will be searched for in each of the directories
22017 specified by include paths and linker library search paths.
22018
22019 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
22020 Define the value of the global environment variable
22021 MSP430_GCC_INCLUDE_DIR to the full path to the directory
22022 containing devices.csv, and GCC will search this directory for
22023 devices.csv. If devices.csv is found, this directory will also
22024 be registered as an include path, and linker library path.
22025 Header files and linker scripts in this directory can therefore
22026 be used without manually specifying "-I" and "-L" on the
22027 command line.
22028
22029 The msp430-elf{,bare}/include/devices directory
22030 Finally, GCC will examine msp430-elf{,bare}/include/devices
22031 from the toolchain root directory. This directory does not
22032 exist in a default installation, but if the user has created it
22033 and copied devices.csv there, then the MCU data will be read.
22034 As above, this directory will also be registered as an include
22035 path, and linker library path.
22036
22037 If none of the above search methods find devices.csv, then the
22038 hard-coded MCU data is used.
22039
22040 -mwarn-mcu
22041 -mno-warn-mcu
22042 This option enables or disables warnings about conflicts between
22043 the MCU name specified by the -mmcu option and the ISA set by the
22044 -mcpu option and/or the hardware multiply support set by the
22045 -mhwmult option. It also toggles warnings about unrecognized MCU
22046 names. This option is on by default.
22047
22048 -mcpu=
22049 Specifies the ISA to use. Accepted values are msp430, msp430x and
22050 msp430xv2. This option is deprecated. The -mmcu= option should be
22051 used to select the ISA.
22052
22053 -msim
22054 Link to the simulator runtime libraries and linker script.
22055 Overrides any scripts that would be selected by the -mmcu= option.
22056
22057 -mlarge
22058 Use large-model addressing (20-bit pointers, 20-bit "size_t").
22059
22060 -msmall
22061 Use small-model addressing (16-bit pointers, 16-bit "size_t").
22062
22063 -mrelax
22064 This option is passed to the assembler and linker, and allows the
22065 linker to perform certain optimizations that cannot be done until
22066 the final link.
22067
22068 mhwmult=
22069 Describes the type of hardware multiply supported by the target.
22070 Accepted values are none for no hardware multiply, 16bit for the
22071 original 16-bit-only multiply supported by early MCUs. 32bit for
22072 the 16/32-bit multiply supported by later MCUs and f5series for the
22073 16/32-bit multiply supported by F5-series MCUs. A value of auto
22074 can also be given. This tells GCC to deduce the hardware multiply
22075 support based upon the MCU name provided by the -mmcu option. If
22076 no -mmcu option is specified or if the MCU name is not recognized
22077 then no hardware multiply support is assumed. "auto" is the
22078 default setting.
22079
22080 Hardware multiplies are normally performed by calling a library
22081 routine. This saves space in the generated code. When compiling
22082 at -O3 or higher however the hardware multiplier is invoked inline.
22083 This makes for bigger, but faster code.
22084
22085 The hardware multiply routines disable interrupts whilst running
22086 and restore the previous interrupt state when they finish. This
22087 makes them safe to use inside interrupt handlers as well as in
22088 normal code.
22089
22090 -minrt
22091 Enable the use of a minimum runtime environment - no static
22092 initializers or constructors. This is intended for memory-
22093 constrained devices. The compiler includes special symbols in some
22094 objects that tell the linker and runtime which code fragments are
22095 required.
22096
22097 -mtiny-printf
22098 Enable reduced code size "printf" and "puts" library functions.
22099 The tiny implementations of these functions are not reentrant, so
22100 must be used with caution in multi-threaded applications.
22101
22102 Support for streams has been removed and the string to be printed
22103 will always be sent to stdout via the "write" syscall. The string
22104 is not buffered before it is sent to write.
22105
22106 This option requires Newlib Nano IO, so GCC must be configured with
22107 --enable-newlib-nano-formatted-io.
22108
22109 -mmax-inline-shift=
22110 This option takes an integer between 0 and 64 inclusive, and sets
22111 the maximum number of inline shift instructions which should be
22112 emitted to perform a shift operation by a constant amount. When
22113 this value needs to be exceeded, an mspabi helper function is used
22114 instead. The default value is 4.
22115
22116 This only affects cases where a shift by multiple positions cannot
22117 be completed with a single instruction (e.g. all shifts >1 on the
22118 430 ISA).
22119
22120 Shifts of a 32-bit value are at least twice as costly, so the value
22121 passed for this option is divided by 2 and the resulting value used
22122 instead.
22123
22124 -mcode-region=
22125 -mdata-region=
22126 These options tell the compiler where to place functions and data
22127 that do not have one of the "lower", "upper", "either" or "section"
22128 attributes. Possible values are "lower", "upper", "either" or
22129 "any". The first three behave like the corresponding attribute.
22130 The fourth possible value - "any" - is the default. It leaves
22131 placement entirely up to the linker script and how it assigns the
22132 standard sections (".text", ".data", etc) to the memory regions.
22133
22134 -msilicon-errata=
22135 This option passes on a request to assembler to enable the fixes
22136 for the named silicon errata.
22137
22138 -msilicon-errata-warn=
22139 This option passes on a request to the assembler to enable warning
22140 messages when a silicon errata might need to be applied.
22141
22142 -mwarn-devices-csv
22143 -mno-warn-devices-csv
22144 Warn if devices.csv is not found or there are problem parsing it
22145 (default: on).
22146
22147 NDS32 Options
22148
22149 These options are defined for NDS32 implementations:
22150
22151 -mbig-endian
22152 Generate code in big-endian mode.
22153
22154 -mlittle-endian
22155 Generate code in little-endian mode.
22156
22157 -mreduced-regs
22158 Use reduced-set registers for register allocation.
22159
22160 -mfull-regs
22161 Use full-set registers for register allocation.
22162
22163 -mcmov
22164 Generate conditional move instructions.
22165
22166 -mno-cmov
22167 Do not generate conditional move instructions.
22168
22169 -mext-perf
22170 Generate performance extension instructions.
22171
22172 -mno-ext-perf
22173 Do not generate performance extension instructions.
22174
22175 -mext-perf2
22176 Generate performance extension 2 instructions.
22177
22178 -mno-ext-perf2
22179 Do not generate performance extension 2 instructions.
22180
22181 -mext-string
22182 Generate string extension instructions.
22183
22184 -mno-ext-string
22185 Do not generate string extension instructions.
22186
22187 -mv3push
22188 Generate v3 push25/pop25 instructions.
22189
22190 -mno-v3push
22191 Do not generate v3 push25/pop25 instructions.
22192
22193 -m16-bit
22194 Generate 16-bit instructions.
22195
22196 -mno-16-bit
22197 Do not generate 16-bit instructions.
22198
22199 -misr-vector-size=num
22200 Specify the size of each interrupt vector, which must be 4 or 16.
22201
22202 -mcache-block-size=num
22203 Specify the size of each cache block, which must be a power of 2
22204 between 4 and 512.
22205
22206 -march=arch
22207 Specify the name of the target architecture.
22208
22209 -mcmodel=code-model
22210 Set the code model to one of
22211
22212 small
22213 All the data and read-only data segments must be within 512KB
22214 addressing space. The text segment must be within 16MB
22215 addressing space.
22216
22217 medium
22218 The data segment must be within 512KB while the read-only data
22219 segment can be within 4GB addressing space. The text segment
22220 should be still within 16MB addressing space.
22221
22222 large
22223 All the text and data segments can be within 4GB addressing
22224 space.
22225
22226 -mctor-dtor
22227 Enable constructor/destructor feature.
22228
22229 -mrelax
22230 Guide linker to relax instructions.
22231
22232 Nios II Options
22233
22234 These are the options defined for the Altera Nios II processor.
22235
22236 -G num
22237 Put global and static objects less than or equal to num bytes into
22238 the small data or BSS sections instead of the normal data or BSS
22239 sections. The default value of num is 8.
22240
22241 -mgpopt=option
22242 -mgpopt
22243 -mno-gpopt
22244 Generate (do not generate) GP-relative accesses. The following
22245 option names are recognized:
22246
22247 none
22248 Do not generate GP-relative accesses.
22249
22250 local
22251 Generate GP-relative accesses for small data objects that are
22252 not external, weak, or uninitialized common symbols. Also use
22253 GP-relative addressing for objects that have been explicitly
22254 placed in a small data section via a "section" attribute.
22255
22256 global
22257 As for local, but also generate GP-relative accesses for small
22258 data objects that are external, weak, or common. If you use
22259 this option, you must ensure that all parts of your program
22260 (including libraries) are compiled with the same -G setting.
22261
22262 data
22263 Generate GP-relative accesses for all data objects in the
22264 program. If you use this option, the entire data and BSS
22265 segments of your program must fit in 64K of memory and you must
22266 use an appropriate linker script to allocate them within the
22267 addressable range of the global pointer.
22268
22269 all Generate GP-relative addresses for function pointers as well as
22270 data pointers. If you use this option, the entire text, data,
22271 and BSS segments of your program must fit in 64K of memory and
22272 you must use an appropriate linker script to allocate them
22273 within the addressable range of the global pointer.
22274
22275 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
22276 equivalent to -mgpopt=none.
22277
22278 The default is -mgpopt except when -fpic or -fPIC is specified to
22279 generate position-independent code. Note that the Nios II ABI does
22280 not permit GP-relative accesses from shared libraries.
22281
22282 You may need to specify -mno-gpopt explicitly when building
22283 programs that include large amounts of small data, including large
22284 GOT data sections. In this case, the 16-bit offset for GP-relative
22285 addressing may not be large enough to allow access to the entire
22286 small data section.
22287
22288 -mgprel-sec=regexp
22289 This option specifies additional section names that can be accessed
22290 via GP-relative addressing. It is most useful in conjunction with
22291 "section" attributes on variable declarations and a custom linker
22292 script. The regexp is a POSIX Extended Regular Expression.
22293
22294 This option does not affect the behavior of the -G option, and the
22295 specified sections are in addition to the standard ".sdata" and
22296 ".sbss" small-data sections that are recognized by -mgpopt.
22297
22298 -mr0rel-sec=regexp
22299 This option specifies names of sections that can be accessed via a
22300 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
22301 32-bit address space. It is most useful in conjunction with
22302 "section" attributes on variable declarations and a custom linker
22303 script. The regexp is a POSIX Extended Regular Expression.
22304
22305 In contrast to the use of GP-relative addressing for small data,
22306 zero-based addressing is never generated by default and there are
22307 no conventional section names used in standard linker scripts for
22308 sections in the low or high areas of memory.
22309
22310 -mel
22311 -meb
22312 Generate little-endian (default) or big-endian (experimental) code,
22313 respectively.
22314
22315 -march=arch
22316 This specifies the name of the target Nios II architecture. GCC
22317 uses this name to determine what kind of instructions it can emit
22318 when generating assembly code. Permissible names are: r1, r2.
22319
22320 The preprocessor macro "__nios2_arch__" is available to programs,
22321 with value 1 or 2, indicating the targeted ISA level.
22322
22323 -mbypass-cache
22324 -mno-bypass-cache
22325 Force all load and store instructions to always bypass cache by
22326 using I/O variants of the instructions. The default is not to
22327 bypass the cache.
22328
22329 -mno-cache-volatile
22330 -mcache-volatile
22331 Volatile memory access bypass the cache using the I/O variants of
22332 the load and store instructions. The default is not to bypass the
22333 cache.
22334
22335 -mno-fast-sw-div
22336 -mfast-sw-div
22337 Do not use table-based fast divide for small numbers. The default
22338 is to use the fast divide at -O3 and above.
22339
22340 -mno-hw-mul
22341 -mhw-mul
22342 -mno-hw-mulx
22343 -mhw-mulx
22344 -mno-hw-div
22345 -mhw-div
22346 Enable or disable emitting "mul", "mulx" and "div" family of
22347 instructions by the compiler. The default is to emit "mul" and not
22348 emit "div" and "mulx".
22349
22350 -mbmx
22351 -mno-bmx
22352 -mcdx
22353 -mno-cdx
22354 Enable or disable generation of Nios II R2 BMX (bit manipulation)
22355 and CDX (code density) instructions. Enabling these instructions
22356 also requires -march=r2. Since these instructions are optional
22357 extensions to the R2 architecture, the default is not to emit them.
22358
22359 -mcustom-insn=N
22360 -mno-custom-insn
22361 Each -mcustom-insn=N option enables use of a custom instruction
22362 with encoding N when generating code that uses insn. For example,
22363 -mcustom-fadds=253 generates custom instruction 253 for single-
22364 precision floating-point add operations instead of the default
22365 behavior of using a library call.
22366
22367 The following values of insn are supported. Except as otherwise
22368 noted, floating-point operations are expected to be implemented
22369 with normal IEEE 754 semantics and correspond directly to the C
22370 operators or the equivalent GCC built-in functions.
22371
22372 Single-precision floating point:
22373
22374 fadds, fsubs, fdivs, fmuls
22375 Binary arithmetic operations.
22376
22377 fnegs
22378 Unary negation.
22379
22380 fabss
22381 Unary absolute value.
22382
22383 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
22384 Comparison operations.
22385
22386 fmins, fmaxs
22387 Floating-point minimum and maximum. These instructions are
22388 only generated if -ffinite-math-only is specified.
22389
22390 fsqrts
22391 Unary square root operation.
22392
22393 fcoss, fsins, ftans, fatans, fexps, flogs
22394 Floating-point trigonometric and exponential functions. These
22395 instructions are only generated if -funsafe-math-optimizations
22396 is also specified.
22397
22398 Double-precision floating point:
22399
22400 faddd, fsubd, fdivd, fmuld
22401 Binary arithmetic operations.
22402
22403 fnegd
22404 Unary negation.
22405
22406 fabsd
22407 Unary absolute value.
22408
22409 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
22410 Comparison operations.
22411
22412 fmind, fmaxd
22413 Double-precision minimum and maximum. These instructions are
22414 only generated if -ffinite-math-only is specified.
22415
22416 fsqrtd
22417 Unary square root operation.
22418
22419 fcosd, fsind, ftand, fatand, fexpd, flogd
22420 Double-precision trigonometric and exponential functions.
22421 These instructions are only generated if
22422 -funsafe-math-optimizations is also specified.
22423
22424 Conversions:
22425
22426 fextsd
22427 Conversion from single precision to double precision.
22428
22429 ftruncds
22430 Conversion from double precision to single precision.
22431
22432 fixsi, fixsu, fixdi, fixdu
22433 Conversion from floating point to signed or unsigned integer
22434 types, with truncation towards zero.
22435
22436 round
22437 Conversion from single-precision floating point to signed
22438 integer, rounding to the nearest integer and ties away from
22439 zero. This corresponds to the "__builtin_lroundf" function
22440 when -fno-math-errno is used.
22441
22442 floatis, floatus, floatid, floatud
22443 Conversion from signed or unsigned integer types to floating-
22444 point types.
22445
22446 In addition, all of the following transfer instructions for
22447 internal registers X and Y must be provided to use any of the
22448 double-precision floating-point instructions. Custom instructions
22449 taking two double-precision source operands expect the first
22450 operand in the 64-bit register X. The other operand (or only
22451 operand of a unary operation) is given to the custom arithmetic
22452 instruction with the least significant half in source register src1
22453 and the most significant half in src2. A custom instruction that
22454 returns a double-precision result returns the most significant 32
22455 bits in the destination register and the other half in 32-bit
22456 register Y. GCC automatically generates the necessary code
22457 sequences to write register X and/or read register Y when double-
22458 precision floating-point instructions are used.
22459
22460 fwrx
22461 Write src1 into the least significant half of X and src2 into
22462 the most significant half of X.
22463
22464 fwry
22465 Write src1 into Y.
22466
22467 frdxhi, frdxlo
22468 Read the most or least (respectively) significant half of X and
22469 store it in dest.
22470
22471 frdy
22472 Read the value of Y and store it into dest.
22473
22474 Note that you can gain more local control over generation of Nios
22475 II custom instructions by using the "target("custom-insn=N")" and
22476 "target("no-custom-insn")" function attributes or pragmas.
22477
22478 -mcustom-fpu-cfg=name
22479 This option enables a predefined, named set of custom instruction
22480 encodings (see -mcustom-insn above). Currently, the following sets
22481 are defined:
22482
22483 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
22484 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
22485
22486 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
22487 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
22488 -fsingle-precision-constant
22489
22490 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
22491 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
22492 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
22493 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
22494 -mcustom-fdivs=255 -fsingle-precision-constant
22495
22496 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
22497 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
22498 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
22499 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
22500 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
22501 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
22502 -mcustom-fsubs=254 -mcustom-fdivs=255
22503
22504 Custom instruction assignments given by individual -mcustom-insn=
22505 options override those given by -mcustom-fpu-cfg=, regardless of
22506 the order of the options on the command line.
22507
22508 Note that you can gain more local control over selection of a FPU
22509 configuration by using the "target("custom-fpu-cfg=name")" function
22510 attribute or pragma.
22511
22512 The name fph2 is an abbreviation for Nios II Floating Point
22513 Hardware 2 Component. Please note that the custom instructions
22514 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
22515 generated if -ffinite-math-only is specified. The custom
22516 instruction enabled by -mcustom-round=248 is only generated if
22517 -fno-math-errno is specified. In contrast to the other
22518 configurations, -fsingle-precision-constant is not set.
22519
22520 These additional -m options are available for the Altera Nios II ELF
22521 (bare-metal) target:
22522
22523 -mhal
22524 Link with HAL BSP. This suppresses linking with the GCC-provided C
22525 runtime startup and termination code, and is typically used in
22526 conjunction with -msys-crt0= to specify the location of the
22527 alternate startup code provided by the HAL BSP.
22528
22529 -msmallc
22530 Link with a limited version of the C library, -lsmallc, rather than
22531 Newlib.
22532
22533 -msys-crt0=startfile
22534 startfile is the file name of the startfile (crt0) to use when
22535 linking. This option is only useful in conjunction with -mhal.
22536
22537 -msys-lib=systemlib
22538 systemlib is the library name of the library that provides low-
22539 level system calls required by the C library, e.g. "read" and
22540 "write". This option is typically used to link with a library
22541 provided by a HAL BSP.
22542
22543 Nvidia PTX Options
22544
22545 These options are defined for Nvidia PTX:
22546
22547 -m64
22548 Ignored, but preserved for backward compatibility. Only 64-bit ABI
22549 is supported.
22550
22551 -misa=ISA-string
22552 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
22553 strings must be lower-case. Valid ISA strings include sm_30 and
22554 sm_35. The default ISA is sm_35.
22555
22556 -mmainkernel
22557 Link in code for a __main kernel. This is for stand-alone instead
22558 of offloading execution.
22559
22560 -moptimize
22561 Apply partitioned execution optimizations. This is the default
22562 when any level of optimization is selected.
22563
22564 -msoft-stack
22565 Generate code that does not use ".local" memory directly for stack
22566 storage. Instead, a per-warp stack pointer is maintained
22567 explicitly. This enables variable-length stack allocation (with
22568 variable-length arrays or "alloca"), and when global memory is used
22569 for underlying storage, makes it possible to access automatic
22570 variables from other threads, or with atomic instructions. This
22571 code generation variant is used for OpenMP offloading, but the
22572 option is exposed on its own for the purpose of testing the
22573 compiler; to generate code suitable for linking into programs using
22574 OpenMP offloading, use option -mgomp.
22575
22576 -muniform-simt
22577 Switch to code generation variant that allows to execute all
22578 threads in each warp, while maintaining memory state and side
22579 effects as if only one thread in each warp was active outside of
22580 OpenMP SIMD regions. All atomic operations and calls to runtime
22581 (malloc, free, vprintf) are conditionally executed (iff current
22582 lane index equals the master lane index), and the register being
22583 assigned is copied via a shuffle instruction from the master lane.
22584 Outside of SIMD regions lane 0 is the master; inside, each thread
22585 sees itself as the master. Shared memory array "int __nvptx_uni[]"
22586 stores all-zeros or all-ones bitmasks for each warp, indicating
22587 current mode (0 outside of SIMD regions). Each thread can bitwise-
22588 and the bitmask at position "tid.y" with current lane index to
22589 compute the master lane index.
22590
22591 -mgomp
22592 Generate code for use in OpenMP offloading: enables -msoft-stack
22593 and -muniform-simt options, and selects corresponding multilib
22594 variant.
22595
22596 OpenRISC Options
22597
22598 These options are defined for OpenRISC:
22599
22600 -mboard=name
22601 Configure a board specific runtime. This will be passed to the
22602 linker for newlib board library linking. The default is "or1ksim".
22603
22604 -mnewlib
22605 This option is ignored; it is for compatibility purposes only.
22606 This used to select linker and preprocessor options for use with
22607 newlib.
22608
22609 -msoft-div
22610 -mhard-div
22611 Select software or hardware divide ("l.div", "l.divu")
22612 instructions. This default is hardware divide.
22613
22614 -msoft-mul
22615 -mhard-mul
22616 Select software or hardware multiply ("l.mul", "l.muli")
22617 instructions. This default is hardware multiply.
22618
22619 -msoft-float
22620 -mhard-float
22621 Select software or hardware for floating point operations. The
22622 default is software.
22623
22624 -mdouble-float
22625 When -mhard-float is selected, enables generation of double-
22626 precision floating point instructions. By default functions from
22627 libgcc are used to perform double-precision floating point
22628 operations.
22629
22630 -munordered-float
22631 When -mhard-float is selected, enables generation of unordered
22632 floating point compare and set flag ("lf.sfun*") instructions. By
22633 default functions from libgcc are used to perform unordered
22634 floating point compare and set flag operations.
22635
22636 -mcmov
22637 Enable generation of conditional move ("l.cmov") instructions. By
22638 default the equivalent will be generated using set and branch.
22639
22640 -mror
22641 Enable generation of rotate right ("l.ror") instructions. By
22642 default functions from libgcc are used to perform rotate right
22643 operations.
22644
22645 -mrori
22646 Enable generation of rotate right with immediate ("l.rori")
22647 instructions. By default functions from libgcc are used to perform
22648 rotate right with immediate operations.
22649
22650 -msext
22651 Enable generation of sign extension ("l.ext*") instructions. By
22652 default memory loads are used to perform sign extension.
22653
22654 -msfimm
22655 Enable generation of compare and set flag with immediate ("l.sf*i")
22656 instructions. By default extra instructions will be generated to
22657 store the immediate to a register first.
22658
22659 -mshftimm
22660 Enable generation of shift with immediate ("l.srai", "l.srli",
22661 "l.slli") instructions. By default extra instructions will be
22662 generated to store the immediate to a register first.
22663
22664 PDP-11 Options
22665
22666 These options are defined for the PDP-11:
22667
22668 -mfpu
22669 Use hardware FPP floating point. This is the default. (FIS
22670 floating point on the PDP-11/40 is not supported.) Implies -m45.
22671
22672 -msoft-float
22673 Do not use hardware floating point.
22674
22675 -mac0
22676 Return floating-point results in ac0 (fr0 in Unix assembler
22677 syntax).
22678
22679 -mno-ac0
22680 Return floating-point results in memory. This is the default.
22681
22682 -m40
22683 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22684
22685 -m45
22686 Generate code for a PDP-11/45. This is the default.
22687
22688 -m10
22689 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22690
22691 -mint16
22692 -mno-int32
22693 Use 16-bit "int". This is the default.
22694
22695 -mint32
22696 -mno-int16
22697 Use 32-bit "int".
22698
22699 -msplit
22700 Target has split instruction and data space. Implies -m45.
22701
22702 -munix-asm
22703 Use Unix assembler syntax.
22704
22705 -mdec-asm
22706 Use DEC assembler syntax.
22707
22708 -mgnu-asm
22709 Use GNU assembler syntax. This is the default.
22710
22711 -mlra
22712 Use the new LRA register allocator. By default, the old "reload"
22713 allocator is used.
22714
22715 picoChip Options
22716
22717 These -m options are defined for picoChip implementations:
22718
22719 -mae=ae_type
22720 Set the instruction set, register set, and instruction scheduling
22721 parameters for array element type ae_type. Supported values for
22722 ae_type are ANY, MUL, and MAC.
22723
22724 -mae=ANY selects a completely generic AE type. Code generated with
22725 this option runs on any of the other AE types. The code is not as
22726 efficient as it would be if compiled for a specific AE type, and
22727 some types of operation (e.g., multiplication) do not work properly
22728 on all types of AE.
22729
22730 -mae=MUL selects a MUL AE type. This is the most useful AE type
22731 for compiled code, and is the default.
22732
22733 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
22734 option may suffer from poor performance of byte (char)
22735 manipulation, since the DSP AE does not provide hardware support
22736 for byte load/stores.
22737
22738 -msymbol-as-address
22739 Enable the compiler to directly use a symbol name as an address in
22740 a load/store instruction, without first loading it into a register.
22741 Typically, the use of this option generates larger programs, which
22742 run faster than when the option isn't used. However, the results
22743 vary from program to program, so it is left as a user option,
22744 rather than being permanently enabled.
22745
22746 -mno-inefficient-warnings
22747 Disables warnings about the generation of inefficient code. These
22748 warnings can be generated, for example, when compiling code that
22749 performs byte-level memory operations on the MAC AE type. The MAC
22750 AE has no hardware support for byte-level memory operations, so all
22751 byte load/stores must be synthesized from word load/store
22752 operations. This is inefficient and a warning is generated to
22753 indicate that you should rewrite the code to avoid byte operations,
22754 or to target an AE type that has the necessary hardware support.
22755 This option disables these warnings.
22756
22757 PowerPC Options
22758
22759 These are listed under
22760
22761 PRU Options
22762
22763 These command-line options are defined for PRU target:
22764
22765 -minrt
22766 Link with a minimum runtime environment, with no support for static
22767 initializers and constructors. Using this option can significantly
22768 reduce the size of the final ELF binary. Beware that the compiler
22769 could still generate code with static initializers and
22770 constructors. It is up to the programmer to ensure that the source
22771 program will not use those features.
22772
22773 -mmcu=mcu
22774 Specify the PRU MCU variant to use. Check Newlib for the exact
22775 list of supported MCUs.
22776
22777 -mno-relax
22778 Make GCC pass the --no-relax command-line option to the linker
22779 instead of the --relax option.
22780
22781 -mloop
22782 Allow (or do not allow) GCC to use the LOOP instruction.
22783
22784 -mabi=variant
22785 Specify the ABI variant to output code for. -mabi=ti selects the
22786 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
22787 more naturally with certain GCC assumptions. These are the
22788 differences:
22789
22790 Function Pointer Size
22791 TI ABI specifies that function (code) pointers are 16-bit,
22792 whereas GNU supports only 32-bit data and code pointers.
22793
22794 Optional Return Value Pointer
22795 Function return values larger than 64 bits are passed by using
22796 a hidden pointer as the first argument of the function. TI
22797 ABI, though, mandates that the pointer can be NULL in case the
22798 caller is not using the returned value. GNU always passes and
22799 expects a valid return value pointer.
22800
22801 The current -mabi=ti implementation simply raises a compile error
22802 when any of the above code constructs is detected. As a
22803 consequence the standard C library cannot be built and it is
22804 omitted when linking with -mabi=ti.
22805
22806 Relaxation is a GNU feature and for safety reasons is disabled when
22807 using -mabi=ti. The TI toolchain does not emit relocations for
22808 QBBx instructions, so the GNU linker cannot adjust them when
22809 shortening adjacent LDI32 pseudo instructions.
22810
22811 RISC-V Options
22812
22813 These command-line options are defined for RISC-V targets:
22814
22815 -mbranch-cost=n
22816 Set the cost of branches to roughly n instructions.
22817
22818 -mplt
22819 -mno-plt
22820 When generating PIC code, do or don't allow the use of PLTs.
22821 Ignored for non-PIC. The default is -mplt.
22822
22823 -mabi=ABI-string
22824 Specify integer and floating-point calling convention. ABI-string
22825 contains two parts: the size of integer types and the registers
22826 used for floating-point types. For example -march=rv64ifd
22827 -mabi=lp64d means that long and pointers are 64-bit (implicitly
22828 defining int to be 32-bit), and that floating-point values up to 64
22829 bits wide are passed in F registers. Contrast this with
22830 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
22831 generate code that uses the F and D extensions but only allows
22832 floating-point values up to 32 bits long to be passed in registers;
22833 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
22834 will be passed in registers.
22835
22836 The default for this argument is system dependent, users who want a
22837 specific calling convention should specify one explicitly. The
22838 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
22839 and lp64d. Some calling conventions are impossible to implement on
22840 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
22841 because the ABI requires 64-bit values be passed in F registers,
22842 but F registers are only 32 bits wide. There is also the ilp32e
22843 ABI that can only be used with the rv32e architecture. This ABI is
22844 not well specified at present, and is subject to change.
22845
22846 -mfdiv
22847 -mno-fdiv
22848 Do or don't use hardware floating-point divide and square root
22849 instructions. This requires the F or D extensions for floating-
22850 point registers. The default is to use them if the specified
22851 architecture has these instructions.
22852
22853 -mdiv
22854 -mno-div
22855 Do or don't use hardware instructions for integer division. This
22856 requires the M extension. The default is to use them if the
22857 specified architecture has these instructions.
22858
22859 -march=ISA-string
22860 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
22861 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
22862
22863 When -march= is not specified, use the setting from -mcpu.
22864
22865 If both -march and -mcpu= are not specified, the default for this
22866 argument is system dependent, users who want a specific
22867 architecture extensions should specify one explicitly.
22868
22869 -mcpu=processor-string
22870 Use architecture of and optimize the output for the given
22871 processor, specified by particular CPU name. Permissible values
22872 for this option are: sifive-e20, sifive-e21, sifive-e24,
22873 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
22874 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
22875
22876 -mtune=processor-string
22877 Optimize the output for the given processor, specified by
22878 microarchitecture or particular CPU name. Permissible values for
22879 this option are: rocket, sifive-3-series, sifive-5-series,
22880 sifive-7-series, size, and all valid options for -mcpu=.
22881
22882 When -mtune= is not specified, use the setting from -mcpu, the
22883 default is rocket if both are not specified.
22884
22885 The size choice is not intended for use by end-users. This is used
22886 when -Os is specified. It overrides the instruction cost info
22887 provided by -mtune=, but does not override the pipeline info. This
22888 helps reduce code size while still giving good performance.
22889
22890 -mpreferred-stack-boundary=num
22891 Attempt to keep the stack boundary aligned to a 2 raised to num
22892 byte boundary. If -mpreferred-stack-boundary is not specified, the
22893 default is 4 (16 bytes or 128-bits).
22894
22895 Warning: If you use this switch, then you must build all modules
22896 with the same value, including any libraries. This includes the
22897 system libraries and startup modules.
22898
22899 -msmall-data-limit=n
22900 Put global and static data smaller than n bytes into a special
22901 section (on some targets).
22902
22903 -msave-restore
22904 -mno-save-restore
22905 Do or don't use smaller but slower prologue and epilogue code that
22906 uses library function calls. The default is to use fast inline
22907 prologues and epilogues.
22908
22909 -mshorten-memrefs
22910 -mno-shorten-memrefs
22911 Do or do not attempt to make more use of compressed load/store
22912 instructions by replacing a load/store of 'base register + large
22913 offset' with a new load/store of 'new base + small offset'. If the
22914 new base gets stored in a compressed register, then the new
22915 load/store can be compressed. Currently targets 32-bit integer
22916 load/stores only.
22917
22918 -mstrict-align
22919 -mno-strict-align
22920 Do not or do generate unaligned memory accesses. The default is
22921 set depending on whether the processor we are optimizing for
22922 supports fast unaligned access or not.
22923
22924 -mcmodel=medlow
22925 Generate code for the medium-low code model. The program and its
22926 statically defined symbols must lie within a single 2 GiB address
22927 range and must lie between absolute addresses -2 GiB and +2 GiB.
22928 Programs can be statically or dynamically linked. This is the
22929 default code model.
22930
22931 -mcmodel=medany
22932 Generate code for the medium-any code model. The program and its
22933 statically defined symbols must be within any single 2 GiB address
22934 range. Programs can be statically or dynamically linked.
22935
22936 -mexplicit-relocs
22937 -mno-exlicit-relocs
22938 Use or do not use assembler relocation operators when dealing with
22939 symbolic addresses. The alternative is to use assembler macros
22940 instead, which may limit optimization.
22941
22942 -mrelax
22943 -mno-relax
22944 Take advantage of linker relaxations to reduce the number of
22945 instructions required to materialize symbol addresses. The default
22946 is to take advantage of linker relaxations.
22947
22948 -memit-attribute
22949 -mno-emit-attribute
22950 Emit (do not emit) RISC-V attribute to record extra information
22951 into ELF objects. This feature requires at least binutils 2.32.
22952
22953 -malign-data=type
22954 Control how GCC aligns variables and constants of array, structure,
22955 or union types. Supported values for type are xlen which uses x
22956 register width as the alignment value, and natural which uses
22957 natural alignment. xlen is the default.
22958
22959 -mbig-endian
22960 Generate big-endian code. This is the default when GCC is
22961 configured for a riscv64be-*-* or riscv32be-*-* target.
22962
22963 -mlittle-endian
22964 Generate little-endian code. This is the default when GCC is
22965 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
22966 or riscv32be-*-* target.
22967
22968 -mstack-protector-guard=guard
22969 -mstack-protector-guard-reg=reg
22970 -mstack-protector-guard-offset=offset
22971 Generate stack protection code using canary at guard. Supported
22972 locations are global for a global canary or tls for per-thread
22973 canary in the TLS block.
22974
22975 With the latter choice the options -mstack-protector-guard-reg=reg
22976 and -mstack-protector-guard-offset=offset furthermore specify which
22977 register to use as base register for reading the canary, and from
22978 what offset from that base register. There is no default register
22979 or offset as this is entirely for use within the Linux kernel.
22980
22981 RL78 Options
22982
22983 -msim
22984 Links in additional target libraries to support operation within a
22985 simulator.
22986
22987 -mmul=none
22988 -mmul=g10
22989 -mmul=g13
22990 -mmul=g14
22991 -mmul=rl78
22992 Specifies the type of hardware multiplication and division support
22993 to be used. The simplest is "none", which uses software for both
22994 multiplication and division. This is the default. The "g13" value
22995 is for the hardware multiply/divide peripheral found on the
22996 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
22997 multiplication and division instructions supported by the RL78/G14
22998 (S3 core) parts. The value "rl78" is an alias for "g14" and the
22999 value "mg10" is an alias for "none".
23000
23001 In addition a C preprocessor macro is defined, based upon the
23002 setting of this option. Possible values are: "__RL78_MUL_NONE__",
23003 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
23004
23005 -mcpu=g10
23006 -mcpu=g13
23007 -mcpu=g14
23008 -mcpu=rl78
23009 Specifies the RL78 core to target. The default is the G14 core,
23010 also known as an S3 core or just RL78. The G13 or S2 core does not
23011 have multiply or divide instructions, instead it uses a hardware
23012 peripheral for these operations. The G10 or S1 core does not have
23013 register banks, so it uses a different calling convention.
23014
23015 If this option is set it also selects the type of hardware multiply
23016 support to use, unless this is overridden by an explicit -mmul=none
23017 option on the command line. Thus specifying -mcpu=g13 enables the
23018 use of the G13 hardware multiply peripheral and specifying
23019 -mcpu=g10 disables the use of hardware multiplications altogether.
23020
23021 Note, although the RL78/G14 core is the default target, specifying
23022 -mcpu=g14 or -mcpu=rl78 on the command line does change the
23023 behavior of the toolchain since it also enables G14 hardware
23024 multiply support. If these options are not specified on the
23025 command line then software multiplication routines will be used
23026 even though the code targets the RL78 core. This is for backwards
23027 compatibility with older toolchains which did not have hardware
23028 multiply and divide support.
23029
23030 In addition a C preprocessor macro is defined, based upon the
23031 setting of this option. Possible values are: "__RL78_G10__",
23032 "__RL78_G13__" or "__RL78_G14__".
23033
23034 -mg10
23035 -mg13
23036 -mg14
23037 -mrl78
23038 These are aliases for the corresponding -mcpu= option. They are
23039 provided for backwards compatibility.
23040
23041 -mallregs
23042 Allow the compiler to use all of the available registers. By
23043 default registers "r24..r31" are reserved for use in interrupt
23044 handlers. With this option enabled these registers can be used in
23045 ordinary functions as well.
23046
23047 -m64bit-doubles
23048 -m32bit-doubles
23049 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
23050 (-m32bit-doubles) in size. The default is -m32bit-doubles.
23051
23052 -msave-mduc-in-interrupts
23053 -mno-save-mduc-in-interrupts
23054 Specifies that interrupt handler functions should preserve the MDUC
23055 registers. This is only necessary if normal code might use the
23056 MDUC registers, for example because it performs multiplication and
23057 division operations. The default is to ignore the MDUC registers
23058 as this makes the interrupt handlers faster. The target option
23059 -mg13 needs to be passed for this to work as this feature is only
23060 available on the G13 target (S2 core). The MDUC registers will
23061 only be saved if the interrupt handler performs a multiplication or
23062 division operation or it calls another function.
23063
23064 IBM RS/6000 and PowerPC Options
23065
23066 These -m options are defined for the IBM RS/6000 and PowerPC:
23067
23068 -mpowerpc-gpopt
23069 -mno-powerpc-gpopt
23070 -mpowerpc-gfxopt
23071 -mno-powerpc-gfxopt
23072 -mpowerpc64
23073 -mno-powerpc64
23074 -mmfcrf
23075 -mno-mfcrf
23076 -mpopcntb
23077 -mno-popcntb
23078 -mpopcntd
23079 -mno-popcntd
23080 -mfprnd
23081 -mno-fprnd
23082 -mcmpb
23083 -mno-cmpb
23084 -mhard-dfp
23085 -mno-hard-dfp
23086 You use these options to specify which instructions are available
23087 on the processor you are using. The default value of these options
23088 is determined when configuring GCC. Specifying the -mcpu=cpu_type
23089 overrides the specification of these options. We recommend you use
23090 the -mcpu=cpu_type option rather than the options listed above.
23091
23092 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
23093 architecture instructions in the General Purpose group, including
23094 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
23095 to use the optional PowerPC architecture instructions in the
23096 Graphics group, including floating-point select.
23097
23098 The -mmfcrf option allows GCC to generate the move from condition
23099 register field instruction implemented on the POWER4 processor and
23100 other processors that support the PowerPC V2.01 architecture. The
23101 -mpopcntb option allows GCC to generate the popcount and double-
23102 precision FP reciprocal estimate instruction implemented on the
23103 POWER5 processor and other processors that support the PowerPC
23104 V2.02 architecture. The -mpopcntd option allows GCC to generate
23105 the popcount instruction implemented on the POWER7 processor and
23106 other processors that support the PowerPC V2.06 architecture. The
23107 -mfprnd option allows GCC to generate the FP round to integer
23108 instructions implemented on the POWER5+ processor and other
23109 processors that support the PowerPC V2.03 architecture. The -mcmpb
23110 option allows GCC to generate the compare bytes instruction
23111 implemented on the POWER6 processor and other processors that
23112 support the PowerPC V2.05 architecture. The -mhard-dfp option
23113 allows GCC to generate the decimal floating-point instructions
23114 implemented on some POWER processors.
23115
23116 The -mpowerpc64 option allows GCC to generate the additional 64-bit
23117 instructions that are found in the full PowerPC64 architecture and
23118 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23119 -mno-powerpc64.
23120
23121 -mcpu=cpu_type
23122 Set architecture type, register usage, and instruction scheduling
23123 parameters for machine type cpu_type. Supported values for
23124 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
23125 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
23126 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
23127 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
23128 power4, power5, power5+, power6, power6x, power7, power8, power9,
23129 future, powerpc, powerpc64, powerpc64le, rs64, and native.
23130
23131 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
23132 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
23133 64-bit little endian PowerPC architecture machine types, with an
23134 appropriate, generic processor model assumed for scheduling
23135 purposes.
23136
23137 Specifying native as cpu type detects and selects the architecture
23138 option that corresponds to the host processor of the system
23139 performing the compilation. -mcpu=native has no effect if GCC does
23140 not recognize the processor.
23141
23142 The other options specify a specific processor. Code generated
23143 under those options runs best on that processor, and may not run at
23144 all on others.
23145
23146 The -mcpu options automatically enable or disable the following
23147 options:
23148
23149 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
23150 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
23151 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
23152 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
23153 -mfloat128-hardware -mprefixed -mpcrel -mmma
23154
23155 The particular options set for any particular CPU varies between
23156 compiler versions, depending on what setting seems to produce
23157 optimal code for that CPU; it doesn't necessarily reflect the
23158 actual hardware's capabilities. If you wish to set an individual
23159 option to a particular value, you may specify it after the -mcpu
23160 option, like -mcpu=970 -mno-altivec.
23161
23162 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
23163 disabled by the -mcpu option at present because AIX does not have
23164 full support for these options. You may still enable or disable
23165 them individually if you're sure it'll work in your environment.
23166
23167 -mtune=cpu_type
23168 Set the instruction scheduling parameters for machine type
23169 cpu_type, but do not set the architecture type or register usage,
23170 as -mcpu=cpu_type does. The same values for cpu_type are used for
23171 -mtune as for -mcpu. If both are specified, the code generated
23172 uses the architecture and registers set by -mcpu, but the
23173 scheduling parameters set by -mtune.
23174
23175 -mcmodel=small
23176 Generate PowerPC64 code for the small model: The TOC is limited to
23177 64k.
23178
23179 -mcmodel=medium
23180 Generate PowerPC64 code for the medium model: The TOC and other
23181 static data may be up to a total of 4G in size. This is the
23182 default for 64-bit Linux.
23183
23184 -mcmodel=large
23185 Generate PowerPC64 code for the large model: The TOC may be up to
23186 4G in size. Other data and code is only limited by the 64-bit
23187 address space.
23188
23189 -maltivec
23190 -mno-altivec
23191 Generate code that uses (does not use) AltiVec instructions, and
23192 also enable the use of built-in functions that allow more direct
23193 access to the AltiVec instruction set. You may also need to set
23194 -mabi=altivec to adjust the current ABI with AltiVec ABI
23195 enhancements.
23196
23197 When -maltivec is used, the element order for AltiVec intrinsics
23198 such as "vec_splat", "vec_extract", and "vec_insert" match array
23199 element order corresponding to the endianness of the target. That
23200 is, element zero identifies the leftmost element in a vector
23201 register when targeting a big-endian platform, and identifies the
23202 rightmost element in a vector register when targeting a little-
23203 endian platform.
23204
23205 -mvrsave
23206 -mno-vrsave
23207 Generate VRSAVE instructions when generating AltiVec code.
23208
23209 -msecure-plt
23210 Generate code that allows ld and ld.so to build executables and
23211 shared libraries with non-executable ".plt" and ".got" sections.
23212 This is a PowerPC 32-bit SYSV ABI option.
23213
23214 -mbss-plt
23215 Generate code that uses a BSS ".plt" section that ld.so fills in,
23216 and requires ".plt" and ".got" sections that are both writable and
23217 executable. This is a PowerPC 32-bit SYSV ABI option.
23218
23219 -misel
23220 -mno-isel
23221 This switch enables or disables the generation of ISEL
23222 instructions.
23223
23224 -mvsx
23225 -mno-vsx
23226 Generate code that uses (does not use) vector/scalar (VSX)
23227 instructions, and also enable the use of built-in functions that
23228 allow more direct access to the VSX instruction set.
23229
23230 -mcrypto
23231 -mno-crypto
23232 Enable the use (disable) of the built-in functions that allow
23233 direct access to the cryptographic instructions that were added in
23234 version 2.07 of the PowerPC ISA.
23235
23236 -mhtm
23237 -mno-htm
23238 Enable (disable) the use of the built-in functions that allow
23239 direct access to the Hardware Transactional Memory (HTM)
23240 instructions that were added in version 2.07 of the PowerPC ISA.
23241
23242 -mpower8-fusion
23243 -mno-power8-fusion
23244 Generate code that keeps (does not keeps) some integer operations
23245 adjacent so that the instructions can be fused together on power8
23246 and later processors.
23247
23248 -mpower8-vector
23249 -mno-power8-vector
23250 Generate code that uses (does not use) the vector and scalar
23251 instructions that were added in version 2.07 of the PowerPC ISA.
23252 Also enable the use of built-in functions that allow more direct
23253 access to the vector instructions.
23254
23255 -mquad-memory
23256 -mno-quad-memory
23257 Generate code that uses (does not use) the non-atomic quad word
23258 memory instructions. The -mquad-memory option requires use of
23259 64-bit mode.
23260
23261 -mquad-memory-atomic
23262 -mno-quad-memory-atomic
23263 Generate code that uses (does not use) the atomic quad word memory
23264 instructions. The -mquad-memory-atomic option requires use of
23265 64-bit mode.
23266
23267 -mfloat128
23268 -mno-float128
23269 Enable/disable the __float128 keyword for IEEE 128-bit floating
23270 point and use either software emulation for IEEE 128-bit floating
23271 point or hardware instructions.
23272
23273 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
23274 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
23275 support. The IEEE 128-bit floating point support only works on
23276 PowerPC Linux systems.
23277
23278 The default for -mfloat128 is enabled on PowerPC Linux systems
23279 using the VSX instruction set, and disabled on other systems.
23280
23281 If you use the ISA 3.0 instruction set (-mpower9-vector or
23282 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
23283 support will also enable the generation of ISA 3.0 IEEE 128-bit
23284 floating point instructions. Otherwise, if you do not specify to
23285 generate ISA 3.0 instructions or you are targeting a 32-bit big
23286 endian system, IEEE 128-bit floating point will be done with
23287 software emulation.
23288
23289 -mfloat128-hardware
23290 -mno-float128-hardware
23291 Enable/disable using ISA 3.0 hardware instructions to support the
23292 __float128 data type.
23293
23294 The default for -mfloat128-hardware is enabled on PowerPC Linux
23295 systems using the ISA 3.0 instruction set, and disabled on other
23296 systems.
23297
23298 -m32
23299 -m64
23300 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23301 targets (including GNU/Linux). The 32-bit environment sets int,
23302 long and pointer to 32 bits and generates code that runs on any
23303 PowerPC variant. The 64-bit environment sets int to 32 bits and
23304 long and pointer to 64 bits, and generates code for PowerPC64, as
23305 for -mpowerpc64.
23306
23307 -mfull-toc
23308 -mno-fp-in-toc
23309 -mno-sum-in-toc
23310 -mminimal-toc
23311 Modify generation of the TOC (Table Of Contents), which is created
23312 for every executable file. The -mfull-toc option is selected by
23313 default. In that case, GCC allocates at least one TOC entry for
23314 each unique non-automatic variable reference in your program. GCC
23315 also places floating-point constants in the TOC. However, only
23316 16,384 entries are available in the TOC.
23317
23318 If you receive a linker error message that saying you have
23319 overflowed the available TOC space, you can reduce the amount of
23320 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
23321 -mno-fp-in-toc prevents GCC from putting floating-point constants
23322 in the TOC and -mno-sum-in-toc forces GCC to generate code to
23323 calculate the sum of an address and a constant at run time instead
23324 of putting that sum into the TOC. You may specify one or both of
23325 these options. Each causes GCC to produce very slightly slower and
23326 larger code at the expense of conserving TOC space.
23327
23328 If you still run out of space in the TOC even when you specify both
23329 of these options, specify -mminimal-toc instead. This option
23330 causes GCC to make only one TOC entry for every file. When you
23331 specify this option, GCC produces code that is slower and larger
23332 but which uses extremely little TOC space. You may wish to use
23333 this option only on files that contain less frequently-executed
23334 code.
23335
23336 -maix64
23337 -maix32
23338 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
23339 64-bit "long" type, and the infrastructure needed to support them.
23340 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
23341 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
23342
23343 -mxl-compat
23344 -mno-xl-compat
23345 Produce code that conforms more closely to IBM XL compiler
23346 semantics when using AIX-compatible ABI. Pass floating-point
23347 arguments to prototyped functions beyond the register save area
23348 (RSA) on the stack in addition to argument FPRs. Do not assume
23349 that most significant double in 128-bit long double value is
23350 properly rounded when comparing values and converting to double.
23351 Use XL symbol names for long double support routines.
23352
23353 The AIX calling convention was extended but not initially
23354 documented to handle an obscure K&R C case of calling a function
23355 that takes the address of its arguments with fewer arguments than
23356 declared. IBM XL compilers access floating-point arguments that do
23357 not fit in the RSA from the stack when a subroutine is compiled
23358 without optimization. Because always storing floating-point
23359 arguments on the stack is inefficient and rarely needed, this
23360 option is not enabled by default and only is necessary when calling
23361 subroutines compiled by IBM XL compilers without optimization.
23362
23363 -mpe
23364 Support IBM RS/6000 SP Parallel Environment (PE). Link an
23365 application written to use message passing with special startup
23366 code to enable the application to run. The system must have PE
23367 installed in the standard location (/usr/lpp/ppe.poe/), or the
23368 specs file must be overridden with the -specs= option to specify
23369 the appropriate directory location. The Parallel Environment does
23370 not support threads, so the -mpe option and the -pthread option are
23371 incompatible.
23372
23373 -malign-natural
23374 -malign-power
23375 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23376 -malign-natural overrides the ABI-defined alignment of larger
23377 types, such as floating-point doubles, on their natural size-based
23378 boundary. The option -malign-power instructs GCC to follow the
23379 ABI-specified alignment rules. GCC defaults to the standard
23380 alignment defined in the ABI.
23381
23382 On 64-bit Darwin, natural alignment is the default, and
23383 -malign-power is not supported.
23384
23385 -msoft-float
23386 -mhard-float
23387 Generate code that does not use (uses) the floating-point register
23388 set. Software floating-point emulation is provided if you use the
23389 -msoft-float option, and pass the option to GCC when linking.
23390
23391 -mmultiple
23392 -mno-multiple
23393 Generate code that uses (does not use) the load multiple word
23394 instructions and the store multiple word instructions. These
23395 instructions are generated by default on POWER systems, and not
23396 generated on PowerPC systems. Do not use -mmultiple on little-
23397 endian PowerPC systems, since those instructions do not work when
23398 the processor is in little-endian mode. The exceptions are PPC740
23399 and PPC750 which permit these instructions in little-endian mode.
23400
23401 -mupdate
23402 -mno-update
23403 Generate code that uses (does not use) the load or store
23404 instructions that update the base register to the address of the
23405 calculated memory location. These instructions are generated by
23406 default. If you use -mno-update, there is a small window between
23407 the time that the stack pointer is updated and the address of the
23408 previous frame is stored, which means code that walks the stack
23409 frame across interrupts or signals may get corrupted data.
23410
23411 -mavoid-indexed-addresses
23412 -mno-avoid-indexed-addresses
23413 Generate code that tries to avoid (not avoid) the use of indexed
23414 load or store instructions. These instructions can incur a
23415 performance penalty on Power6 processors in certain situations,
23416 such as when stepping through large arrays that cross a 16M
23417 boundary. This option is enabled by default when targeting Power6
23418 and disabled otherwise.
23419
23420 -mfused-madd
23421 -mno-fused-madd
23422 Generate code that uses (does not use) the floating-point multiply
23423 and accumulate instructions. These instructions are generated by
23424 default if hardware floating point is used. The machine-dependent
23425 -mfused-madd option is now mapped to the machine-independent
23426 -ffp-contract=fast option, and -mno-fused-madd is mapped to
23427 -ffp-contract=off.
23428
23429 -mmulhw
23430 -mno-mulhw
23431 Generate code that uses (does not use) the half-word multiply and
23432 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
23433 processors. These instructions are generated by default when
23434 targeting those processors.
23435
23436 -mdlmzb
23437 -mno-dlmzb
23438 Generate code that uses (does not use) the string-search dlmzb
23439 instruction on the IBM 405, 440, 464 and 476 processors. This
23440 instruction is generated by default when targeting those
23441 processors.
23442
23443 -mno-bit-align
23444 -mbit-align
23445 On System V.4 and embedded PowerPC systems do not (do) force
23446 structures and unions that contain bit-fields to be aligned to the
23447 base type of the bit-field.
23448
23449 For example, by default a structure containing nothing but 8
23450 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
23451 and has a size of 4 bytes. By using -mno-bit-align, the structure
23452 is aligned to a 1-byte boundary and is 1 byte in size.
23453
23454 -mno-strict-align
23455 -mstrict-align
23456 On System V.4 and embedded PowerPC systems do not (do) assume that
23457 unaligned memory references are handled by the system.
23458
23459 -mrelocatable
23460 -mno-relocatable
23461 Generate code that allows (does not allow) a static executable to
23462 be relocated to a different address at run time. A simple embedded
23463 PowerPC system loader should relocate the entire contents of
23464 ".got2" and 4-byte locations listed in the ".fixup" section, a
23465 table of 32-bit addresses generated by this option. For this to
23466 work, all objects linked together must be compiled with
23467 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
23468 stack to an 8-byte boundary.
23469
23470 -mrelocatable-lib
23471 -mno-relocatable-lib
23472 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
23473 to allow static executables to be relocated at run time, but
23474 -mrelocatable-lib does not use the smaller stack alignment of
23475 -mrelocatable. Objects compiled with -mrelocatable-lib may be
23476 linked with objects compiled with any combination of the
23477 -mrelocatable options.
23478
23479 -mno-toc
23480 -mtoc
23481 On System V.4 and embedded PowerPC systems do not (do) assume that
23482 register 2 contains a pointer to a global area pointing to the
23483 addresses used in the program.
23484
23485 -mlittle
23486 -mlittle-endian
23487 On System V.4 and embedded PowerPC systems compile code for the
23488 processor in little-endian mode. The -mlittle-endian option is the
23489 same as -mlittle.
23490
23491 -mbig
23492 -mbig-endian
23493 On System V.4 and embedded PowerPC systems compile code for the
23494 processor in big-endian mode. The -mbig-endian option is the same
23495 as -mbig.
23496
23497 -mdynamic-no-pic
23498 On Darwin and Mac OS X systems, compile code so that it is not
23499 relocatable, but that its external references are relocatable. The
23500 resulting code is suitable for applications, but not shared
23501 libraries.
23502
23503 -msingle-pic-base
23504 Treat the register used for PIC addressing as read-only, rather
23505 than loading it in the prologue for each function. The runtime
23506 system is responsible for initializing this register with an
23507 appropriate value before execution begins.
23508
23509 -mprioritize-restricted-insns=priority
23510 This option controls the priority that is assigned to dispatch-slot
23511 restricted instructions during the second scheduling pass. The
23512 argument priority takes the value 0, 1, or 2 to assign no, highest,
23513 or second-highest (respectively) priority to dispatch-slot
23514 restricted instructions.
23515
23516 -msched-costly-dep=dependence_type
23517 This option controls which dependences are considered costly by the
23518 target during instruction scheduling. The argument dependence_type
23519 takes one of the following values:
23520
23521 no No dependence is costly.
23522
23523 all All dependences are costly.
23524
23525 true_store_to_load
23526 A true dependence from store to load is costly.
23527
23528 store_to_load
23529 Any dependence from store to load is costly.
23530
23531 number
23532 Any dependence for which the latency is greater than or equal
23533 to number is costly.
23534
23535 -minsert-sched-nops=scheme
23536 This option controls which NOP insertion scheme is used during the
23537 second scheduling pass. The argument scheme takes one of the
23538 following values:
23539
23540 no Don't insert NOPs.
23541
23542 pad Pad with NOPs any dispatch group that has vacant issue slots,
23543 according to the scheduler's grouping.
23544
23545 regroup_exact
23546 Insert NOPs to force costly dependent insns into separate
23547 groups. Insert exactly as many NOPs as needed to force an insn
23548 to a new group, according to the estimated processor grouping.
23549
23550 number
23551 Insert NOPs to force costly dependent insns into separate
23552 groups. Insert number NOPs to force an insn to a new group.
23553
23554 -mcall-sysv
23555 On System V.4 and embedded PowerPC systems compile code using
23556 calling conventions that adhere to the March 1995 draft of the
23557 System V Application Binary Interface, PowerPC processor
23558 supplement. This is the default unless you configured GCC using
23559 powerpc-*-eabiaix.
23560
23561 -mcall-sysv-eabi
23562 -mcall-eabi
23563 Specify both -mcall-sysv and -meabi options.
23564
23565 -mcall-sysv-noeabi
23566 Specify both -mcall-sysv and -mno-eabi options.
23567
23568 -mcall-aixdesc
23569 On System V.4 and embedded PowerPC systems compile code for the AIX
23570 operating system.
23571
23572 -mcall-linux
23573 On System V.4 and embedded PowerPC systems compile code for the
23574 Linux-based GNU system.
23575
23576 -mcall-freebsd
23577 On System V.4 and embedded PowerPC systems compile code for the
23578 FreeBSD operating system.
23579
23580 -mcall-netbsd
23581 On System V.4 and embedded PowerPC systems compile code for the
23582 NetBSD operating system.
23583
23584 -mcall-openbsd
23585 On System V.4 and embedded PowerPC systems compile code for the
23586 OpenBSD operating system.
23587
23588 -mtraceback=traceback_type
23589 Select the type of traceback table. Valid values for traceback_type
23590 are full, part, and no.
23591
23592 -maix-struct-return
23593 Return all structures in memory (as specified by the AIX ABI).
23594
23595 -msvr4-struct-return
23596 Return structures smaller than 8 bytes in registers (as specified
23597 by the SVR4 ABI).
23598
23599 -mabi=abi-type
23600 Extend the current ABI with a particular extension, or remove such
23601 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
23602 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
23603
23604 -mabi=ibmlongdouble
23605 Change the current ABI to use IBM extended-precision long double.
23606 This is not likely to work if your system defaults to using IEEE
23607 extended-precision long double. If you change the long double type
23608 from IEEE extended-precision, the compiler will issue a warning
23609 unless you use the -Wno-psabi option. Requires -mlong-double-128
23610 to be enabled.
23611
23612 -mabi=ieeelongdouble
23613 Change the current ABI to use IEEE extended-precision long double.
23614 This is not likely to work if your system defaults to using IBM
23615 extended-precision long double. If you change the long double type
23616 from IBM extended-precision, the compiler will issue a warning
23617 unless you use the -Wno-psabi option. Requires -mlong-double-128
23618 to be enabled.
23619
23620 -mabi=elfv1
23621 Change the current ABI to use the ELFv1 ABI. This is the default
23622 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
23623 ABI requires special system support and is likely to fail in
23624 spectacular ways.
23625
23626 -mabi=elfv2
23627 Change the current ABI to use the ELFv2 ABI. This is the default
23628 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
23629 ABI requires special system support and is likely to fail in
23630 spectacular ways.
23631
23632 -mgnu-attribute
23633 -mno-gnu-attribute
23634 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23635 .gnu.attributes section that specify ABI variations in function
23636 parameters or return values.
23637
23638 -mprototype
23639 -mno-prototype
23640 On System V.4 and embedded PowerPC systems assume that all calls to
23641 variable argument functions are properly prototyped. Otherwise,
23642 the compiler must insert an instruction before every non-prototyped
23643 call to set or clear bit 6 of the condition code register ("CR") to
23644 indicate whether floating-point values are passed in the floating-
23645 point registers in case the function takes variable arguments.
23646 With -mprototype, only calls to prototyped variable argument
23647 functions set or clear the bit.
23648
23649 -msim
23650 On embedded PowerPC systems, assume that the startup module is
23651 called sim-crt0.o and that the standard C libraries are libsim.a
23652 and libc.a. This is the default for powerpc-*-eabisim
23653 configurations.
23654
23655 -mmvme
23656 On embedded PowerPC systems, assume that the startup module is
23657 called crt0.o and the standard C libraries are libmvme.a and
23658 libc.a.
23659
23660 -mads
23661 On embedded PowerPC systems, assume that the startup module is
23662 called crt0.o and the standard C libraries are libads.a and libc.a.
23663
23664 -myellowknife
23665 On embedded PowerPC systems, assume that the startup module is
23666 called crt0.o and the standard C libraries are libyk.a and libc.a.
23667
23668 -mvxworks
23669 On System V.4 and embedded PowerPC systems, specify that you are
23670 compiling for a VxWorks system.
23671
23672 -memb
23673 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
23674 header to indicate that eabi extended relocations are used.
23675
23676 -meabi
23677 -mno-eabi
23678 On System V.4 and embedded PowerPC systems do (do not) adhere to
23679 the Embedded Applications Binary Interface (EABI), which is a set
23680 of modifications to the System V.4 specifications. Selecting
23681 -meabi means that the stack is aligned to an 8-byte boundary, a
23682 function "__eabi" is called from "main" to set up the EABI
23683 environment, and the -msdata option can use both "r2" and "r13" to
23684 point to two separate small data areas. Selecting -mno-eabi means
23685 that the stack is aligned to a 16-byte boundary, no EABI
23686 initialization function is called from "main", and the -msdata
23687 option only uses "r13" to point to a single small data area. The
23688 -meabi option is on by default if you configured GCC using one of
23689 the powerpc*-*-eabi* options.
23690
23691 -msdata=eabi
23692 On System V.4 and embedded PowerPC systems, put small initialized
23693 "const" global and static data in the ".sdata2" section, which is
23694 pointed to by register "r2". Put small initialized non-"const"
23695 global and static data in the ".sdata" section, which is pointed to
23696 by register "r13". Put small uninitialized global and static data
23697 in the ".sbss" section, which is adjacent to the ".sdata" section.
23698 The -msdata=eabi option is incompatible with the -mrelocatable
23699 option. The -msdata=eabi option also sets the -memb option.
23700
23701 -msdata=sysv
23702 On System V.4 and embedded PowerPC systems, put small global and
23703 static data in the ".sdata" section, which is pointed to by
23704 register "r13". Put small uninitialized global and static data in
23705 the ".sbss" section, which is adjacent to the ".sdata" section.
23706 The -msdata=sysv option is incompatible with the -mrelocatable
23707 option.
23708
23709 -msdata=default
23710 -msdata
23711 On System V.4 and embedded PowerPC systems, if -meabi is used,
23712 compile code the same as -msdata=eabi, otherwise compile code the
23713 same as -msdata=sysv.
23714
23715 -msdata=data
23716 On System V.4 and embedded PowerPC systems, put small global data
23717 in the ".sdata" section. Put small uninitialized global data in
23718 the ".sbss" section. Do not use register "r13" to address small
23719 data however. This is the default behavior unless other -msdata
23720 options are used.
23721
23722 -msdata=none
23723 -mno-sdata
23724 On embedded PowerPC systems, put all initialized global and static
23725 data in the ".data" section, and all uninitialized data in the
23726 ".bss" section.
23727
23728 -mreadonly-in-sdata
23729 Put read-only objects in the ".sdata" section as well. This is the
23730 default.
23731
23732 -mblock-move-inline-limit=num
23733 Inline all block moves (such as calls to "memcpy" or structure
23734 copies) less than or equal to num bytes. The minimum value for num
23735 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
23736 default value is target-specific.
23737
23738 -mblock-compare-inline-limit=num
23739 Generate non-looping inline code for all block compares (such as
23740 calls to "memcmp" or structure compares) less than or equal to num
23741 bytes. If num is 0, all inline expansion (non-loop and loop) of
23742 block compare is disabled. The default value is target-specific.
23743
23744 -mblock-compare-inline-loop-limit=num
23745 Generate an inline expansion using loop code for all block compares
23746 that are less than or equal to num bytes, but greater than the
23747 limit for non-loop inline block compare expansion. If the block
23748 length is not constant, at most num bytes will be compared before
23749 "memcmp" is called to compare the remainder of the block. The
23750 default value is target-specific.
23751
23752 -mstring-compare-inline-limit=num
23753 Compare at most num string bytes with inline code. If the
23754 difference or end of string is not found at the end of the inline
23755 compare a call to "strcmp" or "strncmp" will take care of the rest
23756 of the comparison. The default is 64 bytes.
23757
23758 -G num
23759 On embedded PowerPC systems, put global and static items less than
23760 or equal to num bytes into the small data or BSS sections instead
23761 of the normal data or BSS section. By default, num is 8. The -G
23762 num switch is also passed to the linker. All modules should be
23763 compiled with the same -G num value.
23764
23765 -mregnames
23766 -mno-regnames
23767 On System V.4 and embedded PowerPC systems do (do not) emit
23768 register names in the assembly language output using symbolic
23769 forms.
23770
23771 -mlongcall
23772 -mno-longcall
23773 By default assume that all calls are far away so that a longer and
23774 more expensive calling sequence is required. This is required for
23775 calls farther than 32 megabytes (33,554,432 bytes) from the current
23776 location. A short call is generated if the compiler knows the call
23777 cannot be that far away. This setting can be overridden by the
23778 "shortcall" function attribute, or by "#pragma longcall(0)".
23779
23780 Some linkers are capable of detecting out-of-range calls and
23781 generating glue code on the fly. On these systems, long calls are
23782 unnecessary and generate slower code. As of this writing, the AIX
23783 linker can do this, as can the GNU linker for PowerPC/64. It is
23784 planned to add this feature to the GNU linker for 32-bit PowerPC
23785 systems as well.
23786
23787 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
23788 linkers, GCC can generate long calls using an inline PLT call
23789 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
23790 ELFv1 (big-endian) do not support inline PLT calls.
23791
23792 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
23793 L42", plus a branch island (glue code). The two target addresses
23794 represent the callee and the branch island. The Darwin/PPC linker
23795 prefers the first address and generates a "bl callee" if the PPC
23796 "bl" instruction reaches the callee directly; otherwise, the linker
23797 generates "bl L42" to call the branch island. The branch island is
23798 appended to the body of the calling function; it computes the full
23799 32-bit address of the callee and jumps to it.
23800
23801 On Mach-O (Darwin) systems, this option directs the compiler emit
23802 to the glue for every direct call, and the Darwin linker decides
23803 whether to use or discard it.
23804
23805 In the future, GCC may ignore all longcall specifications when the
23806 linker is known to generate glue.
23807
23808 -mpltseq
23809 -mno-pltseq
23810 Implement (do not implement) -fno-plt and long calls using an
23811 inline PLT call sequence that supports lazy linking and long calls
23812 to functions in dlopen'd shared libraries. Inline PLT calls are
23813 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
23814 newer GNU linkers, and are enabled by default if the support is
23815 detected when configuring GCC, and, in the case of 32-bit PowerPC,
23816 if GCC is configured with --enable-secureplt. -mpltseq code and
23817 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
23818 together.
23819
23820 -mtls-markers
23821 -mno-tls-markers
23822 Mark (do not mark) calls to "__tls_get_addr" with a relocation
23823 specifying the function argument. The relocation allows the linker
23824 to reliably associate function call with argument setup
23825 instructions for TLS optimization, which in turn allows GCC to
23826 better schedule the sequence.
23827
23828 -mrecip
23829 -mno-recip
23830 This option enables use of the reciprocal estimate and reciprocal
23831 square root estimate instructions with additional Newton-Raphson
23832 steps to increase precision instead of doing a divide or square
23833 root and divide for floating-point arguments. You should use the
23834 -ffast-math option when using -mrecip (or at least
23835 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
23836 and -fno-trapping-math). Note that while the throughput of the
23837 sequence is generally higher than the throughput of the non-
23838 reciprocal instruction, the precision of the sequence can be
23839 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
23840 0.99999994) for reciprocal square roots.
23841
23842 -mrecip=opt
23843 This option controls which reciprocal estimate instructions may be
23844 used. opt is a comma-separated list of options, which may be
23845 preceded by a "!" to invert the option:
23846
23847 all Enable all estimate instructions.
23848
23849 default
23850 Enable the default instructions, equivalent to -mrecip.
23851
23852 none
23853 Disable all estimate instructions, equivalent to -mno-recip.
23854
23855 div Enable the reciprocal approximation instructions for both
23856 single and double precision.
23857
23858 divf
23859 Enable the single-precision reciprocal approximation
23860 instructions.
23861
23862 divd
23863 Enable the double-precision reciprocal approximation
23864 instructions.
23865
23866 rsqrt
23867 Enable the reciprocal square root approximation instructions
23868 for both single and double precision.
23869
23870 rsqrtf
23871 Enable the single-precision reciprocal square root
23872 approximation instructions.
23873
23874 rsqrtd
23875 Enable the double-precision reciprocal square root
23876 approximation instructions.
23877
23878 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
23879 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
23880 "XVRSQRTEDP" instructions which handle the double-precision
23881 reciprocal square root calculations.
23882
23883 -mrecip-precision
23884 -mno-recip-precision
23885 Assume (do not assume) that the reciprocal estimate instructions
23886 provide higher-precision estimates than is mandated by the PowerPC
23887 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
23888 automatically selects -mrecip-precision. The double-precision
23889 square root estimate instructions are not generated by default on
23890 low-precision machines, since they do not provide an estimate that
23891 converges after three steps.
23892
23893 -mveclibabi=type
23894 Specifies the ABI type to use for vectorizing intrinsics using an
23895 external library. The only type supported at present is mass,
23896 which specifies to use IBM's Mathematical Acceleration Subsystem
23897 (MASS) libraries for vectorizing intrinsics using external
23898 libraries. GCC currently emits calls to "acosd2", "acosf4",
23899 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
23900 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
23901 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
23902 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
23903 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
23904 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
23905 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
23906 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
23907 "tanhf4" when generating code for power7. Both -ftree-vectorize
23908 and -funsafe-math-optimizations must also be enabled. The MASS
23909 libraries must be specified at link time.
23910
23911 -mfriz
23912 -mno-friz
23913 Generate (do not generate) the "friz" instruction when the
23914 -funsafe-math-optimizations option is used to optimize rounding of
23915 floating-point values to 64-bit integer and back to floating point.
23916 The "friz" instruction does not return the same value if the
23917 floating-point number is too large to fit in an integer.
23918
23919 -mpointers-to-nested-functions
23920 -mno-pointers-to-nested-functions
23921 Generate (do not generate) code to load up the static chain
23922 register ("r11") when calling through a pointer on AIX and 64-bit
23923 Linux systems where a function pointer points to a 3-word
23924 descriptor giving the function address, TOC value to be loaded in
23925 register "r2", and static chain value to be loaded in register
23926 "r11". The -mpointers-to-nested-functions is on by default. You
23927 cannot call through pointers to nested functions or pointers to
23928 functions compiled in other languages that use the static chain if
23929 you use -mno-pointers-to-nested-functions.
23930
23931 -msave-toc-indirect
23932 -mno-save-toc-indirect
23933 Generate (do not generate) code to save the TOC value in the
23934 reserved stack location in the function prologue if the function
23935 calls through a pointer on AIX and 64-bit Linux systems. If the
23936 TOC value is not saved in the prologue, it is saved just before the
23937 call through the pointer. The -mno-save-toc-indirect option is the
23938 default.
23939
23940 -mcompat-align-parm
23941 -mno-compat-align-parm
23942 Generate (do not generate) code to pass structure parameters with a
23943 maximum alignment of 64 bits, for compatibility with older versions
23944 of GCC.
23945
23946 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23947 structure parameter on a 128-bit boundary when that structure
23948 contained a member requiring 128-bit alignment. This is corrected
23949 in more recent versions of GCC. This option may be used to
23950 generate code that is compatible with functions compiled with older
23951 versions of GCC.
23952
23953 The -mno-compat-align-parm option is the default.
23954
23955 -mstack-protector-guard=guard
23956 -mstack-protector-guard-reg=reg
23957 -mstack-protector-guard-offset=offset
23958 -mstack-protector-guard-symbol=symbol
23959 Generate stack protection code using canary at guard. Supported
23960 locations are global for global canary or tls for per-thread canary
23961 in the TLS block (the default with GNU libc version 2.4 or later).
23962
23963 With the latter choice the options -mstack-protector-guard-reg=reg
23964 and -mstack-protector-guard-offset=offset furthermore specify which
23965 register to use as base register for reading the canary, and from
23966 what offset from that base register. The default for those is as
23967 specified in the relevant ABI.
23968 -mstack-protector-guard-symbol=symbol overrides the offset with a
23969 symbol reference to a canary in the TLS block.
23970
23971 -mpcrel
23972 -mno-pcrel
23973 Generate (do not generate) pc-relative addressing when the option
23974 -mcpu=future is used. The -mpcrel option requires that the medium
23975 code model (-mcmodel=medium) and prefixed addressing (-mprefixed)
23976 options are enabled.
23977
23978 -mprefixed
23979 -mno-prefixed
23980 Generate (do not generate) addressing modes using prefixed load and
23981 store instructions when the option -mcpu=future is used.
23982
23983 -mmma
23984 -mno-mma
23985 Generate (do not generate) the MMA instructions when the option
23986 -mcpu=future is used.
23987
23988 -mblock-ops-unaligned-vsx
23989 -mno-block-ops-unaligned-vsx
23990 Generate (do not generate) unaligned vsx loads and stores for
23991 inline expansion of "memcpy" and "memmove".
23992
23993 RX Options
23994
23995 These command-line options are defined for RX targets:
23996
23997 -m64bit-doubles
23998 -m32bit-doubles
23999 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24000 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
24001 RX floating-point hardware only works on 32-bit values, which is
24002 why the default is -m32bit-doubles.
24003
24004 -fpu
24005 -nofpu
24006 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
24007 hardware. The default is enabled for the RX600 series and disabled
24008 for the RX200 series.
24009
24010 Floating-point instructions are only generated for 32-bit floating-
24011 point values, however, so the FPU hardware is not used for doubles
24012 if the -m64bit-doubles option is used.
24013
24014 Note If the -fpu option is enabled then -funsafe-math-optimizations
24015 is also enabled automatically. This is because the RX FPU
24016 instructions are themselves unsafe.
24017
24018 -mcpu=name
24019 Selects the type of RX CPU to be targeted. Currently three types
24020 are supported, the generic RX600 and RX200 series hardware and the
24021 specific RX610 CPU. The default is RX600.
24022
24023 The only difference between RX600 and RX610 is that the RX610 does
24024 not support the "MVTIPL" instruction.
24025
24026 The RX200 series does not have a hardware floating-point unit and
24027 so -nofpu is enabled by default when this type is selected.
24028
24029 -mbig-endian-data
24030 -mlittle-endian-data
24031 Store data (but not code) in the big-endian format. The default is
24032 -mlittle-endian-data, i.e. to store data in the little-endian
24033 format.
24034
24035 -msmall-data-limit=N
24036 Specifies the maximum size in bytes of global and static variables
24037 which can be placed into the small data area. Using the small data
24038 area can lead to smaller and faster code, but the size of area is
24039 limited and it is up to the programmer to ensure that the area does
24040 not overflow. Also when the small data area is used one of the
24041 RX's registers (usually "r13") is reserved for use pointing to this
24042 area, so it is no longer available for use by the compiler. This
24043 could result in slower and/or larger code if variables are pushed
24044 onto the stack instead of being held in this register.
24045
24046 Note, common variables (variables that have not been initialized)
24047 and constants are not placed into the small data area as they are
24048 assigned to other sections in the output executable.
24049
24050 The default value is zero, which disables this feature. Note, this
24051 feature is not enabled by default with higher optimization levels
24052 (-O2 etc) because of the potentially detrimental effects of
24053 reserving a register. It is up to the programmer to experiment and
24054 discover whether this feature is of benefit to their program. See
24055 the description of the -mpid option for a description of how the
24056 actual register to hold the small data area pointer is chosen.
24057
24058 -msim
24059 -mno-sim
24060 Use the simulator runtime. The default is to use the libgloss
24061 board-specific runtime.
24062
24063 -mas100-syntax
24064 -mno-as100-syntax
24065 When generating assembler output use a syntax that is compatible
24066 with Renesas's AS100 assembler. This syntax can also be handled by
24067 the GAS assembler, but it has some restrictions so it is not
24068 generated by default.
24069
24070 -mmax-constant-size=N
24071 Specifies the maximum size, in bytes, of a constant that can be
24072 used as an operand in a RX instruction. Although the RX
24073 instruction set does allow constants of up to 4 bytes in length to
24074 be used in instructions, a longer value equates to a longer
24075 instruction. Thus in some circumstances it can be beneficial to
24076 restrict the size of constants that are used in instructions.
24077 Constants that are too big are instead placed into a constant pool
24078 and referenced via register indirection.
24079
24080 The value N can be between 0 and 4. A value of 0 (the default) or
24081 4 means that constants of any size are allowed.
24082
24083 -mrelax
24084 Enable linker relaxation. Linker relaxation is a process whereby
24085 the linker attempts to reduce the size of a program by finding
24086 shorter versions of various instructions. Disabled by default.
24087
24088 -mint-register=N
24089 Specify the number of registers to reserve for fast interrupt
24090 handler functions. The value N can be between 0 and 4. A value of
24091 1 means that register "r13" is reserved for the exclusive use of
24092 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
24093 value of 3 reserves "r13", "r12" and "r11", and a value of 4
24094 reserves "r13" through "r10". A value of 0, the default, does not
24095 reserve any registers.
24096
24097 -msave-acc-in-interrupts
24098 Specifies that interrupt handler functions should preserve the
24099 accumulator register. This is only necessary if normal code might
24100 use the accumulator register, for example because it performs
24101 64-bit multiplications. The default is to ignore the accumulator
24102 as this makes the interrupt handlers faster.
24103
24104 -mpid
24105 -mno-pid
24106 Enables the generation of position independent data. When enabled
24107 any access to constant data is done via an offset from a base
24108 address held in a register. This allows the location of constant
24109 data to be determined at run time without requiring the executable
24110 to be relocated, which is a benefit to embedded applications with
24111 tight memory constraints. Data that can be modified is not
24112 affected by this option.
24113
24114 Note, using this feature reserves a register, usually "r13", for
24115 the constant data base address. This can result in slower and/or
24116 larger code, especially in complicated functions.
24117
24118 The actual register chosen to hold the constant data base address
24119 depends upon whether the -msmall-data-limit and/or the
24120 -mint-register command-line options are enabled. Starting with
24121 register "r13" and proceeding downwards, registers are allocated
24122 first to satisfy the requirements of -mint-register, then -mpid and
24123 finally -msmall-data-limit. Thus it is possible for the small data
24124 area register to be "r8" if both -mint-register=4 and -mpid are
24125 specified on the command line.
24126
24127 By default this feature is not enabled. The default can be
24128 restored via the -mno-pid command-line option.
24129
24130 -mno-warn-multiple-fast-interrupts
24131 -mwarn-multiple-fast-interrupts
24132 Prevents GCC from issuing a warning message if it finds more than
24133 one fast interrupt handler when it is compiling a file. The
24134 default is to issue a warning for each extra fast interrupt handler
24135 found, as the RX only supports one such interrupt.
24136
24137 -mallow-string-insns
24138 -mno-allow-string-insns
24139 Enables or disables the use of the string manipulation instructions
24140 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
24141 "RMPA" instruction. These instructions may prefetch data, which is
24142 not safe to do if accessing an I/O register. (See section 12.2.7
24143 of the RX62N Group User's Manual for more information).
24144
24145 The default is to allow these instructions, but it is not possible
24146 for GCC to reliably detect all circumstances where a string
24147 instruction might be used to access an I/O register, so their use
24148 cannot be disabled automatically. Instead it is reliant upon the
24149 programmer to use the -mno-allow-string-insns option if their
24150 program accesses I/O space.
24151
24152 When the instructions are enabled GCC defines the C preprocessor
24153 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
24154 "__RX_DISALLOW_STRING_INSNS__".
24155
24156 -mjsr
24157 -mno-jsr
24158 Use only (or not only) "JSR" instructions to access functions.
24159 This option can be used when code size exceeds the range of "BSR"
24160 instructions. Note that -mno-jsr does not mean to not use "JSR"
24161 but instead means that any type of branch may be used.
24162
24163 Note: The generic GCC command-line option -ffixed-reg has special
24164 significance to the RX port when used with the "interrupt" function
24165 attribute. This attribute indicates a function intended to process
24166 fast interrupts. GCC ensures that it only uses the registers "r10",
24167 "r11", "r12" and/or "r13" and only provided that the normal use of the
24168 corresponding registers have been restricted via the -ffixed-reg or
24169 -mint-register command-line options.
24170
24171 S/390 and zSeries Options
24172
24173 These are the -m options defined for the S/390 and zSeries
24174 architecture.
24175
24176 -mhard-float
24177 -msoft-float
24178 Use (do not use) the hardware floating-point instructions and
24179 registers for floating-point operations. When -msoft-float is
24180 specified, functions in libgcc.a are used to perform floating-point
24181 operations. When -mhard-float is specified, the compiler generates
24182 IEEE floating-point instructions. This is the default.
24183
24184 -mhard-dfp
24185 -mno-hard-dfp
24186 Use (do not use) the hardware decimal-floating-point instructions
24187 for decimal-floating-point operations. When -mno-hard-dfp is
24188 specified, functions in libgcc.a are used to perform decimal-
24189 floating-point operations. When -mhard-dfp is specified, the
24190 compiler generates decimal-floating-point hardware instructions.
24191 This is the default for -march=z9-ec or higher.
24192
24193 -mlong-double-64
24194 -mlong-double-128
24195 These switches control the size of "long double" type. A size of 64
24196 bits makes the "long double" type equivalent to the "double" type.
24197 This is the default.
24198
24199 -mbackchain
24200 -mno-backchain
24201 Store (do not store) the address of the caller's frame as backchain
24202 pointer into the callee's stack frame. A backchain may be needed
24203 to allow debugging using tools that do not understand DWARF call
24204 frame information. When -mno-packed-stack is in effect, the
24205 backchain pointer is stored at the bottom of the stack frame; when
24206 -mpacked-stack is in effect, the backchain is placed into the
24207 topmost word of the 96/160 byte register save area.
24208
24209 In general, code compiled with -mbackchain is call-compatible with
24210 code compiled with -mno-backchain; however, use of the backchain
24211 for debugging purposes usually requires that the whole binary is
24212 built with -mbackchain. Note that the combination of -mbackchain,
24213 -mpacked-stack and -mhard-float is not supported. In order to
24214 build a linux kernel use -msoft-float.
24215
24216 The default is to not maintain the backchain.
24217
24218 -mpacked-stack
24219 -mno-packed-stack
24220 Use (do not use) the packed stack layout. When -mno-packed-stack
24221 is specified, the compiler uses the all fields of the 96/160 byte
24222 register save area only for their default purpose; unused fields
24223 still take up stack space. When -mpacked-stack is specified,
24224 register save slots are densely packed at the top of the register
24225 save area; unused space is reused for other purposes, allowing for
24226 more efficient use of the available stack space. However, when
24227 -mbackchain is also in effect, the topmost word of the save area is
24228 always used to store the backchain, and the return address register
24229 is always saved two words below the backchain.
24230
24231 As long as the stack frame backchain is not used, code generated
24232 with -mpacked-stack is call-compatible with code generated with
24233 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
24234 S/390 or zSeries generated code that uses the stack frame backchain
24235 at run time, not just for debugging purposes. Such code is not
24236 call-compatible with code compiled with -mpacked-stack. Also, note
24237 that the combination of -mbackchain, -mpacked-stack and
24238 -mhard-float is not supported. In order to build a linux kernel
24239 use -msoft-float.
24240
24241 The default is to not use the packed stack layout.
24242
24243 -msmall-exec
24244 -mno-small-exec
24245 Generate (or do not generate) code using the "bras" instruction to
24246 do subroutine calls. This only works reliably if the total
24247 executable size does not exceed 64k. The default is to use the
24248 "basr" instruction instead, which does not have this limitation.
24249
24250 -m64
24251 -m31
24252 When -m31 is specified, generate code compliant to the GNU/Linux
24253 for S/390 ABI. When -m64 is specified, generate code compliant to
24254 the GNU/Linux for zSeries ABI. This allows GCC in particular to
24255 generate 64-bit instructions. For the s390 targets, the default is
24256 -m31, while the s390x targets default to -m64.
24257
24258 -mzarch
24259 -mesa
24260 When -mzarch is specified, generate code using the instructions
24261 available on z/Architecture. When -mesa is specified, generate
24262 code using the instructions available on ESA/390. Note that -mesa
24263 is not possible with -m64. When generating code compliant to the
24264 GNU/Linux for S/390 ABI, the default is -mesa. When generating
24265 code compliant to the GNU/Linux for zSeries ABI, the default is
24266 -mzarch.
24267
24268 -mhtm
24269 -mno-htm
24270 The -mhtm option enables a set of builtins making use of
24271 instructions available with the transactional execution facility
24272 introduced with the IBM zEnterprise EC12 machine generation S/390
24273 System z Built-in Functions. -mhtm is enabled by default when
24274 using -march=zEC12.
24275
24276 -mvx
24277 -mno-vx
24278 When -mvx is specified, generate code using the instructions
24279 available with the vector extension facility introduced with the
24280 IBM z13 machine generation. This option changes the ABI for some
24281 vector type values with regard to alignment and calling
24282 conventions. In case vector type values are being used in an ABI-
24283 relevant context a GAS .gnu_attribute command will be added to mark
24284 the resulting binary with the ABI used. -mvx is enabled by default
24285 when using -march=z13.
24286
24287 -mzvector
24288 -mno-zvector
24289 The -mzvector option enables vector language extensions and
24290 builtins using instructions available with the vector extension
24291 facility introduced with the IBM z13 machine generation. This
24292 option adds support for vector to be used as a keyword to define
24293 vector type variables and arguments. vector is only available when
24294 GNU extensions are enabled. It will not be expanded when
24295 requesting strict standard compliance e.g. with -std=c99. In
24296 addition to the GCC low-level builtins -mzvector enables a set of
24297 builtins added for compatibility with AltiVec-style implementations
24298 like Power and Cell. In order to make use of these builtins the
24299 header file vecintrin.h needs to be included. -mzvector is
24300 disabled by default.
24301
24302 -mmvcle
24303 -mno-mvcle
24304 Generate (or do not generate) code using the "mvcle" instruction to
24305 perform block moves. When -mno-mvcle is specified, use a "mvc"
24306 loop instead. This is the default unless optimizing for size.
24307
24308 -mdebug
24309 -mno-debug
24310 Print (or do not print) additional debug information when
24311 compiling. The default is to not print debug information.
24312
24313 -march=cpu-type
24314 Generate code that runs on cpu-type, which is the name of a system
24315 representing a certain processor type. Possible values for cpu-
24316 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
24317 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, and native.
24318
24319 The default is -march=z900.
24320
24321 Specifying native as cpu type can be used to select the best
24322 architecture option for the host processor. -march=native has no
24323 effect if GCC does not recognize the processor.
24324
24325 -mtune=cpu-type
24326 Tune to cpu-type everything applicable about the generated code,
24327 except for the ABI and the set of available instructions. The list
24328 of cpu-type values is the same as for -march. The default is the
24329 value used for -march.
24330
24331 -mtpf-trace
24332 -mno-tpf-trace
24333 Generate code that adds (does not add) in TPF OS specific branches
24334 to trace routines in the operating system. This option is off by
24335 default, even when compiling for the TPF OS.
24336
24337 -mtpf-trace-skip
24338 -mno-tpf-trace-skip
24339 Generate code that changes (does not change) the default branch
24340 targets enabled by -mtpf-trace to point to specialized trace
24341 routines providing the ability of selectively skipping function
24342 trace entries for the TPF OS. This option is off by default, even
24343 when compiling for the TPF OS and specifying -mtpf-trace.
24344
24345 -mfused-madd
24346 -mno-fused-madd
24347 Generate code that uses (does not use) the floating-point multiply
24348 and accumulate instructions. These instructions are generated by
24349 default if hardware floating point is used.
24350
24351 -mwarn-framesize=framesize
24352 Emit a warning if the current function exceeds the given frame
24353 size. Because this is a compile-time check it doesn't need to be a
24354 real problem when the program runs. It is intended to identify
24355 functions that most probably cause a stack overflow. It is useful
24356 to be used in an environment with limited stack size e.g. the linux
24357 kernel.
24358
24359 -mwarn-dynamicstack
24360 Emit a warning if the function calls "alloca" or uses dynamically-
24361 sized arrays. This is generally a bad idea with a limited stack
24362 size.
24363
24364 -mstack-guard=stack-guard
24365 -mstack-size=stack-size
24366 If these options are provided the S/390 back end emits additional
24367 instructions in the function prologue that trigger a trap if the
24368 stack size is stack-guard bytes above the stack-size (remember that
24369 the stack on S/390 grows downward). If the stack-guard option is
24370 omitted the smallest power of 2 larger than the frame size of the
24371 compiled function is chosen. These options are intended to be used
24372 to help debugging stack overflow problems. The additionally
24373 emitted code causes only little overhead and hence can also be used
24374 in production-like systems without greater performance degradation.
24375 The given values have to be exact powers of 2 and stack-size has to
24376 be greater than stack-guard without exceeding 64k. In order to be
24377 efficient the extra code makes the assumption that the stack starts
24378 at an address aligned to the value given by stack-size. The stack-
24379 guard option can only be used in conjunction with stack-size.
24380
24381 -mhotpatch=pre-halfwords,post-halfwords
24382 If the hotpatch option is enabled, a "hot-patching" function
24383 prologue is generated for all functions in the compilation unit.
24384 The funtion label is prepended with the given number of two-byte
24385 NOP instructions (pre-halfwords, maximum 1000000). After the
24386 label, 2 * post-halfwords bytes are appended, using the largest NOP
24387 like instructions the architecture allows (maximum 1000000).
24388
24389 If both arguments are zero, hotpatching is disabled.
24390
24391 This option can be overridden for individual functions with the
24392 "hotpatch" attribute.
24393
24394 Score Options
24395
24396 These options are defined for Score implementations:
24397
24398 -meb
24399 Compile code for big-endian mode. This is the default.
24400
24401 -mel
24402 Compile code for little-endian mode.
24403
24404 -mnhwloop
24405 Disable generation of "bcnz" instructions.
24406
24407 -muls
24408 Enable generation of unaligned load and store instructions.
24409
24410 -mmac
24411 Enable the use of multiply-accumulate instructions. Disabled by
24412 default.
24413
24414 -mscore5
24415 Specify the SCORE5 as the target architecture.
24416
24417 -mscore5u
24418 Specify the SCORE5U of the target architecture.
24419
24420 -mscore7
24421 Specify the SCORE7 as the target architecture. This is the default.
24422
24423 -mscore7d
24424 Specify the SCORE7D as the target architecture.
24425
24426 SH Options
24427
24428 These -m options are defined for the SH implementations:
24429
24430 -m1 Generate code for the SH1.
24431
24432 -m2 Generate code for the SH2.
24433
24434 -m2e
24435 Generate code for the SH2e.
24436
24437 -m2a-nofpu
24438 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
24439 way that the floating-point unit is not used.
24440
24441 -m2a-single-only
24442 Generate code for the SH2a-FPU, in such a way that no double-
24443 precision floating-point operations are used.
24444
24445 -m2a-single
24446 Generate code for the SH2a-FPU assuming the floating-point unit is
24447 in single-precision mode by default.
24448
24449 -m2a
24450 Generate code for the SH2a-FPU assuming the floating-point unit is
24451 in double-precision mode by default.
24452
24453 -m3 Generate code for the SH3.
24454
24455 -m3e
24456 Generate code for the SH3e.
24457
24458 -m4-nofpu
24459 Generate code for the SH4 without a floating-point unit.
24460
24461 -m4-single-only
24462 Generate code for the SH4 with a floating-point unit that only
24463 supports single-precision arithmetic.
24464
24465 -m4-single
24466 Generate code for the SH4 assuming the floating-point unit is in
24467 single-precision mode by default.
24468
24469 -m4 Generate code for the SH4.
24470
24471 -m4-100
24472 Generate code for SH4-100.
24473
24474 -m4-100-nofpu
24475 Generate code for SH4-100 in such a way that the floating-point
24476 unit is not used.
24477
24478 -m4-100-single
24479 Generate code for SH4-100 assuming the floating-point unit is in
24480 single-precision mode by default.
24481
24482 -m4-100-single-only
24483 Generate code for SH4-100 in such a way that no double-precision
24484 floating-point operations are used.
24485
24486 -m4-200
24487 Generate code for SH4-200.
24488
24489 -m4-200-nofpu
24490 Generate code for SH4-200 without in such a way that the floating-
24491 point unit is not used.
24492
24493 -m4-200-single
24494 Generate code for SH4-200 assuming the floating-point unit is in
24495 single-precision mode by default.
24496
24497 -m4-200-single-only
24498 Generate code for SH4-200 in such a way that no double-precision
24499 floating-point operations are used.
24500
24501 -m4-300
24502 Generate code for SH4-300.
24503
24504 -m4-300-nofpu
24505 Generate code for SH4-300 without in such a way that the floating-
24506 point unit is not used.
24507
24508 -m4-300-single
24509 Generate code for SH4-300 in such a way that no double-precision
24510 floating-point operations are used.
24511
24512 -m4-300-single-only
24513 Generate code for SH4-300 in such a way that no double-precision
24514 floating-point operations are used.
24515
24516 -m4-340
24517 Generate code for SH4-340 (no MMU, no FPU).
24518
24519 -m4-500
24520 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
24521 assembler.
24522
24523 -m4a-nofpu
24524 Generate code for the SH4al-dsp, or for a SH4a in such a way that
24525 the floating-point unit is not used.
24526
24527 -m4a-single-only
24528 Generate code for the SH4a, in such a way that no double-precision
24529 floating-point operations are used.
24530
24531 -m4a-single
24532 Generate code for the SH4a assuming the floating-point unit is in
24533 single-precision mode by default.
24534
24535 -m4a
24536 Generate code for the SH4a.
24537
24538 -m4al
24539 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
24540 assembler. GCC doesn't generate any DSP instructions at the
24541 moment.
24542
24543 -mb Compile code for the processor in big-endian mode.
24544
24545 -ml Compile code for the processor in little-endian mode.
24546
24547 -mdalign
24548 Align doubles at 64-bit boundaries. Note that this changes the
24549 calling conventions, and thus some functions from the standard C
24550 library do not work unless you recompile it first with -mdalign.
24551
24552 -mrelax
24553 Shorten some address references at link time, when possible; uses
24554 the linker option -relax.
24555
24556 -mbigtable
24557 Use 32-bit offsets in "switch" tables. The default is to use
24558 16-bit offsets.
24559
24560 -mbitops
24561 Enable the use of bit manipulation instructions on SH2A.
24562
24563 -mfmovd
24564 Enable the use of the instruction "fmovd". Check -mdalign for
24565 alignment constraints.
24566
24567 -mrenesas
24568 Comply with the calling conventions defined by Renesas.
24569
24570 -mno-renesas
24571 Comply with the calling conventions defined for GCC before the
24572 Renesas conventions were available. This option is the default for
24573 all targets of the SH toolchain.
24574
24575 -mnomacsave
24576 Mark the "MAC" register as call-clobbered, even if -mrenesas is
24577 given.
24578
24579 -mieee
24580 -mno-ieee
24581 Control the IEEE compliance of floating-point comparisons, which
24582 affects the handling of cases where the result of a comparison is
24583 unordered. By default -mieee is implicitly enabled. If
24584 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
24585 results in faster floating-point greater-equal and less-equal
24586 comparisons. The implicit settings can be overridden by specifying
24587 either -mieee or -mno-ieee.
24588
24589 -minline-ic_invalidate
24590 Inline code to invalidate instruction cache entries after setting
24591 up nested function trampolines. This option has no effect if
24592 -musermode is in effect and the selected code generation option
24593 (e.g. -m4) does not allow the use of the "icbi" instruction. If
24594 the selected code generation option does not allow the use of the
24595 "icbi" instruction, and -musermode is not in effect, the inlined
24596 code manipulates the instruction cache address array directly with
24597 an associative write. This not only requires privileged mode at
24598 run time, but it also fails if the cache line had been mapped via
24599 the TLB and has become unmapped.
24600
24601 -misize
24602 Dump instruction size and location in the assembly code.
24603
24604 -mpadstruct
24605 This option is deprecated. It pads structures to multiple of 4
24606 bytes, which is incompatible with the SH ABI.
24607
24608 -matomic-model=model
24609 Sets the model of atomic operations and additional parameters as a
24610 comma separated list. For details on the atomic built-in functions
24611 see __atomic Builtins. The following models and parameters are
24612 supported:
24613
24614 none
24615 Disable compiler generated atomic sequences and emit library
24616 calls for atomic operations. This is the default if the target
24617 is not "sh*-*-linux*".
24618
24619 soft-gusa
24620 Generate GNU/Linux compatible gUSA software atomic sequences
24621 for the atomic built-in functions. The generated atomic
24622 sequences require additional support from the
24623 interrupt/exception handling code of the system and are only
24624 suitable for SH3* and SH4* single-core systems. This option is
24625 enabled by default when the target is "sh*-*-linux*" and SH3*
24626 or SH4*. When the target is SH4A, this option also partially
24627 utilizes the hardware atomic instructions "movli.l" and
24628 "movco.l" to create more efficient code, unless strict is
24629 specified.
24630
24631 soft-tcb
24632 Generate software atomic sequences that use a variable in the
24633 thread control block. This is a variation of the gUSA
24634 sequences which can also be used on SH1* and SH2* targets. The
24635 generated atomic sequences require additional support from the
24636 interrupt/exception handling code of the system and are only
24637 suitable for single-core systems. When using this model, the
24638 gbr-offset= parameter has to be specified as well.
24639
24640 soft-imask
24641 Generate software atomic sequences that temporarily disable
24642 interrupts by setting "SR.IMASK = 1111". This model works only
24643 when the program runs in privileged mode and is only suitable
24644 for single-core systems. Additional support from the
24645 interrupt/exception handling code of the system is not
24646 required. This model is enabled by default when the target is
24647 "sh*-*-linux*" and SH1* or SH2*.
24648
24649 hard-llcs
24650 Generate hardware atomic sequences using the "movli.l" and
24651 "movco.l" instructions only. This is only available on SH4A
24652 and is suitable for multi-core systems. Since the hardware
24653 instructions support only 32 bit atomic variables access to 8
24654 or 16 bit variables is emulated with 32 bit accesses. Code
24655 compiled with this option is also compatible with other
24656 software atomic model interrupt/exception handling systems if
24657 executed on an SH4A system. Additional support from the
24658 interrupt/exception handling code of the system is not required
24659 for this model.
24660
24661 gbr-offset=
24662 This parameter specifies the offset in bytes of the variable in
24663 the thread control block structure that should be used by the
24664 generated atomic sequences when the soft-tcb model has been
24665 selected. For other models this parameter is ignored. The
24666 specified value must be an integer multiple of four and in the
24667 range 0-1020.
24668
24669 strict
24670 This parameter prevents mixed usage of multiple atomic models,
24671 even if they are compatible, and makes the compiler generate
24672 atomic sequences of the specified model only.
24673
24674 -mtas
24675 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
24676 that depending on the particular hardware and software
24677 configuration this can degrade overall performance due to the
24678 operand cache line flushes that are implied by the "tas.b"
24679 instruction. On multi-core SH4A processors the "tas.b" instruction
24680 must be used with caution since it can result in data corruption
24681 for certain cache configurations.
24682
24683 -mprefergot
24684 When generating position-independent code, emit function calls
24685 using the Global Offset Table instead of the Procedure Linkage
24686 Table.
24687
24688 -musermode
24689 -mno-usermode
24690 Don't allow (allow) the compiler generating privileged mode code.
24691 Specifying -musermode also implies -mno-inline-ic_invalidate if the
24692 inlined code would not work in user mode. -musermode is the
24693 default when the target is "sh*-*-linux*". If the target is SH1*
24694 or SH2* -musermode has no effect, since there is no user mode.
24695
24696 -multcost=number
24697 Set the cost to assume for a multiply insn.
24698
24699 -mdiv=strategy
24700 Set the division strategy to be used for integer division
24701 operations. strategy can be one of:
24702
24703 call-div1
24704 Calls a library function that uses the single-step division
24705 instruction "div1" to perform the operation. Division by zero
24706 calculates an unspecified result and does not trap. This is
24707 the default except for SH4, SH2A and SHcompact.
24708
24709 call-fp
24710 Calls a library function that performs the operation in double
24711 precision floating point. Division by zero causes a floating-
24712 point exception. This is the default for SHcompact with FPU.
24713 Specifying this for targets that do not have a double precision
24714 FPU defaults to "call-div1".
24715
24716 call-table
24717 Calls a library function that uses a lookup table for small
24718 divisors and the "div1" instruction with case distinction for
24719 larger divisors. Division by zero calculates an unspecified
24720 result and does not trap. This is the default for SH4.
24721 Specifying this for targets that do not have dynamic shift
24722 instructions defaults to "call-div1".
24723
24724 When a division strategy has not been specified the default
24725 strategy is selected based on the current target. For SH2A the
24726 default strategy is to use the "divs" and "divu" instructions
24727 instead of library function calls.
24728
24729 -maccumulate-outgoing-args
24730 Reserve space once for outgoing arguments in the function prologue
24731 rather than around each call. Generally beneficial for performance
24732 and size. Also needed for unwinding to avoid changing the stack
24733 frame around conditional code.
24734
24735 -mdivsi3_libfunc=name
24736 Set the name of the library function used for 32-bit signed
24737 division to name. This only affects the name used in the call
24738 division strategies, and the compiler still expects the same sets
24739 of input/output/clobbered registers as if this option were not
24740 present.
24741
24742 -mfixed-range=register-range
24743 Generate code treating the given register range as fixed registers.
24744 A fixed register is one that the register allocator cannot use.
24745 This is useful when compiling kernel code. A register range is
24746 specified as two registers separated by a dash. Multiple register
24747 ranges can be specified separated by a comma.
24748
24749 -mbranch-cost=num
24750 Assume num to be the cost for a branch instruction. Higher numbers
24751 make the compiler try to generate more branch-free code if
24752 possible. If not specified the value is selected depending on the
24753 processor type that is being compiled for.
24754
24755 -mzdcbranch
24756 -mno-zdcbranch
24757 Assume (do not assume) that zero displacement conditional branch
24758 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
24759 the compiler prefers zero displacement branch code sequences. This
24760 is enabled by default when generating code for SH4 and SH4A. It
24761 can be explicitly disabled by specifying -mno-zdcbranch.
24762
24763 -mcbranch-force-delay-slot
24764 Force the usage of delay slots for conditional branches, which
24765 stuffs the delay slot with a "nop" if a suitable instruction cannot
24766 be found. By default this option is disabled. It can be enabled
24767 to work around hardware bugs as found in the original SH7055.
24768
24769 -mfused-madd
24770 -mno-fused-madd
24771 Generate code that uses (does not use) the floating-point multiply
24772 and accumulate instructions. These instructions are generated by
24773 default if hardware floating point is used. The machine-dependent
24774 -mfused-madd option is now mapped to the machine-independent
24775 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24776 -ffp-contract=off.
24777
24778 -mfsca
24779 -mno-fsca
24780 Allow or disallow the compiler to emit the "fsca" instruction for
24781 sine and cosine approximations. The option -mfsca must be used in
24782 combination with -funsafe-math-optimizations. It is enabled by
24783 default when generating code for SH4A. Using -mno-fsca disables
24784 sine and cosine approximations even if -funsafe-math-optimizations
24785 is in effect.
24786
24787 -mfsrra
24788 -mno-fsrra
24789 Allow or disallow the compiler to emit the "fsrra" instruction for
24790 reciprocal square root approximations. The option -mfsrra must be
24791 used in combination with -funsafe-math-optimizations and
24792 -ffinite-math-only. It is enabled by default when generating code
24793 for SH4A. Using -mno-fsrra disables reciprocal square root
24794 approximations even if -funsafe-math-optimizations and
24795 -ffinite-math-only are in effect.
24796
24797 -mpretend-cmove
24798 Prefer zero-displacement conditional branches for conditional move
24799 instruction patterns. This can result in faster code on the SH4
24800 processor.
24801
24802 -mfdpic
24803 Generate code using the FDPIC ABI.
24804
24805 Solaris 2 Options
24806
24807 These -m options are supported on Solaris 2:
24808
24809 -mclear-hwcap
24810 -mclear-hwcap tells the compiler to remove the hardware
24811 capabilities generated by the Solaris assembler. This is only
24812 necessary when object files use ISA extensions not supported by the
24813 current machine, but check at runtime whether or not to use them.
24814
24815 -mimpure-text
24816 -mimpure-text, used in addition to -shared, tells the compiler to
24817 not pass -z text to the linker when linking a shared object. Using
24818 this option, you can link position-dependent code into a shared
24819 object.
24820
24821 -mimpure-text suppresses the "relocations remain against
24822 allocatable but non-writable sections" linker error message.
24823 However, the necessary relocations trigger copy-on-write, and the
24824 shared object is not actually shared across processes. Instead of
24825 using -mimpure-text, you should compile all source code with -fpic
24826 or -fPIC.
24827
24828 These switches are supported in addition to the above on Solaris 2:
24829
24830 -pthreads
24831 This is a synonym for -pthread.
24832
24833 SPARC Options
24834
24835 These -m options are supported on the SPARC:
24836
24837 -mno-app-regs
24838 -mapp-regs
24839 Specify -mapp-regs to generate output using the global registers 2
24840 through 4, which the SPARC SVR4 ABI reserves for applications.
24841 Like the global register 1, each global register 2 through 4 is
24842 then treated as an allocable register that is clobbered by function
24843 calls. This is the default.
24844
24845 To be fully SVR4 ABI-compliant at the cost of some performance
24846 loss, specify -mno-app-regs. You should compile libraries and
24847 system software with this option.
24848
24849 -mflat
24850 -mno-flat
24851 With -mflat, the compiler does not generate save/restore
24852 instructions and uses a "flat" or single register window model.
24853 This model is compatible with the regular register window model.
24854 The local registers and the input registers (0--5) are still
24855 treated as "call-saved" registers and are saved on the stack as
24856 needed.
24857
24858 With -mno-flat (the default), the compiler generates save/restore
24859 instructions (except for leaf functions). This is the normal
24860 operating mode.
24861
24862 -mfpu
24863 -mhard-float
24864 Generate output containing floating-point instructions. This is
24865 the default.
24866
24867 -mno-fpu
24868 -msoft-float
24869 Generate output containing library calls for floating point.
24870 Warning: the requisite libraries are not available for all SPARC
24871 targets. Normally the facilities of the machine's usual C compiler
24872 are used, but this cannot be done directly in cross-compilation.
24873 You must make your own arrangements to provide suitable library
24874 functions for cross-compilation. The embedded targets sparc-*-aout
24875 and sparclite-*-* do provide software floating-point support.
24876
24877 -msoft-float changes the calling convention in the output file;
24878 therefore, it is only useful if you compile all of a program with
24879 this option. In particular, you need to compile libgcc.a, the
24880 library that comes with GCC, with -msoft-float in order for this to
24881 work.
24882
24883 -mhard-quad-float
24884 Generate output containing quad-word (long double) floating-point
24885 instructions.
24886
24887 -msoft-quad-float
24888 Generate output containing library calls for quad-word (long
24889 double) floating-point instructions. The functions called are
24890 those specified in the SPARC ABI. This is the default.
24891
24892 As of this writing, there are no SPARC implementations that have
24893 hardware support for the quad-word floating-point instructions.
24894 They all invoke a trap handler for one of these instructions, and
24895 then the trap handler emulates the effect of the instruction.
24896 Because of the trap handler overhead, this is much slower than
24897 calling the ABI library routines. Thus the -msoft-quad-float
24898 option is the default.
24899
24900 -mno-unaligned-doubles
24901 -munaligned-doubles
24902 Assume that doubles have 8-byte alignment. This is the default.
24903
24904 With -munaligned-doubles, GCC assumes that doubles have 8-byte
24905 alignment only if they are contained in another type, or if they
24906 have an absolute address. Otherwise, it assumes they have 4-byte
24907 alignment. Specifying this option avoids some rare compatibility
24908 problems with code generated by other compilers. It is not the
24909 default because it results in a performance loss, especially for
24910 floating-point code.
24911
24912 -muser-mode
24913 -mno-user-mode
24914 Do not generate code that can only run in supervisor mode. This is
24915 relevant only for the "casa" instruction emitted for the LEON3
24916 processor. This is the default.
24917
24918 -mfaster-structs
24919 -mno-faster-structs
24920 With -mfaster-structs, the compiler assumes that structures should
24921 have 8-byte alignment. This enables the use of pairs of "ldd" and
24922 "std" instructions for copies in structure assignment, in place of
24923 twice as many "ld" and "st" pairs. However, the use of this
24924 changed alignment directly violates the SPARC ABI. Thus, it's
24925 intended only for use on targets where the developer acknowledges
24926 that their resulting code is not directly in line with the rules of
24927 the ABI.
24928
24929 -mstd-struct-return
24930 -mno-std-struct-return
24931 With -mstd-struct-return, the compiler generates checking code in
24932 functions returning structures or unions to detect size mismatches
24933 between the two sides of function calls, as per the 32-bit ABI.
24934
24935 The default is -mno-std-struct-return. This option has no effect
24936 in 64-bit mode.
24937
24938 -mlra
24939 -mno-lra
24940 Enable Local Register Allocation. This is the default for SPARC
24941 since GCC 7 so -mno-lra needs to be passed to get old Reload.
24942
24943 -mcpu=cpu_type
24944 Set the instruction set, register set, and instruction scheduling
24945 parameters for machine type cpu_type. Supported values for
24946 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
24947 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
24948 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24949 niagara7 and m8.
24950
24951 Native Solaris and GNU/Linux toolchains also support the value
24952 native, which selects the best architecture option for the host
24953 processor. -mcpu=native has no effect if GCC does not recognize
24954 the processor.
24955
24956 Default instruction scheduling parameters are used for values that
24957 select an architecture and not an implementation. These are v7,
24958 v8, sparclite, sparclet, v9.
24959
24960 Here is a list of each supported architecture and their supported
24961 implementations.
24962
24963 v7 cypress, leon3v7
24964
24965 v8 supersparc, hypersparc, leon, leon3
24966
24967 sparclite
24968 f930, f934, sparclite86x
24969
24970 sparclet
24971 tsc701
24972
24973 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
24974 niagara7, m8
24975
24976 By default (unless configured otherwise), GCC generates code for
24977 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
24978 compiler additionally optimizes it for the Cypress CY7C602 chip, as
24979 used in the SPARCStation/SPARCServer 3xx series. This is also
24980 appropriate for the older SPARCStation 1, 2, IPX etc.
24981
24982 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
24983 architecture. The only difference from V7 code is that the
24984 compiler emits the integer multiply and integer divide instructions
24985 which exist in SPARC-V8 but not in SPARC-V7. With
24986 -mcpu=supersparc, the compiler additionally optimizes it for the
24987 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
24988 series.
24989
24990 With -mcpu=sparclite, GCC generates code for the SPARClite variant
24991 of the SPARC architecture. This adds the integer multiply, integer
24992 divide step and scan ("ffs") instructions which exist in SPARClite
24993 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
24994 optimizes it for the Fujitsu MB86930 chip, which is the original
24995 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
24996 optimizes it for the Fujitsu MB86934 chip, which is the more recent
24997 SPARClite with FPU.
24998
24999 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
25000 the SPARC architecture. This adds the integer multiply,
25001 multiply/accumulate, integer divide step and scan ("ffs")
25002 instructions which exist in SPARClet but not in SPARC-V7. With
25003 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
25004 SPARClet chip.
25005
25006 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
25007 architecture. This adds 64-bit integer and floating-point move
25008 instructions, 3 additional floating-point condition code registers
25009 and conditional move instructions. With -mcpu=ultrasparc, the
25010 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
25011 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
25012 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25013 -mcpu=niagara, the compiler additionally optimizes it for Sun
25014 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
25015 additionally optimizes it for Sun UltraSPARC T2 chips. With
25016 -mcpu=niagara3, the compiler additionally optimizes it for Sun
25017 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
25018 additionally optimizes it for Sun UltraSPARC T4 chips. With
25019 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
25020 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
25021 it for Oracle M8 chips.
25022
25023 -mtune=cpu_type
25024 Set the instruction scheduling parameters for machine type
25025 cpu_type, but do not set the instruction set or register set that
25026 the option -mcpu=cpu_type does.
25027
25028 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
25029 but the only useful values are those that select a particular CPU
25030 implementation. Those are cypress, supersparc, hypersparc, leon,
25031 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
25032 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
25033 m8. With native Solaris and GNU/Linux toolchains, native can also
25034 be used.
25035
25036 -mv8plus
25037 -mno-v8plus
25038 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
25039 difference from the V8 ABI is that the global and out registers are
25040 considered 64 bits wide. This is enabled by default on Solaris in
25041 32-bit mode for all SPARC-V9 processors.
25042
25043 -mvis
25044 -mno-vis
25045 With -mvis, GCC generates code that takes advantage of the
25046 UltraSPARC Visual Instruction Set extensions. The default is
25047 -mno-vis.
25048
25049 -mvis2
25050 -mno-vis2
25051 With -mvis2, GCC generates code that takes advantage of version 2.0
25052 of the UltraSPARC Visual Instruction Set extensions. The default
25053 is -mvis2 when targeting a cpu that supports such instructions,
25054 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
25055
25056 -mvis3
25057 -mno-vis3
25058 With -mvis3, GCC generates code that takes advantage of version 3.0
25059 of the UltraSPARC Visual Instruction Set extensions. The default
25060 is -mvis3 when targeting a cpu that supports such instructions,
25061 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
25062 -mvis.
25063
25064 -mvis4
25065 -mno-vis4
25066 With -mvis4, GCC generates code that takes advantage of version 4.0
25067 of the UltraSPARC Visual Instruction Set extensions. The default
25068 is -mvis4 when targeting a cpu that supports such instructions,
25069 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
25070 -mvis2 and -mvis.
25071
25072 -mvis4b
25073 -mno-vis4b
25074 With -mvis4b, GCC generates code that takes advantage of version
25075 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
25076 additional VIS instructions introduced in the Oracle SPARC
25077 Architecture 2017. The default is -mvis4b when targeting a cpu
25078 that supports such instructions, such as m8 and later. Setting
25079 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
25080
25081 -mcbcond
25082 -mno-cbcond
25083 With -mcbcond, GCC generates code that takes advantage of the
25084 UltraSPARC Compare-and-Branch-on-Condition instructions. The
25085 default is -mcbcond when targeting a CPU that supports such
25086 instructions, such as Niagara-4 and later.
25087
25088 -mfmaf
25089 -mno-fmaf
25090 With -mfmaf, GCC generates code that takes advantage of the
25091 UltraSPARC Fused Multiply-Add Floating-point instructions. The
25092 default is -mfmaf when targeting a CPU that supports such
25093 instructions, such as Niagara-3 and later.
25094
25095 -mfsmuld
25096 -mno-fsmuld
25097 With -mfsmuld, GCC generates code that takes advantage of the
25098 Floating-point Multiply Single to Double (FsMULd) instruction. The
25099 default is -mfsmuld when targeting a CPU supporting the
25100 architecture versions V8 or V9 with FPU except -mcpu=leon.
25101
25102 -mpopc
25103 -mno-popc
25104 With -mpopc, GCC generates code that takes advantage of the
25105 UltraSPARC Population Count instruction. The default is -mpopc
25106 when targeting a CPU that supports such an instruction, such as
25107 Niagara-2 and later.
25108
25109 -msubxc
25110 -mno-subxc
25111 With -msubxc, GCC generates code that takes advantage of the
25112 UltraSPARC Subtract-Extended-with-Carry instruction. The default
25113 is -msubxc when targeting a CPU that supports such an instruction,
25114 such as Niagara-7 and later.
25115
25116 -mfix-at697f
25117 Enable the documented workaround for the single erratum of the
25118 Atmel AT697F processor (which corresponds to erratum #13 of the
25119 AT697E processor).
25120
25121 -mfix-ut699
25122 Enable the documented workarounds for the floating-point errata and
25123 the data cache nullify errata of the UT699 processor.
25124
25125 -mfix-ut700
25126 Enable the documented workaround for the back-to-back store errata
25127 of the UT699E/UT700 processor.
25128
25129 -mfix-gr712rc
25130 Enable the documented workaround for the back-to-back store errata
25131 of the GR712RC processor.
25132
25133 These -m options are supported in addition to the above on SPARC-V9
25134 processors in 64-bit environments:
25135
25136 -m32
25137 -m64
25138 Generate code for a 32-bit or 64-bit environment. The 32-bit
25139 environment sets int, long and pointer to 32 bits. The 64-bit
25140 environment sets int to 32 bits and long and pointer to 64 bits.
25141
25142 -mcmodel=which
25143 Set the code model to one of
25144
25145 medlow
25146 The Medium/Low code model: 64-bit addresses, programs must be
25147 linked in the low 32 bits of memory. Programs can be
25148 statically or dynamically linked.
25149
25150 medmid
25151 The Medium/Middle code model: 64-bit addresses, programs must
25152 be linked in the low 44 bits of memory, the text and data
25153 segments must be less than 2GB in size and the data segment
25154 must be located within 2GB of the text segment.
25155
25156 medany
25157 The Medium/Anywhere code model: 64-bit addresses, programs may
25158 be linked anywhere in memory, the text and data segments must
25159 be less than 2GB in size and the data segment must be located
25160 within 2GB of the text segment.
25161
25162 embmedany
25163 The Medium/Anywhere code model for embedded systems: 64-bit
25164 addresses, the text and data segments must be less than 2GB in
25165 size, both starting anywhere in memory (determined at link
25166 time). The global register %g4 points to the base of the data
25167 segment. Programs are statically linked and PIC is not
25168 supported.
25169
25170 -mmemory-model=mem-model
25171 Set the memory model in force on the processor to one of
25172
25173 default
25174 The default memory model for the processor and operating
25175 system.
25176
25177 rmo Relaxed Memory Order
25178
25179 pso Partial Store Order
25180
25181 tso Total Store Order
25182
25183 sc Sequential Consistency
25184
25185 These memory models are formally defined in Appendix D of the
25186 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
25187 field.
25188
25189 -mstack-bias
25190 -mno-stack-bias
25191 With -mstack-bias, GCC assumes that the stack pointer, and frame
25192 pointer if present, are offset by -2047 which must be added back
25193 when making stack frame references. This is the default in 64-bit
25194 mode. Otherwise, assume no such offset is present.
25195
25196 Options for System V
25197
25198 These additional options are available on System V Release 4 for
25199 compatibility with other compilers on those systems:
25200
25201 -G Create a shared object. It is recommended that -symbolic or
25202 -shared be used instead.
25203
25204 -Qy Identify the versions of each tool used by the compiler, in a
25205 ".ident" assembler directive in the output.
25206
25207 -Qn Refrain from adding ".ident" directives to the output file (this is
25208 the default).
25209
25210 -YP,dirs
25211 Search the directories dirs, and no others, for libraries specified
25212 with -l.
25213
25214 -Ym,dir
25215 Look in the directory dir to find the M4 preprocessor. The
25216 assembler uses this option.
25217
25218 TILE-Gx Options
25219
25220 These -m options are supported on the TILE-Gx:
25221
25222 -mcmodel=small
25223 Generate code for the small model. The distance for direct calls
25224 is limited to 500M in either direction. PC-relative addresses are
25225 32 bits. Absolute addresses support the full address range.
25226
25227 -mcmodel=large
25228 Generate code for the large model. There is no limitation on call
25229 distance, pc-relative addresses, or absolute addresses.
25230
25231 -mcpu=name
25232 Selects the type of CPU to be targeted. Currently the only
25233 supported type is tilegx.
25234
25235 -m32
25236 -m64
25237 Generate code for a 32-bit or 64-bit environment. The 32-bit
25238 environment sets int, long, and pointer to 32 bits. The 64-bit
25239 environment sets int to 32 bits and long and pointer to 64 bits.
25240
25241 -mbig-endian
25242 -mlittle-endian
25243 Generate code in big/little endian mode, respectively.
25244
25245 TILEPro Options
25246
25247 These -m options are supported on the TILEPro:
25248
25249 -mcpu=name
25250 Selects the type of CPU to be targeted. Currently the only
25251 supported type is tilepro.
25252
25253 -m32
25254 Generate code for a 32-bit environment, which sets int, long, and
25255 pointer to 32 bits. This is the only supported behavior so the
25256 flag is essentially ignored.
25257
25258 V850 Options
25259
25260 These -m options are defined for V850 implementations:
25261
25262 -mlong-calls
25263 -mno-long-calls
25264 Treat all calls as being far away (near). If calls are assumed to
25265 be far away, the compiler always loads the function's address into
25266 a register, and calls indirect through the pointer.
25267
25268 -mno-ep
25269 -mep
25270 Do not optimize (do optimize) basic blocks that use the same index
25271 pointer 4 or more times to copy pointer into the "ep" register, and
25272 use the shorter "sld" and "sst" instructions. The -mep option is
25273 on by default if you optimize.
25274
25275 -mno-prolog-function
25276 -mprolog-function
25277 Do not use (do use) external functions to save and restore
25278 registers at the prologue and epilogue of a function. The external
25279 functions are slower, but use less code space if more than one
25280 function saves the same number of registers. The -mprolog-function
25281 option is on by default if you optimize.
25282
25283 -mspace
25284 Try to make the code as small as possible. At present, this just
25285 turns on the -mep and -mprolog-function options.
25286
25287 -mtda=n
25288 Put static or global variables whose size is n bytes or less into
25289 the tiny data area that register "ep" points to. The tiny data
25290 area can hold up to 256 bytes in total (128 bytes for byte
25291 references).
25292
25293 -msda=n
25294 Put static or global variables whose size is n bytes or less into
25295 the small data area that register "gp" points to. The small data
25296 area can hold up to 64 kilobytes.
25297
25298 -mzda=n
25299 Put static or global variables whose size is n bytes or less into
25300 the first 32 kilobytes of memory.
25301
25302 -mv850
25303 Specify that the target processor is the V850.
25304
25305 -mv850e3v5
25306 Specify that the target processor is the V850E3V5. The
25307 preprocessor constant "__v850e3v5__" is defined if this option is
25308 used.
25309
25310 -mv850e2v4
25311 Specify that the target processor is the V850E3V5. This is an
25312 alias for the -mv850e3v5 option.
25313
25314 -mv850e2v3
25315 Specify that the target processor is the V850E2V3. The
25316 preprocessor constant "__v850e2v3__" is defined if this option is
25317 used.
25318
25319 -mv850e2
25320 Specify that the target processor is the V850E2. The preprocessor
25321 constant "__v850e2__" is defined if this option is used.
25322
25323 -mv850e1
25324 Specify that the target processor is the V850E1. The preprocessor
25325 constants "__v850e1__" and "__v850e__" are defined if this option
25326 is used.
25327
25328 -mv850es
25329 Specify that the target processor is the V850ES. This is an alias
25330 for the -mv850e1 option.
25331
25332 -mv850e
25333 Specify that the target processor is the V850E. The preprocessor
25334 constant "__v850e__" is defined if this option is used.
25335
25336 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
25337 -mv850e2v3 nor -mv850e3v5 are defined then a default target
25338 processor is chosen and the relevant __v850*__ preprocessor
25339 constant is defined.
25340
25341 The preprocessor constants "__v850" and "__v851__" are always
25342 defined, regardless of which processor variant is the target.
25343
25344 -mdisable-callt
25345 -mno-disable-callt
25346 This option suppresses generation of the "CALLT" instruction for
25347 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
25348 v850 architecture.
25349
25350 This option is enabled by default when the RH850 ABI is in use (see
25351 -mrh850-abi), and disabled by default when the GCC ABI is in use.
25352 If "CALLT" instructions are being generated then the C preprocessor
25353 symbol "__V850_CALLT__" is defined.
25354
25355 -mrelax
25356 -mno-relax
25357 Pass on (or do not pass on) the -mrelax command-line option to the
25358 assembler.
25359
25360 -mlong-jumps
25361 -mno-long-jumps
25362 Disable (or re-enable) the generation of PC-relative jump
25363 instructions.
25364
25365 -msoft-float
25366 -mhard-float
25367 Disable (or re-enable) the generation of hardware floating point
25368 instructions. This option is only significant when the target
25369 architecture is V850E2V3 or higher. If hardware floating point
25370 instructions are being generated then the C preprocessor symbol
25371 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
25372 defined.
25373
25374 -mloop
25375 Enables the use of the e3v5 LOOP instruction. The use of this
25376 instruction is not enabled by default when the e3v5 architecture is
25377 selected because its use is still experimental.
25378
25379 -mrh850-abi
25380 -mghs
25381 Enables support for the RH850 version of the V850 ABI. This is the
25382 default. With this version of the ABI the following rules apply:
25383
25384 * Integer sized structures and unions are returned via a memory
25385 pointer rather than a register.
25386
25387 * Large structures and unions (more than 8 bytes in size) are
25388 passed by value.
25389
25390 * Functions are aligned to 16-bit boundaries.
25391
25392 * The -m8byte-align command-line option is supported.
25393
25394 * The -mdisable-callt command-line option is enabled by default.
25395 The -mno-disable-callt command-line option is not supported.
25396
25397 When this version of the ABI is enabled the C preprocessor symbol
25398 "__V850_RH850_ABI__" is defined.
25399
25400 -mgcc-abi
25401 Enables support for the old GCC version of the V850 ABI. With this
25402 version of the ABI the following rules apply:
25403
25404 * Integer sized structures and unions are returned in register
25405 "r10".
25406
25407 * Large structures and unions (more than 8 bytes in size) are
25408 passed by reference.
25409
25410 * Functions are aligned to 32-bit boundaries, unless optimizing
25411 for size.
25412
25413 * The -m8byte-align command-line option is not supported.
25414
25415 * The -mdisable-callt command-line option is supported but not
25416 enabled by default.
25417
25418 When this version of the ABI is enabled the C preprocessor symbol
25419 "__V850_GCC_ABI__" is defined.
25420
25421 -m8byte-align
25422 -mno-8byte-align
25423 Enables support for "double" and "long long" types to be aligned on
25424 8-byte boundaries. The default is to restrict the alignment of all
25425 objects to at most 4-bytes. When -m8byte-align is in effect the C
25426 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
25427
25428 -mbig-switch
25429 Generate code suitable for big switch tables. Use this option only
25430 if the assembler/linker complain about out of range branches within
25431 a switch table.
25432
25433 -mapp-regs
25434 This option causes r2 and r5 to be used in the code generated by
25435 the compiler. This setting is the default.
25436
25437 -mno-app-regs
25438 This option causes r2 and r5 to be treated as fixed registers.
25439
25440 VAX Options
25441
25442 These -m options are defined for the VAX:
25443
25444 -munix
25445 Do not output certain jump instructions ("aobleq" and so on) that
25446 the Unix assembler for the VAX cannot handle across long ranges.
25447
25448 -mgnu
25449 Do output those jump instructions, on the assumption that the GNU
25450 assembler is being used.
25451
25452 -mg Output code for G-format floating-point numbers instead of
25453 D-format.
25454
25455 Visium Options
25456
25457 -mdebug
25458 A program which performs file I/O and is destined to run on an MCM
25459 target should be linked with this option. It causes the libraries
25460 libc.a and libdebug.a to be linked. The program should be run on
25461 the target under the control of the GDB remote debugging stub.
25462
25463 -msim
25464 A program which performs file I/O and is destined to run on the
25465 simulator should be linked with option. This causes libraries
25466 libc.a and libsim.a to be linked.
25467
25468 -mfpu
25469 -mhard-float
25470 Generate code containing floating-point instructions. This is the
25471 default.
25472
25473 -mno-fpu
25474 -msoft-float
25475 Generate code containing library calls for floating-point.
25476
25477 -msoft-float changes the calling convention in the output file;
25478 therefore, it is only useful if you compile all of a program with
25479 this option. In particular, you need to compile libgcc.a, the
25480 library that comes with GCC, with -msoft-float in order for this to
25481 work.
25482
25483 -mcpu=cpu_type
25484 Set the instruction set, register set, and instruction scheduling
25485 parameters for machine type cpu_type. Supported values for
25486 cpu_type are mcm, gr5 and gr6.
25487
25488 mcm is a synonym of gr5 present for backward compatibility.
25489
25490 By default (unless configured otherwise), GCC generates code for
25491 the GR5 variant of the Visium architecture.
25492
25493 With -mcpu=gr6, GCC generates code for the GR6 variant of the
25494 Visium architecture. The only difference from GR5 code is that the
25495 compiler will generate block move instructions.
25496
25497 -mtune=cpu_type
25498 Set the instruction scheduling parameters for machine type
25499 cpu_type, but do not set the instruction set or register set that
25500 the option -mcpu=cpu_type would.
25501
25502 -msv-mode
25503 Generate code for the supervisor mode, where there are no
25504 restrictions on the access to general registers. This is the
25505 default.
25506
25507 -muser-mode
25508 Generate code for the user mode, where the access to some general
25509 registers is forbidden: on the GR5, registers r24 to r31 cannot be
25510 accessed in this mode; on the GR6, only registers r29 to r31 are
25511 affected.
25512
25513 VMS Options
25514
25515 These -m options are defined for the VMS implementations:
25516
25517 -mvms-return-codes
25518 Return VMS condition codes from "main". The default is to return
25519 POSIX-style condition (e.g. error) codes.
25520
25521 -mdebug-main=prefix
25522 Flag the first routine whose name starts with prefix as the main
25523 routine for the debugger.
25524
25525 -mmalloc64
25526 Default to 64-bit memory allocation routines.
25527
25528 -mpointer-size=size
25529 Set the default size of pointers. Possible options for size are 32
25530 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
25531 no for supporting only 32 bit pointers. The later option disables
25532 "pragma pointer_size".
25533
25534 VxWorks Options
25535
25536 The options in this section are defined for all VxWorks targets.
25537 Options specific to the target hardware are listed with the other
25538 options for that target.
25539
25540 -mrtp
25541 GCC can generate code for both VxWorks kernels and real time
25542 processes (RTPs). This option switches from the former to the
25543 latter. It also defines the preprocessor macro "__RTP__".
25544
25545 -non-static
25546 Link an RTP executable against shared libraries rather than static
25547 libraries. The options -static and -shared can also be used for
25548 RTPs; -static is the default.
25549
25550 -Bstatic
25551 -Bdynamic
25552 These options are passed down to the linker. They are defined for
25553 compatibility with Diab.
25554
25555 -Xbind-lazy
25556 Enable lazy binding of function calls. This option is equivalent
25557 to -Wl,-z,now and is defined for compatibility with Diab.
25558
25559 -Xbind-now
25560 Disable lazy binding of function calls. This option is the default
25561 and is defined for compatibility with Diab.
25562
25563 x86 Options
25564
25565 These -m options are defined for the x86 family of computers.
25566
25567 -march=cpu-type
25568 Generate instructions for the machine type cpu-type. In contrast
25569 to -mtune=cpu-type, which merely tunes the generated code for the
25570 specified cpu-type, -march=cpu-type allows GCC to generate code
25571 that may not run at all on processors other than the one indicated.
25572 Specifying -march=cpu-type implies -mtune=cpu-type, except where
25573 noted otherwise.
25574
25575 The choices for cpu-type are:
25576
25577 native
25578 This selects the CPU to generate code for at compilation time
25579 by determining the processor type of the compiling machine.
25580 Using -march=native enables all instruction subsets supported
25581 by the local machine (hence the result might not run on
25582 different machines). Using -mtune=native produces code
25583 optimized for the local machine under the constraints of the
25584 selected instruction set.
25585
25586 x86-64
25587 A generic CPU with 64-bit extensions.
25588
25589 x86-64-v2
25590 x86-64-v3
25591 x86-64-v4
25592 These choices for cpu-type select the corresponding micro-
25593 architecture level from the x86-64 psABI. On ABIs other than
25594 the x86-64 psABI they select the same CPU features as the
25595 x86-64 psABI documents for the particular micro-architecture
25596 level.
25597
25598 Since these cpu-type values do not have a corresponding -mtune
25599 setting, using -march with these values enables generic tuning.
25600 Specific tuning can be enabled using the -mtune=other-cpu-type
25601 option with an appropriate other-cpu-type value.
25602
25603 i386
25604 Original Intel i386 CPU.
25605
25606 i486
25607 Intel i486 CPU. (No scheduling is implemented for this chip.)
25608
25609 i586
25610 pentium
25611 Intel Pentium CPU with no MMX support.
25612
25613 lakemont
25614 Intel Lakemont MCU, based on Intel Pentium CPU.
25615
25616 pentium-mmx
25617 Intel Pentium MMX CPU, based on Pentium core with MMX
25618 instruction set support.
25619
25620 pentiumpro
25621 Intel Pentium Pro CPU.
25622
25623 i686
25624 When used with -march, the Pentium Pro instruction set is used,
25625 so the code runs on all i686 family chips. When used with
25626 -mtune, it has the same meaning as generic.
25627
25628 pentium2
25629 Intel Pentium II CPU, based on Pentium Pro core with MMX
25630 instruction set support.
25631
25632 pentium3
25633 pentium3m
25634 Intel Pentium III CPU, based on Pentium Pro core with MMX and
25635 SSE instruction set support.
25636
25637 pentium-m
25638 Intel Pentium M; low-power version of Intel Pentium III CPU
25639 with MMX, SSE and SSE2 instruction set support. Used by
25640 Centrino notebooks.
25641
25642 pentium4
25643 pentium4m
25644 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
25645 support.
25646
25647 prescott
25648 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
25649 SSE3 instruction set support.
25650
25651 nocona
25652 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
25653 MMX, SSE, SSE2 and SSE3 instruction set support.
25654
25655 core2
25656 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
25657 and SSSE3 instruction set support.
25658
25659 nehalem
25660 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
25661 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
25662
25663 westmere
25664 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
25665 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
25666 set support.
25667
25668 sandybridge
25669 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25670 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
25671 instruction set support.
25672
25673 ivybridge
25674 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
25675 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
25676 FSGSBASE, RDRND and F16C instruction set support.
25677
25678 haswell
25679 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25680 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25681 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
25682 set support.
25683
25684 broadwell
25685 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25686 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25687 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED ADCX and
25688 PREFETCHW instruction set support.
25689
25690 skylake
25691 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25692 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25693 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25694 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
25695 support.
25696
25697 bonnell
25698 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
25699 SSE2, SSE3 and SSSE3 instruction set support.
25700
25701 silvermont
25702 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25703 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25704 PCLMUL and RDRND instruction set support.
25705
25706 goldmont
25707 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25708 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25709 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT and FSGSBASE
25710 instruction set support.
25711
25712 goldmont-plus
25713 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
25714 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25715 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25716 PTWRITE, RDPID, SGX and UMIP instruction set support.
25717
25718 tremont
25719 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
25720 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25721 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25722 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25723 CLDEMOTE and WAITPKG instruction set support.
25724
25725 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
25726 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25727 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25728 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER and
25729 AVX512CD instruction set support.
25730
25731 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
25732 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
25733 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25734 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER, AVX512CD,
25735 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set
25736 support.
25737
25738 skylake-avx512
25739 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
25740 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25741 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25742 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25743 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
25744 support.
25745
25746 cannonlake
25747 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
25748 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25749 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25750 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25751 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
25752 UMIP instruction set support.
25753
25754 icelake-client
25755 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
25756 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25757 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25758 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25759 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25760 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25761 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25762 support.
25763
25764 icelake-server
25765 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
25766 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25767 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25768 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25769 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25770 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25771 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
25772 WBNOINVD instruction set support.
25773
25774 cascadelake
25775 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25776 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25777 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25778 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25779 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
25780 support.
25781
25782 cooperlake
25783 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25784 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25785 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25786 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
25787 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
25788 instruction set support.
25789
25790 tigerlake
25791 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25792 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25793 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25794 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25795 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25796 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25797 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG, WBNOINVD,
25798 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
25799 instruction set support.
25800
25801 sapphirerapids
25802 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
25803 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
25804 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
25805 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
25806 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
25807 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE,
25808 PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-
25809 TILE, AMX-INT8 and AVX-VNNI instruction set support.
25810
25811 alderlake
25812 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25813 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
25814 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
25815 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
25816 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
25817 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
25818 WIDEKL and AVX-VNNI instruction set support.
25819
25820 rocketlake
25821 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
25822 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
25823 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
25824 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
25825 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
25826 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
25827 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
25828 support.
25829
25830 k6 AMD K6 CPU with MMX instruction set support.
25831
25832 k6-2
25833 k6-3
25834 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
25835 set support.
25836
25837 athlon
25838 athlon-tbird
25839 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
25840 prefetch instructions support.
25841
25842 athlon-4
25843 athlon-xp
25844 athlon-mp
25845 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
25846 full SSE instruction set support.
25847
25848 k8
25849 opteron
25850 athlon64
25851 athlon-fx
25852 Processors based on the AMD K8 core with x86-64 instruction set
25853 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
25854 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
25855 3DNow! and 64-bit instruction set extensions.)
25856
25857 k8-sse3
25858 opteron-sse3
25859 athlon64-sse3
25860 Improved versions of AMD K8 cores with SSE3 instruction set
25861 support.
25862
25863 amdfam10
25864 barcelona
25865 CPUs based on AMD Family 10h cores with x86-64 instruction set
25866 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
25867 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
25868
25869 bdver1
25870 CPUs based on AMD Family 15h cores with x86-64 instruction set
25871 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
25872 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
25873 and 64-bit instruction set extensions.)
25874
25875 bdver2
25876 AMD Family 15h core based CPUs with x86-64 instruction set
25877 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
25878 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
25879 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
25880
25881 bdver3
25882 AMD Family 15h core based CPUs with x86-64 instruction set
25883 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
25884 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
25885 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
25886 extensions.)
25887
25888 bdver4
25889 AMD Family 15h core based CPUs with x86-64 instruction set
25890 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
25891 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
25892 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
25893 instruction set extensions.)
25894
25895 znver1
25896 AMD Family 17h core based CPUs with x86-64 instruction set
25897 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
25898 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
25899 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
25900 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
25901 extensions.)
25902
25903 znver2
25904 AMD Family 17h core based CPUs with x86-64 instruction set
25905 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25906 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25907 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25908 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25909 WBNOINVD, and 64-bit instruction set extensions.)
25910
25911 znver3
25912 AMD Family 19h core based CPUs with x86-64 instruction set
25913 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
25914 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
25915 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
25916 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
25917 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
25918 extensions.)
25919
25920 btver1
25921 CPUs based on AMD Family 14h cores with x86-64 instruction set
25922 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
25923 CX16, ABM and 64-bit instruction set extensions.)
25924
25925 btver2
25926 CPUs based on AMD Family 16h cores with x86-64 instruction set
25927 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
25928 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
25929 and 64-bit instruction set extensions.
25930
25931 winchip-c6
25932 IDT WinChip C6 CPU, dealt in same way as i486 with additional
25933 MMX instruction set support.
25934
25935 winchip2
25936 IDT WinChip 2 CPU, dealt in same way as i486 with additional
25937 MMX and 3DNow! instruction set support.
25938
25939 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
25940 scheduling is implemented for this chip.)
25941
25942 c3-2
25943 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
25944 support. (No scheduling is implemented for this chip.)
25945
25946 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
25947 set support. (No scheduling is implemented for this chip.)
25948
25949 samuel-2
25950 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
25951 support. (No scheduling is implemented for this chip.)
25952
25953 nehemiah
25954 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
25955 (No scheduling is implemented for this chip.)
25956
25957 esther
25958 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
25959 set support. (No scheduling is implemented for this chip.)
25960
25961 eden-x2
25962 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
25963 instruction set support. (No scheduling is implemented for
25964 this chip.)
25965
25966 eden-x4
25967 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
25968 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
25969 scheduling is implemented for this chip.)
25970
25971 nano
25972 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
25973 SSSE3 instruction set support. (No scheduling is implemented
25974 for this chip.)
25975
25976 nano-1000
25977 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25978 instruction set support. (No scheduling is implemented for
25979 this chip.)
25980
25981 nano-2000
25982 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
25983 instruction set support. (No scheduling is implemented for
25984 this chip.)
25985
25986 nano-3000
25987 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
25988 SSE4.1 instruction set support. (No scheduling is implemented
25989 for this chip.)
25990
25991 nano-x2
25992 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
25993 and SSE4.1 instruction set support. (No scheduling is
25994 implemented for this chip.)
25995
25996 nano-x4
25997 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
25998 and SSE4.1 instruction set support. (No scheduling is
25999 implemented for this chip.)
26000
26001 geode
26002 AMD Geode embedded processor with MMX and 3DNow! instruction
26003 set support.
26004
26005 -mtune=cpu-type
26006 Tune to cpu-type everything applicable about the generated code,
26007 except for the ABI and the set of available instructions. While
26008 picking a specific cpu-type schedules things appropriately for that
26009 particular chip, the compiler does not generate any code that
26010 cannot run on the default machine type unless you use a -march=cpu-
26011 type option. For example, if GCC is configured for
26012 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
26013 for Pentium 4 but still runs on i686 machines.
26014
26015 The choices for cpu-type are the same as for -march. In addition,
26016 -mtune supports 2 extra choices for cpu-type:
26017
26018 generic
26019 Produce code optimized for the most common IA32/AMD64/EM64T
26020 processors. If you know the CPU on which your code will run,
26021 then you should use the corresponding -mtune or -march option
26022 instead of -mtune=generic. But, if you do not know exactly
26023 what CPU users of your application will have, then you should
26024 use this option.
26025
26026 As new processors are deployed in the marketplace, the behavior
26027 of this option will change. Therefore, if you upgrade to a
26028 newer version of GCC, code generation controlled by this option
26029 will change to reflect the processors that are most common at
26030 the time that version of GCC is released.
26031
26032 There is no -march=generic option because -march indicates the
26033 instruction set the compiler can use, and there is no generic
26034 instruction set applicable to all processors. In contrast,
26035 -mtune indicates the processor (or, in this case, collection of
26036 processors) for which the code is optimized.
26037
26038 intel
26039 Produce code optimized for the most current Intel processors,
26040 which are Haswell and Silvermont for this version of GCC. If
26041 you know the CPU on which your code will run, then you should
26042 use the corresponding -mtune or -march option instead of
26043 -mtune=intel. But, if you want your application performs
26044 better on both Haswell and Silvermont, then you should use this
26045 option.
26046
26047 As new Intel processors are deployed in the marketplace, the
26048 behavior of this option will change. Therefore, if you upgrade
26049 to a newer version of GCC, code generation controlled by this
26050 option will change to reflect the most current Intel processors
26051 at the time that version of GCC is released.
26052
26053 There is no -march=intel option because -march indicates the
26054 instruction set the compiler can use, and there is no common
26055 instruction set applicable to all processors. In contrast,
26056 -mtune indicates the processor (or, in this case, collection of
26057 processors) for which the code is optimized.
26058
26059 -mcpu=cpu-type
26060 A deprecated synonym for -mtune.
26061
26062 -mfpmath=unit
26063 Generate floating-point arithmetic for selected unit unit. The
26064 choices for unit are:
26065
26066 387 Use the standard 387 floating-point coprocessor present on the
26067 majority of chips and emulated otherwise. Code compiled with
26068 this option runs almost everywhere. The temporary results are
26069 computed in 80-bit precision instead of the precision specified
26070 by the type, resulting in slightly different results compared
26071 to most of other chips. See -ffloat-store for more detailed
26072 description.
26073
26074 This is the default choice for non-Darwin x86-32 targets.
26075
26076 sse Use scalar floating-point instructions present in the SSE
26077 instruction set. This instruction set is supported by Pentium
26078 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
26079 and Athlon MP chips. The earlier version of the SSE
26080 instruction set supports only single-precision arithmetic, thus
26081 the double and extended-precision arithmetic are still done
26082 using 387. A later version, present only in Pentium 4 and AMD
26083 x86-64 chips, supports double-precision arithmetic too.
26084
26085 For the x86-32 compiler, you must use -march=cpu-type, -msse or
26086 -msse2 switches to enable SSE extensions and make this option
26087 effective. For the x86-64 compiler, these extensions are
26088 enabled by default.
26089
26090 The resulting code should be considerably faster in the
26091 majority of cases and avoid the numerical instability problems
26092 of 387 code, but may break some existing code that expects
26093 temporaries to be 80 bits.
26094
26095 This is the default choice for the x86-64 compiler, Darwin
26096 x86-32 targets, and the default choice for x86-32 targets with
26097 the SSE2 instruction set when -ffast-math is enabled.
26098
26099 sse,387
26100 sse+387
26101 both
26102 Attempt to utilize both instruction sets at once. This
26103 effectively doubles the amount of available registers, and on
26104 chips with separate execution units for 387 and SSE the
26105 execution resources too. Use this option with care, as it is
26106 still experimental, because the GCC register allocator does not
26107 model separate functional units well, resulting in unstable
26108 performance.
26109
26110 -masm=dialect
26111 Output assembly instructions using selected dialect. Also affects
26112 which dialect is used for basic "asm" and extended "asm". Supported
26113 choices (in dialect order) are att or intel. The default is att.
26114 Darwin does not support intel.
26115
26116 -mieee-fp
26117 -mno-ieee-fp
26118 Control whether or not the compiler uses IEEE floating-point
26119 comparisons. These correctly handle the case where the result of a
26120 comparison is unordered.
26121
26122 -m80387
26123 -mhard-float
26124 Generate output containing 80387 instructions for floating point.
26125
26126 -mno-80387
26127 -msoft-float
26128 Generate output containing library calls for floating point.
26129
26130 Warning: the requisite libraries are not part of GCC. Normally the
26131 facilities of the machine's usual C compiler are used, but this
26132 cannot be done directly in cross-compilation. You must make your
26133 own arrangements to provide suitable library functions for cross-
26134 compilation.
26135
26136 On machines where a function returns floating-point results in the
26137 80387 register stack, some floating-point opcodes may be emitted
26138 even if -msoft-float is used.
26139
26140 -mno-fp-ret-in-387
26141 Do not use the FPU registers for return values of functions.
26142
26143 The usual calling convention has functions return values of types
26144 "float" and "double" in an FPU register, even if there is no FPU.
26145 The idea is that the operating system should emulate an FPU.
26146
26147 The option -mno-fp-ret-in-387 causes such values to be returned in
26148 ordinary CPU registers instead.
26149
26150 -mno-fancy-math-387
26151 Some 387 emulators do not support the "sin", "cos" and "sqrt"
26152 instructions for the 387. Specify this option to avoid generating
26153 those instructions. This option is overridden when -march
26154 indicates that the target CPU always has an FPU and so the
26155 instruction does not need emulation. These instructions are not
26156 generated unless you also use the -funsafe-math-optimizations
26157 switch.
26158
26159 -malign-double
26160 -mno-align-double
26161 Control whether GCC aligns "double", "long double", and "long long"
26162 variables on a two-word boundary or a one-word boundary. Aligning
26163 "double" variables on a two-word boundary produces code that runs
26164 somewhat faster on a Pentium at the expense of more memory.
26165
26166 On x86-64, -malign-double is enabled by default.
26167
26168 Warning: if you use the -malign-double switch, structures
26169 containing the above types are aligned differently than the
26170 published application binary interface specifications for the
26171 x86-32 and are not binary compatible with structures in code
26172 compiled without that switch.
26173
26174 -m96bit-long-double
26175 -m128bit-long-double
26176 These switches control the size of "long double" type. The x86-32
26177 application binary interface specifies the size to be 96 bits, so
26178 -m96bit-long-double is the default in 32-bit mode.
26179
26180 Modern architectures (Pentium and newer) prefer "long double" to be
26181 aligned to an 8- or 16-byte boundary. In arrays or structures
26182 conforming to the ABI, this is not possible. So specifying
26183 -m128bit-long-double aligns "long double" to a 16-byte boundary by
26184 padding the "long double" with an additional 32-bit zero.
26185
26186 In the x86-64 compiler, -m128bit-long-double is the default choice
26187 as its ABI specifies that "long double" is aligned on 16-byte
26188 boundary.
26189
26190 Notice that neither of these options enable any extra precision
26191 over the x87 standard of 80 bits for a "long double".
26192
26193 Warning: if you override the default value for your target ABI,
26194 this changes the size of structures and arrays containing "long
26195 double" variables, as well as modifying the function calling
26196 convention for functions taking "long double". Hence they are not
26197 binary-compatible with code compiled without that switch.
26198
26199 -mlong-double-64
26200 -mlong-double-80
26201 -mlong-double-128
26202 These switches control the size of "long double" type. A size of 64
26203 bits makes the "long double" type equivalent to the "double" type.
26204 This is the default for 32-bit Bionic C library. A size of 128
26205 bits makes the "long double" type equivalent to the "__float128"
26206 type. This is the default for 64-bit Bionic C library.
26207
26208 Warning: if you override the default value for your target ABI,
26209 this changes the size of structures and arrays containing "long
26210 double" variables, as well as modifying the function calling
26211 convention for functions taking "long double". Hence they are not
26212 binary-compatible with code compiled without that switch.
26213
26214 -malign-data=type
26215 Control how GCC aligns variables. Supported values for type are
26216 compat uses increased alignment value compatible uses GCC 4.8 and
26217 earlier, abi uses alignment value as specified by the psABI, and
26218 cacheline uses increased alignment value to match the cache line
26219 size. compat is the default.
26220
26221 -mlarge-data-threshold=threshold
26222 When -mcmodel=medium is specified, data objects larger than
26223 threshold are placed in the large data section. This value must be
26224 the same across all objects linked into the binary, and defaults to
26225 65535.
26226
26227 -mrtd
26228 Use a different function-calling convention, in which functions
26229 that take a fixed number of arguments return with the "ret num"
26230 instruction, which pops their arguments while returning. This
26231 saves one instruction in the caller since there is no need to pop
26232 the arguments there.
26233
26234 You can specify that an individual function is called with this
26235 calling sequence with the function attribute "stdcall". You can
26236 also override the -mrtd option by using the function attribute
26237 "cdecl".
26238
26239 Warning: this calling convention is incompatible with the one
26240 normally used on Unix, so you cannot use it if you need to call
26241 libraries compiled with the Unix compiler.
26242
26243 Also, you must provide function prototypes for all functions that
26244 take variable numbers of arguments (including "printf"); otherwise
26245 incorrect code is generated for calls to those functions.
26246
26247 In addition, seriously incorrect code results if you call a
26248 function with too many arguments. (Normally, extra arguments are
26249 harmlessly ignored.)
26250
26251 -mregparm=num
26252 Control how many registers are used to pass integer arguments. By
26253 default, no registers are used to pass arguments, and at most 3
26254 registers can be used. You can control this behavior for a
26255 specific function by using the function attribute "regparm".
26256
26257 Warning: if you use this switch, and num is nonzero, then you must
26258 build all modules with the same value, including any libraries.
26259 This includes the system libraries and startup modules.
26260
26261 -msseregparm
26262 Use SSE register passing conventions for float and double arguments
26263 and return values. You can control this behavior for a specific
26264 function by using the function attribute "sseregparm".
26265
26266 Warning: if you use this switch then you must build all modules
26267 with the same value, including any libraries. This includes the
26268 system libraries and startup modules.
26269
26270 -mvect8-ret-in-mem
26271 Return 8-byte vectors in memory instead of MMX registers. This is
26272 the default on VxWorks to match the ABI of the Sun Studio compilers
26273 until version 12. Only use this option if you need to remain
26274 compatible with existing code produced by those previous compiler
26275 versions or older versions of GCC.
26276
26277 -mpc32
26278 -mpc64
26279 -mpc80
26280 Set 80387 floating-point precision to 32, 64 or 80 bits. When
26281 -mpc32 is specified, the significands of results of floating-point
26282 operations are rounded to 24 bits (single precision); -mpc64 rounds
26283 the significands of results of floating-point operations to 53 bits
26284 (double precision) and -mpc80 rounds the significands of results of
26285 floating-point operations to 64 bits (extended double precision),
26286 which is the default. When this option is used, floating-point
26287 operations in higher precisions are not available to the programmer
26288 without setting the FPU control word explicitly.
26289
26290 Setting the rounding of floating-point operations to less than the
26291 default 80 bits can speed some programs by 2% or more. Note that
26292 some mathematical libraries assume that extended-precision (80-bit)
26293 floating-point operations are enabled by default; routines in such
26294 libraries could suffer significant loss of accuracy, typically
26295 through so-called "catastrophic cancellation", when this option is
26296 used to set the precision to less than extended precision.
26297
26298 -mstackrealign
26299 Realign the stack at entry. On the x86, the -mstackrealign option
26300 generates an alternate prologue and epilogue that realigns the run-
26301 time stack if necessary. This supports mixing legacy codes that
26302 keep 4-byte stack alignment with modern codes that keep 16-byte
26303 stack alignment for SSE compatibility. See also the attribute
26304 "force_align_arg_pointer", applicable to individual functions.
26305
26306 -mpreferred-stack-boundary=num
26307 Attempt to keep the stack boundary aligned to a 2 raised to num
26308 byte boundary. If -mpreferred-stack-boundary is not specified, the
26309 default is 4 (16 bytes or 128 bits).
26310
26311 Warning: When generating code for the x86-64 architecture with SSE
26312 extensions disabled, -mpreferred-stack-boundary=3 can be used to
26313 keep the stack boundary aligned to 8 byte boundary. Since x86-64
26314 ABI require 16 byte stack alignment, this is ABI incompatible and
26315 intended to be used in controlled environment where stack space is
26316 important limitation. This option leads to wrong code when
26317 functions compiled with 16 byte stack alignment (such as functions
26318 from a standard library) are called with misaligned stack. In this
26319 case, SSE instructions may lead to misaligned memory access traps.
26320 In addition, variable arguments are handled incorrectly for 16 byte
26321 aligned objects (including x87 long double and __int128), leading
26322 to wrong results. You must build all modules with
26323 -mpreferred-stack-boundary=3, including any libraries. This
26324 includes the system libraries and startup modules.
26325
26326 -mincoming-stack-boundary=num
26327 Assume the incoming stack is aligned to a 2 raised to num byte
26328 boundary. If -mincoming-stack-boundary is not specified, the one
26329 specified by -mpreferred-stack-boundary is used.
26330
26331 On Pentium and Pentium Pro, "double" and "long double" values
26332 should be aligned to an 8-byte boundary (see -malign-double) or
26333 suffer significant run time performance penalties. On Pentium III,
26334 the Streaming SIMD Extension (SSE) data type "__m128" may not work
26335 properly if it is not 16-byte aligned.
26336
26337 To ensure proper alignment of this values on the stack, the stack
26338 boundary must be as aligned as that required by any value stored on
26339 the stack. Further, every function must be generated such that it
26340 keeps the stack aligned. Thus calling a function compiled with a
26341 higher preferred stack boundary from a function compiled with a
26342 lower preferred stack boundary most likely misaligns the stack. It
26343 is recommended that libraries that use callbacks always use the
26344 default setting.
26345
26346 This extra alignment does consume extra stack space, and generally
26347 increases code size. Code that is sensitive to stack space usage,
26348 such as embedded systems and operating system kernels, may want to
26349 reduce the preferred alignment to -mpreferred-stack-boundary=2.
26350
26351 -mmmx
26352 -msse
26353 -msse2
26354 -msse3
26355 -mssse3
26356 -msse4
26357 -msse4a
26358 -msse4.1
26359 -msse4.2
26360 -mavx
26361 -mavx2
26362 -mavx512f
26363 -mavx512pf
26364 -mavx512er
26365 -mavx512cd
26366 -mavx512vl
26367 -mavx512bw
26368 -mavx512dq
26369 -mavx512ifma
26370 -mavx512vbmi
26371 -msha
26372 -maes
26373 -mpclmul
26374 -mclflushopt
26375 -mclwb
26376 -mfsgsbase
26377 -mptwrite
26378 -mrdrnd
26379 -mf16c
26380 -mfma
26381 -mpconfig
26382 -mwbnoinvd
26383 -mfma4
26384 -mprfchw
26385 -mrdpid
26386 -mprefetchwt1
26387 -mrdseed
26388 -msgx
26389 -mxop
26390 -mlwp
26391 -m3dnow
26392 -m3dnowa
26393 -mpopcnt
26394 -mabm
26395 -madx
26396 -mbmi
26397 -mbmi2
26398 -mlzcnt
26399 -mfxsr
26400 -mxsave
26401 -mxsaveopt
26402 -mxsavec
26403 -mxsaves
26404 -mrtm
26405 -mhle
26406 -mtbm
26407 -mmwaitx
26408 -mclzero
26409 -mpku
26410 -mavx512vbmi2
26411 -mavx512bf16
26412 -mgfni
26413 -mvaes
26414 -mwaitpkg
26415 -mvpclmulqdq
26416 -mavx512bitalg
26417 -mmovdiri
26418 -mmovdir64b
26419 -menqcmd
26420 -muintr
26421 -mtsxldtrk
26422 -mavx512vpopcntdq
26423 -mavx512vp2intersect
26424 -mavx5124fmaps
26425 -mavx512vnni
26426 -mavxvnni
26427 -mavx5124vnniw
26428 -mcldemote
26429 -mserialize
26430 -mamx-tile
26431 -mamx-int8
26432 -mamx-bf16
26433 -mhreset
26434 -mkl
26435 -mwidekl
26436 These switches enable the use of instructions in the MMX, SSE,
26437 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
26438 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
26439 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
26440 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
26441 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
26442 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
26443 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
26444 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
26445 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
26446 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
26447 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI or CLDEMOTE extended
26448 instruction sets. Each has a corresponding -mno- option to disable
26449 use of these instructions.
26450
26451 These extensions are also available as built-in functions: see x86
26452 Built-in Functions, for details of the functions enabled and
26453 disabled by these switches.
26454
26455 To generate SSE/SSE2 instructions automatically from floating-point
26456 code (as opposed to 387 instructions), see -mfpmath=sse.
26457
26458 GCC depresses SSEx instructions when -mavx is used. Instead, it
26459 generates new AVX instructions or AVX equivalence for all SSEx
26460 instructions when needed.
26461
26462 These options enable GCC to use these extended instructions in
26463 generated code, even without -mfpmath=sse. Applications that
26464 perform run-time CPU detection must compile separate files for each
26465 supported architecture, using the appropriate flags. In
26466 particular, the file containing the CPU detection code should be
26467 compiled without these options.
26468
26469 -mdump-tune-features
26470 This option instructs GCC to dump the names of the x86 performance
26471 tuning features and default settings. The names can be used in
26472 -mtune-ctrl=feature-list.
26473
26474 -mtune-ctrl=feature-list
26475 This option is used to do fine grain control of x86 code generation
26476 features. feature-list is a comma separated list of feature names.
26477 See also -mdump-tune-features. When specified, the feature is
26478 turned on if it is not preceded with ^, otherwise, it is turned
26479 off. -mtune-ctrl=feature-list is intended to be used by GCC
26480 developers. Using it may lead to code paths not covered by testing
26481 and can potentially result in compiler ICEs or runtime errors.
26482
26483 -mno-default
26484 This option instructs GCC to turn off all tunable features. See
26485 also -mtune-ctrl=feature-list and -mdump-tune-features.
26486
26487 -mcld
26488 This option instructs GCC to emit a "cld" instruction in the
26489 prologue of functions that use string instructions. String
26490 instructions depend on the DF flag to select between autoincrement
26491 or autodecrement mode. While the ABI specifies the DF flag to be
26492 cleared on function entry, some operating systems violate this
26493 specification by not clearing the DF flag in their exception
26494 dispatchers. The exception handler can be invoked with the DF flag
26495 set, which leads to wrong direction mode when string instructions
26496 are used. This option can be enabled by default on 32-bit x86
26497 targets by configuring GCC with the --enable-cld configure option.
26498 Generation of "cld" instructions can be suppressed with the
26499 -mno-cld compiler option in this case.
26500
26501 -mvzeroupper
26502 This option instructs GCC to emit a "vzeroupper" instruction before
26503 a transfer of control flow out of the function to minimize the AVX
26504 to SSE transition penalty as well as remove unnecessary "zeroupper"
26505 intrinsics.
26506
26507 -mprefer-avx128
26508 This option instructs GCC to use 128-bit AVX instructions instead
26509 of 256-bit AVX instructions in the auto-vectorizer.
26510
26511 -mprefer-vector-width=opt
26512 This option instructs GCC to use opt-bit vector width in
26513 instructions instead of default on the selected platform.
26514
26515 none
26516 No extra limitations applied to GCC other than defined by the
26517 selected platform.
26518
26519 128 Prefer 128-bit vector width for instructions.
26520
26521 256 Prefer 256-bit vector width for instructions.
26522
26523 512 Prefer 512-bit vector width for instructions.
26524
26525 -mcx16
26526 This option enables GCC to generate "CMPXCHG16B" instructions in
26527 64-bit code to implement compare-and-exchange operations on 16-byte
26528 aligned 128-bit objects. This is useful for atomic updates of data
26529 structures exceeding one machine word in size. The compiler uses
26530 this instruction to implement __sync Builtins. However, for
26531 __atomic Builtins operating on 128-bit integers, a library call is
26532 always used.
26533
26534 -msahf
26535 This option enables generation of "SAHF" instructions in 64-bit
26536 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
26537 the introduction of Pentium 4 G1 step in December 2005, lacked the
26538 "LAHF" and "SAHF" instructions which are supported by AMD64. These
26539 are load and store instructions, respectively, for certain status
26540 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
26541 "fmod", "drem", and "remainder" built-in functions; see Other
26542 Builtins for details.
26543
26544 -mmovbe
26545 This option enables use of the "movbe" instruction to implement
26546 "__builtin_bswap32" and "__builtin_bswap64".
26547
26548 -mshstk
26549 The -mshstk option enables shadow stack built-in functions from x86
26550 Control-flow Enforcement Technology (CET).
26551
26552 -mcrc32
26553 This option enables built-in functions "__builtin_ia32_crc32qi",
26554 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
26555 "__builtin_ia32_crc32di" to generate the "crc32" machine
26556 instruction.
26557
26558 -mrecip
26559 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
26560 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
26561 Newton-Raphson step to increase precision instead of "DIVSS" and
26562 "SQRTSS" (and their vectorized variants) for single-precision
26563 floating-point arguments. These instructions are generated only
26564 when -funsafe-math-optimizations is enabled together with
26565 -ffinite-math-only and -fno-trapping-math. Note that while the
26566 throughput of the sequence is higher than the throughput of the
26567 non-reciprocal instruction, the precision of the sequence can be
26568 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
26569 0.99999994).
26570
26571 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
26572 "RSQRTPS") already with -ffast-math (or the above option
26573 combination), and doesn't need -mrecip.
26574
26575 Also note that GCC emits the above sequence with additional Newton-
26576 Raphson step for vectorized single-float division and vectorized
26577 "sqrtf(x)" already with -ffast-math (or the above option
26578 combination), and doesn't need -mrecip.
26579
26580 -mrecip=opt
26581 This option controls which reciprocal estimate instructions may be
26582 used. opt is a comma-separated list of options, which may be
26583 preceded by a ! to invert the option:
26584
26585 all Enable all estimate instructions.
26586
26587 default
26588 Enable the default instructions, equivalent to -mrecip.
26589
26590 none
26591 Disable all estimate instructions, equivalent to -mno-recip.
26592
26593 div Enable the approximation for scalar division.
26594
26595 vec-div
26596 Enable the approximation for vectorized division.
26597
26598 sqrt
26599 Enable the approximation for scalar square root.
26600
26601 vec-sqrt
26602 Enable the approximation for vectorized square root.
26603
26604 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
26605 approximations, except for square root.
26606
26607 -mveclibabi=type
26608 Specifies the ABI type to use for vectorizing intrinsics using an
26609 external library. Supported values for type are svml for the Intel
26610 short vector math library and acml for the AMD math core library.
26611 To use this option, both -ftree-vectorize and
26612 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
26613 ABI-compatible library must be specified at link time.
26614
26615 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
26616 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
26617 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
26618 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
26619 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
26620 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
26621 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
26622 and "vmlsAcos4" for corresponding function type when
26623 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
26624 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
26625 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
26626 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
26627 corresponding function type when -mveclibabi=acml is used.
26628
26629 -mabi=name
26630 Generate code for the specified calling convention. Permissible
26631 values are sysv for the ABI used on GNU/Linux and other systems,
26632 and ms for the Microsoft ABI. The default is to use the Microsoft
26633 ABI when targeting Microsoft Windows and the SysV ABI on all other
26634 systems. You can control this behavior for specific functions by
26635 using the function attributes "ms_abi" and "sysv_abi".
26636
26637 -mforce-indirect-call
26638 Force all calls to functions to be indirect. This is useful when
26639 using Intel Processor Trace where it generates more precise timing
26640 information for function calls.
26641
26642 -mmanual-endbr
26643 Insert ENDBR instruction at function entry only via the "cf_check"
26644 function attribute. This is useful when used with the option
26645 -fcf-protection=branch to control ENDBR insertion at the function
26646 entry.
26647
26648 -mcall-ms2sysv-xlogues
26649 Due to differences in 64-bit ABIs, any Microsoft ABI function that
26650 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
26651 clobbered. By default, the code for saving and restoring these
26652 registers is emitted inline, resulting in fairly lengthy prologues
26653 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
26654 epilogues that use stubs in the static portion of libgcc to perform
26655 these saves and restores, thus reducing function size at the cost
26656 of a few extra instructions.
26657
26658 -mtls-dialect=type
26659 Generate code to access thread-local storage using the gnu or gnu2
26660 conventions. gnu is the conservative default; gnu2 is more
26661 efficient, but it may add compile- and run-time requirements that
26662 cannot be satisfied on all systems.
26663
26664 -mpush-args
26665 -mno-push-args
26666 Use PUSH operations to store outgoing parameters. This method is
26667 shorter and usually equally fast as method using SUB/MOV operations
26668 and is enabled by default. In some cases disabling it may improve
26669 performance because of improved scheduling and reduced
26670 dependencies.
26671
26672 -maccumulate-outgoing-args
26673 If enabled, the maximum amount of space required for outgoing
26674 arguments is computed in the function prologue. This is faster on
26675 most modern CPUs because of reduced dependencies, improved
26676 scheduling and reduced stack usage when the preferred stack
26677 boundary is not equal to 2. The drawback is a notable increase in
26678 code size. This switch implies -mno-push-args.
26679
26680 -mthreads
26681 Support thread-safe exception handling on MinGW. Programs that
26682 rely on thread-safe exception handling must compile and link all
26683 code with the -mthreads option. When compiling, -mthreads defines
26684 -D_MT; when linking, it links in a special thread helper library
26685 -lmingwthrd which cleans up per-thread exception-handling data.
26686
26687 -mms-bitfields
26688 -mno-ms-bitfields
26689 Enable/disable bit-field layout compatible with the native
26690 Microsoft Windows compiler.
26691
26692 If "packed" is used on a structure, or if bit-fields are used, it
26693 may be that the Microsoft ABI lays out the structure differently
26694 than the way GCC normally does. Particularly when moving packed
26695 data between functions compiled with GCC and the native Microsoft
26696 compiler (either via function call or as data in a file), it may be
26697 necessary to access either format.
26698
26699 This option is enabled by default for Microsoft Windows targets.
26700 This behavior can also be controlled locally by use of variable or
26701 type attributes. For more information, see x86 Variable Attributes
26702 and x86 Type Attributes.
26703
26704 The Microsoft structure layout algorithm is fairly simple with the
26705 exception of the bit-field packing. The padding and alignment of
26706 members of structures and whether a bit-field can straddle a
26707 storage-unit boundary are determine by these rules:
26708
26709 1. Structure members are stored sequentially in the order in which
26710 they are
26711 declared: the first member has the lowest memory address and
26712 the last member the highest.
26713
26714 2. Every data object has an alignment requirement. The alignment
26715 requirement
26716 for all data except structures, unions, and arrays is either
26717 the size of the object or the current packing size (specified
26718 with either the "aligned" attribute or the "pack" pragma),
26719 whichever is less. For structures, unions, and arrays, the
26720 alignment requirement is the largest alignment requirement of
26721 its members. Every object is allocated an offset so that:
26722
26723 offset % alignment_requirement == 0
26724
26725 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
26726 allocation
26727 unit if the integral types are the same size and if the next
26728 bit-field fits into the current allocation unit without
26729 crossing the boundary imposed by the common alignment
26730 requirements of the bit-fields.
26731
26732 MSVC interprets zero-length bit-fields in the following ways:
26733
26734 1. If a zero-length bit-field is inserted between two bit-fields
26735 that
26736 are normally coalesced, the bit-fields are not coalesced.
26737
26738 For example:
26739
26740 struct
26741 {
26742 unsigned long bf_1 : 12;
26743 unsigned long : 0;
26744 unsigned long bf_2 : 12;
26745 } t1;
26746
26747 The size of "t1" is 8 bytes with the zero-length bit-field. If
26748 the zero-length bit-field were removed, "t1"'s size would be 4
26749 bytes.
26750
26751 2. If a zero-length bit-field is inserted after a bit-field, "foo",
26752 and the
26753 alignment of the zero-length bit-field is greater than the
26754 member that follows it, "bar", "bar" is aligned as the type of
26755 the zero-length bit-field.
26756
26757 For example:
26758
26759 struct
26760 {
26761 char foo : 4;
26762 short : 0;
26763 char bar;
26764 } t2;
26765
26766 struct
26767 {
26768 char foo : 4;
26769 short : 0;
26770 double bar;
26771 } t3;
26772
26773 For "t2", "bar" is placed at offset 2, rather than offset 1.
26774 Accordingly, the size of "t2" is 4. For "t3", the zero-length
26775 bit-field does not affect the alignment of "bar" or, as a
26776 result, the size of the structure.
26777
26778 Taking this into account, it is important to note the
26779 following:
26780
26781 1. If a zero-length bit-field follows a normal bit-field, the
26782 type of the
26783 zero-length bit-field may affect the alignment of the
26784 structure as whole. For example, "t2" has a size of 4
26785 bytes, since the zero-length bit-field follows a normal
26786 bit-field, and is of type short.
26787
26788 2. Even if a zero-length bit-field is not followed by a normal
26789 bit-field, it may
26790 still affect the alignment of the structure:
26791
26792 struct
26793 {
26794 char foo : 6;
26795 long : 0;
26796 } t4;
26797
26798 Here, "t4" takes up 4 bytes.
26799
26800 3. Zero-length bit-fields following non-bit-field members are
26801 ignored:
26802 struct
26803 {
26804 char foo;
26805 long : 0;
26806 char bar;
26807 } t5;
26808
26809 Here, "t5" takes up 2 bytes.
26810
26811 -mno-align-stringops
26812 Do not align the destination of inlined string operations. This
26813 switch reduces code size and improves performance in case the
26814 destination is already aligned, but GCC doesn't know about it.
26815
26816 -minline-all-stringops
26817 By default GCC inlines string operations only when the destination
26818 is known to be aligned to least a 4-byte boundary. This enables
26819 more inlining and increases code size, but may improve performance
26820 of code that depends on fast "memcpy" and "memset" for short
26821 lengths. The option enables inline expansion of "strlen" for all
26822 pointer alignments.
26823
26824 -minline-stringops-dynamically
26825 For string operations of unknown size, use run-time checks with
26826 inline code for small blocks and a library call for large blocks.
26827
26828 -mstringop-strategy=alg
26829 Override the internal decision heuristic for the particular
26830 algorithm to use for inlining string operations. The allowed
26831 values for alg are:
26832
26833 rep_byte
26834 rep_4byte
26835 rep_8byte
26836 Expand using i386 "rep" prefix of the specified size.
26837
26838 byte_loop
26839 loop
26840 unrolled_loop
26841 Expand into an inline loop.
26842
26843 libcall
26844 Always use a library call.
26845
26846 -mmemcpy-strategy=strategy
26847 Override the internal decision heuristic to decide if
26848 "__builtin_memcpy" should be inlined and what inline algorithm to
26849 use when the expected size of the copy operation is known. strategy
26850 is a comma-separated list of alg:max_size:dest_align triplets. alg
26851 is specified in -mstringop-strategy, max_size specifies the max
26852 byte size with which inline algorithm alg is allowed. For the last
26853 triplet, the max_size must be "-1". The max_size of the triplets in
26854 the list must be specified in increasing order. The minimal byte
26855 size for alg is 0 for the first triplet and "max_size + 1" of the
26856 preceding range.
26857
26858 -mmemset-strategy=strategy
26859 The option is similar to -mmemcpy-strategy= except that it is to
26860 control "__builtin_memset" expansion.
26861
26862 -momit-leaf-frame-pointer
26863 Don't keep the frame pointer in a register for leaf functions.
26864 This avoids the instructions to save, set up, and restore frame
26865 pointers and makes an extra register available in leaf functions.
26866 The option -fomit-leaf-frame-pointer removes the frame pointer for
26867 leaf functions, which might make debugging harder.
26868
26869 -mtls-direct-seg-refs
26870 -mno-tls-direct-seg-refs
26871 Controls whether TLS variables may be accessed with offsets from
26872 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
26873 whether the thread base pointer must be added. Whether or not this
26874 is valid depends on the operating system, and whether it maps the
26875 segment to cover the entire TLS area.
26876
26877 For systems that use the GNU C Library, the default is on.
26878
26879 -msse2avx
26880 -mno-sse2avx
26881 Specify that the assembler should encode SSE instructions with VEX
26882 prefix. The option -mavx turns this on by default.
26883
26884 -mfentry
26885 -mno-fentry
26886 If profiling is active (-pg), put the profiling counter call before
26887 the prologue. Note: On x86 architectures the attribute
26888 "ms_hook_prologue" isn't possible at the moment for -mfentry and
26889 -pg.
26890
26891 -mrecord-mcount
26892 -mno-record-mcount
26893 If profiling is active (-pg), generate a __mcount_loc section that
26894 contains pointers to each profiling call. This is useful for
26895 automatically patching and out calls.
26896
26897 -mnop-mcount
26898 -mno-nop-mcount
26899 If profiling is active (-pg), generate the calls to the profiling
26900 functions as NOPs. This is useful when they should be patched in
26901 later dynamically. This is likely only useful together with
26902 -mrecord-mcount.
26903
26904 -minstrument-return=type
26905 Instrument function exit in -pg -mfentry instrumented functions
26906 with call to specified function. This only instruments true returns
26907 ending with ret, but not sibling calls ending with jump. Valid
26908 types are none to not instrument, call to generate a call to
26909 __return__, or nop5 to generate a 5 byte nop.
26910
26911 -mrecord-return
26912 -mno-record-return
26913 Generate a __return_loc section pointing to all return
26914 instrumentation code.
26915
26916 -mfentry-name=name
26917 Set name of __fentry__ symbol called at function entry for -pg
26918 -mfentry functions.
26919
26920 -mfentry-section=name
26921 Set name of section to record -mrecord-mcount calls (default
26922 __mcount_loc).
26923
26924 -mskip-rax-setup
26925 -mno-skip-rax-setup
26926 When generating code for the x86-64 architecture with SSE
26927 extensions disabled, -mskip-rax-setup can be used to skip setting
26928 up RAX register when there are no variable arguments passed in
26929 vector registers.
26930
26931 Warning: Since RAX register is used to avoid unnecessarily saving
26932 vector registers on stack when passing variable arguments, the
26933 impacts of this option are callees may waste some stack space,
26934 misbehave or jump to a random location. GCC 4.4 or newer don't
26935 have those issues, regardless the RAX register value.
26936
26937 -m8bit-idiv
26938 -mno-8bit-idiv
26939 On some processors, like Intel Atom, 8-bit unsigned integer divide
26940 is much faster than 32-bit/64-bit integer divide. This option
26941 generates a run-time check. If both dividend and divisor are
26942 within range of 0 to 255, 8-bit unsigned integer divide is used
26943 instead of 32-bit/64-bit integer divide.
26944
26945 -mavx256-split-unaligned-load
26946 -mavx256-split-unaligned-store
26947 Split 32-byte AVX unaligned load and store.
26948
26949 -mstack-protector-guard=guard
26950 -mstack-protector-guard-reg=reg
26951 -mstack-protector-guard-offset=offset
26952 Generate stack protection code using canary at guard. Supported
26953 locations are global for global canary or tls for per-thread canary
26954 in the TLS block (the default). This option has effect only when
26955 -fstack-protector or -fstack-protector-all is specified.
26956
26957 With the latter choice the options -mstack-protector-guard-reg=reg
26958 and -mstack-protector-guard-offset=offset furthermore specify which
26959 segment register (%fs or %gs) to use as base register for reading
26960 the canary, and from what offset from that base register. The
26961 default for those is as specified in the relevant ABI.
26962
26963 -mgeneral-regs-only
26964 Generate code that uses only the general-purpose registers. This
26965 prevents the compiler from using floating-point, vector, mask and
26966 bound registers.
26967
26968 -mindirect-branch=choice
26969 Convert indirect call and jump with choice. The default is keep,
26970 which keeps indirect call and jump unmodified. thunk converts
26971 indirect call and jump to call and return thunk. thunk-inline
26972 converts indirect call and jump to inlined call and return thunk.
26973 thunk-extern converts indirect call and jump to external call and
26974 return thunk provided in a separate object file. You can control
26975 this behavior for a specific function by using the function
26976 attribute "indirect_branch".
26977
26978 Note that -mcmodel=large is incompatible with
26979 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
26980 the thunk function may not be reachable in the large code model.
26981
26982 Note that -mindirect-branch=thunk-extern is compatible with
26983 -fcf-protection=branch since the external thunk can be made to
26984 enable control-flow check.
26985
26986 -mfunction-return=choice
26987 Convert function return with choice. The default is keep, which
26988 keeps function return unmodified. thunk converts function return
26989 to call and return thunk. thunk-inline converts function return to
26990 inlined call and return thunk. thunk-extern converts function
26991 return to external call and return thunk provided in a separate
26992 object file. You can control this behavior for a specific function
26993 by using the function attribute "function_return".
26994
26995 Note that -mindirect-return=thunk-extern is compatible with
26996 -fcf-protection=branch since the external thunk can be made to
26997 enable control-flow check.
26998
26999 Note that -mcmodel=large is incompatible with
27000 -mfunction-return=thunk and -mfunction-return=thunk-extern since
27001 the thunk function may not be reachable in the large code model.
27002
27003 -mindirect-branch-register
27004 Force indirect call and jump via register.
27005
27006 These -m switches are supported in addition to the above on x86-64
27007 processors in 64-bit environments.
27008
27009 -m32
27010 -m64
27011 -mx32
27012 -m16
27013 -miamcu
27014 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
27015 option sets "int", "long", and pointer types to 32 bits, and
27016 generates code that runs on any i386 system.
27017
27018 The -m64 option sets "int" to 32 bits and "long" and pointer types
27019 to 64 bits, and generates code for the x86-64 architecture. For
27020 Darwin only the -m64 option also turns off the -fno-pic and
27021 -mdynamic-no-pic options.
27022
27023 The -mx32 option sets "int", "long", and pointer types to 32 bits,
27024 and generates code for the x86-64 architecture.
27025
27026 The -m16 option is the same as -m32, except for that it outputs the
27027 ".code16gcc" assembly directive at the beginning of the assembly
27028 output so that the binary can run in 16-bit mode.
27029
27030 The -miamcu option generates code which conforms to Intel MCU
27031 psABI. It requires the -m32 option to be turned on.
27032
27033 -mno-red-zone
27034 Do not use a so-called "red zone" for x86-64 code. The red zone is
27035 mandated by the x86-64 ABI; it is a 128-byte area beyond the
27036 location of the stack pointer that is not modified by signal or
27037 interrupt handlers and therefore can be used for temporary data
27038 without adjusting the stack pointer. The flag -mno-red-zone
27039 disables this red zone.
27040
27041 -mcmodel=small
27042 Generate code for the small code model: the program and its symbols
27043 must be linked in the lower 2 GB of the address space. Pointers
27044 are 64 bits. Programs can be statically or dynamically linked.
27045 This is the default code model.
27046
27047 -mcmodel=kernel
27048 Generate code for the kernel code model. The kernel runs in the
27049 negative 2 GB of the address space. This model has to be used for
27050 Linux kernel code.
27051
27052 -mcmodel=medium
27053 Generate code for the medium model: the program is linked in the
27054 lower 2 GB of the address space. Small symbols are also placed
27055 there. Symbols with sizes larger than -mlarge-data-threshold are
27056 put into large data or BSS sections and can be located above 2GB.
27057 Programs can be statically or dynamically linked.
27058
27059 -mcmodel=large
27060 Generate code for the large model. This model makes no assumptions
27061 about addresses and sizes of sections.
27062
27063 -maddress-mode=long
27064 Generate code for long address mode. This is only supported for
27065 64-bit and x32 environments. It is the default address mode for
27066 64-bit environments.
27067
27068 -maddress-mode=short
27069 Generate code for short address mode. This is only supported for
27070 32-bit and x32 environments. It is the default address mode for
27071 32-bit and x32 environments.
27072
27073 -mneeded
27074 -mno-needed
27075 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
27076 indicate the micro-architecture ISA level required to execute the
27077 binary.
27078
27079 x86 Windows Options
27080
27081 These additional options are available for Microsoft Windows targets:
27082
27083 -mconsole
27084 This option specifies that a console application is to be
27085 generated, by instructing the linker to set the PE header subsystem
27086 type required for console applications. This option is available
27087 for Cygwin and MinGW targets and is enabled by default on those
27088 targets.
27089
27090 -mdll
27091 This option is available for Cygwin and MinGW targets. It
27092 specifies that a DLL---a dynamic link library---is to be generated,
27093 enabling the selection of the required runtime startup object and
27094 entry point.
27095
27096 -mnop-fun-dllimport
27097 This option is available for Cygwin and MinGW targets. It
27098 specifies that the "dllimport" attribute should be ignored.
27099
27100 -mthread
27101 This option is available for MinGW targets. It specifies that
27102 MinGW-specific thread support is to be used.
27103
27104 -municode
27105 This option is available for MinGW-w64 targets. It causes the
27106 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
27107 capable runtime startup code.
27108
27109 -mwin32
27110 This option is available for Cygwin and MinGW targets. It
27111 specifies that the typical Microsoft Windows predefined macros are
27112 to be set in the pre-processor, but does not influence the choice
27113 of runtime library/startup code.
27114
27115 -mwindows
27116 This option is available for Cygwin and MinGW targets. It
27117 specifies that a GUI application is to be generated by instructing
27118 the linker to set the PE header subsystem type appropriately.
27119
27120 -fno-set-stack-executable
27121 This option is available for MinGW targets. It specifies that the
27122 executable flag for the stack used by nested functions isn't set.
27123 This is necessary for binaries running in kernel mode of Microsoft
27124 Windows, as there the User32 API, which is used to set executable
27125 privileges, isn't available.
27126
27127 -fwritable-relocated-rdata
27128 This option is available for MinGW and Cygwin targets. It
27129 specifies that relocated-data in read-only section is put into the
27130 ".data" section. This is a necessary for older runtimes not
27131 supporting modification of ".rdata" sections for pseudo-relocation.
27132
27133 -mpe-aligned-commons
27134 This option is available for Cygwin and MinGW targets. It
27135 specifies that the GNU extension to the PE file format that permits
27136 the correct alignment of COMMON variables should be used when
27137 generating code. It is enabled by default if GCC detects that the
27138 target assembler found during configuration supports the feature.
27139
27140 See also under x86 Options for standard options.
27141
27142 Xstormy16 Options
27143
27144 These options are defined for Xstormy16:
27145
27146 -msim
27147 Choose startup files and linker script suitable for the simulator.
27148
27149 Xtensa Options
27150
27151 These options are supported for Xtensa targets:
27152
27153 -mconst16
27154 -mno-const16
27155 Enable or disable use of "CONST16" instructions for loading
27156 constant values. The "CONST16" instruction is currently not a
27157 standard option from Tensilica. When enabled, "CONST16"
27158 instructions are always used in place of the standard "L32R"
27159 instructions. The use of "CONST16" is enabled by default only if
27160 the "L32R" instruction is not available.
27161
27162 -mfused-madd
27163 -mno-fused-madd
27164 Enable or disable use of fused multiply/add and multiply/subtract
27165 instructions in the floating-point option. This has no effect if
27166 the floating-point option is not also enabled. Disabling fused
27167 multiply/add and multiply/subtract instructions forces the compiler
27168 to use separate instructions for the multiply and add/subtract
27169 operations. This may be desirable in some cases where strict IEEE
27170 754-compliant results are required: the fused multiply add/subtract
27171 instructions do not round the intermediate result, thereby
27172 producing results with more bits of precision than specified by the
27173 IEEE standard. Disabling fused multiply add/subtract instructions
27174 also ensures that the program output is not sensitive to the
27175 compiler's ability to combine multiply and add/subtract operations.
27176
27177 -mserialize-volatile
27178 -mno-serialize-volatile
27179 When this option is enabled, GCC inserts "MEMW" instructions before
27180 "volatile" memory references to guarantee sequential consistency.
27181 The default is -mserialize-volatile. Use -mno-serialize-volatile
27182 to omit the "MEMW" instructions.
27183
27184 -mforce-no-pic
27185 For targets, like GNU/Linux, where all user-mode Xtensa code must
27186 be position-independent code (PIC), this option disables PIC for
27187 compiling kernel code.
27188
27189 -mtext-section-literals
27190 -mno-text-section-literals
27191 These options control the treatment of literal pools. The default
27192 is -mno-text-section-literals, which places literals in a separate
27193 section in the output file. This allows the literal pool to be
27194 placed in a data RAM/ROM, and it also allows the linker to combine
27195 literal pools from separate object files to remove redundant
27196 literals and improve code size. With -mtext-section-literals, the
27197 literals are interspersed in the text section in order to keep them
27198 as close as possible to their references. This may be necessary
27199 for large assembly files. Literals for each function are placed
27200 right before that function.
27201
27202 -mauto-litpools
27203 -mno-auto-litpools
27204 These options control the treatment of literal pools. The default
27205 is -mno-auto-litpools, which places literals in a separate section
27206 in the output file unless -mtext-section-literals is used. With
27207 -mauto-litpools the literals are interspersed in the text section
27208 by the assembler. Compiler does not produce explicit ".literal"
27209 directives and loads literals into registers with "MOVI"
27210 instructions instead of "L32R" to let the assembler do relaxation
27211 and place literals as necessary. This option allows assembler to
27212 create several literal pools per function and assemble very big
27213 functions, which may not be possible with -mtext-section-literals.
27214
27215 -mtarget-align
27216 -mno-target-align
27217 When this option is enabled, GCC instructs the assembler to
27218 automatically align instructions to reduce branch penalties at the
27219 expense of some code density. The assembler attempts to widen
27220 density instructions to align branch targets and the instructions
27221 following call instructions. If there are not enough preceding
27222 safe density instructions to align a target, no widening is
27223 performed. The default is -mtarget-align. These options do not
27224 affect the treatment of auto-aligned instructions like "LOOP",
27225 which the assembler always aligns, either by widening density
27226 instructions or by inserting NOP instructions.
27227
27228 -mlongcalls
27229 -mno-longcalls
27230 When this option is enabled, GCC instructs the assembler to
27231 translate direct calls to indirect calls unless it can determine
27232 that the target of a direct call is in the range allowed by the
27233 call instruction. This translation typically occurs for calls to
27234 functions in other source files. Specifically, the assembler
27235 translates a direct "CALL" instruction into an "L32R" followed by a
27236 "CALLX" instruction. The default is -mno-longcalls. This option
27237 should be used in programs where the call target can potentially be
27238 out of range. This option is implemented in the assembler, not the
27239 compiler, so the assembly code generated by GCC still shows direct
27240 call instructions---look at the disassembled object code to see the
27241 actual instructions. Note that the assembler uses an indirect call
27242 for every cross-file call, not just those that really are out of
27243 range.
27244
27245 -mabi=name
27246 Generate code for the specified ABI. Permissible values are:
27247 call0, windowed. Default ABI is chosen by the Xtensa core
27248 configuration.
27249
27250 -mabi=call0
27251 When this option is enabled function parameters are passed in
27252 registers "a2" through "a7", registers "a12" through "a15" are
27253 caller-saved, and register "a15" may be used as a frame pointer.
27254 When this version of the ABI is enabled the C preprocessor symbol
27255 "__XTENSA_CALL0_ABI__" is defined.
27256
27257 -mabi=windowed
27258 When this option is enabled function parameters are passed in
27259 registers "a10" through "a15", and called function rotates register
27260 window by 8 registers on entry so that its arguments are found in
27261 registers "a2" through "a7". Register "a7" may be used as a frame
27262 pointer. Register window is rotated 8 registers back upon return.
27263 When this version of the ABI is enabled the C preprocessor symbol
27264 "__XTENSA_WINDOWED_ABI__" is defined.
27265
27266 zSeries Options
27267
27268 These are listed under
27269
27271 This section describes several environment variables that affect how
27272 GCC operates. Some of them work by specifying directories or prefixes
27273 to use when searching for various kinds of files. Some are used to
27274 specify other aspects of the compilation environment.
27275
27276 Note that you can also specify places to search using options such as
27277 -B, -I and -L. These take precedence over places specified using
27278 environment variables, which in turn take precedence over those
27279 specified by the configuration of GCC.
27280
27281 LANG
27282 LC_CTYPE
27283 LC_MESSAGES
27284 LC_ALL
27285 These environment variables control the way that GCC uses
27286 localization information which allows GCC to work with different
27287 national conventions. GCC inspects the locale categories LC_CTYPE
27288 and LC_MESSAGES if it has been configured to do so. These locale
27289 categories can be set to any value supported by your installation.
27290 A typical value is en_GB.UTF-8 for English in the United Kingdom
27291 encoded in UTF-8.
27292
27293 The LC_CTYPE environment variable specifies character
27294 classification. GCC uses it to determine the character boundaries
27295 in a string; this is needed for some multibyte encodings that
27296 contain quote and escape characters that are otherwise interpreted
27297 as a string end or escape.
27298
27299 The LC_MESSAGES environment variable specifies the language to use
27300 in diagnostic messages.
27301
27302 If the LC_ALL environment variable is set, it overrides the value
27303 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
27304 default to the value of the LANG environment variable. If none of
27305 these variables are set, GCC defaults to traditional C English
27306 behavior.
27307
27308 TMPDIR
27309 If TMPDIR is set, it specifies the directory to use for temporary
27310 files. GCC uses temporary files to hold the output of one stage of
27311 compilation which is to be used as input to the next stage: for
27312 example, the output of the preprocessor, which is the input to the
27313 compiler proper.
27314
27315 GCC_COMPARE_DEBUG
27316 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
27317 -fcompare-debug to the compiler driver. See the documentation of
27318 this option for more details.
27319
27320 GCC_EXEC_PREFIX
27321 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
27322 names of the subprograms executed by the compiler. No slash is
27323 added when this prefix is combined with the name of a subprogram,
27324 but you can specify a prefix that ends with a slash if you wish.
27325
27326 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
27327 appropriate prefix to use based on the pathname it is invoked with.
27328
27329 If GCC cannot find the subprogram using the specified prefix, it
27330 tries looking in the usual places for the subprogram.
27331
27332 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
27333 prefix is the prefix to the installed compiler. In many cases
27334 prefix is the value of "prefix" when you ran the configure script.
27335
27336 Other prefixes specified with -B take precedence over this prefix.
27337
27338 This prefix is also used for finding files such as crt0.o that are
27339 used for linking.
27340
27341 In addition, the prefix is used in an unusual way in finding the
27342 directories to search for header files. For each of the standard
27343 directories whose name normally begins with /usr/local/lib/gcc
27344 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
27345 replacing that beginning with the specified prefix to produce an
27346 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
27347 just before it searches the standard directory /usr/local/lib/bar.
27348 If a standard directory begins with the configured prefix then the
27349 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
27350 header files.
27351
27352 COMPILER_PATH
27353 The value of COMPILER_PATH is a colon-separated list of
27354 directories, much like PATH. GCC tries the directories thus
27355 specified when searching for subprograms, if it cannot find the
27356 subprograms using GCC_EXEC_PREFIX.
27357
27358 LIBRARY_PATH
27359 The value of LIBRARY_PATH is a colon-separated list of directories,
27360 much like PATH. When configured as a native compiler, GCC tries
27361 the directories thus specified when searching for special linker
27362 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
27363 GCC also uses these directories when searching for ordinary
27364 libraries for the -l option (but directories specified with -L come
27365 first).
27366
27367 LANG
27368 This variable is used to pass locale information to the compiler.
27369 One way in which this information is used is to determine the
27370 character set to be used when character literals, string literals
27371 and comments are parsed in C and C++. When the compiler is
27372 configured to allow multibyte characters, the following values for
27373 LANG are recognized:
27374
27375 C-JIS
27376 Recognize JIS characters.
27377
27378 C-SJIS
27379 Recognize SJIS characters.
27380
27381 C-EUCJP
27382 Recognize EUCJP characters.
27383
27384 If LANG is not defined, or if it has some other value, then the
27385 compiler uses "mblen" and "mbtowc" as defined by the default locale
27386 to recognize and translate multibyte characters.
27387
27388 GCC_EXTRA_DIAGNOSTIC_OUTPUT
27389 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
27390 values, then additional text will be emitted to stderr when fix-it
27391 hints are emitted. -fdiagnostics-parseable-fixits and
27392 -fno-diagnostics-parseable-fixits take precedence over this
27393 environment variable.
27394
27395 fixits-v1
27396 Emit parseable fix-it hints, equivalent to
27397 -fdiagnostics-parseable-fixits. In particular, columns are
27398 expressed as a count of bytes, starting at byte 1 for the
27399 initial column.
27400
27401 fixits-v2
27402 As "fixits-v1", but columns are expressed as display columns,
27403 as per -fdiagnostics-column-unit=display.
27404
27405 Some additional environment variables affect the behavior of the
27406 preprocessor.
27407
27408 CPATH
27409 C_INCLUDE_PATH
27410 CPLUS_INCLUDE_PATH
27411 OBJC_INCLUDE_PATH
27412 Each variable's value is a list of directories separated by a
27413 special character, much like PATH, in which to look for header
27414 files. The special character, "PATH_SEPARATOR", is target-
27415 dependent and determined at GCC build time. For Microsoft Windows-
27416 based targets it is a semicolon, and for almost all other targets
27417 it is a colon.
27418
27419 CPATH specifies a list of directories to be searched as if
27420 specified with -I, but after any paths given with -I options on the
27421 command line. This environment variable is used regardless of
27422 which language is being preprocessed.
27423
27424 The remaining environment variables apply only when preprocessing
27425 the particular language indicated. Each specifies a list of
27426 directories to be searched as if specified with -isystem, but after
27427 any paths given with -isystem options on the command line.
27428
27429 In all these variables, an empty element instructs the compiler to
27430 search its current working directory. Empty elements can appear at
27431 the beginning or end of a path. For instance, if the value of
27432 CPATH is ":/special/include", that has the same effect as
27433 -I. -I/special/include.
27434
27435 DEPENDENCIES_OUTPUT
27436 If this variable is set, its value specifies how to output
27437 dependencies for Make based on the non-system header files
27438 processed by the compiler. System header files are ignored in the
27439 dependency output.
27440
27441 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
27442 case the Make rules are written to that file, guessing the target
27443 name from the source file name. Or the value can have the form
27444 file target, in which case the rules are written to file file using
27445 target as the target name.
27446
27447 In other words, this environment variable is equivalent to
27448 combining the options -MM and -MF, with an optional -MT switch too.
27449
27450 SUNPRO_DEPENDENCIES
27451 This variable is the same as DEPENDENCIES_OUTPUT (see above),
27452 except that system header files are not ignored, so it implies -M
27453 rather than -MM. However, the dependence on the main input file is
27454 omitted.
27455
27456 SOURCE_DATE_EPOCH
27457 If this variable is set, its value specifies a UNIX timestamp to be
27458 used in replacement of the current date and time in the "__DATE__"
27459 and "__TIME__" macros, so that the embedded timestamps become
27460 reproducible.
27461
27462 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
27463 the number of seconds (excluding leap seconds) since 01 Jan 1970
27464 00:00:00 represented in ASCII; identical to the output of "date
27465 +%s" on GNU/Linux and other systems that support the %s extension
27466 in the "date" command.
27467
27468 The value should be a known timestamp such as the last modification
27469 time of the source or package and it should be set by the build
27470 process.
27471
27473 For instructions on reporting bugs, see <https://bugzilla.redhat.com/>.
27474
27476 1. On some systems, gcc -shared needs to build supplementary stub code
27477 for constructors to work. On multi-libbed systems, gcc -shared
27478 must select the correct support libraries to link against. Failing
27479 to supply the correct flags may lead to subtle defects. Supplying
27480 them in cases where they are not necessary is innocuous.
27481
27483 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
27484 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
27485
27487 See the Info entry for gcc, or
27488 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
27489 to GCC.
27490
27492 Copyright (c) 1988-2021 Free Software Foundation, Inc.
27493
27494 Permission is granted to copy, distribute and/or modify this document
27495 under the terms of the GNU Free Documentation License, Version 1.3 or
27496 any later version published by the Free Software Foundation; with the
27497 Invariant Sections being "GNU General Public License" and "Funding Free
27498 Software", the Front-Cover texts being (a) (see below), and with the
27499 Back-Cover Texts being (b) (see below). A copy of the license is
27500 included in the gfdl(7) man page.
27501
27502 (a) The FSF's Front-Cover Text is:
27503
27504 A GNU Manual
27505
27506 (b) The FSF's Back-Cover Text is:
27507
27508 You have freedom to copy and modify this GNU Manual, like GNU
27509 software. Copies published by the Free Software Foundation raise
27510 funds for GNU development.
27511
27512
27513
27514gcc-11.1.0 2021-04-27 GCC(1)